Skip to content

Commit

Permalink
Update BetterReflection
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 14, 2023
1 parent 51a284b commit ff8ad7e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 39 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 13 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\\:
Expand Down
10 changes: 4 additions & 6 deletions src/Analyser/FileAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -168,7 +166,7 @@ public function analyseFile(
// pass
} catch (IdentifierNotFound) {
// pass
} catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection) {
} catch (UnableToCompileNode) {
// pass
}
};
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 1 addition & 3 deletions src/Command/AnalyseApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions src/Command/FixerWorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions src/Reflection/BetterReflection/BetterReflectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ff8ad7e

Please sign in to comment.