diff --git a/composer.json b/composer.json index 7227e71..114c23d 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "require-dev": { "phpunit/phpunit": "^10.0", "orchestra/testbench": "^8.6", - "phpstan/phpstan": "^1.10", + "phpstan/phpstan": "^2.0", "friendsofphp/php-cs-fixer": "^3.26", "squizlabs/php_codesniffer": "^3.7", "psalm/plugin-laravel": "^2.8" diff --git a/phpstan.neon b/phpstan.neon index 8d5df44..a81f5c5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,7 +4,7 @@ parameters: - src - tests - # The level 9 is the highest level + # The level 10 is the highest level level: 5 ignoreErrors: @@ -17,15 +17,14 @@ parameters: - '#Call to an undefined method#' - '#If condition is always true#' - '#Call to an undefined static#' - - '#Method class\@anonymous\/tests\/ServiceTest.php\:12\:\:obtain\(\)#' - '#AnourValar\\LaravelAtom\\Tests\\Models\\Post\:\:\$data#' - - '#with return type void returns array\\) of method Countable\:\:count\(\)#' excludePaths: checkFunctionNameCase: true checkInternalClassCaseSensitivity: true - checkAlwaysTrueInstanceof: true reportMaybesInMethodSignatures: true reportStaticMethodSignatures: true checkUninitializedProperties: true @@ -33,3 +32,6 @@ parameters: reportAlwaysTrueInLastCondition: true reportWrongPhpDocTypeInVarTag: true checkMissingCallableSignature: true + reportPossiblyNonexistentGeneralArrayOffset: true + reportPossiblyNonexistentConstantArrayOffset: true + reportAnyTypeWideningInVarTag: true diff --git a/src/Http/Middleware/Web/Select2.php b/src/Http/Middleware/Web/Select2.php index 1f90a82..1d5af77 100644 --- a/src/Http/Middleware/Web/Select2.php +++ b/src/Http/Middleware/Web/Select2.php @@ -43,6 +43,10 @@ public function handle(Request $request, Closure $next): Response */ private function convertResponse(\Symfony\Component\HttpFoundation\Response &$response): void { + if ($response->getStatusCode() != 200) { + return; + } + $content = $response->getOriginalContent(); if ( diff --git a/tests/MapperCollectionTest.php b/tests/MapperCollectionTest.php index 1b756c6..29152f1 100644 --- a/tests/MapperCollectionTest.php +++ b/tests/MapperCollectionTest.php @@ -52,7 +52,7 @@ public function test_simple(array $data) } /** - * @return void + * @return array */ public static function provideSimpleData() {