diff --git a/build/baseline-7.4.neon b/build/baseline-7.4.neon index 4b224cdda5..9217c32c19 100644 --- a/build/baseline-7.4.neon +++ b/build/baseline-7.4.neon @@ -93,6 +93,6 @@ parameters: count: 1 path: ../src/Reflection/ReflectionProvider/SetterReflectionProviderProvider.php - - message: "#^Class class@anonymous/src/Testing/TestCase\\.php\\:268 has an uninitialized property \\$reflectionProvider\\. Give it default value or assign it in the constructor\\.$#" + message: "#^Class class@anonymous/src/Testing/TestCase\\.php\\:267 has an uninitialized property \\$reflectionProvider\\. Give it default value or assign it in the constructor\\.$#" count: 1 path: ../src/Testing/TestCase.php diff --git a/compiler/build/scoper.inc.php b/compiler/build/scoper.inc.php index 1d1f3644f6..0c29fc16e3 100644 --- a/compiler/build/scoper.inc.php +++ b/compiler/build/scoper.inc.php @@ -121,10 +121,6 @@ function (string $filePath, string $prefix, string $content): string { return $class; } - if (strpos($class, 'Roave\\BetterReflection\\') === 0) { - return $class; - } - if (strpos($class, '@') === 0) { return $class; } @@ -217,7 +213,6 @@ function (string $filePath, string $prefix, string $content): string { 'PHPStan\*', 'PhpParser\*', 'Hoa\*', - 'Roave\BetterReflection\*', ], 'whitelist-global-functions' => false, 'whitelist-global-classes' => false, diff --git a/compiler/src/Console/CompileCommand.php b/compiler/src/Console/CompileCommand.php index 4903cb4242..c5ec2364dc 100644 --- a/compiler/src/Console/CompileCommand.php +++ b/compiler/src/Console/CompileCommand.php @@ -201,10 +201,8 @@ private function buildPreloadScript(): void $output = ''; foreach ($finder->files()->name('*.php')->in([ $this->buildDir . '/src', - $this->buildDir . '/stubs/runtime', $vendorDir . '/nikic/php-parser/lib/PhpParser', $vendorDir . '/phpstan/phpdoc-parser/src', - $vendorDir . '/ondrejmirtes/better-reflection/src', ])->exclude([ 'Testing', ]) as $phpFile) { diff --git a/composer.json b/composer.json index 5aa2633026..a4cc6c2171 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "nette/utils": "^3.1.3", "nikic/php-parser": "4.10.4", "ondram/ci-detector": "^3.4.0", - "ondrejmirtes/better-reflection": "4.3.50", + "ondrejmirtes/better-reflection": "4.3.51", "phpdocumentor/reflection-docblock": "4.3.4", "phpstan/php-8-stubs": "^0.1.12", "phpstan/phpdoc-parser": "^0.4.9", diff --git a/composer.lock b/composer.lock index ae3ef26c06..7eb0f462e2 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": "89f3df5b8e07c793c27ab69f51f0c05f", + "content-hash": "73cb2009e1ae3bbefed51e995653ba4a", "packages": [ { "name": "clue/block-react", @@ -2072,21 +2072,21 @@ }, { "name": "ondrejmirtes/better-reflection", - "version": "4.3.50", + "version": "4.3.51", "source": { "type": "git", "url": "https://github.com/ondrejmirtes/BetterReflection.git", - "reference": "e4f77fb14901488eef16b0f35007800df2ffeb46" + "reference": "34f2d24f6cda682b26465965bbeafb289caf3219" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ondrejmirtes/BetterReflection/zipball/e4f77fb14901488eef16b0f35007800df2ffeb46", - "reference": "e4f77fb14901488eef16b0f35007800df2ffeb46", + "url": "https://api.github.com/repos/ondrejmirtes/BetterReflection/zipball/34f2d24f6cda682b26465965bbeafb289caf3219", + "reference": "34f2d24f6cda682b26465965bbeafb289caf3219", "shasum": "" }, "require": { "ext-json": "*", - "jetbrains/phpstorm-stubs": "dev-master#b2402e4a525593f68ff46303dcc6bc625437276a", + "jetbrains/phpstorm-stubs": "dev-master#0a73df114cdea7f30c8b5f6fbfbf8e6839a89e88", "nikic/php-parser": "4.10.4", "php": ">=7.1.0", "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.2.0", @@ -2109,7 +2109,7 @@ }, "autoload": { "psr-4": { - "Roave\\BetterReflection\\": "src" + "PHPStan\\BetterReflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2140,9 +2140,9 @@ ], "description": "Better Reflection - an improved code reflection API", "support": { - "source": "https://github.com/ondrejmirtes/BetterReflection/tree/4.3.50" + "source": "https://github.com/ondrejmirtes/BetterReflection/tree/4.3.51" }, - "time": "2021-02-18T10:40:17+00:00" + "time": "2021-02-24T12:12:21+00:00" }, { "name": "phpdocumentor/reflection-common", diff --git a/conf/config.neon b/conf/config.neon index a135002b3d..bbd7565b79 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -98,7 +98,6 @@ parameters: - '#^PhpParser\\#' - '#^PHPStan\\#' - '#^Hoa\\#' - - '#^Roave\\BetterReflection\\#' dynamicConstantNames: - ICONV_IMPL - LIBXML_VERSION @@ -1331,7 +1330,7 @@ services: - PHPStan\Reflection\ReflectionProvider betterReflectionSourceLocator: - class: Roave\BetterReflection\SourceLocator\Type\SourceLocator + class: PHPStan\BetterReflection\SourceLocator\Type\SourceLocator factory: @PHPStan\Reflection\BetterReflection\BetterReflectionSourceLocatorFactory::create autowired: false @@ -1405,17 +1404,17 @@ services: implement: PHPStan\Reflection\BetterReflection\BetterReflectionProviderFactory - - class: Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber + class: PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber arguments: phpParser: @php8PhpParser phpVersionId: %phpVersion% autowired: - - Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber + - PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber - - class: Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber + class: PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber autowired: - - Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber + - PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber php8Lexer: class: PhpParser\Lexer\Emulative diff --git a/conf/config.stubValidator.neon b/conf/config.stubValidator.neon index e4c2ccc9b0..86e25998d0 100644 --- a/conf/config.stubValidator.neon +++ b/conf/config.stubValidator.neon @@ -25,27 +25,27 @@ services: autowired: false stubClassReflector: - class: Roave\BetterReflection\Reflector\ClassReflector + class: PHPStan\BetterReflection\Reflector\ClassReflector arguments: sourceLocator: @stubSourceLocator autowired: false stubFunctionReflector: - class: Roave\BetterReflection\Reflector\FunctionReflector + class: PHPStan\BetterReflection\Reflector\FunctionReflector arguments: classReflector: @stubClassReflector sourceLocator: @stubSourceLocator autowired: false stubConstantReflector: - class: Roave\BetterReflection\Reflector\ConstantReflector + class: PHPStan\BetterReflection\Reflector\ConstantReflector arguments: classReflector: @stubClassReflector sourceLocator: @stubSourceLocator autowired: false stubSourceLocator: - class: Roave\BetterReflection\SourceLocator\Type\SourceLocator + class: PHPStan\BetterReflection\SourceLocator\Type\SourceLocator factory: @PHPStan\PhpDoc\StubSourceLocatorFactory::create() autowired: false diff --git a/src/Analyser/FileAnalyser.php b/src/Analyser/FileAnalyser.php index f5acdb13ff..af21ba3f71 100644 --- a/src/Analyser/FileAnalyser.php +++ b/src/Analyser/FileAnalyser.php @@ -4,6 +4,10 @@ use PhpParser\Comment; use PhpParser\Node; +use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; +use PHPStan\BetterReflection\Reflection\Exception\NotAClassReflection; +use PHPStan\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; +use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; use PHPStan\Dependency\DependencyResolver; use PHPStan\Node\FileNode; use PHPStan\Parser\Parser; @@ -14,10 +18,6 @@ use PHPStan\Rules\NonIgnorableRuleError; use PHPStan\Rules\Registry; use PHPStan\Rules\TipRuleError; -use Roave\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; -use Roave\BetterReflection\Reflection\Exception\NotAClassReflection; -use Roave\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; use function array_key_exists; use function array_unique; diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 6a5bc2d0f7..a87651744d 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -46,6 +46,10 @@ use PhpParser\Node\Stmt\TryCatch; use PhpParser\Node\Stmt\Unset_; use PhpParser\Node\Stmt\While_; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; +use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource; use PHPStan\DependencyInjection\Reflection\ClassReflectionExtensionRegistryProvider; use PHPStan\File\FileHelper; use PHPStan\File\FileReader; @@ -114,10 +118,6 @@ use PHPStan\Type\TypeTraverser; use PHPStan\Type\TypeUtils; use PHPStan\Type\UnionType; -use Roave\BetterReflection\Reflection\Adapter\ReflectionClass; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; -use Roave\BetterReflection\SourceLocator\Located\LocatedSource; class NodeScopeResolver { @@ -1257,7 +1257,7 @@ private function createAstClassReflection(Node\Stmt\ClassLike $stmt, Scope $scop new LocatedSource(FileReader::read($scope->getFile()), $scope->getFile()), $scope->getNamespace() !== null ? new Node\Stmt\Namespace_(new Name($scope->getNamespace())) : null ); - if (!$betterReflectionClass instanceof \Roave\BetterReflection\Reflection\ReflectionClass) { + if (!$betterReflectionClass instanceof \PHPStan\BetterReflection\Reflection\ReflectionClass) { throw new \PHPStan\ShouldNotHappenException(); } diff --git a/src/DependencyInjection/ContainerFactory.php b/src/DependencyInjection/ContainerFactory.php index a1b4434a1a..3783883811 100644 --- a/src/DependencyInjection/ContainerFactory.php +++ b/src/DependencyInjection/ContainerFactory.php @@ -4,12 +4,12 @@ use Nette\DI\Extensions\PhpExtension; use Phar; +use PHPStan\BetterReflection\BetterReflection; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; use PHPStan\Broker\Broker; use PHPStan\Command\CommandHelper; use PHPStan\File\FileHelper; use PHPStan\Php\PhpVersion; -use Roave\BetterReflection\BetterReflection; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; use Symfony\Component\Finder\Finder; use function sys_get_temp_dir; diff --git a/src/PhpDoc/StubSourceLocatorFactory.php b/src/PhpDoc/StubSourceLocatorFactory.php index 3eef4391d1..a3a1215c34 100644 --- a/src/PhpDoc/StubSourceLocatorFactory.php +++ b/src/PhpDoc/StubSourceLocatorFactory.php @@ -2,15 +2,15 @@ namespace PHPStan\PhpDoc; +use PHPStan\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Locator; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; +use PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; use PHPStan\DependencyInjection\Container; use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocatorRepository; -use Roave\BetterReflection\Reflector\FunctionReflector; -use Roave\BetterReflection\SourceLocator\Ast\Locator; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; -use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; class StubSourceLocatorFactory { diff --git a/src/Reflection/BetterReflection/BetterReflectionProvider.php b/src/Reflection/BetterReflection/BetterReflectionProvider.php index 9d066b5d08..679486dfae 100644 --- a/src/Reflection/BetterReflection/BetterReflectionProvider.php +++ b/src/Reflection/BetterReflection/BetterReflectionProvider.php @@ -4,6 +4,17 @@ use PhpParser\PrettyPrinter\Standard; use PHPStan\Analyser\Scope; +use PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName; +use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionFunction; +use PHPStan\BetterReflection\Reflection\Exception\NotAClassReflection; +use PHPStan\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflector\ConstantReflector; +use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; +use PHPStan\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource; use PHPStan\Broker\AnonymousClassNameHelper; use PHPStan\DependencyInjection\Reflection\ClassReflectionExtensionRegistryProvider; use PHPStan\File\FileHelper; @@ -23,17 +34,6 @@ use PHPStan\Type\Generic\TemplateTypeMap; use PHPStan\Type\MixedType; use PHPStan\Type\Type; -use Roave\BetterReflection\Identifier\Exception\InvalidIdentifierName; -use Roave\BetterReflection\NodeCompiler\Exception\UnableToCompileNode; -use Roave\BetterReflection\Reflection\Adapter\ReflectionClass; -use Roave\BetterReflection\Reflection\Adapter\ReflectionFunction; -use Roave\BetterReflection\Reflection\Exception\NotAClassReflection; -use Roave\BetterReflection\Reflection\Exception\NotAnInterfaceReflection; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\Reflector\ConstantReflector; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; -use Roave\BetterReflection\Reflector\FunctionReflector; -use Roave\BetterReflection\SourceLocator\Located\LocatedSource; class BetterReflectionProvider implements ReflectionProvider { @@ -42,11 +42,11 @@ class BetterReflectionProvider implements ReflectionProvider private \PHPStan\DependencyInjection\Reflection\ClassReflectionExtensionRegistryProvider $classReflectionExtensionRegistryProvider; - private \Roave\BetterReflection\Reflector\ClassReflector $classReflector; + private \PHPStan\BetterReflection\Reflector\ClassReflector $classReflector; - private \Roave\BetterReflection\Reflector\FunctionReflector $functionReflector; + private \PHPStan\BetterReflection\Reflector\FunctionReflector $functionReflector; - private \Roave\BetterReflection\Reflector\ConstantReflector $constantReflector; + private \PHPStan\BetterReflection\Reflector\ConstantReflector $constantReflector; private \PHPStan\Type\FileTypeMapper $fileTypeMapper; @@ -207,7 +207,7 @@ public function getAnonymousClassReflection(\PhpParser\Node\Stmt\Class_ $classNo return self::$anonymousClasses[$className]; } - $reflectionClass = \Roave\BetterReflection\Reflection\ReflectionClass::createFromNode( + $reflectionClass = \PHPStan\BetterReflection\Reflection\ReflectionClass::createFromNode( $this->classReflector, $classNode, new LocatedSource($this->printer->prettyPrint([$classNode]), $scopeFile), @@ -313,7 +313,7 @@ public function resolveFunctionName(\PhpParser\Node\Name $nameNode, ?Scope $scop try { $this->functionReflector->reflect($name); return true; - } catch (\Roave\BetterReflection\Reflector\Exception\IdentifierNotFound $e) { + } catch (\PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound $e) { // pass } catch (InvalidIdentifierName $e) { // pass @@ -358,7 +358,7 @@ public function resolveConstantName(\PhpParser\Node\Name $nameNode, ?Scope $scop try { $this->constantReflector->reflect($name); return true; - } catch (\Roave\BetterReflection\Reflector\Exception\IdentifierNotFound $e) { + } catch (\PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound $e) { // pass } catch (UnableToCompileNode | NotAClassReflection | NotAnInterfaceReflection $e) { // pass diff --git a/src/Reflection/BetterReflection/BetterReflectionProviderFactory.php b/src/Reflection/BetterReflection/BetterReflectionProviderFactory.php index 2b5c7db77c..903fc7c02b 100644 --- a/src/Reflection/BetterReflection/BetterReflectionProviderFactory.php +++ b/src/Reflection/BetterReflection/BetterReflectionProviderFactory.php @@ -2,9 +2,9 @@ namespace PHPStan\Reflection\BetterReflection; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\Reflector\ConstantReflector; -use Roave\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflector\ConstantReflector; +use PHPStan\BetterReflection\Reflector\FunctionReflector; interface BetterReflectionProviderFactory { diff --git a/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php b/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php index d3a4d0adf4..ad3962e587 100644 --- a/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php +++ b/src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php @@ -12,16 +12,16 @@ use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocatorRepository; use PHPStan\Reflection\BetterReflection\SourceLocator\PhpVersionBlacklistSourceLocator; use PHPStan\Reflection\BetterReflection\SourceLocator\SkipClassAliasSourceLocator; -use Roave\BetterReflection\Reflector\FunctionReflector; -use Roave\BetterReflection\SourceLocator\Ast\Locator; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; -use Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber; -use Roave\BetterReflection\SourceLocator\SourceStubber\SourceStubber; -use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Locator; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\SourceStubber; +use PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; class BetterReflectionSourceLocatorFactory { diff --git a/src/Reflection/BetterReflection/Reflector/MemoizingClassReflector.php b/src/Reflection/BetterReflection/Reflector/MemoizingClassReflector.php index 1140407039..d34a77a86f 100644 --- a/src/Reflection/BetterReflection/Reflector/MemoizingClassReflector.php +++ b/src/Reflection/BetterReflection/Reflector/MemoizingClassReflector.php @@ -2,21 +2,21 @@ namespace PHPStan\Reflection\BetterReflection\Reflector; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\ClassReflector; final class MemoizingClassReflector extends ClassReflector { - /** @var array */ + /** @var array */ private array $reflections = []; /** * Create a ReflectionClass for the specified $className. * - * @return \Roave\BetterReflection\Reflection\ReflectionClass + * @return \PHPStan\BetterReflection\Reflection\ReflectionClass * - * @throws \Roave\BetterReflection\Reflector\Exception\IdentifierNotFound + * @throws \PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound */ public function reflect(string $className): Reflection { diff --git a/src/Reflection/BetterReflection/Reflector/MemoizingConstantReflector.php b/src/Reflection/BetterReflection/Reflector/MemoizingConstantReflector.php index f006d0a427..aca5db5d44 100644 --- a/src/Reflection/BetterReflection/Reflector/MemoizingConstantReflector.php +++ b/src/Reflection/BetterReflection/Reflector/MemoizingConstantReflector.php @@ -2,21 +2,21 @@ namespace PHPStan\Reflection\BetterReflection\Reflector; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\ConstantReflector; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\ConstantReflector; final class MemoizingConstantReflector extends ConstantReflector { - /** @var array */ + /** @var array */ private array $reflections = []; /** * Create a ReflectionConstant for the specified $constantName. * - * @return \Roave\BetterReflection\Reflection\ReflectionConstant + * @return \PHPStan\BetterReflection\Reflection\ReflectionConstant * - * @throws \Roave\BetterReflection\Reflector\Exception\IdentifierNotFound + * @throws \PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound */ public function reflect(string $constantName): Reflection { diff --git a/src/Reflection/BetterReflection/Reflector/MemoizingFunctionReflector.php b/src/Reflection/BetterReflection/Reflector/MemoizingFunctionReflector.php index 3eb2b4b5df..078392ef1b 100644 --- a/src/Reflection/BetterReflection/Reflector/MemoizingFunctionReflector.php +++ b/src/Reflection/BetterReflection/Reflector/MemoizingFunctionReflector.php @@ -2,21 +2,21 @@ namespace PHPStan\Reflection\BetterReflection\Reflector; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\FunctionReflector; final class MemoizingFunctionReflector extends FunctionReflector { - /** @var array */ + /** @var array */ private array $reflections = []; /** * Create a ReflectionFunction for the specified $functionName. * - * @return \Roave\BetterReflection\Reflection\ReflectionFunction + * @return \PHPStan\BetterReflection\Reflection\ReflectionFunction * - * @throws \Roave\BetterReflection\Reflector\Exception\IdentifierNotFound + * @throws \PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound */ public function reflect(string $functionName): Reflection { diff --git a/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php index 62737e9848..592dfe0554 100644 --- a/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocator.php @@ -6,18 +6,18 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflection\ReflectionConstant; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure; +use PHPStan\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; +use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; use ReflectionClass; use ReflectionException; use ReflectionFunction; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflection\ReflectionConstant; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure; -use Roave\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; -use Roave\BetterReflection\SourceLocator\Located\LocatedSource; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; use function array_key_exists; use function file_exists; use function restore_error_handler; @@ -47,7 +47,7 @@ class AutoloadSourceLocator implements SourceLocator /** @var array> */ private array $constantNodes = []; - /** @var array */ + /** @var array */ private array $locatedSourcesByFile = []; public function __construct(FileNodesFetcher $fileNodesFetcher) diff --git a/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php b/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php index 53cd741ec2..30ef0852e4 100644 --- a/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php +++ b/src/Reflection/BetterReflection/SourceLocator/CachingVisitor.php @@ -5,8 +5,8 @@ use PhpParser\BuilderHelpers; use PhpParser\Node\Stmt\Namespace_; use PhpParser\NodeVisitorAbstract; -use Roave\BetterReflection\Reflection\Exception\InvalidConstantNode; -use Roave\BetterReflection\Util\ConstantNodeChecker; +use PHPStan\BetterReflection\Reflection\Exception\InvalidConstantNode; +use PHPStan\BetterReflection\Util\ConstantNodeChecker; class CachingVisitor extends NodeVisitorAbstract { diff --git a/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php index 3c7d08592a..9b4ca0d402 100644 --- a/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/ClassBlacklistSourceLocator.php @@ -3,11 +3,11 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; use Nette\Utils\Strings; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; class ClassBlacklistSourceLocator implements SourceLocator { diff --git a/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php index e0cd896a2b..cff56df029 100644 --- a/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/ClassWhitelistSourceLocator.php @@ -3,11 +3,11 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; use Nette\Utils\Strings; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; class ClassWhitelistSourceLocator implements SourceLocator { diff --git a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php index 7eee2e1fa5..cc0e55dea6 100644 --- a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php +++ b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php @@ -3,11 +3,11 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; use Nette\Utils\Json; +use PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\Composer\Psr\Psr0Mapping; +use PHPStan\BetterReflection\SourceLocator\Type\Composer\Psr\Psr4Mapping; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; use PHPStan\File\FileReader; -use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Psr0Mapping; -use Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Psr4Mapping; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; class ComposerJsonAndInstalledJsonSourceLocatorMaker { diff --git a/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php b/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php index e2dda64270..5791a790b6 100644 --- a/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php +++ b/src/Reflection/BetterReflection/SourceLocator/FetchedNodesResult.php @@ -2,7 +2,7 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; -use Roave\BetterReflection\SourceLocator\Located\LocatedSource; +use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource; class FetchedNodesResult { @@ -16,13 +16,13 @@ class FetchedNodesResult /** @var array> */ private array $constantNodes; - private \Roave\BetterReflection\SourceLocator\Located\LocatedSource $locatedSource; + private \PHPStan\BetterReflection\SourceLocator\Located\LocatedSource $locatedSource; /** * @param array>> $classNodes * @param array> $functionNodes * @param array> $constantNodes - * @param \Roave\BetterReflection\SourceLocator\Located\LocatedSource $locatedSource + * @param \PHPStan\BetterReflection\SourceLocator\Located\LocatedSource $locatedSource */ public function __construct( array $classNodes, diff --git a/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php b/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php index 49ac33571d..db88b2b177 100644 --- a/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php +++ b/src/Reflection/BetterReflection/SourceLocator/FileNodesFetcher.php @@ -3,9 +3,9 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; use PhpParser\NodeTraverser; +use PHPStan\BetterReflection\SourceLocator\Located\LocatedSource; use PHPStan\File\FileReader; use PHPStan\Parser\Parser; -use Roave\BetterReflection\SourceLocator\Located\LocatedSource; class FileNodesFetcher { diff --git a/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php b/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php index 52f58da694..6c55a2552e 100644 --- a/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php +++ b/src/Reflection/BetterReflection/SourceLocator/FileReadTrapStreamWrapper.php @@ -12,7 +12,7 @@ * in operation. * * @internal DO NOT USE: this is an implementation detail of - * the {@see \Roave\BetterReflection\SourceLocator\Type\AutoloadSourceLocator} + * the {@see \PHPStan\BetterReflection\SourceLocator\Type\AutoloadSourceLocator} * * phpcs:disable SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint * phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php index 961c7b50b8..9aaa11a6e4 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocator.php @@ -2,12 +2,12 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; use function array_key_exists; class OptimizedDirectorySourceLocator implements SourceLocator @@ -30,7 +30,7 @@ class OptimizedDirectorySourceLocator implements SourceLocator /** @var array> */ private array $functionNodes = []; - /** @var array */ + /** @var array */ private array $locatedSourcesByFile = []; /** diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php index 135d71bad2..b065a1f7ef 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocator.php @@ -2,12 +2,12 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\Type\Composer\Psr\PsrAutoloaderMapping; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\Type\Composer\Psr\PsrAutoloaderMapping; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; class OptimizedPsrAutoloaderLocator implements SourceLocator { diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocatorFactory.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocatorFactory.php index 36f31e94a7..4a466b7e2d 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocatorFactory.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedPsrAutoloaderLocatorFactory.php @@ -2,7 +2,7 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; -use Roave\BetterReflection\SourceLocator\Type\Composer\Psr\PsrAutoloaderMapping; +use PHPStan\BetterReflection\SourceLocator\Type\Composer\Psr\PsrAutoloaderMapping; interface OptimizedPsrAutoloaderLocatorFactory { diff --git a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php index 2acb26499e..25904df254 100644 --- a/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocator.php @@ -3,15 +3,15 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; use PhpParser\Node\Expr\FuncCall; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflection\ReflectionClass; -use Roave\BetterReflection\Reflection\ReflectionConstant; -use Roave\BetterReflection\Reflection\ReflectionFunction; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflection\ReflectionClass; +use PHPStan\BetterReflection\Reflection\ReflectionConstant; +use PHPStan\BetterReflection\Reflection\ReflectionFunction; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; class OptimizedSingleFileSourceLocator implements SourceLocator { diff --git a/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php index 4fe8c40bda..9d9b7ec942 100644 --- a/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php @@ -2,12 +2,12 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; class PhpVersionBlacklistSourceLocator implements SourceLocator { diff --git a/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php b/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php index 4a7df14252..2afa00d549 100644 --- a/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php +++ b/src/Reflection/BetterReflection/SourceLocator/SkipClassAliasSourceLocator.php @@ -2,11 +2,11 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; -use Roave\BetterReflection\Identifier\Identifier; -use Roave\BetterReflection\Identifier\IdentifierType; -use Roave\BetterReflection\Reflection\Reflection; -use Roave\BetterReflection\Reflector\Reflector; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; +use PHPStan\BetterReflection\Identifier\Identifier; +use PHPStan\BetterReflection\Identifier\IdentifierType; +use PHPStan\BetterReflection\Reflection\Reflection; +use PHPStan\BetterReflection\Reflector\Reflector; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; class SkipClassAliasSourceLocator implements SourceLocator { diff --git a/src/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubber.php b/src/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubber.php index 977ef3b659..c482ee70ef 100644 --- a/src/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubber.php +++ b/src/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubber.php @@ -2,10 +2,10 @@ namespace PHPStan\Reflection\BetterReflection\SourceStubber; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\SourceStubber; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\StubData; use PHPStan\File\FileReader; use PHPStan\Php8StubsMap; -use Roave\BetterReflection\SourceLocator\SourceStubber\SourceStubber; -use Roave\BetterReflection\SourceLocator\SourceStubber\StubData; class Php8StubsSourceStubber implements SourceStubber { diff --git a/src/Reflection/ClassReflection.php b/src/Reflection/ClassReflection.php index 7a7e2fad61..1d766a34c0 100644 --- a/src/Reflection/ClassReflection.php +++ b/src/Reflection/ClassReflection.php @@ -3,6 +3,7 @@ namespace PHPStan\Reflection; use Attribute; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass; use PHPStan\Php\PhpVersion; use PHPStan\PhpDoc\ResolvedPhpDocBlock; use PHPStan\PhpDoc\Tag\ExtendsTag; @@ -23,7 +24,6 @@ use PHPStan\Type\Type; use PHPStan\Type\VerbosityLevel; use ReflectionMethod; -use Roave\BetterReflection\Reflection\Adapter\ReflectionClass; class ClassReflection implements ReflectionWithFilename { diff --git a/src/Reflection/Php/PhpClassReflectionExtension.php b/src/Reflection/Php/PhpClassReflectionExtension.php index 3ea14308eb..e32cda3b78 100644 --- a/src/Reflection/Php/PhpClassReflectionExtension.php +++ b/src/Reflection/Php/PhpClassReflectionExtension.php @@ -10,6 +10,8 @@ use PHPStan\Analyser\NodeScopeResolver; use PHPStan\Analyser\ScopeContext; use PHPStan\Analyser\ScopeFactory; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionMethod; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionProperty; use PHPStan\Parser\Parser; use PHPStan\PhpDoc\PhpDocInheritanceResolver; use PHPStan\PhpDoc\ResolvedPhpDocBlock; @@ -40,8 +42,6 @@ use PHPStan\Type\Type; use PHPStan\Type\TypehintHelper; use PHPStan\Type\TypeUtils; -use Roave\BetterReflection\Reflection\Adapter\ReflectionMethod; -use Roave\BetterReflection\Reflection\Adapter\ReflectionProperty; class PhpClassReflectionExtension implements PropertiesClassReflectionExtension, MethodsClassReflectionExtension diff --git a/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php b/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php index 9fa9e27949..c54aa8e565 100644 --- a/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php +++ b/src/Reflection/ReflectionProvider/ClassBlacklistReflectionProvider.php @@ -4,12 +4,12 @@ use Nette\Utils\Strings; use PHPStan\Analyser\Scope; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\GlobalConstantReflection; use PHPStan\Reflection\ReflectionProvider; use PHPStan\Reflection\ReflectionWithFilename; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; class ClassBlacklistReflectionProvider implements ReflectionProvider { diff --git a/src/Reflection/Runtime/RuntimeReflectionProvider.php b/src/Reflection/Runtime/RuntimeReflectionProvider.php index 4f38cd2d33..f7e3eca7ef 100644 --- a/src/Reflection/Runtime/RuntimeReflectionProvider.php +++ b/src/Reflection/Runtime/RuntimeReflectionProvider.php @@ -4,6 +4,7 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; use PHPStan\DependencyInjection\Reflection\ClassReflectionExtensionRegistryProvider; use PHPStan\Php\PhpVersion; use PHPStan\PhpDoc\StubPhpDocProvider; @@ -19,7 +20,6 @@ use PHPStan\Type\Generic\TemplateTypeMap; use PHPStan\Type\Type; use ReflectionClass; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; class RuntimeReflectionProvider implements ReflectionProvider { diff --git a/src/Rules/Functions/ReturnTypeRule.php b/src/Rules/Functions/ReturnTypeRule.php index 46698d97ac..a554fcba21 100644 --- a/src/Rules/Functions/ReturnTypeRule.php +++ b/src/Rules/Functions/ReturnTypeRule.php @@ -5,12 +5,12 @@ use PhpParser\Node; use PhpParser\Node\Stmt\Return_; use PHPStan\Analyser\Scope; +use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; +use PHPStan\BetterReflection\Reflector\FunctionReflector; use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Reflection\Php\PhpFunctionFromParserNodeReflection; use PHPStan\Reflection\Php\PhpMethodFromParserNodeReflection; use PHPStan\Rules\FunctionReturnTypeCheck; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; -use Roave\BetterReflection\Reflector\FunctionReflector; /** * @implements \PHPStan\Rules\Rule<\PhpParser\Node\Stmt\Return_> diff --git a/src/Rules/Methods/MissingMethodImplementationRule.php b/src/Rules/Methods/MissingMethodImplementationRule.php index 102c797913..201ce41461 100644 --- a/src/Rules/Methods/MissingMethodImplementationRule.php +++ b/src/Rules/Methods/MissingMethodImplementationRule.php @@ -4,10 +4,10 @@ use PhpParser\Node; use PHPStan\Analyser\Scope; +use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; use PHPStan\Node\InClassNode; use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; /** * @implements Rule diff --git a/src/Testing/TestCase-staticReflection.neon b/src/Testing/TestCase-staticReflection.neon index 05124871bd..1d0c89cb3d 100644 --- a/src/Testing/TestCase-staticReflection.neon +++ b/src/Testing/TestCase-staticReflection.neon @@ -40,7 +40,7 @@ services: autowired: false testCaseSourceLocator: - class: Roave\BetterReflection\SourceLocator\Type\SourceLocator + class: PHPStan\BetterReflection\SourceLocator\Type\SourceLocator factory: @PHPStan\Testing\TestCaseSourceLocatorFactory::create() autowired: false diff --git a/src/Testing/TestCase.php b/src/Testing/TestCase.php index 50686eee43..f4246e1978 100644 --- a/src/Testing/TestCase.php +++ b/src/Testing/TestCase.php @@ -10,6 +10,16 @@ use PHPStan\Analyser\ScopeFactory; use PHPStan\Analyser\TypeSpecifier; use PHPStan\Analyser\TypeSpecifierFactory; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflector\ConstantReflector; +use PHPStan\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Locator; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber; +use PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; use PHPStan\Broker\AnonymousClassNameHelper; use PHPStan\Broker\Broker; use PHPStan\Broker\BrokerFactory; @@ -60,16 +70,6 @@ use PHPStan\Type\Generic\TemplateTypeMap; use PHPStan\Type\Php\SimpleXMLElementClassPropertyReflectionExtension; use PHPStan\Type\Type; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\Reflector\ConstantReflector; -use Roave\BetterReflection\Reflector\FunctionReflector; -use Roave\BetterReflection\SourceLocator\Ast\Locator; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; -use Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber; -use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; abstract class TestCase extends \PHPUnit\Framework\TestCase { @@ -238,7 +238,6 @@ private function createRuntimeReflectionProvider(ReflectionProvider $actualRefle '#^PhpParser\\\\#', '#^PHPStan\\\\#', '#^Hoa\\\\#', - '#^Roave\\\\BetterReflection\\\\#', ], null ); diff --git a/src/Testing/TestCaseSourceLocatorFactory.php b/src/Testing/TestCaseSourceLocatorFactory.php index fda53c3c5b..ca90ea6114 100644 --- a/src/Testing/TestCaseSourceLocatorFactory.php +++ b/src/Testing/TestCaseSourceLocatorFactory.php @@ -3,19 +3,19 @@ namespace PHPStan\Testing; use Composer\Autoload\ClassLoader; +use PHPStan\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Locator; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber; +use PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; +use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator; use PHPStan\DependencyInjection\Container; use PHPStan\Reflection\BetterReflection\SourceLocator\AutoloadSourceLocator; use PHPStan\Reflection\BetterReflection\SourceLocator\ComposerJsonAndInstalledJsonSourceLocatorMaker; use PHPStan\Reflection\BetterReflection\SourceLocator\PhpVersionBlacklistSourceLocator; -use Roave\BetterReflection\Reflector\FunctionReflector; -use Roave\BetterReflection\SourceLocator\Ast\Locator; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; -use Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber; -use Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; -use Roave\BetterReflection\SourceLocator\Type\SourceLocator; class TestCaseSourceLocatorFactory { diff --git a/tests/PHPStan/Broker/BrokerTest.php b/tests/PHPStan/Broker/BrokerTest.php index 2f14c70c42..6e32c59a4d 100644 --- a/tests/PHPStan/Broker/BrokerTest.php +++ b/tests/PHPStan/Broker/BrokerTest.php @@ -4,6 +4,7 @@ use PhpParser\Node\Name; use PHPStan\Analyser\Scope; +use PHPStan\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; use PHPStan\Cache\Cache; use PHPStan\DependencyInjection\Reflection\DirectClassReflectionExtensionRegistryProvider; use PHPStan\DependencyInjection\Type\DirectDynamicReturnTypeExtensionRegistryProvider; @@ -19,7 +20,6 @@ use PHPStan\Reflection\Runtime\RuntimeReflectionProvider; use PHPStan\Reflection\SignatureMap\NativeFunctionReflectionProvider; use PHPStan\Type\FileTypeMapper; -use Roave\BetterReflection\SourceLocator\SourceStubber\PhpStormStubsSourceStubber; class BrokerTest extends \PHPStan\Testing\TestCase { diff --git a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocatorTest.php b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocatorTest.php index c6e59041d9..6d37cd64fd 100644 --- a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocatorTest.php +++ b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/AutoloadSourceLocatorTest.php @@ -2,11 +2,11 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; +use PHPStan\BetterReflection\Reflection\ReflectionClass; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflector\ConstantReflector; +use PHPStan\BetterReflection\Reflector\FunctionReflector; use PHPStan\Testing\TestCase; -use Roave\BetterReflection\Reflection\ReflectionClass; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\Reflector\ConstantReflector; -use Roave\BetterReflection\Reflector\FunctionReflector; use TestSingleFileSourceLocator\AFoo; use TestSingleFileSourceLocator\InCondition; diff --git a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php index 3bfd453866..cce937f43d 100644 --- a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php +++ b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedDirectorySourceLocatorTest.php @@ -2,10 +2,10 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; +use PHPStan\BetterReflection\Reflector\FunctionReflector; use PHPStan\Testing\TestCase; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; -use Roave\BetterReflection\Reflector\FunctionReflector; use TestDirectorySourceLocator\AFoo; class OptimizedDirectorySourceLocatorTest extends TestCase diff --git a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php index f6418dcd5e..38185ccfc8 100644 --- a/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php +++ b/tests/PHPStan/Reflection/BetterReflection/SourceLocator/OptimizedSingleFileSourceLocatorTest.php @@ -2,11 +2,11 @@ namespace PHPStan\Reflection\BetterReflection\SourceLocator; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflector\ConstantReflector; +use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound; +use PHPStan\BetterReflection\Reflector\FunctionReflector; use PHPStan\Testing\TestCase; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\Reflector\ConstantReflector; -use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; -use Roave\BetterReflection\Reflector\FunctionReflector; use TestSingleFileSourceLocator\AFoo; class OptimizedSingleFileSourceLocatorTest extends TestCase diff --git a/tests/PHPStan/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubberTest.php b/tests/PHPStan/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubberTest.php index b6027ad09f..8cc9f4fb49 100644 --- a/tests/PHPStan/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubberTest.php +++ b/tests/PHPStan/Reflection/BetterReflection/SourceStubber/Php8StubsSourceStubberTest.php @@ -4,11 +4,11 @@ use PhpParser\Lexer\Emulative; use PhpParser\ParserFactory; +use PHPStan\BetterReflection\Reflector\ClassReflector; +use PHPStan\BetterReflection\Reflector\FunctionReflector; +use PHPStan\BetterReflection\SourceLocator\Ast\Locator; +use PHPStan\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; use PHPUnit\Framework\TestCase; -use Roave\BetterReflection\Reflector\ClassReflector; -use Roave\BetterReflection\Reflector\FunctionReflector; -use Roave\BetterReflection\SourceLocator\Ast\Locator; -use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; class Php8StubsSourceStubberTest extends TestCase {