Bump up slevomat coding standard.#362
Merged
Merged
Conversation
6c7f989 to
81493b5
Compare
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;
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.