From 38ffdde4f8ea57966d568d928ede47a591ce7188 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 9 Apr 2024 10:10:14 +0900 Subject: [PATCH 1/3] test: replace empty() --- tests/_support/Config/Registrar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/_support/Config/Registrar.php b/tests/_support/Config/Registrar.php index 8889021a2d00..d43da3166336 100644 --- a/tests/_support/Config/Registrar.php +++ b/tests/_support/Config/Registrar.php @@ -134,7 +134,7 @@ public static function Database() // Under GitHub Actions, we can set an ENV var named 'DB' // so that we can test against multiple databases. - if (($group = getenv('DB')) && ! empty(self::$dbConfig[$group])) { + if (($group = getenv('DB')) && isset(self::$dbConfig[$group])) { $config['tests'] = self::$dbConfig[$group]; } From 522cd747ebe3b076adbdf264d1b2cd341b06139d Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 9 Apr 2024 10:10:40 +0900 Subject: [PATCH 2/3] test: add types and PHPDoc array types --- tests/_support/Config/Registrar.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/_support/Config/Registrar.php b/tests/_support/Config/Registrar.php index d43da3166336..b92c5e24bb16 100644 --- a/tests/_support/Config/Registrar.php +++ b/tests/_support/Config/Registrar.php @@ -23,9 +23,9 @@ class Registrar /** * DB config array for testing purposes. * - * @var array + * @var array|bool|int|string>> */ - protected static $dbConfig = [ + protected static array $dbConfig = [ 'MySQLi' => [ 'DSN' => '', 'hostname' => '127.0.0.1', @@ -126,9 +126,9 @@ class Registrar /** * Override database config * - * @return array + * @return array|bool|int|string> */ - public static function Database() + public static function Database(): array { $config = []; @@ -146,9 +146,9 @@ public static function Database() * * @see PublisherRestrictionsTest::testRegistrarsNotAllowed() * - * @return array + * @return array> */ - public static function Publisher() + public static function Publisher(): array { return [ 'restrictions' => [SUPPORTPATH => '*'], From d3a03a751718222a7dfcfbd0df631af5cdb99cc9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 9 Apr 2024 10:11:12 +0900 Subject: [PATCH 3/3] chore: update phpstan-baseline.php --- phpstan-baseline.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index ffe358b48943..44f3fcd4d706 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -10046,26 +10046,6 @@ 'count' => 2, 'path' => __DIR__ . '/tests/_support/Config/Filters.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Config/Registrar.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Config\\\\Registrar\\:\\:Database\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Config/Registrar.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method Tests\\\\Support\\\\Config\\\\Registrar\\:\\:Publisher\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Config/Registrar.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Property Tests\\\\Support\\\\Config\\\\Registrar\\:\\:\\$dbConfig type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/_support/Config/Registrar.php', -]; $ignoreErrors[] = [ 'message' => '#^Variable \\$routes might not be defined\\.$#', 'count' => 5,