Skip to content

Bump up slevomat coding standard.#362

Merged
othercorey merged 1 commit into
5.xfrom
5.x-update-slevomat-standard
Jun 26, 2022
Merged

Bump up slevomat coding standard.#362
othercorey merged 1 commit into
5.xfrom
5.x-update-slevomat-standard

Conversation

@ADmad

@ADmad ADmad commented Jun 26, 2022

Copy link
Copy Markdown
Member

No description provided.

@ADmad ADmad added this to the 5.x milestone Jun 26, 2022
@ADmad ADmad force-pushed the 5.x-update-slevomat-standard branch from 6c7f989 to 81493b5 Compare June 26, 2022 18:00
@ADmad ADmad requested a review from othercorey June 26, 2022 18:01
@ADmad

ADmad commented Jun 26, 2022

Copy link
Copy Markdown
Member Author
diff --git a/composer.json b/composer.json
index 015f3f72a3..b100340113 100644
--- a/composer.json
+++ b/composer.json
@@ -55,7 +55,7 @@
         "cakephp/validation": "self.version"
     },
     "require-dev": {
-        "cakephp/cakephp-codesniffer": "5.x-dev",
+        "cakephp/cakephp-codesniffer": "dev-5.x-update-slevomat-standard",
         "mikey179/vfsstream": "^1.6.10",
         "paragonie/csp-builder": "^2.3",
         "phpunit/phpunit": "^9.5.19"
diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php
index 864c2ce47d..ea7ce14233 100644
--- a/src/Cache/Cache.php
+++ b/src/Cache/Cache.php
@@ -19,6 +19,7 @@ namespace Cake\Cache;
 use Cake\Cache\Engine\NullEngine;
 use Cake\Core\StaticConfigTrait;
 use Closure;
+use Psr\SimpleCache\CacheInterface;
 use RuntimeException;

 /**
@@ -201,7 +202,7 @@ class Cache
      * @param string $config The name of the configured cache backend.
      * @return \Psr\SimpleCache\CacheInterface&\Cake\Cache\CacheEngineInterface
      */
-    public static function pool(string $config)
+    public static function pool(string $config): CacheInterface&CacheEngineInterface
     {
         if (!static::$_enabled) {
             return new NullEngine();
diff --git a/src/Http/Cookie/Cookie.php b/src/Http/Cookie/Cookie.php
index 48f8f7f9e4..1f9b48200e 100644
--- a/src/Http/Cookie/Cookie.php
+++ b/src/Http/Cookie/Cookie.php
@@ -543,7 +543,7 @@ class Cookie implements CookieInterface
     /**
      * @inheritDoc
      */
-    public function getExpiry(): DateTimeInterface|null
+    public function getExpiry(): ?DateTimeInterface
     {
         return $this->expiresAt;
     }
diff --git a/src/Http/Cookie/CookieInterface.php b/src/Http/Cookie/CookieInterface.php
index 0dc1527b99..60476ecebd 100644
--- a/src/Http/Cookie/CookieInterface.php
+++ b/src/Http/Cookie/CookieInterface.php
@@ -144,7 +144,7 @@ interface CookieInterface
      *
      * @return \DateTimeInterface|null Timestamp of expiry or null
      */
-    public function getExpiry(): DateTimeInterface|null;
+    public function getExpiry(): ?DateTimeInterface;

     /**
      * Get the timestamp from the expiration time
diff --git a/src/I18n/TranslatorRegistry.php b/src/I18n/TranslatorRegistry.php
index 7bc5f2b890..85ca07a2e4 100644
--- a/src/I18n/TranslatorRegistry.php
+++ b/src/I18n/TranslatorRegistry.php
@@ -16,6 +16,9 @@ declare(strict_types=1);
  */
 namespace Cake\I18n;

+use Cake\Cache\CacheEngineInterface;
+use Psr\SimpleCache\CacheInterface;
+
 /**
  * Constructs and stores instances of translators that can be
  * retrieved by name and locale.
@@ -168,7 +171,7 @@ class TranslatorRegistry
      * @param \Psr\SimpleCache\CacheInterface&\Cake\Cache\CacheEngineInterface $cacher The cacher instance.
      * @return void
      */
-    public function setCacher($cacher): void
+    public function setCacher(CacheInterface&CacheEngineInterface $cacher): void
     {
         $this->_cacher = $cacher;
     }
diff --git a/src/TestSuite/Fixture/TestFixture.php b/src/TestSuite/Fixture/TestFixture.php
index 1af15270eb..2a32ecb1db 100644
--- a/src/TestSuite/Fixture/TestFixture.php
+++ b/src/TestSuite/Fixture/TestFixture.php
@@ -16,6 +16,8 @@ declare(strict_types=1);
 namespace Cake\TestSuite\Fixture;

 use Cake\Core\Exception\CakeException;
+use Cake\Database\Schema\SqlGeneratorInterface;
+use Cake\Database\Schema\TableSchemaInterface;
 use Cake\Datasource\ConnectionInterface;
 use Cake\Datasource\ConnectionManager;
 use Cake\Datasource\FixtureInterface;
@@ -57,7 +59,7 @@ class TestFixture implements FixtureInterface
      * @var \Cake\Database\Schema\TableSchemaInterface&\Cake\Database\Schema\SqlGeneratorInterface
      * @psalm-suppress PropertyNotSetInConstructor
      */
-    protected $_schema;
+    protected TableSchemaInterface&SqlGeneratorInterface $_schema;

     /**
      * Instantiate the fixture.
@@ -224,7 +226,7 @@ class TestFixture implements FixtureInterface
      *
      * @return \Cake\Database\Schema\TableSchemaInterface&\Cake\Database\Schema\SqlGeneratorInterface
      */
-    public function getTableSchema()
+    public function getTableSchema(): TableSchemaInterface&SqlGeneratorInterface
     {
         return $this->_schema;
     }

@othercorey othercorey merged commit e281a50 into 5.x Jun 26, 2022
@othercorey othercorey deleted the 5.x-update-slevomat-standard branch June 26, 2022 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants