diff --git a/composer.json b/composer.json index 9ad3283f6b..7bcac47621 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "nette/utils": "^3.2.5", "nikic/php-parser": "^4.15.5", "ondram/ci-detector": "^3.4.0", - "ondrejmirtes/better-reflection": "6.8.0.1", + "ondrejmirtes/better-reflection": "6.11.0.0", "phpstan/php-8-stubs": "0.3.60", "phpstan/phpdoc-parser": "1.22.0", "react/async": "^3", diff --git a/composer.lock b/composer.lock index 01bc4f0e01..3a7fd35928 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d34207449c5f761a036bc3a57baca3e0", + "content-hash": "c34940cb8bed44afa9de4ebc2f0076ca", "packages": [ { "name": "clue/ndjson-react", @@ -2099,34 +2099,34 @@ }, { "name": "ondrejmirtes/better-reflection", - "version": "6.8.0.1", + "version": "6.11.0.0", "source": { "type": "git", "url": "https://github.com/ondrejmirtes/BetterReflection.git", - "reference": "80955a36bd344a112bde564085652246f14a95e2" + "reference": "9ae003bcdd7b38383a882a5c8a9d2930d2efa61e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ondrejmirtes/BetterReflection/zipball/80955a36bd344a112bde564085652246f14a95e2", - "reference": "80955a36bd344a112bde564085652246f14a95e2", + "url": "https://api.github.com/repos/ondrejmirtes/BetterReflection/zipball/9ae003bcdd7b38383a882a5c8a9d2930d2efa61e", + "reference": "9ae003bcdd7b38383a882a5c8a9d2930d2efa61e", "shasum": "" }, "require": { "ext-json": "*", "jetbrains/phpstorm-stubs": "dev-master#7b055d8634d2143a909f2c5141ec70c82b8b9254", - "nikic/php-parser": "^4.15.4", + "nikic/php-parser": "^4.15.5", "php": "^7.2 || ^8.0" }, "conflict": { "thecodingmachine/safe": "<1.1.3" }, "require-dev": { - "doctrine/coding-standard": "^11.1.0", - "phpstan/phpstan": "^1.10.3", - "phpstan/phpstan-phpunit": "^1.3.10", - "phpunit/phpunit": "10.0.14", + "doctrine/coding-standard": "^12.0.0", + "phpstan/phpstan": "^1.10.16", + "phpstan/phpstan-phpunit": "^1.3.13", + "phpunit/phpunit": "^10.2.1", "rector/rector": "0.14.3", - "vimeo/psalm": "5.7.7" + "vimeo/psalm": "5.12.0" }, "suggest": { "composer/composer": "Required to use the ComposerSourceLocator" @@ -2165,9 +2165,9 @@ ], "description": "Better Reflection - an improved code reflection API", "support": { - "source": "https://github.com/ondrejmirtes/BetterReflection/tree/6.8.0.1" + "source": "https://github.com/ondrejmirtes/BetterReflection/tree/6.11.0.0" }, - "time": "2023-03-06T12:56:20+00:00" + "time": "2023-06-14T14:16:55+00:00" }, { "name": "phpstan/php-8-stubs", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a60b2f928a..bbc738718b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -277,16 +277,6 @@ parameters: count: 1 path: src/Reflection/BetterReflection/BetterReflectionProvider.php - - - message: "#^Dead catch \\- PHPStan\\\\BetterReflection\\\\Reflection\\\\Exception\\\\NotAClassReflection is never thrown in the try block\\.$#" - count: 1 - path: src/Reflection/BetterReflection/BetterReflectionProvider.php - - - - message: "#^Dead catch \\- PHPStan\\\\BetterReflection\\\\Reflection\\\\Exception\\\\NotAnInterfaceReflection is never thrown in the try block\\.$#" - count: 1 - path: src/Reflection/BetterReflection/BetterReflectionProvider.php - - message: """ #^Call to deprecated method getTypeFromValue\\(\\) of class PHPStan\\\\Type\\\\ConstantTypeHelper\\: diff --git a/src/Analyser/FileAnalyser.php b/src/Analyser/FileAnalyser.php index f27181ccd7..73eb4b5665 100644 --- a/src/Analyser/FileAnalyser.php +++ b/src/Analyser/FileAnalyser.php @@ -7,8 +7,6 @@ use PHPStan\AnalysedCodeException; use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; use PHPStan\BetterReflection\Reflection\Exception\CircularReference; -use PHPStan\BetterReflection\Reflection\Exception\NotAClassReflection; -use PHPStan\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; use PHPStan\Collectors\CollectedData; use PHPStan\Collectors\Registry as CollectorRegistry; @@ -104,7 +102,7 @@ public function analyseFile( } catch (IdentifierNotFound $e) { $fileErrors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, $node->getLine(), $e, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); continue; - } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection | CircularReference $e) { + } catch (UnableToCompileNode | CircularReference $e) { $fileErrors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, $node->getLine(), $e); continue; } @@ -140,7 +138,7 @@ public function analyseFile( } catch (IdentifierNotFound $e) { $fileErrors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, $node->getLine(), $e, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); continue; - } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection | CircularReference $e) { + } catch (UnableToCompileNode | CircularReference $e) { $fileErrors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, $node->getLine(), $e); continue; } @@ -168,7 +166,7 @@ public function analyseFile( // pass } catch (IdentifierNotFound) { // pass - } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection) { + } catch (UnableToCompileNode) { // pass } }; @@ -228,7 +226,7 @@ public function analyseFile( $fileErrors[] = new Error($e->getMessage(), $file, null, $e, null, null, $e->getTip()); } catch (IdentifierNotFound $e) { $fileErrors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, null, $e, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); - } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection | CircularReference $e) { + } catch (UnableToCompileNode | CircularReference $e) { $fileErrors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, null, $e); } } elseif (is_dir($file)) { diff --git a/src/Command/AnalyseApplication.php b/src/Command/AnalyseApplication.php index 04db8148bd..4d1bfc4818 100644 --- a/src/Command/AnalyseApplication.php +++ b/src/Command/AnalyseApplication.php @@ -12,8 +12,6 @@ use PHPStan\Analyser\ScopeFactory; use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; use PHPStan\BetterReflection\Reflection\Exception\CircularReference; -use PHPStan\BetterReflection\Reflection\Exception\NotAClassReflection; -use PHPStan\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; use PHPStan\Collectors\CollectedData; use PHPStan\Internal\BytesHelper; @@ -167,7 +165,7 @@ private function getCollectedDataErrors(array $collectedData): array } catch (IdentifierNotFound $e) { $errors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, $node->getLine(), $e, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); continue; - } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection | CircularReference $e) { + } catch (UnableToCompileNode | CircularReference $e) { $errors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, $node->getLine(), $e); continue; } diff --git a/src/Command/FixerWorkerCommand.php b/src/Command/FixerWorkerCommand.php index 6a925b8ce7..f0742aca68 100644 --- a/src/Command/FixerWorkerCommand.php +++ b/src/Command/FixerWorkerCommand.php @@ -12,8 +12,6 @@ use PHPStan\Analyser\ScopeFactory; use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; use PHPStan\BetterReflection\Reflection\Exception\CircularReference; -use PHPStan\BetterReflection\Reflection\Exception\NotAClassReflection; -use PHPStan\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; use PHPStan\Collectors\CollectedData; use PHPStan\DependencyInjection\Container; @@ -194,7 +192,7 @@ private function getCollectedDataErrors(Container $container, array $collectedDa } catch (IdentifierNotFound $e) { $errors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, $node->getLine(), $e, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); continue; - } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection | CircularReference $e) { + } catch (UnableToCompileNode | CircularReference $e) { $errors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, $node->getLine(), $e); continue; } diff --git a/src/Reflection/BetterReflection/BetterReflectionProvider.php b/src/Reflection/BetterReflection/BetterReflectionProvider.php index 0766abd21a..b7ee3367e9 100644 --- a/src/Reflection/BetterReflection/BetterReflectionProvider.php +++ b/src/Reflection/BetterReflection/BetterReflectionProvider.php @@ -10,8 +10,6 @@ use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionFunction; use PHPStan\BetterReflection\Reflection\Adapter\ReflectionParameter; -use PHPStan\BetterReflection\Reflection\Exception\NotAClassReflection; -use PHPStan\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; use PHPStan\BetterReflection\Reflection\ReflectionEnum; use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; use PHPStan\BetterReflection\Reflector\Reflector; @@ -364,7 +362,7 @@ public function resolveConstantName(Node\Name $nameNode, ?NamespaceAnswerer $nam return true; } catch (IdentifierNotFound) { // pass - } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection) { + } catch (UnableToCompileNode) { // pass } return false;