|
15 | 15 | use PHPStan\Rules\Registry; |
16 | 16 | use PHPStan\Rules\TipRuleError; |
17 | 17 | use Roave\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; |
| 18 | +use Roave\BetterReflection\Reflection\Exception\NotAClassReflection; |
| 19 | +use Roave\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; |
18 | 20 | use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; |
19 | 21 | use function array_fill_keys; |
20 | 22 | use function array_key_exists; |
@@ -90,8 +92,8 @@ public function analyseFile( |
90 | 92 | } catch (IdentifierNotFound $e) { |
91 | 93 | $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'); |
92 | 94 | continue; |
93 | | - } catch (UnableToCompileNode $e) { |
94 | | - $fileErrors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, $node->getLine(), $e, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); |
| 95 | + } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection $e) { |
| 96 | + $fileErrors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, $node->getLine(), $e); |
95 | 97 | continue; |
96 | 98 | } |
97 | 99 |
|
@@ -178,7 +180,7 @@ public function analyseFile( |
178 | 180 | // pass |
179 | 181 | } catch (IdentifierNotFound $e) { |
180 | 182 | // pass |
181 | | - } catch (UnableToCompileNode $e) { |
| 183 | + } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection $e) { |
182 | 184 | // pass |
183 | 185 | } |
184 | 186 | }; |
@@ -239,8 +241,8 @@ public function analyseFile( |
239 | 241 | $fileErrors[] = new Error($e->getMessage(), $file, null, $e, null, null, $e->getTip()); |
240 | 242 | } catch (IdentifierNotFound $e) { |
241 | 243 | $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'); |
242 | | - } catch (UnableToCompileNode $e) { |
243 | | - $fileErrors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, null, $e, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); |
| 244 | + } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection $e) { |
| 245 | + $fileErrors[] = new Error(sprintf('Reflection error: %s', $e->getMessage()), $file, null, $e); |
244 | 246 | } |
245 | 247 | } elseif (is_dir($file)) { |
246 | 248 | $fileErrors[] = new Error(sprintf('File %s is a directory.', $file), $file, null, false); |
|
0 commit comments