Browse Source

Update return types.

Remove no longer needed `ReturnTypeWillChange` attribute.
ADmad 4 years ago
parent
commit
15ae094897

+ 2 - 5
src/Http/Session/CacheSession.php

@@ -20,7 +20,6 @@ namespace Cake\Http\Session;
 
 use Cake\Cache\Cache;
 use InvalidArgumentException;
-use ReturnTypeWillChange;
 use SessionHandlerInterface;
 
 /**
@@ -81,8 +80,7 @@ class CacheSession implements SessionHandlerInterface
      * @param string $id ID that uniquely identifies session in cache.
      * @return string|false Session data or false if it does not exist.
      */
-    #[ReturnTypeWillChange]
-    public function read($id)
+    public function read($id): string|false
     {
         $value = Cache::read($id, $this->_options['config']);
 
@@ -128,8 +126,7 @@ class CacheSession implements SessionHandlerInterface
      * @param int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
      * @return int|false
      */
-    #[ReturnTypeWillChange]
-    public function gc($maxlifetime)
+    public function gc($maxlifetime): int|false
     {
         return 0;
     }

+ 2 - 5
src/Http/Session/DatabaseSession.php

@@ -19,7 +19,6 @@ declare(strict_types=1);
 namespace Cake\Http\Session;
 
 use Cake\ORM\Locator\LocatorAwareTrait;
-use ReturnTypeWillChange;
 use SessionHandlerInterface;
 
 /**
@@ -110,8 +109,7 @@ class DatabaseSession implements SessionHandlerInterface
      * @param string $id ID that uniquely identifies session in database.
      * @return string|false Session data or false if it does not exist.
      */
-    #[ReturnTypeWillChange]
-    public function read($id)
+    public function read($id): string|false
     {
         /** @var string $pkField */
         $pkField = $this->_table->getPrimaryKey();
@@ -178,8 +176,7 @@ class DatabaseSession implements SessionHandlerInterface
      * @param int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
      * @return int|false The number of deleted sessions on success, or false on failure.
      */
-    #[ReturnTypeWillChange]
-    public function gc($maxlifetime)
+    public function gc($maxlifetime): int|false
     {
         return $this->_table->deleteAll(['expires <' => time()]);
     }

+ 1 - 3
src/I18n/DateFormatTrait.php

@@ -21,7 +21,6 @@ use Closure;
 use DateTime;
 use DateTimeZone;
 use IntlDateFormatter;
-use ReturnTypeWillChange;
 use RuntimeException;
 
 /**
@@ -444,8 +443,7 @@ trait DateFormatTrait
      *
      * @return string|int
      */
-    #[ReturnTypeWillChange]
-    public function jsonSerialize()
+    public function jsonSerialize(): mixed
     {
         if (static::$_jsonEncodeFormat instanceof Closure) {
             return call_user_func(static::$_jsonEncodeFormat, $this);

+ 2 - 5
tests/test_app/Plugin/TestPlugin/src/Http/Session/TestPluginSession.php

@@ -3,7 +3,6 @@ declare(strict_types=1);
 
 namespace TestPlugin\Http\Session;
 
-use ReturnTypeWillChange;
 use SessionHandlerInterface;
 
 /**
@@ -21,8 +20,7 @@ class TestPluginSession implements SessionHandlerInterface
         return true;
     }
 
-    #[ReturnTypeWillChange]
-    public function read($id)
+    public function read($id): string|false
     {
     }
 
@@ -36,8 +34,7 @@ class TestPluginSession implements SessionHandlerInterface
         return true;
     }
 
-    #[ReturnTypeWillChange]
-    public function gc($maxlifetime)
+    public function gc($maxlifetime): int|false
     {
         return 0;
     }

+ 2 - 5
tests/test_app/TestApp/Http/Session/TestAppLibSession.php

@@ -3,7 +3,6 @@ declare(strict_types=1);
 
 namespace TestApp\Http\Session;
 
-use ReturnTypeWillChange;
 use SessionHandlerInterface;
 
 /**
@@ -28,8 +27,7 @@ class TestAppLibSession implements SessionHandlerInterface
         return true;
     }
 
-    #[ReturnTypeWillChange]
-    public function read($id)
+    public function read($id): string|false
     {
     }
 
@@ -43,8 +41,7 @@ class TestAppLibSession implements SessionHandlerInterface
         return true;
     }
 
-    #[ReturnTypeWillChange]
-    public function gc($maxlifetime)
+    public function gc($maxlifetime): int|false
     {
         return 0;
     }