From 14cac496243daf53e7642b5dd151e54d65e3802d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Aug 2022 16:21:16 +0000 Subject: [PATCH 1/3] Bump symfony/console from 6.0.11 to 6.0.12 Bumps [symfony/console](https://github.com/symfony/console) from 6.0.11 to 6.0.12. - [Release notes](https://github.com/symfony/console/releases) - [Changelog](https://github.com/symfony/console/blob/6.1/CHANGELOG.md) - [Commits](https://github.com/symfony/console/compare/v6.0.11...v6.0.12) --- updated-dependencies: - dependency-name: symfony/console dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index a7ddc0ddd..a9a4b3ae9 100644 --- a/composer.lock +++ b/composer.lock @@ -3827,16 +3827,16 @@ }, { "name": "symfony/console", - "version": "v6.0.11", + "version": "v6.0.12", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "09b8e50f09bf0e5bbde9b61b19d7f53751114725" + "reference": "c5c2e313aa682530167c25077d6bdff36346251e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/09b8e50f09bf0e5bbde9b61b19d7f53751114725", - "reference": "09b8e50f09bf0e5bbde9b61b19d7f53751114725", + "url": "https://api.github.com/repos/symfony/console/zipball/c5c2e313aa682530167c25077d6bdff36346251e", + "reference": "c5c2e313aa682530167c25077d6bdff36346251e", "shasum": "" }, "require": { @@ -3902,7 +3902,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.0.11" + "source": "https://github.com/symfony/console/tree/v6.0.12" }, "funding": [ { @@ -3918,7 +3918,7 @@ "type": "tidelift" } ], - "time": "2022-07-22T14:17:38+00:00" + "time": "2022-08-23T20:52:30+00:00" }, { "name": "symfony/filesystem", @@ -4602,16 +4602,16 @@ }, { "name": "symfony/string", - "version": "v6.0.11", + "version": "v6.0.12", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "042b6bf0f6ccca6d456a0572eb788cfb8b1ff809" + "reference": "3a975ba1a1508ad97df45f4590f55b7cc4c1a0a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/042b6bf0f6ccca6d456a0572eb788cfb8b1ff809", - "reference": "042b6bf0f6ccca6d456a0572eb788cfb8b1ff809", + "url": "https://api.github.com/repos/symfony/string/zipball/3a975ba1a1508ad97df45f4590f55b7cc4c1a0a0", + "reference": "3a975ba1a1508ad97df45f4590f55b7cc4c1a0a0", "shasum": "" }, "require": { @@ -4667,7 +4667,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.11" + "source": "https://github.com/symfony/string/tree/v6.0.12" }, "funding": [ { @@ -4683,7 +4683,7 @@ "type": "tidelift" } ], - "time": "2022-07-27T15:50:26+00:00" + "time": "2022-08-12T18:05:20+00:00" }, { "name": "thecodingmachine/safe", From c0284d42bc39f9285c23d4c5cc0bf105b420f2d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Aug 2022 16:35:23 +0000 Subject: [PATCH 2/3] Bump symfony/filesystem from 6.0.11 to 6.0.12 Bumps [symfony/filesystem](https://github.com/symfony/filesystem) from 6.0.11 to 6.0.12. - [Release notes](https://github.com/symfony/filesystem/releases) - [Changelog](https://github.com/symfony/filesystem/blob/6.1/CHANGELOG.md) - [Commits](https://github.com/symfony/filesystem/compare/v6.0.11...v6.0.12) --- updated-dependencies: - dependency-name: symfony/filesystem dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index a9a4b3ae9..b8f50a347 100644 --- a/composer.lock +++ b/composer.lock @@ -3922,16 +3922,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.0.11", + "version": "v6.0.12", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "33787a6b6e055245d5710697dfc4a9a2b896c032" + "reference": "a36b782dc19dce3ab7e47d4b92b13cefb3511da3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/33787a6b6e055245d5710697dfc4a9a2b896c032", - "reference": "33787a6b6e055245d5710697dfc4a9a2b896c032", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/a36b782dc19dce3ab7e47d4b92b13cefb3511da3", + "reference": "a36b782dc19dce3ab7e47d4b92b13cefb3511da3", "shasum": "" }, "require": { @@ -3965,7 +3965,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.0.11" + "source": "https://github.com/symfony/filesystem/tree/v6.0.12" }, "funding": [ { @@ -3981,7 +3981,7 @@ "type": "tidelift" } ], - "time": "2022-07-20T14:06:08+00:00" + "time": "2022-08-02T16:01:06+00:00" }, { "name": "symfony/finder", From f9dca39d3a75b7de860709acdba9be54c986fdfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Hansl=C3=ADk?= Date: Fri, 26 Aug 2022 19:34:48 +0200 Subject: [PATCH 3/3] Bump doctrine/coding-standard from 9.0.0 to 10.0.0 --- composer.json | 2 +- composer.lock | 58 ++--- phpcs.xml.dist | 17 -- src/BetterReflection.php | 12 +- src/Identifier/Identifier.php | 4 +- src/NodeCompiler/CompileNodeToValue.php | 8 +- src/NodeCompiler/CompiledValue.php | 6 +- src/NodeCompiler/CompilerContext.php | 8 +- .../Exception/UnableToCompileNode.php | 8 +- .../Adapter/ReflectionAttribute.php | 4 +- src/Reflection/Adapter/ReflectionClass.php | 66 ++--- .../Adapter/ReflectionClassConstant.php | 2 +- src/Reflection/Adapter/ReflectionEnum.php | 68 ++---- .../Adapter/ReflectionEnumBackedCase.php | 2 +- .../Adapter/ReflectionEnumUnitCase.php | 2 +- src/Reflection/Adapter/ReflectionFunction.php | 32 +-- .../Adapter/ReflectionIntersectionType.php | 4 +- src/Reflection/Adapter/ReflectionMethod.php | 42 ++-- .../Adapter/ReflectionNamedType.php | 4 +- src/Reflection/Adapter/ReflectionObject.php | 58 ++--- .../Adapter/ReflectionParameter.php | 10 +- src/Reflection/Adapter/ReflectionProperty.php | 14 +- .../Adapter/ReflectionUnionType.php | 4 +- .../Annotation/AnnotationHelper.php | 12 +- .../Attribute/ReflectionAttributeHelper.php | 8 +- src/Reflection/ReflectionAttribute.php | 4 +- src/Reflection/ReflectionClass.php | 89 +++---- src/Reflection/ReflectionClassConstant.php | 10 +- src/Reflection/ReflectionConstant.php | 31 +-- src/Reflection/ReflectionEnum.php | 16 +- src/Reflection/ReflectionEnumCase.php | 18 +- src/Reflection/ReflectionFunction.php | 24 +- src/Reflection/ReflectionFunctionAbstract.php | 23 +- src/Reflection/ReflectionIntersectionType.php | 4 +- src/Reflection/ReflectionMethod.php | 36 ++- src/Reflection/ReflectionObject.php | 30 +-- src/Reflection/ReflectionParameter.php | 30 +-- src/Reflection/ReflectionProperty.php | 14 +- src/Reflection/ReflectionType.php | 8 +- src/Reflection/ReflectionUnionType.php | 4 +- .../ReflectionAttributeStringCast.php | 8 +- .../ReflectionClassConstantStringCast.php | 4 +- .../StringCast/ReflectionClassStringCast.php | 36 +-- .../ReflectionEnumCaseStringCast.php | 4 +- .../ReflectionFunctionStringCast.php | 4 +- .../StringCast/ReflectionMethodStringCast.php | 4 +- .../ReflectionParameterStringCast.php | 4 +- .../ReflectionPropertyStringCast.php | 4 +- .../StringCast/ReflectionTypeStringCast.php | 4 +- .../Ast/FindReflectionsInTree.php | 10 +- src/SourceLocator/Ast/Locator.php | 6 +- .../Ast/Parser/MemoizingParser.php | 9 +- .../Ast/Strategy/AstConversionStrategy.php | 8 +- .../Ast/Strategy/NodeToReflection.php | 8 +- src/SourceLocator/FileChecker.php | 4 +- .../Located/AliasLocatedSource.php | 8 +- .../Located/AnonymousLocatedSource.php | 4 +- .../Located/EvaledLocatedSource.php | 4 +- .../Located/InternalLocatedSource.php | 6 +- src/SourceLocator/Located/LocatedSource.php | 12 +- .../SourceStubber/AggregateSourceStubber.php | 12 +- .../PhpStormStubs/CachingVisitor.php | 20 +- .../PhpStormStubsSourceStubber.php | 30 +-- .../SourceStubber/ReflectionSourceStubber.php | 18 +- .../SourceStubber/SourceStubber.php | 10 +- src/SourceLocator/SourceStubber/StubData.php | 8 +- .../Type/AbstractSourceLocator.php | 4 +- .../Type/AggregateSourceLocator.php | 6 +- .../AnonymousClassObjectSourceLocator.php | 12 +- .../Type/AutoloadSourceLocator.php | 24 +- .../FileReadTrapStreamWrapper.php | 4 +- .../Type/ClosureSourceLocator.php | 10 +- ...LocatorForComposerJsonAndInstalledJson.php | 12 +- .../Factory/MakeLocatorForInstalledJson.php | 12 +- .../Type/Composer/PsrAutoloaderLocator.php | 2 +- .../Type/ComposerSourceLocator.php | 2 +- .../Type/DirectoriesSourceLocator.php | 2 +- .../Type/EvaledCodeSourceLocator.php | 4 +- .../Type/FileIteratorSourceLocator.php | 10 +- .../Type/MemoizingSourceLocator.php | 6 +- .../Type/PhpInternalSourceLocator.php | 10 +- .../Type/SingleFileSourceLocator.php | 6 +- src/SourceLocator/Type/SourceLocator.php | 2 +- .../Type/StringSourceLocator.php | 6 +- src/Util/Autoload/ClassLoader.php | 4 +- .../Exception/SignatureCheckFailed.php | 4 +- .../LoaderMethodInterface.php | 4 +- .../ClassPrinter/ClassPrinterInterface.php | 4 +- .../Autoload/Exception/ClassAlreadyLoaded.php | 4 +- .../Exception/ClassAlreadyRegistered.php | 4 +- .../Autoload/Exception/FailedToLoadClass.php | 4 +- src/Util/CalculateReflectionColumn.php | 8 +- src/Util/ClassExistenceChecker.php | 8 +- src/Util/ConstantNodeChecker.php | 8 +- src/Util/GetLastDocComment.php | 4 +- src/Util/Visitor/ReturnNodeVisitor.php | 6 +- test/benchmark/PhpUnitTestCaseBench.php | 4 +- test/unit/BetterReflectionSingleton.php | 2 +- test/unit/BetterReflectionTest.php | 4 +- .../Exception/InvalidIdentifierNameTest.php | 4 +- test/unit/Identifier/IdentifierTest.php | 20 +- test/unit/Identifier/IdentifierTypeTest.php | 12 +- .../NodeCompiler/CompileNodeToValueTest.php | 88 ++----- test/unit/NodeCompiler/CompiledValueTest.php | 4 +- .../unit/NodeCompiler/CompilerContextTest.php | 4 +- .../Exception/UnableToCompileNodeTest.php | 4 +- .../Adapter/ReflectionAttributeTest.php | 18 +- .../Adapter/ReflectionClassConstantTest.php | 38 +-- .../Adapter/ReflectionClassTest.php | 20 +- .../Adapter/ReflectionEnumBackedCaseTest.php | 18 +- .../Reflection/Adapter/ReflectionEnumTest.php | 20 +- .../Adapter/ReflectionEnumUnitCaseTest.php | 18 +- .../Adapter/ReflectionFunctionTest.php | 20 +- .../ReflectionIntersectionTypeTest.php | 18 +- .../Adapter/ReflectionMethodTest.php | 20 +- .../Adapter/ReflectionNamedTypeTest.php | 34 +-- .../Adapter/ReflectionObjectTest.php | 20 +- .../Adapter/ReflectionParameterTest.php | 20 +- .../Adapter/ReflectionPropertyTest.php | 20 +- .../Reflection/Adapter/ReflectionTypeTest.php | 20 +- .../Adapter/ReflectionUnionTypeTest.php | 18 +- .../Annotation/AnnotationHelperTest.php | 20 +- .../ReflectionAttributeHelperTest.php | 4 +- .../Exception/ClassDoesNotExistTest.php | 4 +- .../Exception/FunctionDoesNotExistTest.php | 4 +- .../InvalidArrowFunctionBodyNodeTest.php | 4 +- .../Exception/InvalidConstantNodeTest.php | 4 +- .../Exception/NoObjectProvidedTest.php | 4 +- .../Exception/NotAClassReflectionTest.php | 4 +- .../NotAnInterfaceReflectionTest.php | 4 +- .../Reflection/Exception/NotAnObjectTest.php | 4 +- .../ObjectNotInstanceOfClassTest.php | 4 +- .../Exception/PropertyDoesNotExistTest.php | 4 +- .../Exception/PropertyIsNotStaticTest.php | 4 +- .../Reflection/Exception/UncloneableTest.php | 4 +- .../Reflection/ReflectionAttributeTest.php | 4 +- .../ReflectionClassConstantTest.php | 42 +--- test/unit/Reflection/ReflectionClassTest.php | 80 ++---- .../Reflection/ReflectionConstantTest.php | 28 +-- .../Reflection/ReflectionEnumCaseTest.php | 52 +--- test/unit/Reflection/ReflectionEnumTest.php | 44 +--- .../ReflectionFunctionAbstractTest.php | 80 ++---- .../Reflection/ReflectionFunctionTest.php | 4 +- .../ReflectionIntersectionTypeTest.php | 12 +- test/unit/Reflection/ReflectionMethodTest.php | 30 +-- .../Reflection/ReflectionNamedTypeTest.php | 36 +-- test/unit/Reflection/ReflectionObjectTest.php | 16 +- .../Reflection/ReflectionParameterTest.php | 62 ++--- .../Reflection/ReflectionPropertyTest.php | 98 ++------ test/unit/Reflection/ReflectionTypeTest.php | 8 +- .../Reflection/ReflectionUnionTypeTest.php | 12 +- .../ReflectionAttributeStringCastTest.php | 12 +- .../ReflectionClassConstantStringCastTest.php | 12 +- .../ReflectionClassStringCastTest.php | 12 +- .../ReflectionConstantStringCastTest.php | 12 +- .../ReflectionEnumCaseStringCastTest.php | 4 +- .../ReflectionFunctionStringCastTest.php | 12 +- .../ReflectionMethodStringCastTest.php | 12 +- .../ReflectionParameterStringCastTest.php | 12 +- .../ReflectionPropertyStringCastTest.php | 12 +- .../ReflectionTypeStringCastTest.php | 12 +- test/unit/Reflector/DefaultReflectorTest.php | 4 +- .../Exception/IdentifierNotFoundTest.php | 4 +- .../Ast/Exception/ParseToAstFailureTest.php | 4 +- .../Ast/FindReflectionsInTreeTest.php | 20 +- test/unit/SourceLocator/Ast/LocatorTest.php | 4 +- .../Ast/Parser/MemoizingParserTest.php | 4 +- .../Ast/Strategy/NodeToReflectionTest.php | 4 +- ...valedAnonymousClassCannotBeLocatedTest.php | 4 +- .../EvaledClosureCannotBeLocatedTest.php | 4 +- .../Exception/InvalidDirectoryTest.php | 8 +- .../Exception/InvalidFileInfoTest.php | 12 +- .../Exception/NoAnonymousClassOnLineTest.php | 4 +- .../Exception/NoClosureOnLineTest.php | 4 +- .../TwoAnonymousClassesOnSameLineTest.php | 4 +- .../Exception/TwoClosuresOnSameLineTest.php | 4 +- test/unit/SourceLocator/FileCheckerTest.php | 4 +- .../Located/AliasLocatedSourceTest.php | 4 +- .../Located/AnonymousLocatedSourceTest.php | 4 +- .../Located/EvaledLocatedSourceTest.php | 4 +- .../Located/InternalLocatedSourceTest.php | 4 +- .../Located/LocatedSourceTest.php | 4 +- .../AggregateSourceStubberTest.php | 4 +- .../CouldNotFindPhpStormStubsTest.php | 4 +- .../PhpStormStubsSourceStubberTest.php | 228 +++++------------- .../ReflectionSourceStubberTest.php | 52 +--- .../SourceStubber/StubDataTest.php | 4 +- .../Type/AbstractSourceLocatorTest.php | 4 +- .../Type/AggregateSourceLocatorTest.php | 4 +- .../AnonymousClassObjectSourceLocatorTest.php | 28 +-- .../Type/AutoloadSourceLocatorTest.php | 30 +-- .../Type/ClosureSourceLocatorTest.php | 24 +- .../Exception/FailedToParseJsonTest.php | 4 +- .../Exception/InvalidProjectDirectoryTest.php | 4 +- .../Exception/MissingComposerJsonTest.php | 4 +- .../Exception/MissingInstalledJsonTest.php | 4 +- ...akeLocatorForComposerInstalledJsonTest.php | 8 +- ...torForComposerJsonAndInstalledJsonTest.php | 8 +- .../MakeLocatorForComposerJsonTest.php | 8 +- .../Psr/Excetion/InvalidPrefixMappingTest.php | 4 +- .../Type/Composer/Psr/Psr0MappingTest.php | 4 +- .../Type/Composer/Psr/Psr4MappingTest.php | 4 +- .../Composer/PsrAutoloaderLocatorTest.php | 4 +- .../Type/ComposerSourceLocatorTest.php | 4 +- .../Type/DirectoriesSourceLocatorTest.php | 8 +- .../Type/EvaledCodeSourceLocatorTest.php | 8 +- .../Type/FileIteratorSourceLocatorTest.php | 4 +- .../Type/MemoizingSourceLocatorTest.php | 10 +- .../Type/PhpInternalSourceLocatorTest.php | 28 +-- .../Type/SingleFileSourceLocatorTest.php | 4 +- .../Type/StringSourceLocatorTest.php | 4 +- test/unit/TestListener.php | 2 +- .../ClassLoaderMethod/EvalLoaderTest.php | 4 +- .../Exception/SignatureCheckFailedTest.php | 4 +- .../ClassLoaderMethod/FileCacheLoaderTest.php | 4 +- test/unit/Util/Autoload/ClassLoaderTest.php | 6 +- .../ClassPrinter/PhpParserPrinterTest.php | 4 +- .../Exception/ClassAlreadyLoadedTest.php | 4 +- .../Exception/ClassAlreadyRegisteredTest.php | 4 +- .../Exception/FailedToLoadClassTest.php | 4 +- .../Util/CalculateReflectionColumnTest.php | 4 +- test/unit/Util/ClassExistenceCheckerTest.php | 38 +-- test/unit/Util/ConstantNodeCheckerTest.php | 12 +- .../Exception/InvalidNodePositionTest.php | 4 +- .../Util/Exception/NoNodePositionTest.php | 4 +- test/unit/Util/FileHelperTest.php | 4 +- test/unit/Util/FindReflectionOnLineTest.php | 4 +- test/unit/Util/GetLastDocCommentTest.php | 4 +- .../Util/Visitor/ReturnNodeVisitorTest.php | 8 +- 229 files changed, 948 insertions(+), 2291 deletions(-) diff --git a/composer.json b/composer.json index 2e4fe78f7..9fcad252b 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ ], "require-dev": { - "doctrine/coding-standard": "^9.0.0", + "doctrine/coding-standard": "^10.0.0", "phpstan/phpstan": "^1.8.2", "phpstan/phpstan-phpunit": "^1.1.1", "phpunit/phpunit": "^9.5.23", diff --git a/composer.lock b/composer.lock index a7ddc0ddd..6f1b2867b 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": "fc858dcc27aeb609b42f2e9f7ca95248", + "content-hash": "fed91762a9cedc06cfd307840acec84d", "packages": [ { "name": "jetbrains/phpstorm-stubs", @@ -723,23 +723,23 @@ }, { "name": "doctrine/coding-standard", - "version": "9.0.0", + "version": "10.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/coding-standard.git", - "reference": "35a2452c6025cb739c3244b3348bcd1604df07d1" + "reference": "7903671d7d33c231c8921058b7c14b8f57cbacb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/35a2452c6025cb739c3244b3348bcd1604df07d1", - "reference": "35a2452c6025cb739c3244b3348bcd1604df07d1", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/7903671d7d33c231c8921058b7c14b8f57cbacb7", + "reference": "7903671d7d33c231c8921058b7c14b8f57cbacb7", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", - "php": "^7.1 || ^8.0", - "slevomat/coding-standard": "^7.0.0", - "squizlabs/php_codesniffer": "^3.6.0" + "php": "^7.2 || ^8.0", + "slevomat/coding-standard": "^8.2", + "squizlabs/php_codesniffer": "^3.7" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -772,9 +772,9 @@ ], "support": { "issues": "https://github.com/doctrine/coding-standard/issues", - "source": "https://github.com/doctrine/coding-standard/tree/9.0.0" + "source": "https://github.com/doctrine/coding-standard/tree/10.0.0" }, - "time": "2021-04-12T15:11:14+00:00" + "time": "2022-08-26T10:53:05+00:00" }, { "name": "doctrine/instantiator", @@ -1833,16 +1833,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.6.4", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "135607f9ccc297d6923d49c2bcf309f509413215" + "reference": "367a8d9d5f7da2a0136422d27ce8840583926955" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/135607f9ccc297d6923d49c2bcf309f509413215", - "reference": "135607f9ccc297d6923d49c2bcf309f509413215", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/367a8d9d5f7da2a0136422d27ce8840583926955", + "reference": "367a8d9d5f7da2a0136422d27ce8840583926955", "shasum": "" }, "require": { @@ -1872,9 +1872,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.6.4" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.7.0" }, - "time": "2022-06-26T13:09:08+00:00" + "time": "2022-08-09T12:23:23+00:00" }, { "name": "phpstan/phpstan", @@ -3710,37 +3710,37 @@ }, { "name": "slevomat/coding-standard", - "version": "7.2.1", + "version": "8.4.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90" + "reference": "02f27326be19633a1b6ba76745390bbf9a4be0b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/aff06ae7a84e4534bf6f821dc982a93a5d477c90", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/02f27326be19633a1b6ba76745390bbf9a4be0b6", + "reference": "02f27326be19633a1b6ba76745390bbf9a4be0b6", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.5.1", - "squizlabs/php_codesniffer": "^3.6.2" + "phpstan/phpdoc-parser": ">=1.7.0 <1.8.0", + "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { - "phing/phing": "2.17.3", + "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.4.10|1.7.1", + "phpstan/phpstan": "1.4.10|1.8.2", "phpstan/phpstan-deprecation-rules": "1.0.0", "phpstan/phpstan-phpunit": "1.0.0|1.1.1", - "phpstan/phpstan-strict-rules": "1.2.3", - "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + "phpstan/phpstan-strict-rules": "1.3.0", + "phpunit/phpunit": "7.5.20|8.5.21|9.5.21" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { @@ -3755,7 +3755,7 @@ "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/7.2.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.4.0" }, "funding": [ { @@ -3767,7 +3767,7 @@ "type": "tidelift" } ], - "time": "2022-05-25T10:58:12+00:00" + "time": "2022-08-09T19:03:45+00:00" }, { "name": "squizlabs/php_codesniffer", diff --git a/phpcs.xml.dist b/phpcs.xml.dist index d6b4c606d..77177d729 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -19,8 +19,6 @@ - - @@ -31,25 +29,10 @@ - - - src/Reflection/Adapter/* - - src/Reflection/Adapter/* - - - test/unit/ - - - - - - - diff --git a/src/BetterReflection.php b/src/BetterReflection.php index 1b8b22d9f..7eca68c22 100644 --- a/src/BetterReflection.php +++ b/src/BetterReflection.php @@ -25,17 +25,17 @@ final class BetterReflection { - private ?SourceLocator $sourceLocator = null; + private SourceLocator|null $sourceLocator = null; - private ?Reflector $reflector = null; + private Reflector|null $reflector = null; - private ?Parser $phpParser = null; + private Parser|null $phpParser = null; - private ?AstLocator $astLocator = null; + private AstLocator|null $astLocator = null; - private ?FindReflectionOnLine $findReflectionOnLine = null; + private FindReflectionOnLine|null $findReflectionOnLine = null; - private ?SourceStubber $sourceStubber = null; + private SourceStubber|null $sourceStubber = null; public function sourceLocator(): SourceLocator { diff --git a/src/Identifier/Identifier.php b/src/Identifier/Identifier.php index 258dbe037..ce12d219f 100644 --- a/src/Identifier/Identifier.php +++ b/src/Identifier/Identifier.php @@ -20,9 +20,7 @@ class Identifier private string $name; - /** - * @throws InvalidIdentifierName - */ + /** @throws InvalidIdentifierName */ public function __construct(string $name, private IdentifierType $type) { if ( diff --git a/src/NodeCompiler/CompileNodeToValue.php b/src/NodeCompiler/CompileNodeToValue.php index f14b2dc12..b5fa0070c 100644 --- a/src/NodeCompiler/CompileNodeToValue.php +++ b/src/NodeCompiler/CompileNodeToValue.php @@ -19,9 +19,7 @@ use function in_array; use function sprintf; -/** - * @internal - */ +/** @internal */ class CompileNodeToValue { private const TRUE_FALSE_NULL = ['true', 'false', 'null']; @@ -167,7 +165,7 @@ private function constantExists(string $constantName, CompilerContext $context): } } - private function getConstantValue(Node\Expr\ConstFetch $node, ?string $constantName, CompilerContext $context): mixed + private function getConstantValue(Node\Expr\ConstFetch $node, string|null $constantName, CompilerContext $context): mixed { // It's not resolved when constant value is expression $constantName ??= $this->resolveConstantName($node, $context); @@ -189,7 +187,7 @@ private function resolveClassConstantName(Node\Expr\ClassConstFetch $node, Compi return sprintf('%s::%s', $this->resolveClassName($className, $context), $constantName); } - private function getClassConstantValue(Node\Expr\ClassConstFetch $node, ?string $classConstantName, CompilerContext $context): mixed + private function getClassConstantValue(Node\Expr\ClassConstFetch $node, string|null $classConstantName, CompilerContext $context): mixed { // It's not resolved when constant value is expression $classConstantName ??= $this->resolveClassConstantName($node, $context); diff --git a/src/NodeCompiler/CompiledValue.php b/src/NodeCompiler/CompiledValue.php index c691d596f..3a4354e20 100644 --- a/src/NodeCompiler/CompiledValue.php +++ b/src/NodeCompiler/CompiledValue.php @@ -4,12 +4,10 @@ namespace Roave\BetterReflection\NodeCompiler; -/** - * @internal - */ +/** @internal */ class CompiledValue { - public function __construct(public mixed $value, public ?string $constantName = null) + public function __construct(public mixed $value, public string|null $constantName = null) { } } diff --git a/src/NodeCompiler/CompilerContext.php b/src/NodeCompiler/CompilerContext.php index 487a26932..7464e8fd6 100644 --- a/src/NodeCompiler/CompilerContext.php +++ b/src/NodeCompiler/CompilerContext.php @@ -14,9 +14,7 @@ use Roave\BetterReflection\Reflection\ReflectionProperty; use Roave\BetterReflection\Reflector\Reflector; -/** - * @internal - */ +/** @internal */ class CompilerContext { public function __construct( @@ -30,7 +28,7 @@ public function getReflector(): Reflector return $this->reflector; } - public function getFileName(): ?string + public function getFileName(): string|null { if ($this->contextReflection instanceof ReflectionConstant) { return $this->contextReflection->getFileName(); @@ -48,7 +46,7 @@ public function getNamespace(): string return $this->getClass()?->getNamespaceName() ?? $this->getFunction()?->getNamespaceName() ?? ''; } - public function getClass(): ?ReflectionClass + public function getClass(): ReflectionClass|null { if ($this->contextReflection instanceof ReflectionClass) { return $this->contextReflection; diff --git a/src/NodeCompiler/Exception/UnableToCompileNode.php b/src/NodeCompiler/Exception/UnableToCompileNode.php index 1a7d1c43e..2ba4680b7 100644 --- a/src/NodeCompiler/Exception/UnableToCompileNode.php +++ b/src/NodeCompiler/Exception/UnableToCompileNode.php @@ -13,14 +13,12 @@ use function assert; use function sprintf; -/** - * @internal - */ +/** @internal */ class UnableToCompileNode extends LogicException { - private ?string $constantName = null; + private string|null $constantName = null; - public function constantName(): ?string + public function constantName(): string|null { return $this->constantName; } diff --git a/src/Reflection/Adapter/ReflectionAttribute.php b/src/Reflection/Adapter/ReflectionAttribute.php index 370605eef..02e0b155c 100644 --- a/src/Reflection/Adapter/ReflectionAttribute.php +++ b/src/Reflection/Adapter/ReflectionAttribute.php @@ -28,9 +28,7 @@ public function isRepeated(): bool return $this->betterReflectionAttribute->isRepeated(); } - /** - * @return array - */ + /** @return array */ public function getArguments(): array { return $this->betterReflectionAttribute->getArguments(); diff --git a/src/Reflection/Adapter/ReflectionClass.php b/src/Reflection/Adapter/ReflectionClass.php index 46f3f7d84..67c70025c 100644 --- a/src/Reflection/Adapter/ReflectionClass.php +++ b/src/Reflection/Adapter/ReflectionClass.php @@ -28,9 +28,7 @@ use function sprintf; use function strtolower; -/** - * @psalm-suppress PropertyNotSetInConstructor - */ +/** @psalm-suppress PropertyNotSetInConstructor */ final class ReflectionClass extends CoreReflectionClass { public function __construct(private BetterReflectionClass|BetterReflectionEnum $betterReflectionClass) @@ -104,7 +102,7 @@ public function getDocComment(): string|false return $this->betterReflectionClass->getDocComment() ?: false; } - public function getConstructor(): ?CoreReflectionMethod + public function getConstructor(): CoreReflectionMethod|null { try { return new ReflectionMethod($this->betterReflectionClass->getConstructor()); @@ -128,7 +126,7 @@ public function getMethod(string $name): ReflectionMethod * * @psalm-suppress MethodSignatureMismatch */ - public function getMethods(?int $filter = null): array + public function getMethods(int|null $filter = null): array { return array_map(static fn (BetterReflectionMethod $method): ReflectionMethod => new ReflectionMethod($method), $this->betterReflectionClass->getMethods($filter)); } @@ -154,7 +152,7 @@ public function getProperty(string $name): ReflectionProperty * * @psalm-suppress MethodSignatureMismatch */ - public function getProperties(?int $filter = null): array + public function getProperties(int|null $filter = null): array { return array_values(array_map(static fn (BetterReflectionProperty $property): ReflectionProperty => new ReflectionProperty($property), $this->betterReflectionClass->getProperties($filter))); } @@ -168,10 +166,8 @@ public function hasConstant(string $name): bool return $this->betterReflectionClass->hasConstant($name); } - /** - * @return array - */ - public function getConstants(?int $filter = null): array + /** @return array */ + public function getConstants(int|null $filter = null): array { return array_map( fn (BetterReflectionClassConstant|BetterReflectionEnumCase $betterConstantOrEnumCase): mixed => $this->getConstantValue($betterConstantOrEnumCase), @@ -217,10 +213,8 @@ public function getReflectionConstant(string $name): ReflectionClassConstant|fal return new ReflectionClassConstant($betterReflectionConstant); } - /** - * @return list - */ - public function getReflectionConstants(?int $filter = null): array + /** @return list */ + public function getReflectionConstants(int|null $filter = null): array { return array_values(array_map( static fn (BetterReflectionClassConstant|BetterReflectionEnumCase $betterConstantOrEnum): ReflectionClassConstant => new ReflectionClassConstant($betterConstantOrEnum), @@ -228,10 +222,8 @@ public function getReflectionConstants(?int $filter = null): array )); } - /** - * @return array - */ - private function filterBetterReflectionClassConstants(?int $filter): array + /** @return array */ + private function filterBetterReflectionClassConstants(int|null $filter): array { $reflectionConstants = $this->betterReflectionClass->getReflectionConstants(); @@ -255,9 +247,7 @@ private function filterBetterReflectionClassConstants(?int $filter): array return $reflectionConstants; } - /** - * @return array - */ + /** @return array */ public function getInterfaces(): array { return array_map( @@ -266,9 +256,7 @@ public function getInterfaces(): array ); } - /** - * @return list - */ + /** @return list */ public function getInterfaceNames(): array { return $this->betterReflectionClass->getInterfaceNames(); @@ -279,9 +267,7 @@ public function isInterface(): bool return $this->betterReflectionClass->isInterface(); } - /** - * @return array - */ + /** @return array */ public function getTraits(): array { $traits = $this->betterReflectionClass->getTraits(); @@ -295,17 +281,13 @@ public function getTraits(): array ); } - /** - * @return list - */ + /** @return list */ public function getTraitNames(): array { return $this->betterReflectionClass->getTraitNames(); } - /** - * @return array - */ + /** @return array */ public function getTraitAliases(): array { return $this->betterReflectionClass->getTraitAliases(); @@ -346,7 +328,7 @@ public function newInstanceWithoutConstructor(): object throw new Exception\NotImplemented('Not implemented'); } - public function newInstanceArgs(?array $args = null): object + public function newInstanceArgs(array|null $args = null): object { throw new Exception\NotImplemented('Not implemented'); } @@ -362,9 +344,7 @@ public function getParentClass(): ReflectionClass|false return new self($parentClass); } - /** - * @psalm-suppress MethodSignatureMismatch - */ + /** @psalm-suppress MethodSignatureMismatch */ public function isSubclassOf(CoreReflectionClass|string $class): bool { $realParentClassNames = $this->betterReflectionClass->getParentClassNames(); @@ -427,9 +407,7 @@ public function setStaticPropertyValue(string $name, mixed $value): void $property->setValue($value); } - /** - * @return array|null> - */ + /** @return array|null> */ public function getDefaultProperties(): array { return $this->betterReflectionClass->getDefaultProperties(); @@ -445,9 +423,7 @@ public function isIterable(): bool return $this->isIterateable(); } - /** - * @psalm-suppress MethodSignatureMismatch - */ + /** @psalm-suppress MethodSignatureMismatch */ public function implementsInterface(CoreReflectionClass|string $interface): bool { $realInterfaceNames = $this->betterReflectionClass->getInterfaceNames(); @@ -462,7 +438,7 @@ public function implementsInterface(CoreReflectionClass|string $interface): bool return $this->betterReflectionClass->implementsInterface($realInterfaceName); } - public function getExtension(): ?CoreReflectionExtension + public function getExtension(): CoreReflectionExtension|null { throw new Exception\NotImplemented('Not implemented'); } @@ -492,7 +468,7 @@ public function getShortName(): string * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionClassConstant.php b/src/Reflection/Adapter/ReflectionClassConstant.php index f3dede067..cea258a73 100644 --- a/src/Reflection/Adapter/ReflectionClassConstant.php +++ b/src/Reflection/Adapter/ReflectionClassConstant.php @@ -123,7 +123,7 @@ public function __toString(): string * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionEnum.php b/src/Reflection/Adapter/ReflectionEnum.php index 483385771..b345ca579 100644 --- a/src/Reflection/Adapter/ReflectionEnum.php +++ b/src/Reflection/Adapter/ReflectionEnum.php @@ -28,9 +28,7 @@ use function sprintf; use function strtolower; -/** - * @psalm-suppress PropertyNotSetInConstructor - */ +/** @psalm-suppress PropertyNotSetInConstructor */ final class ReflectionEnum extends CoreReflectionEnum { public function __construct(private BetterReflectionEnum $betterReflectionEnum) @@ -104,7 +102,7 @@ public function getDocComment(): string|false return $this->betterReflectionEnum->getDocComment() ?: false; } - public function getConstructor(): ?CoreReflectionMethod + public function getConstructor(): CoreReflectionMethod|null { try { return new ReflectionMethod($this->betterReflectionEnum->getConstructor()); @@ -128,7 +126,7 @@ public function getMethod(string $name): ReflectionMethod * * @psalm-suppress MethodSignatureMismatch */ - public function getMethods(?int $filter = null): array + public function getMethods(int|null $filter = null): array { return array_map(static fn (BetterReflectionMethod $method): ReflectionMethod => new ReflectionMethod($method), $this->betterReflectionEnum->getMethods($filter)); } @@ -154,7 +152,7 @@ public function getProperty(string $name): ReflectionProperty * * @psalm-suppress MethodSignatureMismatch */ - public function getProperties(?int $filter = null): array + public function getProperties(int|null $filter = null): array { return array_values(array_map(static fn (BetterReflectionProperty $property): ReflectionProperty => new ReflectionProperty($property), $this->betterReflectionEnum->getProperties($filter))); } @@ -164,10 +162,8 @@ public function hasConstant(string $name): bool return $this->betterReflectionEnum->hasCase($name) || $this->betterReflectionEnum->hasConstant($name); } - /** - * @return array - */ - public function getConstants(?int $filter = null): array + /** @return array */ + public function getConstants(int|null $filter = null): array { return array_map( fn (BetterReflectionClassConstant|BetterReflectionEnumCase $betterConstantOrEnumCase): mixed => $this->getConstantValue($betterConstantOrEnumCase), @@ -204,10 +200,8 @@ public function getReflectionConstant(string $name): ReflectionClassConstant|fal return new ReflectionClassConstant($betterReflectionConstantOrEnumCase); } - /** - * @return list - */ - public function getReflectionConstants(?int $filter = null): array + /** @return list */ + public function getReflectionConstants(int|null $filter = null): array { return array_values(array_map( static fn (BetterReflectionClassConstant|BetterReflectionEnumCase $betterConstantOrEnum): ReflectionClassConstant => new ReflectionClassConstant($betterConstantOrEnum), @@ -215,10 +209,8 @@ public function getReflectionConstants(?int $filter = null): array )); } - /** - * @return array - */ - private function filterBetterReflectionClassConstants(?int $filter): array + /** @return array */ + private function filterBetterReflectionClassConstants(int|null $filter): array { $reflectionConstants = $this->betterReflectionEnum->getReflectionConstants(); @@ -239,9 +231,7 @@ private function filterBetterReflectionClassConstants(?int $filter): array return $reflectionConstants; } - /** - * @return array - */ + /** @return array */ public function getInterfaces(): array { return array_map( @@ -250,9 +240,7 @@ public function getInterfaces(): array ); } - /** - * @return list - */ + /** @return list */ public function getInterfaceNames(): array { return $this->betterReflectionEnum->getInterfaceNames(); @@ -263,9 +251,7 @@ public function isInterface(): bool return $this->betterReflectionEnum->isInterface(); } - /** - * @return array - */ + /** @return array */ public function getTraits(): array { $traits = $this->betterReflectionEnum->getTraits(); @@ -288,9 +274,7 @@ public function getTraitNames(): array return $this->betterReflectionEnum->getTraitNames(); } - /** - * @return array - */ + /** @return array */ public function getTraitAliases(): array { return $this->betterReflectionEnum->getTraitAliases(); @@ -331,7 +315,7 @@ public function newInstanceWithoutConstructor(): object throw new Exception\NotImplemented('Not implemented'); } - public function newInstanceArgs(?array $args = null): object + public function newInstanceArgs(array|null $args = null): object { throw new Exception\NotImplemented('Not implemented'); } @@ -341,9 +325,7 @@ public function getParentClass(): ReflectionClass|false return false; } - /** - * @psalm-suppress MethodSignatureMismatch - */ + /** @psalm-suppress MethodSignatureMismatch */ public function isSubclassOf(CoreReflectionClass|string $class): bool { $realParentClassNames = $this->betterReflectionEnum->getParentClassNames(); @@ -378,9 +360,7 @@ public function setStaticPropertyValue(string $name, mixed $value): void throw new CoreReflectionException(sprintf('Property "%s" does not exist', $name)); } - /** - * @return array|null> - */ + /** @return array|null> */ public function getDefaultProperties(): array { return $this->betterReflectionEnum->getDefaultProperties(); @@ -396,9 +376,7 @@ public function isIterable(): bool return $this->isIterateable(); } - /** - * @psalm-suppress MethodSignatureMismatch - */ + /** @psalm-suppress MethodSignatureMismatch */ public function implementsInterface(CoreReflectionClass|string $interface): bool { $realInterfaceNames = $this->betterReflectionEnum->getInterfaceNames(); @@ -413,7 +391,7 @@ public function implementsInterface(CoreReflectionClass|string $interface): bool return $this->betterReflectionEnum->implementsInterface($realInterfaceName); } - public function getExtension(): ?CoreReflectionExtension + public function getExtension(): CoreReflectionExtension|null { throw new Exception\NotImplemented('Not implemented'); } @@ -443,7 +421,7 @@ public function getShortName(): string * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); @@ -485,9 +463,7 @@ public function getCase(string $name): ReflectionEnumUnitCase|ReflectionEnumBack return new ReflectionEnumUnitCase($case); } - /** - * @return list - */ + /** @return list */ public function getCases(): array { return array_map(function (BetterReflectionEnumCase $case): ReflectionEnumUnitCase|ReflectionEnumBackedCase { @@ -504,7 +480,7 @@ public function isBacked(): bool return $this->betterReflectionEnum->isBacked(); } - public function getBackingType(): ?ReflectionNamedType + public function getBackingType(): ReflectionNamedType|null { if ($this->betterReflectionEnum->isBacked()) { return new ReflectionNamedType($this->betterReflectionEnum->getBackingType(), false); diff --git a/src/Reflection/Adapter/ReflectionEnumBackedCase.php b/src/Reflection/Adapter/ReflectionEnumBackedCase.php index f1f89afc2..2561d963e 100644 --- a/src/Reflection/Adapter/ReflectionEnumBackedCase.php +++ b/src/Reflection/Adapter/ReflectionEnumBackedCase.php @@ -76,7 +76,7 @@ public function __toString(): string * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionEnumUnitCase.php b/src/Reflection/Adapter/ReflectionEnumUnitCase.php index a6205e5ab..eeb1a7375 100644 --- a/src/Reflection/Adapter/ReflectionEnumUnitCase.php +++ b/src/Reflection/Adapter/ReflectionEnumUnitCase.php @@ -76,7 +76,7 @@ public function __toString(): string * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionFunction.php b/src/Reflection/Adapter/ReflectionFunction.php index 262367b74..abfa2e97e 100644 --- a/src/Reflection/Adapter/ReflectionFunction.php +++ b/src/Reflection/Adapter/ReflectionFunction.php @@ -60,12 +60,12 @@ public function isUserDefined(): bool return $this->betterReflectionFunction->isUserDefined(); } - public function getClosureThis(): ?object + public function getClosureThis(): object|null { throw new NotImplemented('Not implemented'); } - public function getClosureScopeClass(): ?CoreReflectionClass + public function getClosureScopeClass(): CoreReflectionClass|null { throw new NotImplemented('Not implemented'); } @@ -85,10 +85,8 @@ public function getEndLine(): int|false return $this->betterReflectionFunction->getEndLine(); } - /** - * @psalm-suppress ImplementedReturnTypeMismatch - */ - public function getExtension(): ?CoreReflectionExtension + /** @psalm-suppress ImplementedReturnTypeMismatch */ + public function getExtension(): CoreReflectionExtension|null { throw new NotImplemented('Not implemented'); } @@ -125,9 +123,7 @@ public function getNumberOfRequiredParameters(): int return $this->betterReflectionFunction->getNumberOfRequiredParameters(); } - /** - * @return list - */ + /** @return list */ public function getParameters(): array { return array_map( @@ -141,7 +137,7 @@ public function hasReturnType(): bool return $this->betterReflectionFunction->hasReturnType(); } - public function getReturnType(): ?CoreReflectionType + public function getReturnType(): CoreReflectionType|null { return ReflectionType::fromTypeOrNull($this->betterReflectionFunction->getReturnType()); } @@ -151,9 +147,7 @@ public function getShortName(): string return $this->betterReflectionFunction->getShortName(); } - /** - * @return array - */ + /** @return array */ public function getStaticVariables(): array { throw new NotImplemented('Not implemented'); @@ -188,9 +182,7 @@ public function invoke(mixed ...$args): mixed } } - /** - * @param list $args - */ + /** @param list $args */ public function invokeArgs(array $args): mixed { try { @@ -205,9 +197,7 @@ public function getClosure(): Closure return $this->betterReflectionFunction->getClosure(); } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getClosureUsedVariables(): array { throw new Exception\NotImplemented('Not implemented'); @@ -218,7 +208,7 @@ public function hasTentativeReturnType(): bool return $this->betterReflectionFunction->hasTentativeReturnType(); } - public function getTentativeReturnType(): ?CoreReflectionType + public function getTentativeReturnType(): CoreReflectionType|null { return ReflectionType::fromTypeOrNull($this->betterReflectionFunction->getTentativeReturnType()); } @@ -233,7 +223,7 @@ public function isStatic(): bool * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionIntersectionType.php b/src/Reflection/Adapter/ReflectionIntersectionType.php index 38903792f..5a1f00ce4 100644 --- a/src/Reflection/Adapter/ReflectionIntersectionType.php +++ b/src/Reflection/Adapter/ReflectionIntersectionType.php @@ -18,9 +18,7 @@ public function __construct(private BetterReflectionIntersectionType $betterRefl { } - /** - * @return array - */ + /** @return array */ public function getTypes(): array { return array_filter( diff --git a/src/Reflection/Adapter/ReflectionMethod.php b/src/Reflection/Adapter/ReflectionMethod.php index cdc91dbdc..a8e3bfda4 100644 --- a/src/Reflection/Adapter/ReflectionMethod.php +++ b/src/Reflection/Adapter/ReflectionMethod.php @@ -62,12 +62,12 @@ public function isUserDefined(): bool return $this->betterReflectionMethod->isUserDefined(); } - public function getClosureThis(): ?object + public function getClosureThis(): object|null { throw new NotImplemented('Not implemented'); } - public function getClosureScopeClass(): ?CoreReflectionClass + public function getClosureScopeClass(): CoreReflectionClass|null { throw new NotImplemented('Not implemented'); } @@ -87,10 +87,8 @@ public function getEndLine(): int|false return $this->betterReflectionMethod->getEndLine(); } - /** - * @psalm-suppress ImplementedReturnTypeMismatch - */ - public function getExtension(): ?CoreReflectionExtension + /** @psalm-suppress ImplementedReturnTypeMismatch */ + public function getExtension(): CoreReflectionExtension|null { throw new NotImplemented('Not implemented'); } @@ -127,9 +125,7 @@ public function getNumberOfRequiredParameters(): int return $this->betterReflectionMethod->getNumberOfRequiredParameters(); } - /** - * @return list - */ + /** @return list */ public function getParameters(): array { return array_map( @@ -143,7 +139,7 @@ public function hasReturnType(): bool return $this->betterReflectionMethod->hasReturnType(); } - public function getReturnType(): ?CoreReflectionType + public function getReturnType(): CoreReflectionType|null { return ReflectionType::fromTypeOrNull($this->betterReflectionMethod->getReturnType()); } @@ -153,9 +149,7 @@ public function getShortName(): string return $this->betterReflectionMethod->getShortName(); } - /** - * @return array - */ + /** @return array */ public function getStaticVariables(): array { throw new NotImplemented('Not implemented'); @@ -216,10 +210,8 @@ public function isDestructor(): bool return $this->betterReflectionMethod->isDestructor(); } - /** - * @psalm-suppress MethodSignatureMismatch - */ - public function getClosure(?object $object = null): Closure + /** @psalm-suppress MethodSignatureMismatch */ + public function getClosure(object|null $object = null): Closure { try { return $this->betterReflectionMethod->getClosure($object); @@ -235,7 +227,7 @@ public function getModifiers(): int return $this->betterReflectionMethod->getModifiers(); } - public function invoke(?object $object = null, mixed ...$args): mixed + public function invoke(object|null $object = null, mixed ...$args): mixed { try { return $this->betterReflectionMethod->invoke($object, ...$args); @@ -246,10 +238,8 @@ public function invoke(?object $object = null, mixed ...$args): mixed } } - /** - * @param list $args - */ - public function invokeArgs(?object $object = null, array $args = []): mixed + /** @param list $args */ + public function invokeArgs(object|null $object = null, array $args = []): mixed { try { return $this->betterReflectionMethod->invokeArgs($object, $args); @@ -283,7 +273,7 @@ public function setAccessible(bool $accessible): void * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); @@ -305,14 +295,12 @@ public function hasTentativeReturnType(): bool return $this->betterReflectionMethod->hasTentativeReturnType(); } - public function getTentativeReturnType(): ?CoreReflectionType + public function getTentativeReturnType(): CoreReflectionType|null { return ReflectionType::fromTypeOrNull($this->betterReflectionMethod->getTentativeReturnType()); } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getClosureUsedVariables(): array { throw new Exception\NotImplemented('Not implemented'); diff --git a/src/Reflection/Adapter/ReflectionNamedType.php b/src/Reflection/Adapter/ReflectionNamedType.php index 3a265a273..06d0919be 100644 --- a/src/Reflection/Adapter/ReflectionNamedType.php +++ b/src/Reflection/Adapter/ReflectionNamedType.php @@ -9,9 +9,7 @@ use function strtolower; -/** - * @psalm-suppress MissingImmutableAnnotation - */ +/** @psalm-suppress MissingImmutableAnnotation */ final class ReflectionNamedType extends CoreReflectionNamedType { public function __construct(private BetterReflectionNamedType $betterReflectionType, private bool $allowsNull) diff --git a/src/Reflection/Adapter/ReflectionObject.php b/src/Reflection/Adapter/ReflectionObject.php index e695262a9..e1480e7f1 100644 --- a/src/Reflection/Adapter/ReflectionObject.php +++ b/src/Reflection/Adapter/ReflectionObject.php @@ -26,9 +26,7 @@ use function sprintf; use function strtolower; -/** - * @psalm-suppress PropertyNotSetInConstructor - */ +/** @psalm-suppress PropertyNotSetInConstructor */ final class ReflectionObject extends CoreReflectionObject { public function __construct(private BetterReflectionObject $betterReflectionObject) @@ -117,7 +115,7 @@ private function getMethodRealName(string $name): string * * @psalm-suppress MethodSignatureMismatch */ - public function getMethods(?int $filter = null): array + public function getMethods(int|null $filter = null): array { return array_map( static fn (BetterReflectionMethod $method): ReflectionMethod => new ReflectionMethod($method), @@ -146,7 +144,7 @@ public function getProperty(string $name): ReflectionProperty * * @psalm-suppress MethodSignatureMismatch */ - public function getProperties(?int $filter = null): array + public function getProperties(int|null $filter = null): array { return array_values(array_map(static fn (BetterReflectionProperty $property): ReflectionProperty => new ReflectionProperty($property), $this->betterReflectionObject->getProperties())); } @@ -156,10 +154,8 @@ public function hasConstant(string $name): bool return $this->betterReflectionObject->hasConstant($name); } - /** - * @return array - */ - public function getConstants(?int $filter = null): array + /** @return array */ + public function getConstants(int|null $filter = null): array { $reflectionConstants = $this->betterReflectionObject->getReflectionConstants(); @@ -192,10 +188,8 @@ public function getReflectionConstant(string $name): ReflectionClassConstant|fal return new ReflectionClassConstant($betterReflectionConstant); } - /** - * @return list - */ - public function getReflectionConstants(?int $filter = null): array + /** @return list */ + public function getReflectionConstants(int|null $filter = null): array { return array_values(array_map( static fn (BetterReflectionClassConstant $betterConstant): ReflectionClassConstant => new ReflectionClassConstant($betterConstant), @@ -203,9 +197,7 @@ public function getReflectionConstants(?int $filter = null): array )); } - /** - * @return array - */ + /** @return array */ public function getInterfaces(): array { return array_map( @@ -214,9 +206,7 @@ public function getInterfaces(): array ); } - /** - * @return list - */ + /** @return list */ public function getInterfaceNames(): array { return $this->betterReflectionObject->getInterfaceNames(); @@ -227,9 +217,7 @@ public function isInterface(): bool return $this->betterReflectionObject->isInterface(); } - /** - * @return array - */ + /** @return array */ public function getTraits(): array { $traits = $this->betterReflectionObject->getTraits(); @@ -243,17 +231,13 @@ public function getTraits(): array ); } - /** - * @return list - */ + /** @return list */ public function getTraitNames(): array { return $this->betterReflectionObject->getTraitNames(); } - /** - * @return array - */ + /** @return array */ public function getTraitAliases(): array { return $this->betterReflectionObject->getTraitAliases(); @@ -294,7 +278,7 @@ public function newInstanceWithoutConstructor(): ReflectionObject throw new Exception\NotImplemented('Not implemented'); } - public function newInstanceArgs(?array $args = null): ReflectionObject + public function newInstanceArgs(array|null $args = null): ReflectionObject { throw new Exception\NotImplemented('Not implemented'); } @@ -310,9 +294,7 @@ public function getParentClass(): ReflectionClass|false return new ReflectionClass($parentClass); } - /** - * @psalm-suppress MethodSignatureMismatch - */ + /** @psalm-suppress MethodSignatureMismatch */ public function isSubclassOf(CoreReflectionClass|string $class): bool { $realParentClassNames = $this->betterReflectionObject->getParentClassNames(); @@ -375,9 +357,7 @@ public function setStaticPropertyValue(string $name, mixed $value): void $property->setValue($value); } - /** - * @return array|null> - */ + /** @return array|null> */ public function getDefaultProperties(): array { return $this->betterReflectionObject->getDefaultProperties(); @@ -393,9 +373,7 @@ public function isIterable(): bool return $this->isIterateable(); } - /** - * @psalm-suppress MethodSignatureMismatch - */ + /** @psalm-suppress MethodSignatureMismatch */ public function implementsInterface(CoreReflectionClass|string $interface): bool { $realInterfaceNames = $this->betterReflectionObject->getInterfaceNames(); @@ -410,7 +388,7 @@ public function implementsInterface(CoreReflectionClass|string $interface): bool return $this->betterReflectionObject->implementsInterface($realInterfaceName); } - public function getExtension(): ?CoreReflectionExtension + public function getExtension(): CoreReflectionExtension|null { throw new Exception\NotImplemented('Not implemented'); } @@ -445,7 +423,7 @@ public function isAnonymous(): bool * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionParameter.php b/src/Reflection/Adapter/ReflectionParameter.php index 32fd2023f..b87530a76 100644 --- a/src/Reflection/Adapter/ReflectionParameter.php +++ b/src/Reflection/Adapter/ReflectionParameter.php @@ -16,9 +16,7 @@ use function array_map; use function sprintf; -/** - * @psalm-suppress MissingImmutableAnnotation - */ +/** @psalm-suppress MissingImmutableAnnotation */ final class ReflectionParameter extends CoreReflectionParameter { public function __construct(private BetterReflectionParameter $betterReflectionParameter) @@ -57,7 +55,7 @@ public function getDeclaringFunction(): CoreReflectionFunctionAbstract return new ReflectionFunction($function); } - public function getDeclaringClass(): ?CoreReflectionClass + public function getDeclaringClass(): CoreReflectionClass|null { $declaringClass = $this->betterReflectionParameter->getDeclaringClass(); @@ -68,7 +66,7 @@ public function getDeclaringClass(): ?CoreReflectionClass return new ReflectionClass($declaringClass); } - public function getClass(): ?CoreReflectionClass + public function getClass(): CoreReflectionClass|null { $class = $this->betterReflectionParameter->getClass(); @@ -149,7 +147,7 @@ public function isPromoted(): bool * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionProperty.php b/src/Reflection/Adapter/ReflectionProperty.php index def208d79..5dfc30ecb 100644 --- a/src/Reflection/Adapter/ReflectionProperty.php +++ b/src/Reflection/Adapter/ReflectionProperty.php @@ -38,7 +38,7 @@ public function getName(): string return $this->betterReflectionProperty->getName(); } - public function getValue(?object $object = null): mixed + public function getValue(object|null $object = null): mixed { try { return $this->betterReflectionProperty->getValue($object); @@ -49,9 +49,7 @@ public function getValue(?object $object = null): mixed } } - /** - * @psalm-suppress MethodSignatureMismatch - */ + /** @psalm-suppress MethodSignatureMismatch */ public function setValue(mixed $objectOrValue, mixed $value = null): void { try { @@ -70,9 +68,7 @@ public function hasType(): bool return $this->betterReflectionProperty->hasType(); } - /** - * @psalm-mutation-free - */ + /** @psalm-mutation-free */ public function getType(): ReflectionUnionType|ReflectionNamedType|ReflectionIntersectionType|null { /** @psalm-suppress ImpureMethodCall */ @@ -146,7 +142,7 @@ public function getDefaultValue(): mixed return $this->betterReflectionProperty->getDefaultValue(); } - public function isInitialized(?object $object = null): bool + public function isInitialized(object|null $object = null): bool { try { return $this->betterReflectionProperty->isInitialized($object); @@ -165,7 +161,7 @@ public function isPromoted(): bool * * @return list */ - public function getAttributes(?string $name = null, int $flags = 0): array + public function getAttributes(string|null $name = null, int $flags = 0): array { if ($flags !== 0 && $flags !== ReflectionAttribute::IS_INSTANCEOF) { throw new ValueError('Argument #2 ($flags) must be a valid attribute filter flag'); diff --git a/src/Reflection/Adapter/ReflectionUnionType.php b/src/Reflection/Adapter/ReflectionUnionType.php index 9d5875c57..07656925d 100644 --- a/src/Reflection/Adapter/ReflectionUnionType.php +++ b/src/Reflection/Adapter/ReflectionUnionType.php @@ -18,9 +18,7 @@ public function __construct(private BetterReflectionUnionType $betterReflectionT { } - /** - * @return array - */ + /** @return array */ public function getTypes(): array { return array_filter( diff --git a/src/Reflection/Annotation/AnnotationHelper.php b/src/Reflection/Annotation/AnnotationHelper.php index fa595b351..755db64b7 100644 --- a/src/Reflection/Annotation/AnnotationHelper.php +++ b/src/Reflection/Annotation/AnnotationHelper.php @@ -6,16 +6,12 @@ use function preg_match; -/** - * @internal - */ +/** @internal */ final class AnnotationHelper { public const TENTATIVE_RETURN_TYPE_ANNOTATION = 'betterReflectionTentativeReturnType'; - /** - * @psalm-pure - */ + /** @psalm-pure */ public static function isDeprecated(string $docComment): bool { if ($docComment === '') { @@ -25,9 +21,7 @@ public static function isDeprecated(string $docComment): bool return preg_match('~\*\s*@deprecated(?=\s|\*)~', $docComment) === 1; } - /** - * @psalm-pure - */ + /** @psalm-pure */ public static function hasTentativeReturnType(string $docComment): bool { if ($docComment === '') { diff --git a/src/Reflection/Attribute/ReflectionAttributeHelper.php b/src/Reflection/Attribute/ReflectionAttributeHelper.php index ac9cf924b..39f84c2f2 100644 --- a/src/Reflection/Attribute/ReflectionAttributeHelper.php +++ b/src/Reflection/Attribute/ReflectionAttributeHelper.php @@ -18,14 +18,10 @@ use function array_values; use function count; -/** - * @internal - */ +/** @internal */ class ReflectionAttributeHelper { - /** - * @return list - */ + /** @return list */ public static function createAttributes( Reflector $reflector, ReflectionClass|ReflectionMethod|ReflectionFunction|ReflectionClassConstant|ReflectionEnumCase|ReflectionProperty|ReflectionParameter $reflection, diff --git a/src/Reflection/ReflectionAttribute.php b/src/Reflection/ReflectionAttribute.php index beb743b91..b36866e37 100644 --- a/src/Reflection/ReflectionAttribute.php +++ b/src/Reflection/ReflectionAttribute.php @@ -31,9 +31,7 @@ public function getClass(): ReflectionClass return $this->reflector->reflectClass($this->getName()); } - /** - * @return array - */ + /** @return array */ public function getArguments(): array { $arguments = []; diff --git a/src/Reflection/ReflectionClass.php b/src/Reflection/ReflectionClass.php index 824601945..68a4e58bf 100644 --- a/src/Reflection/ReflectionClass.php +++ b/src/Reflection/ReflectionClass.php @@ -67,27 +67,27 @@ class ReflectionClass implements Reflection private const ANONYMOUS_CLASS_NAME_SUFFIX = '@anonymous'; /** @var array|null indexed by name, when present */ - private ?array $cachedReflectionConstants = null; + private array|null $cachedReflectionConstants = null; /** @var array|null */ - private ?array $cachedImmediateProperties = null; + private array|null $cachedImmediateProperties = null; /** @var array|null */ - private ?array $cachedProperties = null; + private array|null $cachedProperties = null; /** @var array|null */ - private ?array $cachedMethods = null; + private array|null $cachedMethods = null; /** @var array{aliases: array, modifiers: array, precedences: array}|null */ - private ?array $cachedTraitsData = null; + private array|null $cachedTraitsData = null; - private ?ReflectionClass $cachedParentClass = null; + private ReflectionClass|null $cachedParentClass = null; protected function __construct( private Reflector $reflector, private ClassNode|InterfaceNode|TraitNode|EnumNode $node, private LocatedSource $locatedSource, - private ?NamespaceNode $declaringNamespace = null, + private NamespaceNode|null $declaringNamespace = null, ) { } @@ -133,7 +133,7 @@ public static function createFromNode( Reflector $reflector, ClassNode|InterfaceNode|TraitNode|EnumNode $node, LocatedSource $locatedSource, - ?NamespaceNode $namespace = null, + NamespaceNode|null $namespace = null, ): self { return new self($reflector, $node, $locatedSource, $namespace); } @@ -220,18 +220,15 @@ public function getNamespaceName(): string */ public function inNamespace(): bool { - return $this->declaringNamespace !== null - && $this->declaringNamespace->name !== null; + return $this->declaringNamespace?->name !== null; } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return $this->locatedSource->getExtensionName(); } - /** - * @return list - */ + /** @return list */ private function createMethodsFromTrait(ReflectionMethod $method): array { $this->parseTraitUsages(); @@ -249,7 +246,7 @@ private function createMethodsFromTrait(ReflectionMethod $method): array $methodAst->flags = ($methodAst->flags & ~ Node\Stmt\Class_::VISIBILITY_MODIFIER_MASK) | $traitModifiers[$methodHash]; } - $createMethod = fn (?string $aliasMethodName): ReflectionMethod => ReflectionMethod::createFromNode( + $createMethod = fn (string|null $aliasMethodName): ReflectionMethod => ReflectionMethod::createFromNode( $this->reflector, $methodAst, $method->getLocatedSource(), @@ -276,9 +273,7 @@ private function createMethodsFromTrait(ReflectionMethod $method): array return $methods; } - /** - * @return list - */ + /** @return list */ private function getParentMethods(): array { return array_merge( @@ -304,9 +299,7 @@ function (ReflectionClass $ancestor): array { ); } - /** - * @return list - */ + /** @return list */ private function getMethodsFromTraits(): array { return array_merge( @@ -326,9 +319,7 @@ function (ReflectionClass $trait): array { ); } - /** - * @return list - */ + /** @return list */ private function getMethodsFromInterfaces(): array { return array_merge( @@ -426,7 +417,7 @@ private function getMethodsIndexedByName(): array * * @return list */ - public function getMethods(?int $filter = null): array + public function getMethods(int|null $filter = null): array { if ($filter === null) { return array_values($this->getMethodsIndexedByName()); @@ -448,7 +439,7 @@ public function getMethods(?int $filter = null): array * * @return array */ - public function getImmediateMethods(?int $filter = null): array + public function getImmediateMethods(int|null $filter = null): array { /** @var list $methods */ $methods = array_map( @@ -622,7 +613,7 @@ public function hasConstant(string $name): bool * * Returns null if not specified. */ - public function getReflectionConstant(string $name): ?ReflectionClassConstant + public function getReflectionConstant(string $name): ReflectionClassConstant|null { return $this->getReflectionConstants()[$name] ?? null; } @@ -734,7 +725,7 @@ public function getConstructor(): ReflectionMethod * * @return array */ - public function getImmediateProperties(?int $filter = null): array + public function getImmediateProperties(int|null $filter = null): array { if ($this->cachedImmediateProperties === null) { $properties = []; @@ -866,7 +857,7 @@ private function addEnumProperties(array $properties): array * * @return array */ - public function getProperties(?int $filter = null): array + public function getProperties(int|null $filter = null): array { if ($this->cachedProperties === null) { // merging together properties from parent class, traits, current class (in this precise order) @@ -915,7 +906,7 @@ function (ReflectionClass $trait) use ($filter) { * * Returns null if property does not exist. */ - public function getProperty(string $name): ?ReflectionProperty + public function getProperty(string $name): ReflectionProperty|null { $properties = $this->getProperties(); @@ -934,9 +925,7 @@ public function hasProperty(string $name): bool return $this->getProperty($name) !== null; } - /** - * @return array|null> - */ + /** @return array|null> */ public function getDefaultProperties(): array { return array_map( @@ -945,7 +934,7 @@ public function getDefaultProperties(): array ); } - public function getFileName(): ?string + public function getFileName(): string|null { return $this->locatedSource->getFileName(); } @@ -987,7 +976,7 @@ public function getEndColumn(): int * * @throws NotAClassReflection */ - public function getParentClass(): ?ReflectionClass + public function getParentClass(): ReflectionClass|null { if (! ($this->node instanceof ClassNode) || $this->node->extends === null) { return null; @@ -1323,9 +1312,7 @@ private function parseTraitUsages(): void } } - /** - * @psalm-pure - */ + /** @psalm-pure */ private function methodHash(string $className, string $methodName): string { return sprintf( @@ -1501,9 +1488,7 @@ public function isEnum(): bool return $this->node instanceof Node\Stmt\Enum_; } - /** - * @return array - */ + /** @return array */ private function getCurrentClassImplementedInterfacesIndexedByName(): array { if ($this->node instanceof TraitNode) { @@ -1532,9 +1517,7 @@ private function getCurrentClassImplementedInterfacesIndexedByName(): array return $this->addStringableInterface($interfaces); } - /** - * @return list ordered from inheritance root to leaf (this class) - */ + /** @return list ordered from inheritance root to leaf (this class) */ private function getInheritanceClassHierarchy(): array { $parentClass = $this->getParentClass(); @@ -1571,9 +1554,7 @@ private function getInterfacesHierarchy(): array return $this->addStringableInterface($interfaces); } - /** - * @throws Uncloneable - */ + /** @throws Uncloneable */ public function __clone() { throw Uncloneable::fromClass(static::class); @@ -1619,9 +1600,7 @@ public function setStaticPropertyValue(string $propertyName, mixed $value): void $property->setValue($value); } - /** - * @return array - */ + /** @return array */ public function getStaticProperties(): array { $staticProperties = []; @@ -1646,22 +1625,18 @@ public function getAst(): ClassNode|InterfaceNode|TraitNode|EnumNode return $this->node; } - public function getDeclaringNamespaceAst(): ?Namespace_ + public function getDeclaringNamespaceAst(): Namespace_|null { return $this->declaringNamespace; } - /** - * @return list - */ + /** @return list */ public function getAttributes(): array { return ReflectionAttributeHelper::createAttributes($this->reflector, $this); } - /** - * @return list - */ + /** @return list */ public function getAttributesByName(string $name): array { return ReflectionAttributeHelper::filterAttributesByName($this->getAttributes(), $name); diff --git a/src/Reflection/ReflectionClassConstant.php b/src/Reflection/ReflectionClassConstant.php index a64dc6eea..523161f75 100644 --- a/src/Reflection/ReflectionClassConstant.php +++ b/src/Reflection/ReflectionClassConstant.php @@ -20,7 +20,7 @@ class ReflectionClassConstant { public const IS_FINAL = 32; - private ?CompiledValue $compiledValue = null; + private CompiledValue|null $compiledValue = null; private function __construct( private Reflector $reflector, @@ -177,17 +177,13 @@ public function getPositionInAst(): int return $this->positionInNode; } - /** - * @return list - */ + /** @return list */ public function getAttributes(): array { return ReflectionAttributeHelper::createAttributes($this->reflector, $this); } - /** - * @return list - */ + /** @return list */ public function getAttributesByName(string $name): array { return ReflectionAttributeHelper::filterAttributesByName($this->getAttributes(), $name); diff --git a/src/Reflection/ReflectionConstant.php b/src/Reflection/ReflectionConstant.php index f81d2084d..6cfee20ab 100644 --- a/src/Reflection/ReflectionConstant.php +++ b/src/Reflection/ReflectionConstant.php @@ -30,14 +30,14 @@ class ReflectionConstant implements Reflection { - private ?CompiledValue $compiledValue = null; + private CompiledValue|null $compiledValue = null; private function __construct( private Reflector $reflector, private Node\Stmt\Const_|Node\Expr\FuncCall $node, private LocatedSource $locatedSource, - private ?NamespaceNode $declaringNamespace = null, - private ?int $positionInNode = null, + private NamespaceNode|null $declaringNamespace = null, + private int|null $positionInNode = null, ) { } @@ -62,8 +62,8 @@ public static function createFromNode( Reflector $reflector, Node $node, LocatedSource $locatedSource, - ?NamespaceNode $namespace = null, - ?int $positionInNode = null, + NamespaceNode|null $namespace = null, + int|null $positionInNode = null, ): self { if ($node instanceof Node\Stmt\Const_) { assert(is_int($positionInNode)); @@ -78,7 +78,7 @@ private static function createFromConstKeyword( Reflector $reflector, Node\Stmt\Const_ $node, LocatedSource $locatedSource, - ?NamespaceNode $namespace, + NamespaceNode|null $namespace, int $positionInNode, ): self { return new self( @@ -90,9 +90,7 @@ private static function createFromConstKeyword( ); } - /** - * @throws InvalidConstantNode - */ + /** @throws InvalidConstantNode */ private static function createFromDefineFunctionCall( Reflector $reflector, Node\Expr\FuncCall $node, @@ -137,9 +135,7 @@ public function getName(): string return $this->getNameFromDefineFunctionCall($this->node); } - /** - * @psalm-suppress PossiblyNullArrayOffset - */ + /** @psalm-suppress PossiblyNullArrayOffset */ $namespacedName = $this->node->consts[$this->positionInNode]->namespacedName; assert($namespacedName instanceof Node\Name); @@ -176,11 +172,10 @@ public function inNamespace(): bool return substr_count($this->getNameFromDefineFunctionCall($this->node), '\\') !== 0; } - return $this->declaringNamespace !== null - && $this->declaringNamespace->name !== null; + return $this->declaringNamespace?->name !== null; } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return $this->locatedSource->getExtensionName(); } @@ -233,7 +228,7 @@ public function getValue(): mixed return $this->compiledValue->value; } - public function getFileName(): ?string + public function getFileName(): string|null { return $this->locatedSource->getFileName(); } @@ -282,9 +277,7 @@ public function __toString(): string return ReflectionConstantStringCast::toString($this); } - /** - * @return Node\Stmt\Const_|Node\Expr\FuncCall - */ + /** @return Node\Stmt\Const_|Node\Expr\FuncCall */ public function getAst(): Node { return $this->node; diff --git a/src/Reflection/ReflectionEnum.php b/src/Reflection/ReflectionEnum.php index d2ac0c279..c0168ce04 100644 --- a/src/Reflection/ReflectionEnum.php +++ b/src/Reflection/ReflectionEnum.php @@ -23,16 +23,14 @@ class ReflectionEnum extends ReflectionClass { /** @var array|null */ - private ?array $cachedCases = null; + private array|null $cachedCases = null; - /** - * @phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found - */ + /** @phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found */ protected function __construct( private Reflector $reflector, private EnumNode $node, LocatedSource $locatedSource, - ?NamespaceNode $declaringNamespace = null, + NamespaceNode|null $declaringNamespace = null, ) { parent::__construct($reflector, $node, $locatedSource, $declaringNamespace); } @@ -48,7 +46,7 @@ public static function createFromNode( Reflector $reflector, ClassNode|InterfaceNode|TraitNode|EnumNode $node, LocatedSource $locatedSource, - ?NamespaceNode $namespace = null, + NamespaceNode|null $namespace = null, ): self { return new self($reflector, $node, $locatedSource, $namespace); } @@ -60,16 +58,14 @@ public function hasCase(string $name): bool return array_key_exists($name, $cases); } - public function getCase(string $name): ?ReflectionEnumCase + public function getCase(string $name): ReflectionEnumCase|null { $cases = $this->getCases(); return $cases[$name] ?? null; } - /** - * @return array - */ + /** @return array */ public function getCases(): array { if ($this->cachedCases === null) { diff --git a/src/Reflection/ReflectionEnumCase.php b/src/Reflection/ReflectionEnumCase.php index fd507cd9c..e96dbfb71 100644 --- a/src/Reflection/ReflectionEnumCase.php +++ b/src/Reflection/ReflectionEnumCase.php @@ -22,7 +22,7 @@ class ReflectionEnumCase { - private ?CompiledValue $compiledValue = null; + private CompiledValue|null $compiledValue = null; private function __construct( private Reflector $reflector, @@ -31,9 +31,7 @@ private function __construct( ) { } - /** - * @internal - */ + /** @internal */ public static function createFromNode( Reflector $reflector, EnumCase $node, @@ -55,9 +53,7 @@ public function getValue(): string|int return $value; } - /** - * @throws LogicException - */ + /** @throws LogicException */ private function getCompiledValue(): CompiledValue { if ($this->node->expr === null) { @@ -119,17 +115,13 @@ public function isDeprecated(): bool return AnnotationHelper::isDeprecated($this->getDocComment()); } - /** - * @return list - */ + /** @return list */ public function getAttributes(): array { return ReflectionAttributeHelper::createAttributes($this->reflector, $this); } - /** - * @return list - */ + /** @return list */ public function getAttributesByName(string $name): array { return ReflectionAttributeHelper::filterAttributesByName($this->getAttributes(), $name); diff --git a/src/Reflection/ReflectionFunction.php b/src/Reflection/ReflectionFunction.php index d11ffeeea..200acfc54 100644 --- a/src/Reflection/ReflectionFunction.php +++ b/src/Reflection/ReflectionFunction.php @@ -33,24 +33,20 @@ private function __construct( private Reflector $reflector, private Node\Stmt\ClassMethod|Node\Stmt\Function_|Node\Expr\Closure|Node\Expr\ArrowFunction $node, private LocatedSource $locatedSource, - private ?NamespaceNode $declaringNamespace = null, + private NamespaceNode|null $declaringNamespace = null, ) { assert($node instanceof Node\Stmt\Function_ || $node instanceof Node\Expr\Closure || $node instanceof Node\Expr\ArrowFunction); $this->functionNode = $node; } - /** - * @throws IdentifierNotFound - */ + /** @throws IdentifierNotFound */ public static function createFromName(string $functionName): self { return (new BetterReflection())->reflector()->reflectFunction($functionName); } - /** - * @throws IdentifierNotFound - */ + /** @throws IdentifierNotFound */ public static function createFromClosure(Closure $closure): self { $configuration = new BetterReflection(); @@ -66,14 +62,12 @@ public function __toString(): string return ReflectionFunctionStringCast::toString($this); } - /** - * @internal - */ + /** @internal */ public static function createFromNode( Reflector $reflector, Node\Stmt\Function_|Node\Expr\Closure|Node\Expr\ArrowFunction $node, LocatedSource $locatedSource, - ?NamespaceNode $namespaceNode = null, + NamespaceNode|null $namespaceNode = null, ): self { return new self($reflector, $node, $locatedSource, $namespaceNode); } @@ -161,9 +155,7 @@ public function invokeArgs(array $args = []): mixed return $functionName(...$args); } - /** - * @throws NotImplemented - */ + /** @throws NotImplemented */ private function assertIsNoClosure(): void { if ($this->isClosure()) { @@ -171,9 +163,7 @@ private function assertIsNoClosure(): void } } - /** - * @throws FunctionDoesNotExist - */ + /** @throws FunctionDoesNotExist */ private function assertFunctionExist(string $functionName): void { if (! function_exists($functionName)) { diff --git a/src/Reflection/ReflectionFunctionAbstract.php b/src/Reflection/ReflectionFunctionAbstract.php index 412f2b79c..93f128c22 100644 --- a/src/Reflection/ReflectionFunctionAbstract.php +++ b/src/Reflection/ReflectionFunctionAbstract.php @@ -60,8 +60,7 @@ public function getNamespaceName(): string */ public function inNamespace(): bool { - return $this->declaringNamespace !== null - && $this->declaringNamespace->name !== null; + return $this->declaringNamespace?->name !== null; } /** @@ -111,7 +110,7 @@ public function getParameters(): array * Get a single parameter by name. Returns null if parameter not found for * the function. */ - public function getParameter(string $parameterName): ?ReflectionParameter + public function getParameter(string $parameterName): ReflectionParameter|null { foreach ($this->getParameters() as $parameter) { if ($parameter->getName() === $parameterName) { @@ -132,7 +131,7 @@ public function setDocCommentFromString(string $string): void $this->node->setDocComment(new Doc($string)); } - public function getFileName(): ?string + public function getFileName(): string|null { return $this->locatedSource->getFileName(); } @@ -169,7 +168,7 @@ public function isUserDefined(): bool return ! $this->isInternal(); } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return $this->locatedSource->getExtensionName(); } @@ -336,9 +335,7 @@ private function createReturnType(): ReflectionNamedType|ReflectionUnionType|Ref return ReflectionType::createFromNode($this->reflector, $this, $returnType); } - /** - * @throws Uncloneable - */ + /** @throws Uncloneable */ public function __clone() { throw Uncloneable::fromClass(self::class); @@ -364,7 +361,7 @@ public function getBodyAst(): array * function. If specific formatting is required, you should provide your * own implementation of a PrettyPrinter to unparse the AST. */ - public function getBodyCode(?PrettyPrinterAbstract $printer = null): string + public function getBodyCode(PrettyPrinterAbstract|null $printer = null): string { if ($printer === null) { $printer = new StandardPrettyPrinter(); @@ -387,9 +384,7 @@ public function getBodyCode(?PrettyPrinterAbstract $printer = null): string */ abstract public function getAst(): Node\Stmt\ClassMethod|Node\Stmt\Function_|Node\Expr\Closure|Node\Expr\ArrowFunction; - /** - * @return list - */ + /** @return list */ public function getAttributes(): array { /** @@ -399,9 +394,7 @@ public function getAttributes(): array return ReflectionAttributeHelper::createAttributes($this->reflector, $this); } - /** - * @return list - */ + /** @return list */ public function getAttributesByName(string $name): array { return ReflectionAttributeHelper::filterAttributesByName($this->getAttributes(), $name); diff --git a/src/Reflection/ReflectionIntersectionType.php b/src/Reflection/ReflectionIntersectionType.php index 4e3ed3570..07feaa9f2 100644 --- a/src/Reflection/ReflectionIntersectionType.php +++ b/src/Reflection/ReflectionIntersectionType.php @@ -33,9 +33,7 @@ public function __construct( }, $type->types)); } - /** - * @return list - */ + /** @return list */ public function getTypes(): array { return $this->types; diff --git a/src/Reflection/ReflectionMethod.php b/src/Reflection/ReflectionMethod.php index 0909f11eb..997f62963 100644 --- a/src/Reflection/ReflectionMethod.php +++ b/src/Reflection/ReflectionMethod.php @@ -35,29 +35,27 @@ private function __construct( private Reflector $reflector, private MethodNode|Node\Stmt\Function_|Node\Expr\Closure|Node\Expr\ArrowFunction $node, private LocatedSource $locatedSource, - private ?NamespaceNode $declaringNamespace, + private NamespaceNode|null $declaringNamespace, private ReflectionClass $declaringClass, private ReflectionClass $implementingClass, private ReflectionClass $currentClass, - private ?string $aliasName, + private string|null $aliasName, ) { assert($node instanceof MethodNode); $this->methodNode = $node; } - /** - * @internal - */ + /** @internal */ public static function createFromNode( Reflector $reflector, MethodNode $node, LocatedSource $locatedSource, - ?Namespace_ $namespace, + Namespace_|null $namespace, ReflectionClass $declaringClass, ReflectionClass $implementingClass, ReflectionClass $currentClass, - ?string $aliasName = null, + string|null $aliasName = null, ): self { return new self( $reflector, @@ -108,7 +106,7 @@ public function getShortName(): string return $this->methodNode->name->name; } - public function getAliasName(): ?string + public function getAliasName(): string|null { return $this->aliasName; } @@ -154,7 +152,7 @@ public function getPrototype(): self )); } - private function findPrototype(): ?self + private function findPrototype(): self|null { if ($this->isAbstract()) { return $this; @@ -308,7 +306,7 @@ public function getCurrentClass(): ReflectionClass * @throws NoObjectProvided * @throws ObjectNotInstanceOfClass */ - public function getClosure(?object $object = null): Closure + public function getClosure(object|null $object = null): Closure { $declaringClassName = $this->getDeclaringClass()->getName(); @@ -328,7 +326,7 @@ public function getClosure(?object $object = null): Closure * @throws NoObjectProvided * @throws ObjectNotInstanceOfClass */ - public function invoke(?object $object = null, mixed ...$args): mixed + public function invoke(object|null $object = null, mixed ...$args): mixed { return $this->invokeArgs($object, $args); } @@ -340,7 +338,7 @@ public function invoke(?object $object = null, mixed ...$args): mixed * @throws NoObjectProvided * @throws ObjectNotInstanceOfClass */ - public function invokeArgs(?object $object = null, array $args = []): mixed + public function invokeArgs(object|null $object = null, array $args = []): mixed { $implementingClassName = $this->getImplementingClass()->getName(); @@ -353,9 +351,7 @@ public function invokeArgs(?object $object = null, array $args = []): mixed return $this->callObjectMethod($this->assertObject($object), $args); } - /** - * @param array $args - */ + /** @param array $args */ private function callStaticMethod(array $args): mixed { $implementingClassName = $this->getImplementingClass()->getName(); @@ -368,9 +364,7 @@ private function callStaticMethod(array $args): mixed return $closure->__invoke($implementingClassName, $this->getName(), $args); } - /** - * @param array $args - */ + /** @param array $args */ private function callObjectMethod(object $object, array $args): mixed { /** @psalm-suppress MixedMethodCall */ @@ -381,9 +375,7 @@ private function callObjectMethod(object $object, array $args): mixed return $closure->__invoke($object, $this->getName(), $args); } - /** - * @throws ClassDoesNotExist - */ + /** @throws ClassDoesNotExist */ private function assertClassExist(string $className): void { if (! ClassExistenceChecker::classExists($className) && ! ClassExistenceChecker::traitExists($className)) { @@ -395,7 +387,7 @@ private function assertClassExist(string $className): void * @throws NoObjectProvided * @throws ObjectNotInstanceOfClass */ - private function assertObject(?object $object): object + private function assertObject(object|null $object): object { if ($object === null) { throw NoObjectProvided::create(); diff --git a/src/Reflection/ReflectionObject.php b/src/Reflection/ReflectionObject.php index 1b09fb2d4..a2e29d735 100644 --- a/src/Reflection/ReflectionObject.php +++ b/src/Reflection/ReflectionObject.php @@ -68,7 +68,7 @@ public static function createFromInstance(object $instance): ReflectionClass * * @return array */ - private function getRuntimeProperties(?int $filter = null): array + private function getRuntimeProperties(int|null $filter = null): array { if (! $this->reflectionClass->isInstance($this->object)) { throw new InvalidArgumentException('Cannot reflect runtime properties of a separate class'); @@ -140,7 +140,7 @@ public function inNamespace(): bool return $this->reflectionClass->inNamespace(); } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return $this->reflectionClass->getExtensionName(); } @@ -148,7 +148,7 @@ public function getExtensionName(): ?string /** * {@inheritdoc} */ - public function getMethods(?int $filter = null): array + public function getMethods(int|null $filter = null): array { return $this->reflectionClass->getMethods($filter); } @@ -156,7 +156,7 @@ public function getMethods(?int $filter = null): array /** * {@inheritdoc} */ - public function getImmediateMethods(?int $filter = null): array + public function getImmediateMethods(int|null $filter = null): array { return $this->reflectionClass->getImmediateMethods($filter); } @@ -197,7 +197,7 @@ public function hasConstant(string $name): bool return $this->reflectionClass->hasConstant($name); } - public function getReflectionConstant(string $name): ?ReflectionClassConstant + public function getReflectionConstant(string $name): ReflectionClassConstant|null { return $this->reflectionClass->getReflectionConstant($name); } @@ -226,7 +226,7 @@ public function getConstructor(): ReflectionMethod /** * {@inheritdoc} */ - public function getProperties(?int $filter = null): array + public function getProperties(int|null $filter = null): array { return array_merge( $this->reflectionClass->getProperties($filter), @@ -237,7 +237,7 @@ public function getProperties(?int $filter = null): array /** * {@inheritdoc} */ - public function getImmediateProperties(?int $filter = null): array + public function getImmediateProperties(int|null $filter = null): array { return array_merge( $this->reflectionClass->getImmediateProperties($filter), @@ -245,7 +245,7 @@ public function getImmediateProperties(?int $filter = null): array ); } - public function getProperty(string $name): ?ReflectionProperty + public function getProperty(string $name): ReflectionProperty|null { $runtimeProperties = $this->getRuntimeProperties(); @@ -274,7 +274,7 @@ public function getDefaultProperties(): array ); } - public function getFileName(): ?string + public function getFileName(): string|null { return $this->reflectionClass->getFileName(); } @@ -304,7 +304,7 @@ public function getEndColumn(): int return $this->reflectionClass->getEndColumn(); } - public function getParentClass(): ?ReflectionClass + public function getParentClass(): ReflectionClass|null { return $this->reflectionClass->getParentClass(); } @@ -473,22 +473,18 @@ public function getAst(): ClassNode|InterfaceNode|TraitNode|EnumNode return $this->reflectionClass->getAst(); } - public function getDeclaringNamespaceAst(): ?Namespace_ + public function getDeclaringNamespaceAst(): Namespace_|null { return $this->reflectionClass->getDeclaringNamespaceAst(); } - /** - * @return list - */ + /** @return list */ public function getAttributes(): array { return $this->reflectionClass->getAttributes(); } - /** - * @return list - */ + /** @return list */ public function getAttributesByName(string $name): array { return $this->reflectionClass->getAttributesByName($name); diff --git a/src/Reflection/ReflectionParameter.php b/src/Reflection/ReflectionParameter.php index 2d47fc918..17155e80e 100644 --- a/src/Reflection/ReflectionParameter.php +++ b/src/Reflection/ReflectionParameter.php @@ -32,7 +32,7 @@ class ReflectionParameter { private bool $isOptional; - private ?CompiledValue $compiledDefaultValue = null; + private CompiledValue|null $compiledDefaultValue = null; private function __construct( private Reflector $reflector, @@ -169,9 +169,7 @@ public static function createFromNode( ); } - /** - * @throws LogicException - */ + /** @throws LogicException */ private function getCompiledDefaultValue(): CompiledValue { if (! $this->isDefaultValueAvailable()) { @@ -213,7 +211,7 @@ public function getDeclaringFunction(): ReflectionMethod|ReflectionFunction * * This will return null if the declaring function is not a method. */ - public function getDeclaringClass(): ?ReflectionClass + public function getDeclaringClass(): ReflectionClass|null { if ($this->function instanceof ReflectionMethod) { return $this->function->getDeclaringClass(); @@ -222,7 +220,7 @@ public function getDeclaringClass(): ?ReflectionClass return null; } - public function getImplementingClass(): ?ReflectionClass + public function getImplementingClass(): ReflectionClass|null { if ($this->function instanceof ReflectionMethod) { return $this->function->getImplementingClass(); @@ -409,17 +407,13 @@ public function isPromoted(): bool return $this->node->flags !== 0; } - /** - * @throws LogicException - */ + /** @throws LogicException */ public function isDefaultValueConstant(): bool { return $this->getCompiledDefaultValue()->constantName !== null; } - /** - * @throws LogicException - */ + /** @throws LogicException */ public function getDefaultValueConstantName(): string { $compiledDefaultValue = $this->getCompiledDefaultValue(); @@ -434,7 +428,7 @@ public function getDefaultValueConstantName(): string /** * Gets a ReflectionClass for the type hint (returns null if not a class) */ - public function getClass(): ?ReflectionClass + public function getClass(): ReflectionClass|null { $type = $this->getType(); @@ -460,7 +454,7 @@ public function getClass(): ?ReflectionClass return $this->getClassFromNamedType($type); } - private function getClassFromNamedType(ReflectionNamedType $namedType): ?ReflectionClass + private function getClassFromNamedType(ReflectionNamedType $namedType): ReflectionClass|null { try { return $namedType->getClass(); @@ -519,17 +513,13 @@ public function getAst(): ParamNode return $this->node; } - /** - * @return list - */ + /** @return list */ public function getAttributes(): array { return ReflectionAttributeHelper::createAttributes($this->reflector, $this); } - /** - * @return list - */ + /** @return list */ public function getAttributesByName(string $name): array { return ReflectionAttributeHelper::filterAttributesByName($this->getAttributes(), $name); diff --git a/src/Reflection/ReflectionProperty.php b/src/Reflection/ReflectionProperty.php index 77f56091a..3554c2b13 100644 --- a/src/Reflection/ReflectionProperty.php +++ b/src/Reflection/ReflectionProperty.php @@ -37,7 +37,7 @@ class ReflectionProperty { - private ?CompiledValue $compiledDefaultValue = null; + private CompiledValue|null $compiledDefaultValue = null; private function __construct( private Reflector $reflector, @@ -184,7 +184,7 @@ public function isPromoted(): bool return $this->isPromoted; } - public function isInitialized(?object $object = null): bool + public function isInitialized(object|null $object = null): bool { if ($object === null && $this->isStatic()) { return ! $this->hasType() || $this->hasDefaultValue(); @@ -301,17 +301,13 @@ public function getPositionInAst(): int return $this->positionInNode; } - /** - * @return list - */ + /** @return list */ public function getAttributes(): array { return ReflectionAttributeHelper::createAttributes($this->reflector, $this); } - /** - * @return list - */ + /** @return list */ public function getAttributesByName(string $name): array { return ReflectionAttributeHelper::filterAttributesByName($this->getAttributes(), $name); @@ -342,7 +338,7 @@ public function __clone() * @throws NoObjectProvided * @throws ObjectNotInstanceOfClass */ - public function getValue(?object $object = null): mixed + public function getValue(object|null $object = null): mixed { $implementingClassName = $this->getImplementingClass()->getName(); diff --git a/src/Reflection/ReflectionType.php b/src/Reflection/ReflectionType.php index d99edbd35..ca44a71e9 100644 --- a/src/Reflection/ReflectionType.php +++ b/src/Reflection/ReflectionType.php @@ -19,9 +19,7 @@ protected function __construct( ) { } - /** - * @internal - */ + /** @internal */ public static function createFromNode( Reflector $reflector, ReflectionParameter|ReflectionMethod|ReflectionFunction|ReflectionEnum|ReflectionProperty $owner, @@ -73,9 +71,7 @@ public static function createFromNode( return new ReflectionUnionType($reflector, $owner, new UnionType($types)); } - /** - * @internal - */ + /** @internal */ public function getOwner(): ReflectionParameter|ReflectionMethod|ReflectionFunction|ReflectionEnum|ReflectionProperty { return $this->owner; diff --git a/src/Reflection/ReflectionUnionType.php b/src/Reflection/ReflectionUnionType.php index eedcc3f45..bf2e3875c 100644 --- a/src/Reflection/ReflectionUnionType.php +++ b/src/Reflection/ReflectionUnionType.php @@ -33,9 +33,7 @@ public function __construct( }, $type->types)); } - /** - * @return list - */ + /** @return list */ public function getTypes(): array { return $this->types; diff --git a/src/Reflection/StringCast/ReflectionAttributeStringCast.php b/src/Reflection/StringCast/ReflectionAttributeStringCast.php index 751f18f93..f5fe4ea9e 100644 --- a/src/Reflection/StringCast/ReflectionAttributeStringCast.php +++ b/src/Reflection/StringCast/ReflectionAttributeStringCast.php @@ -14,9 +14,7 @@ use function substr; use function var_export; -/** - * @internal - */ +/** @internal */ final class ReflectionAttributeStringCast { public static function toString(ReflectionAttribute $attributeReflection): string @@ -33,9 +31,7 @@ public static function toString(ReflectionAttribute $attributeReflection): strin ); } - /** - * @param array $arguments - */ + /** @param array $arguments */ private static function argumentsToString(array $arguments): string { if ($arguments === []) { diff --git a/src/Reflection/StringCast/ReflectionClassConstantStringCast.php b/src/Reflection/StringCast/ReflectionClassConstantStringCast.php index 4cc1a9135..8588cf4df 100644 --- a/src/Reflection/StringCast/ReflectionClassConstantStringCast.php +++ b/src/Reflection/StringCast/ReflectionClassConstantStringCast.php @@ -10,9 +10,7 @@ use function is_array; use function sprintf; -/** - * @internal - */ +/** @internal */ final class ReflectionClassConstantStringCast { public static function toString(ReflectionClassConstant $constantReflection): string diff --git a/src/Reflection/StringCast/ReflectionClassStringCast.php b/src/Reflection/StringCast/ReflectionClassStringCast.php index 4a8ee2465..0195290f5 100644 --- a/src/Reflection/StringCast/ReflectionClassStringCast.php +++ b/src/Reflection/StringCast/ReflectionClassStringCast.php @@ -24,9 +24,7 @@ use function strtolower; use function trim; -/** - * @internal - */ +/** @internal */ final class ReflectionClassStringCast { public static function toString(ReflectionClass $classReflection): string @@ -156,9 +154,7 @@ private static function constantsToString(array $constants, array $enumCases): s return self::itemsToString($items); } - /** - * @param array $properties - */ + /** @param array $properties */ private static function propertiesToString(array $properties): string { if ($properties === []) { @@ -168,9 +164,7 @@ private static function propertiesToString(array $properties): string return self::itemsToString(array_map(static fn (ReflectionProperty $propertyReflection): string => ReflectionPropertyStringCast::toString($propertyReflection), $properties)); } - /** - * @param array $methods - */ + /** @param array $methods */ private static function methodsToString(array $methods, int $emptyLinesAmongItems = 1): string { if ($methods === []) { @@ -180,9 +174,7 @@ private static function methodsToString(array $methods, int $emptyLinesAmongItem return self::itemsToString(array_map(static fn (ReflectionMethod $method): string => ReflectionMethodStringCast::toString($method), $methods), $emptyLinesAmongItems); } - /** - * @param array $items - */ + /** @param array $items */ private static function itemsToString(array $items, int $emptyLinesAmongItems = 1): string { $string = implode(str_repeat("\n", $emptyLinesAmongItems), $items); @@ -195,41 +187,31 @@ private static function indent(): string return str_repeat(' ', 4); } - /** - * @return array - */ + /** @return array */ private static function getStaticProperties(ReflectionClass $classReflection): array { return array_filter($classReflection->getProperties(), static fn (ReflectionProperty $propertyReflection): bool => $propertyReflection->isStatic()); } - /** - * @return array - */ + /** @return array */ private static function getStaticMethods(ReflectionClass $classReflection): array { return array_filter($classReflection->getMethods(), static fn (ReflectionMethod $methodReflection): bool => $methodReflection->isStatic()); } - /** - * @return array - */ + /** @return array */ private static function getDefaultProperties(ReflectionClass $classReflection): array { return array_filter($classReflection->getProperties(), static fn (ReflectionProperty $propertyReflection): bool => ! $propertyReflection->isStatic() && $propertyReflection->isDefault()); } - /** - * @return array - */ + /** @return array */ private static function getDynamicProperties(ReflectionClass $classReflection): array { return array_filter($classReflection->getProperties(), static fn (ReflectionProperty $propertyReflection): bool => ! $propertyReflection->isStatic() && ! $propertyReflection->isDefault()); } - /** - * @return array - */ + /** @return array */ private static function getMethods(ReflectionClass $classReflection): array { return array_filter($classReflection->getMethods(), static fn (ReflectionMethod $methodReflection): bool => ! $methodReflection->isStatic()); diff --git a/src/Reflection/StringCast/ReflectionEnumCaseStringCast.php b/src/Reflection/StringCast/ReflectionEnumCaseStringCast.php index 2d498c7ba..314048dff 100644 --- a/src/Reflection/StringCast/ReflectionEnumCaseStringCast.php +++ b/src/Reflection/StringCast/ReflectionEnumCaseStringCast.php @@ -9,9 +9,7 @@ use function gettype; use function sprintf; -/** - * @internal - */ +/** @internal */ final class ReflectionEnumCaseStringCast { public static function toString(ReflectionEnumCase $enumCaseReflection): string diff --git a/src/Reflection/StringCast/ReflectionFunctionStringCast.php b/src/Reflection/StringCast/ReflectionFunctionStringCast.php index efc82e487..3810c0e18 100644 --- a/src/Reflection/StringCast/ReflectionFunctionStringCast.php +++ b/src/Reflection/StringCast/ReflectionFunctionStringCast.php @@ -13,9 +13,7 @@ use function is_string; use function sprintf; -/** - * @internal - */ +/** @internal */ final class ReflectionFunctionStringCast { public static function toString(ReflectionFunction $functionReflection): string diff --git a/src/Reflection/StringCast/ReflectionMethodStringCast.php b/src/Reflection/StringCast/ReflectionMethodStringCast.php index d2669a3e8..2057252c8 100644 --- a/src/Reflection/StringCast/ReflectionMethodStringCast.php +++ b/src/Reflection/StringCast/ReflectionMethodStringCast.php @@ -14,9 +14,7 @@ use function is_string; use function sprintf; -/** - * @internal - */ +/** @internal */ final class ReflectionMethodStringCast { public static function toString(ReflectionMethod $methodReflection): string diff --git a/src/Reflection/StringCast/ReflectionParameterStringCast.php b/src/Reflection/StringCast/ReflectionParameterStringCast.php index 1e1f696c2..4c103a025 100644 --- a/src/Reflection/StringCast/ReflectionParameterStringCast.php +++ b/src/Reflection/StringCast/ReflectionParameterStringCast.php @@ -13,9 +13,7 @@ use function substr; use function var_export; -/** - * @internal - */ +/** @internal */ final class ReflectionParameterStringCast { public static function toString(ReflectionParameter $parameterReflection): string diff --git a/src/Reflection/StringCast/ReflectionPropertyStringCast.php b/src/Reflection/StringCast/ReflectionPropertyStringCast.php index 68a25583a..a21c3e4ea 100644 --- a/src/Reflection/StringCast/ReflectionPropertyStringCast.php +++ b/src/Reflection/StringCast/ReflectionPropertyStringCast.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @internal - */ +/** @internal */ final class ReflectionPropertyStringCast { public static function toString(ReflectionProperty $propertyReflection): string diff --git a/src/Reflection/StringCast/ReflectionTypeStringCast.php b/src/Reflection/StringCast/ReflectionTypeStringCast.php index 3ad37465b..e708a36b5 100644 --- a/src/Reflection/StringCast/ReflectionTypeStringCast.php +++ b/src/Reflection/StringCast/ReflectionTypeStringCast.php @@ -12,9 +12,7 @@ use function array_values; use function count; -/** - * @internal - */ +/** @internal */ final class ReflectionTypeStringCast { public static function toString( diff --git a/src/SourceLocator/Ast/FindReflectionsInTree.php b/src/SourceLocator/Ast/FindReflectionsInTree.php index 9bb44913e..579d10ee6 100644 --- a/src/SourceLocator/Ast/FindReflectionsInTree.php +++ b/src/SourceLocator/Ast/FindReflectionsInTree.php @@ -24,9 +24,7 @@ use function assert; use function count; -/** - * @internal - */ +/** @internal */ final class FindReflectionsInTree { public function __construct(private AstConversionStrategy $astConversionStrategy) @@ -51,7 +49,7 @@ public function __invoke( /** @var list */ private array $reflections = []; - private ?Namespace_ $currentNamespace = null; + private Namespace_|null $currentNamespace = null; public function __construct( private Reflector $reflector, @@ -150,9 +148,7 @@ public function leaveNode(Node $node) return null; } - /** - * @return list - */ + /** @return list */ public function getReflections(): array { return $this->reflections; diff --git a/src/SourceLocator/Ast/Locator.php b/src/SourceLocator/Ast/Locator.php index 84627b4f3..0a19004be 100644 --- a/src/SourceLocator/Ast/Locator.php +++ b/src/SourceLocator/Ast/Locator.php @@ -17,9 +17,7 @@ use function strtolower; -/** - * @internal - */ +/** @internal */ class Locator { private FindReflectionsInTree $findReflectionsInTree; @@ -83,7 +81,7 @@ public function findReflectionsOfType( * * @throws IdentifierNotFound */ - private function findInArray(array $reflections, Identifier $identifier, ?string $name): Reflection + private function findInArray(array $reflections, Identifier $identifier, string|null $name): Reflection { if ($name === null) { throw IdentifierNotFound::fromIdentifier($identifier); diff --git a/src/SourceLocator/Ast/Parser/MemoizingParser.php b/src/SourceLocator/Ast/Parser/MemoizingParser.php index d533d4605..d0e28fcbb 100644 --- a/src/SourceLocator/Ast/Parser/MemoizingParser.php +++ b/src/SourceLocator/Ast/Parser/MemoizingParser.php @@ -15,9 +15,7 @@ use function strlen; use function unserialize; -/** - * @internal - */ +/** @internal */ final class MemoizingParser implements Parser { /** @var array indexed by source hash */ @@ -27,10 +25,7 @@ public function __construct(private Parser $wrappedParser) { } - /** - * {@inheritDoc} - */ - public function parse(string $code, ?ErrorHandler $errorHandler = null): ?array + public function parse(string $code, ErrorHandler|null $errorHandler = null): array|null { // note: this code is mathematically buggy by default, as we are using a hash to identify // cache entries. The string length is added to further reduce likeliness (although diff --git a/src/SourceLocator/Ast/Strategy/AstConversionStrategy.php b/src/SourceLocator/Ast/Strategy/AstConversionStrategy.php index cf93768d7..db22e2335 100644 --- a/src/SourceLocator/Ast/Strategy/AstConversionStrategy.php +++ b/src/SourceLocator/Ast/Strategy/AstConversionStrategy.php @@ -11,9 +11,7 @@ use Roave\BetterReflection\Reflector\Reflector; use Roave\BetterReflection\SourceLocator\Located\LocatedSource; -/** - * @internal - */ +/** @internal */ interface AstConversionStrategy { /** @@ -24,7 +22,7 @@ public function __invoke( Reflector $reflector, Node\Stmt\Class_|Node\Stmt\Interface_|Node\Stmt\Trait_|Node\Stmt\Enum_|Node\Stmt\Function_|Node\Expr\Closure|Node\Expr\ArrowFunction|Node\Stmt\Const_|Node\Expr\FuncCall $node, LocatedSource $locatedSource, - ?Node\Stmt\Namespace_ $namespace, - ?int $positionInNode = null, + Node\Stmt\Namespace_|null $namespace, + int|null $positionInNode = null, ): ReflectionClass|ReflectionConstant|ReflectionFunction; } diff --git a/src/SourceLocator/Ast/Strategy/NodeToReflection.php b/src/SourceLocator/Ast/Strategy/NodeToReflection.php index 3c0410fa1..e64df4b66 100644 --- a/src/SourceLocator/Ast/Strategy/NodeToReflection.php +++ b/src/SourceLocator/Ast/Strategy/NodeToReflection.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\Reflector\Reflector; use Roave\BetterReflection\SourceLocator\Located\LocatedSource; -/** - * @internal - */ +/** @internal */ class NodeToReflection implements AstConversionStrategy { /** @@ -25,8 +23,8 @@ public function __invoke( Reflector $reflector, Node\Stmt\Class_|Node\Stmt\Interface_|Node\Stmt\Trait_|Node\Stmt\Enum_|Node\Stmt\Function_|Node\Expr\Closure|Node\Expr\ArrowFunction|Node\Stmt\Const_|Node\Expr\FuncCall $node, LocatedSource $locatedSource, - ?Node\Stmt\Namespace_ $namespace, - ?int $positionInNode = null, + Node\Stmt\Namespace_|null $namespace, + int|null $positionInNode = null, ): ReflectionClass|ReflectionConstant|ReflectionFunction { if ($node instanceof Node\Stmt\Enum_) { return ReflectionEnum::createFromNode( diff --git a/src/SourceLocator/FileChecker.php b/src/SourceLocator/FileChecker.php index 8bb239401..3f7739330 100644 --- a/src/SourceLocator/FileChecker.php +++ b/src/SourceLocator/FileChecker.php @@ -12,9 +12,7 @@ class FileChecker { - /** - * @throws InvalidFileLocation - */ + /** @throws InvalidFileLocation */ public static function assertReadableFile(string $filename): void { if (empty($filename)) { diff --git a/src/SourceLocator/Located/AliasLocatedSource.php b/src/SourceLocator/Located/AliasLocatedSource.php index eaf5c26fe..2d616fa8d 100644 --- a/src/SourceLocator/Located/AliasLocatedSource.php +++ b/src/SourceLocator/Located/AliasLocatedSource.php @@ -4,17 +4,15 @@ namespace Roave\BetterReflection\SourceLocator\Located; -/** - * @internal - */ +/** @internal */ class AliasLocatedSource extends LocatedSource { - public function __construct(string $source, string $name, ?string $filename, private string $aliasName) + public function __construct(string $source, string $name, string|null $filename, private string $aliasName) { parent::__construct($source, $name, $filename); } - public function getAliasName(): ?string + public function getAliasName(): string|null { return $this->aliasName; } diff --git a/src/SourceLocator/Located/AnonymousLocatedSource.php b/src/SourceLocator/Located/AnonymousLocatedSource.php index 65fe48a49..d877cb855 100644 --- a/src/SourceLocator/Located/AnonymousLocatedSource.php +++ b/src/SourceLocator/Located/AnonymousLocatedSource.php @@ -4,9 +4,7 @@ namespace Roave\BetterReflection\SourceLocator\Located; -/** - * @internal - */ +/** @internal */ class AnonymousLocatedSource extends LocatedSource { public function __construct(string $source, string $filename) diff --git a/src/SourceLocator/Located/EvaledLocatedSource.php b/src/SourceLocator/Located/EvaledLocatedSource.php index 8e2d4bdd7..7d81083f1 100644 --- a/src/SourceLocator/Located/EvaledLocatedSource.php +++ b/src/SourceLocator/Located/EvaledLocatedSource.php @@ -4,9 +4,7 @@ namespace Roave\BetterReflection\SourceLocator\Located; -/** - * @internal - */ +/** @internal */ class EvaledLocatedSource extends LocatedSource { public function isEvaled(): bool diff --git a/src/SourceLocator/Located/InternalLocatedSource.php b/src/SourceLocator/Located/InternalLocatedSource.php index de92c4ad2..760a57d0c 100644 --- a/src/SourceLocator/Located/InternalLocatedSource.php +++ b/src/SourceLocator/Located/InternalLocatedSource.php @@ -4,9 +4,7 @@ namespace Roave\BetterReflection\SourceLocator\Located; -/** - * @internal - */ +/** @internal */ class InternalLocatedSource extends LocatedSource { public function __construct(string $source, string $name, private string $extensionName) @@ -19,7 +17,7 @@ public function isInternal(): bool return true; } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return $this->extensionName; } diff --git a/src/SourceLocator/Located/LocatedSource.php b/src/SourceLocator/Located/LocatedSource.php index c0dbc434c..1fac1ff97 100644 --- a/src/SourceLocator/Located/LocatedSource.php +++ b/src/SourceLocator/Located/LocatedSource.php @@ -16,13 +16,13 @@ */ class LocatedSource { - private ?string $filename; + private string|null $filename; /** * @throws InvalidArgumentException * @throws InvalidFileLocation */ - public function __construct(private string $source, private ?string $name, ?string $filename = null) + public function __construct(private string $source, private string|null $name, string|null $filename = null) { if ($filename !== null) { FileChecker::assertReadableFile($filename); @@ -38,12 +38,12 @@ public function getSource(): string return $this->source; } - public function getName(): ?string + public function getName(): string|null { return $this->name; } - public function getFileName(): ?string + public function getFileName(): string|null { return $this->filename; } @@ -56,7 +56,7 @@ public function isInternal(): bool return false; } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return null; } @@ -69,7 +69,7 @@ public function isEvaled(): bool return false; } - public function getAliasName(): ?string + public function getAliasName(): string|null { return null; } diff --git a/src/SourceLocator/SourceStubber/AggregateSourceStubber.php b/src/SourceLocator/SourceStubber/AggregateSourceStubber.php index 2130439a6..9e65e2ce6 100644 --- a/src/SourceLocator/SourceStubber/AggregateSourceStubber.php +++ b/src/SourceLocator/SourceStubber/AggregateSourceStubber.php @@ -18,10 +18,8 @@ public function __construct(SourceStubber $sourceStubber, SourceStubber ...$othe $this->sourceStubbers = array_values(array_merge([$sourceStubber], $otherSourceStubbers)); } - /** - * @param class-string|trait-string $className - */ - public function generateClassStub(string $className): ?StubData + /** @param class-string|trait-string $className */ + public function generateClassStub(string $className): StubData|null { foreach ($this->sourceStubbers as $sourceStubber) { $stubData = $sourceStubber->generateClassStub($className); @@ -34,7 +32,7 @@ public function generateClassStub(string $className): ?StubData return null; } - public function generateFunctionStub(string $functionName): ?StubData + public function generateFunctionStub(string $functionName): StubData|null { foreach ($this->sourceStubbers as $sourceStubber) { $stubData = $sourceStubber->generateFunctionStub($functionName); @@ -47,8 +45,8 @@ public function generateFunctionStub(string $functionName): ?StubData return null; } - public function generateConstantStub(string $constantName): ?StubData + public function generateConstantStub(string $constantName): StubData|null { - return array_reduce($this->sourceStubbers, static fn (?StubData $stubData, SourceStubber $sourceStubber): ?StubData => $stubData ?? $sourceStubber->generateConstantStub($constantName), null); + return array_reduce($this->sourceStubbers, static fn (StubData|null $stubData, SourceStubber $sourceStubber): StubData|null => $stubData ?? $sourceStubber->generateConstantStub($constantName), null); } } diff --git a/src/SourceLocator/SourceStubber/PhpStormStubs/CachingVisitor.php b/src/SourceLocator/SourceStubber/PhpStormStubs/CachingVisitor.php index 7f92b00e7..04ffead41 100644 --- a/src/SourceLocator/SourceStubber/PhpStormStubs/CachingVisitor.php +++ b/src/SourceLocator/SourceStubber/PhpStormStubs/CachingVisitor.php @@ -21,14 +21,12 @@ use function strtolower; use function strtoupper; -/** - * @internal - */ +/** @internal */ class CachingVisitor extends NodeVisitorAbstract { private const TRUE_FALSE_NULL = ['true', 'false', 'null']; - private ?Node\Stmt\Namespace_ $currentNamespace = null; + private Node\Stmt\Namespace_|null $currentNamespace = null; /** @var array */ private array $classNodes = []; @@ -43,7 +41,7 @@ public function __construct(private BuilderFactory $builderFactory) { } - public function enterNode(Node $node): ?int + public function enterNode(Node $node): int|null { if ($node instanceof Node\Stmt\Namespace_) { $this->currentNamespace = $node; @@ -155,25 +153,19 @@ public function leaveNode(Node $node) return null; } - /** - * @return array - */ + /** @return array */ public function getClassNodes(): array { return $this->classNodes; } - /** - * @return array> - */ + /** @return array> */ public function getFunctionNodes(): array { return $this->functionNodes; } - /** - * @return array - */ + /** @return array */ public function getConstantNodes(): array { return $this->constantNodes; diff --git a/src/SourceLocator/SourceStubber/PhpStormStubsSourceStubber.php b/src/SourceLocator/SourceStubber/PhpStormStubsSourceStubber.php index 33697fb34..181f2c638 100644 --- a/src/SourceLocator/SourceStubber/PhpStormStubsSourceStubber.php +++ b/src/SourceLocator/SourceStubber/PhpStormStubsSourceStubber.php @@ -49,9 +49,7 @@ use const PHP_VERSION_ID; -/** - * @internal - */ +/** @internal */ final class PhpStormStubsSourceStubber implements SourceStubber { private const BUILDER_OPTIONS = ['shortArraySyntax' => true]; @@ -144,7 +142,7 @@ final class PhpStormStubsSourceStubber implements SourceStubber private NodeTraverser $nodeTraverser; - private ?string $stubsDirectory = null; + private string|null $stubsDirectory = null; private CachingVisitor $cachingVisitor; @@ -205,10 +203,8 @@ public function __construct(private Parser $phpParser, private int $phpVersion = self::$mapsInitialized = true; } - /** - * @param class-string|trait-string $className - */ - public function generateClassStub(string $className): ?StubData + /** @param class-string|trait-string $className */ + public function generateClassStub(string $className): StubData|null { $classNodeData = $this->getClassNodeData($className); @@ -242,10 +238,8 @@ public function generateClassStub(string $className): ?StubData return new StubData($stub, $extension); } - /** - * @return array{0: Node\Stmt\ClassLike, 1: Node\Stmt\Namespace_|null}|null - */ - private function getClassNodeData(string $className): ?array + /** @return array{0: Node\Stmt\ClassLike, 1: Node\Stmt\Namespace_|null}|null */ + private function getClassNodeData(string $className): array|null { $lowercaseClassName = strtolower($className); @@ -268,7 +262,7 @@ private function getClassNodeData(string $className): ?array return $this->classNodes[$lowercaseClassName]; } - public function generateFunctionStub(string $functionName): ?StubData + public function generateFunctionStub(string $functionName): StubData|null { $lowercaseFunctionName = strtolower($functionName); @@ -298,7 +292,7 @@ public function generateFunctionStub(string $functionName): ?StubData return new StubData($this->createStub($functionNodeData[0], $functionNodeData[1]), $extension); } - public function generateConstantStub(string $constantName): ?StubData + public function generateConstantStub(string $constantName): StubData|null { $lowercaseConstantName = strtolower($constantName); @@ -398,7 +392,7 @@ private function parseFile(string $filePath): void } } - private function createStub(Node\Stmt\ClassLike|Node\Stmt\Function_|Node\Stmt\Const_|Node\Expr\FuncCall $node, ?Node\Stmt\Namespace_ $namespaceNode): string + private function createStub(Node\Stmt\ClassLike|Node\Stmt\Function_|Node\Stmt\Const_|Node\Expr\FuncCall $node, Node\Stmt\Namespace_|null $namespaceNode): string { if (! ($node instanceof Node\Expr\FuncCall)) { $this->addDeprecatedDocComment($node); @@ -689,9 +683,7 @@ private function isSupportedInPhpVersion( return $toVersion === null || $toVersion >= $this->phpVersion; } - /** - * @return array{0: int|null, 1: int|null} - */ + /** @return array{0: int|null, 1: int|null} */ private function getSupportedPhpVersions( Node\Stmt\ClassLike|Node\Stmt\Function_|Node\Stmt\Const_|Node\Expr\FuncCall|Node\Stmt\ClassConst|Node\Stmt\Property|Node\Stmt\ClassMethod|Node\Param $node, ): array { @@ -734,7 +726,7 @@ private function getSupportedPhpVersions( private function getNodeAttribute( Node\Stmt\ClassLike|Node\Stmt\Function_|Node\Stmt\Const_|Node\Expr\FuncCall|Node\Stmt\ClassConst|Node\Stmt\Property|Node\Stmt\ClassMethod|Node\Param $node, string $attributeName, - ): ?Node\Attribute { + ): Node\Attribute|null { if ($node instanceof Node\Expr\FuncCall || $node instanceof Node\Stmt\Const_) { return null; } diff --git a/src/SourceLocator/SourceStubber/ReflectionSourceStubber.php b/src/SourceLocator/SourceStubber/ReflectionSourceStubber.php index 9986c7150..10e3f209a 100644 --- a/src/SourceLocator/SourceStubber/ReflectionSourceStubber.php +++ b/src/SourceLocator/SourceStubber/ReflectionSourceStubber.php @@ -74,10 +74,8 @@ public function __construct() $this->prettyPrinter = new Standard(self::BUILDER_OPTIONS); } - /** - * @param class-string|trait-string $className - */ - public function generateClassStub(string $className): ?StubData + /** @param class-string|trait-string $className */ + public function generateClassStub(string $className): StubData|null { if (! ClassExistenceChecker::exists($className)) { return null; @@ -126,7 +124,7 @@ public function generateClassStub(string $className): ?StubData return $this->createStubData($stub, $extensionName); } - public function generateFunctionStub(string $functionName): ?StubData + public function generateFunctionStub(string $functionName): StubData|null { if (! function_exists($functionName)) { return null; @@ -158,7 +156,7 @@ public function generateFunctionStub(string $functionName): ?StubData return $this->createStubData($this->generateStubInNamespace($functionNode->getNode(), $functionReflection->getNamespaceName()), $extensionName); } - public function generateConstantStub(string $constantName): ?StubData + public function generateConstantStub(string $constantName): StubData|null { $constantData = $this->findConstantData($constantName); @@ -177,10 +175,8 @@ public function generateConstantStub(string $constantName): ?StubData return $this->createStubData($this->generateStub($constantNode), $extensionName); } - /** - * @return array{0: scalar|list|resource|null, 1: string|null}|null - */ - private function findConstantData(string $constantName): ?array + /** @return array{0: scalar|list|resource|null, 1: string|null}|null */ + private function findConstantData(string $constantName): array|null { /** @var array|resource|null>> $constants */ $constants = get_defined_constants(true); @@ -634,7 +630,7 @@ private function generateStub(Node $node): string ); } - private function createStubData(string $stub, ?string $extensionName): StubData + private function createStubData(string $stub, string|null $extensionName): StubData { return new StubData($stub, $extensionName); } diff --git a/src/SourceLocator/SourceStubber/SourceStubber.php b/src/SourceLocator/SourceStubber/SourceStubber.php index c7469a442..a9a27344a 100644 --- a/src/SourceLocator/SourceStubber/SourceStubber.php +++ b/src/SourceLocator/SourceStubber/SourceStubber.php @@ -4,9 +4,7 @@ namespace Roave\BetterReflection\SourceLocator\SourceStubber; -/** - * @internal - */ +/** @internal */ interface SourceStubber { /** @@ -14,15 +12,15 @@ interface SourceStubber * * @param class-string|trait-string $className */ - public function generateClassStub(string $className): ?StubData; + public function generateClassStub(string $className): StubData|null; /** * Generates stub for given function. Returns null when it cannot generate the stub. */ - public function generateFunctionStub(string $functionName): ?StubData; + public function generateFunctionStub(string $functionName): StubData|null; /** * Generates stub for given constant. Returns null when it cannot generate the stub. */ - public function generateConstantStub(string $constantName): ?StubData; + public function generateConstantStub(string $constantName): StubData|null; } diff --git a/src/SourceLocator/SourceStubber/StubData.php b/src/SourceLocator/SourceStubber/StubData.php index 482f84174..c5c9d117f 100644 --- a/src/SourceLocator/SourceStubber/StubData.php +++ b/src/SourceLocator/SourceStubber/StubData.php @@ -4,12 +4,10 @@ namespace Roave\BetterReflection\SourceLocator\SourceStubber; -/** - * @internal - */ +/** @internal */ class StubData { - public function __construct(private string $stub, private ?string $extensionName) + public function __construct(private string $stub, private string|null $extensionName) { } @@ -18,7 +16,7 @@ public function getStub(): string return $this->stub; } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return $this->extensionName; } diff --git a/src/SourceLocator/Type/AbstractSourceLocator.php b/src/SourceLocator/Type/AbstractSourceLocator.php index 504531d7b..cfc2aadda 100644 --- a/src/SourceLocator/Type/AbstractSourceLocator.php +++ b/src/SourceLocator/Type/AbstractSourceLocator.php @@ -23,7 +23,7 @@ abstract class AbstractSourceLocator implements SourceLocator * return new LocatedSource(['createLocatedSource($identifier); diff --git a/src/SourceLocator/Type/AggregateSourceLocator.php b/src/SourceLocator/Type/AggregateSourceLocator.php index 470cfae14..a5a760093 100644 --- a/src/SourceLocator/Type/AggregateSourceLocator.php +++ b/src/SourceLocator/Type/AggregateSourceLocator.php @@ -14,14 +14,12 @@ class AggregateSourceLocator implements SourceLocator { - /** - * @param list $sourceLocators - */ + /** @param list $sourceLocators */ public function __construct(private array $sourceLocators = []) { } - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { foreach ($this->sourceLocators as $sourceLocator) { $located = $sourceLocator->locateIdentifier($reflector, $identifier); diff --git a/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php b/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php index 6bb66b928..6235452f9 100644 --- a/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php +++ b/src/SourceLocator/Type/AnonymousClassObjectSourceLocator.php @@ -31,16 +31,12 @@ use function file_get_contents; use function strpos; -/** - * @internal - */ +/** @internal */ final class AnonymousClassObjectSourceLocator implements SourceLocator { private CoreReflectionClass $coreClassReflection; - /** - * @throws ReflectionException - */ + /** @throws ReflectionException */ public function __construct(object $anonymousClassObject, private Parser $parser) { $this->coreClassReflection = new CoreReflectionClass($anonymousClassObject); @@ -51,7 +47,7 @@ public function __construct(object $anonymousClassObject, private Parser $parser * * @throws ParseToAstFailure */ - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { return $this->getReflectionClass($reflector, $identifier->getType()); } @@ -66,7 +62,7 @@ public function locateIdentifiersByType(Reflector $reflector, IdentifierType $id return array_filter([$this->getReflectionClass($reflector, $identifierType)]); } - private function getReflectionClass(Reflector $reflector, IdentifierType $identifierType): ?ReflectionClass + private function getReflectionClass(Reflector $reflector, IdentifierType $identifierType): ReflectionClass|null { if (! $identifierType->isClass()) { return null; diff --git a/src/SourceLocator/Type/AutoloadSourceLocator.php b/src/SourceLocator/Type/AutoloadSourceLocator.php index afa8fedab..cad162c74 100644 --- a/src/SourceLocator/Type/AutoloadSourceLocator.php +++ b/src/SourceLocator/Type/AutoloadSourceLocator.php @@ -55,7 +55,7 @@ class AutoloadSourceLocator extends AbstractSourceLocator private NodeVisitorAbstract $constantVisitor; - public function __construct(?AstLocator $astLocator = null, ?Parser $phpParser = null) + public function __construct(AstLocator|null $astLocator = null, Parser|null $phpParser = null) { $betterReflection = new BetterReflection(); @@ -75,7 +75,7 @@ public function __construct(?AstLocator $astLocator = null, ?Parser $phpParser = * @throws InvalidArgumentException * @throws InvalidFileLocation */ - protected function createLocatedSource(Identifier $identifier): ?LocatedSource + protected function createLocatedSource(Identifier $identifier): LocatedSource|null { $locatedData = $this->attemptAutoloadForIdentifier($identifier); @@ -110,7 +110,7 @@ protected function createLocatedSource(Identifier $identifier): ?LocatedSource * * @throws ReflectionException */ - private function attemptAutoloadForIdentifier(Identifier $identifier): ?array + private function attemptAutoloadForIdentifier(Identifier $identifier): array|null { if ($identifier->isClass()) { return $this->locateClassByName($identifier->getName()); @@ -150,7 +150,7 @@ private function attemptAutoloadForIdentifier(Identifier $identifier): ?array * * @throws ReflectionException */ - private function locateClassByName(string $className): ?array + private function locateClassByName(string $className): array|null { if (ClassExistenceChecker::exists($className)) { $classReflection = new ReflectionClass($className); @@ -168,7 +168,7 @@ private function locateClassByName(string $className): ?array try { $locatedFile = FileReadTrapStreamWrapper::withStreamWrapperOverride( - static function () use ($className): ?string { + static function () use ($className): string|null { foreach (spl_autoload_functions() as $preExistingAutoloader) { $preExistingAutoloader($className); @@ -212,7 +212,7 @@ private function silenceErrors(): void * * @throws ReflectionException */ - private function locateFunctionByName(string $functionName): ?array + private function locateFunctionByName(string $functionName): array|null { if (! function_exists($functionName)) { return null; @@ -234,7 +234,7 @@ private function locateFunctionByName(string $functionName): ?array * * @return array{fileName: string, name: string}|null */ - private function locateConstantByName(string $constantName): ?array + private function locateConstantByName(string $constantName): array|null { if (! defined($constantName)) { return null; @@ -285,11 +285,11 @@ private function createConstantVisitor(): NodeVisitorAbstract { return new class () extends NodeVisitorAbstract { - private ?string $constantName = null; + private string|null $constantName = null; private Node\Stmt\Const_|Node\Expr\FuncCall|null $node = null; - public function enterNode(Node $node): ?int + public function enterNode(Node $node): int|null { if ($node instanceof Node\Stmt\Const_) { foreach ($node->consts as $constNode) { @@ -331,10 +331,8 @@ public function setConstantName(string $constantName): void $this->constantName = $constantName; } - /** - * @return Node\Stmt\Const_|Node\Expr\FuncCall|null - */ - public function getNode(): ?Node + /** @return Node\Stmt\Const_|Node\Expr\FuncCall|null */ + public function getNode(): Node|null { return $this->node; } diff --git a/src/SourceLocator/Type/AutoloadSourceLocator/FileReadTrapStreamWrapper.php b/src/SourceLocator/Type/AutoloadSourceLocator/FileReadTrapStreamWrapper.php index 4d7997d5d..f8556f00c 100644 --- a/src/SourceLocator/Type/AutoloadSourceLocator/FileReadTrapStreamWrapper.php +++ b/src/SourceLocator/Type/AutoloadSourceLocator/FileReadTrapStreamWrapper.php @@ -33,7 +33,7 @@ final class FileReadTrapStreamWrapper ]; /** @var list|null */ - private static ?array $registeredStreamWrapperProtocols = null; + private static array|null $registeredStreamWrapperProtocols = null; /** * Read this property to determine the last file on which reads were attempted @@ -41,7 +41,7 @@ final class FileReadTrapStreamWrapper * @psalm-readonly * @psalm-allow-private-mutation */ - public static ?string $autoloadLocatedFile = null; + public static string|null $autoloadLocatedFile = null; /** * @param callable() : ExecutedMethodReturnType $executeMeWithinStreamWrapperOverride diff --git a/src/SourceLocator/Type/ClosureSourceLocator.php b/src/SourceLocator/Type/ClosureSourceLocator.php index de68fd9cf..a0c16b409 100644 --- a/src/SourceLocator/Type/ClosureSourceLocator.php +++ b/src/SourceLocator/Type/ClosureSourceLocator.php @@ -31,9 +31,7 @@ use function file_get_contents; use function strpos; -/** - * @internal - */ +/** @internal */ final class ClosureSourceLocator implements SourceLocator { private CoreFunctionReflection $coreFunctionReflection; @@ -48,7 +46,7 @@ public function __construct(Closure $closure, private Parser $parser) * * @throws ParseToAstFailure */ - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { return $this->getReflectionFunction($reflector, $identifier->getType()); } @@ -63,7 +61,7 @@ public function locateIdentifiersByType(Reflector $reflector, IdentifierType $id return array_filter([$this->getReflectionFunction($reflector, $identifierType)]); } - private function getReflectionFunction(Reflector $reflector, IdentifierType $identifierType): ?ReflectionFunction + private function getReflectionFunction(Reflector $reflector, IdentifierType $identifierType): ReflectionFunction|null { if (! $identifierType->isFunction()) { return null; @@ -84,7 +82,7 @@ private function getReflectionFunction(Reflector $reflector, IdentifierType $ide /** @var list */ private array $closureNodes = []; - private ?Namespace_ $currentNamespace = null; + private Namespace_|null $currentNamespace = null; public function __construct(private string $fileName, private int $startLine) { diff --git a/src/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJson.php b/src/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJson.php index d89df1516..e6dce0c28 100644 --- a/src/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJson.php +++ b/src/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJson.php @@ -30,9 +30,7 @@ use function realpath; use function rtrim; -/** - * @psalm-import-type ComposerAutoload from MakeLocatorForComposerJson - */ +/** @psalm-import-type ComposerAutoload from MakeLocatorForComposerJson */ final class MakeLocatorForComposerJsonAndInstalledJson { public function __invoke(string $installationPath, Locator $astLocator): SourceLocator @@ -49,9 +47,7 @@ public function __invoke(string $installationPath, Locator $astLocator): SourceL throw MissingComposerJson::inProjectPath($installationPath); } - /** - * @psalm-var array{autoload: ComposerAutoload, config: array{vendor-dir?: string}}|null $composer - */ + /** @psalm-var array{autoload: ComposerAutoload, config: array{vendor-dir?: string}}|null $composer */ $composer = json_decode((string) file_get_contents($composerJsonPath), true); $vendorDir = $composer['config']['vendor-dir'] ?? 'vendor'; $vendorDir = rtrim($vendorDir, '/'); @@ -165,9 +161,7 @@ private function packageToFilePaths(array $package): array return $package['autoload']['files'] ?? []; } - /** - * @param array{name: string} $package - */ + /** @param array{name: string} $package */ private function packagePrefixPath(string $trimmedInstallationPath, array $package, string $vendorDir): string { return $trimmedInstallationPath . '/' . $vendorDir . '/' . $package['name'] . '/'; diff --git a/src/SourceLocator/Type/Composer/Factory/MakeLocatorForInstalledJson.php b/src/SourceLocator/Type/Composer/Factory/MakeLocatorForInstalledJson.php index b1f5a1cb8..871b58dfe 100644 --- a/src/SourceLocator/Type/Composer/Factory/MakeLocatorForInstalledJson.php +++ b/src/SourceLocator/Type/Composer/Factory/MakeLocatorForInstalledJson.php @@ -30,9 +30,7 @@ use function realpath; use function rtrim; -/** - * @psalm-import-type ComposerAutoload from MakeLocatorForComposerJson - */ +/** @psalm-import-type ComposerAutoload from MakeLocatorForComposerJson */ final class MakeLocatorForInstalledJson { public function __invoke(string $installationPath, Locator $astLocator): SourceLocator @@ -49,9 +47,7 @@ public function __invoke(string $installationPath, Locator $astLocator): SourceL throw MissingComposerJson::inProjectPath($installationPath); } - /** - * @psalm-var array{autoload: ComposerAutoload, config: array{vendor-dir?: string}}|null $composer - */ + /** @psalm-var array{autoload: ComposerAutoload, config: array{vendor-dir?: string}}|null $composer */ $composer = json_decode((string) file_get_contents($composerJsonPath), true); $vendorDir = $composer['config']['vendor-dir'] ?? 'vendor'; $vendorDir = rtrim($vendorDir, '/'); @@ -161,9 +157,7 @@ private function packageToFilePaths(array $package): array return $package['autoload']['files'] ?? []; } - /** - * @param array{name: string, autoload: ComposerAutoload} $package - */ + /** @param array{name: string, autoload: ComposerAutoload} $package */ private function packagePrefixPath(string $trimmedInstallationPath, array $package, string $vendorDir): string { return $trimmedInstallationPath . '/' . $vendorDir . '/' . $package['name'] . '/'; diff --git a/src/SourceLocator/Type/Composer/PsrAutoloaderLocator.php b/src/SourceLocator/Type/Composer/PsrAutoloaderLocator.php index ddd01cad3..a46664a71 100644 --- a/src/SourceLocator/Type/Composer/PsrAutoloaderLocator.php +++ b/src/SourceLocator/Type/Composer/PsrAutoloaderLocator.php @@ -25,7 +25,7 @@ public function __construct(private PsrAutoloaderMapping $mapping, private Locat { } - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { foreach ($this->mapping->resolvePossibleFilePaths($identifier) as $file) { try { diff --git a/src/SourceLocator/Type/ComposerSourceLocator.php b/src/SourceLocator/Type/ComposerSourceLocator.php index ee8dfdbaf..c0da7ab0c 100644 --- a/src/SourceLocator/Type/ComposerSourceLocator.php +++ b/src/SourceLocator/Type/ComposerSourceLocator.php @@ -34,7 +34,7 @@ public function __construct(private ClassLoader $classLoader, Locator $astLocato * @throws InvalidArgumentException * @throws InvalidFileLocation */ - protected function createLocatedSource(Identifier $identifier): ?LocatedSource + protected function createLocatedSource(Identifier $identifier): LocatedSource|null { if ($identifier->getType()->getName() !== IdentifierType::IDENTIFIER_CLASS) { return null; diff --git a/src/SourceLocator/Type/DirectoriesSourceLocator.php b/src/SourceLocator/Type/DirectoriesSourceLocator.php index 6957effaa..ff3256b26 100644 --- a/src/SourceLocator/Type/DirectoriesSourceLocator.php +++ b/src/SourceLocator/Type/DirectoriesSourceLocator.php @@ -50,7 +50,7 @@ static function (string $directory) use ($astLocator): FileIteratorSourceLocator )); } - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { return $this->aggregateSourceLocator->locateIdentifier($reflector, $identifier); } diff --git a/src/SourceLocator/Type/EvaledCodeSourceLocator.php b/src/SourceLocator/Type/EvaledCodeSourceLocator.php index c3339bc2f..d4f10bc07 100644 --- a/src/SourceLocator/Type/EvaledCodeSourceLocator.php +++ b/src/SourceLocator/Type/EvaledCodeSourceLocator.php @@ -29,7 +29,7 @@ public function __construct(Locator $astLocator, private SourceStubber $stubber) * @throws InvalidArgumentException * @throws InvalidFileLocation */ - protected function createLocatedSource(Identifier $identifier): ?LocatedSource + protected function createLocatedSource(Identifier $identifier): LocatedSource|null { $classReflection = $this->getInternalReflectionClass($identifier); @@ -46,7 +46,7 @@ protected function createLocatedSource(Identifier $identifier): ?LocatedSource return new EvaledLocatedSource($stubData->getStub(), $classReflection->getName()); } - private function getInternalReflectionClass(Identifier $identifier): ?ReflectionClass + private function getInternalReflectionClass(Identifier $identifier): ReflectionClass|null { if (! $identifier->isClass()) { return null; diff --git a/src/SourceLocator/Type/FileIteratorSourceLocator.php b/src/SourceLocator/Type/FileIteratorSourceLocator.php index 75381050e..15a811690 100644 --- a/src/SourceLocator/Type/FileIteratorSourceLocator.php +++ b/src/SourceLocator/Type/FileIteratorSourceLocator.php @@ -27,7 +27,7 @@ */ class FileIteratorSourceLocator implements SourceLocator { - private ?AggregateSourceLocator $aggregateSourceLocator = null; + private AggregateSourceLocator|null $aggregateSourceLocator = null; /** @var Iterator */ private Iterator $fileSystemIterator; @@ -48,14 +48,12 @@ public function __construct(Iterator $fileInfoIterator, private Locator $astLoca $this->fileSystemIterator = $fileInfoIterator; } - /** - * @throws InvalidFileLocation - */ + /** @throws InvalidFileLocation */ private function getAggregatedSourceLocator(): AggregateSourceLocator { return $this->aggregateSourceLocator ?? $this->aggregateSourceLocator = new AggregateSourceLocator(array_values(array_filter(array_map( - function (SplFileInfo $item): ?SingleFileSourceLocator { + function (SplFileInfo $item): SingleFileSourceLocator|null { if (! ($item->isFile() && pathinfo($item->getRealPath(), PATHINFO_EXTENSION) === 'php')) { return null; } @@ -71,7 +69,7 @@ function (SplFileInfo $item): ?SingleFileSourceLocator { * * @throws InvalidFileLocation */ - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { return $this->getAggregatedSourceLocator()->locateIdentifier($reflector, $identifier); } diff --git a/src/SourceLocator/Type/MemoizingSourceLocator.php b/src/SourceLocator/Type/MemoizingSourceLocator.php index 7159265cf..ec2847d70 100644 --- a/src/SourceLocator/Type/MemoizingSourceLocator.php +++ b/src/SourceLocator/Type/MemoizingSourceLocator.php @@ -25,7 +25,7 @@ public function __construct(private SourceLocator $wrappedSourceLocator) { } - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { $cacheKey = sprintf('%s_%s', $this->reflectorCacheKey($reflector), $this->identifierToCacheKey($identifier)); @@ -37,9 +37,7 @@ public function locateIdentifier(Reflector $reflector, Identifier $identifier): = $this->wrappedSourceLocator->locateIdentifier($reflector, $identifier); } - /** - * @return list - */ + /** @return list */ public function locateIdentifiersByType(Reflector $reflector, IdentifierType $identifierType): array { $cacheKey = sprintf('%s_%s', $this->reflectorCacheKey($reflector), $this->identifierTypeToCacheKey($identifierType)); diff --git a/src/SourceLocator/Type/PhpInternalSourceLocator.php b/src/SourceLocator/Type/PhpInternalSourceLocator.php index 358e7edb6..c789685ac 100644 --- a/src/SourceLocator/Type/PhpInternalSourceLocator.php +++ b/src/SourceLocator/Type/PhpInternalSourceLocator.php @@ -26,14 +26,14 @@ public function __construct(Locator $astLocator, private SourceStubber $stubber) * @throws InvalidArgumentException * @throws InvalidFileLocation */ - protected function createLocatedSource(Identifier $identifier): ?LocatedSource + protected function createLocatedSource(Identifier $identifier): LocatedSource|null { return $this->getClassSource($identifier) ?? $this->getFunctionSource($identifier) ?? $this->getConstantSource($identifier); } - private function getClassSource(Identifier $identifier): ?InternalLocatedSource + private function getClassSource(Identifier $identifier): InternalLocatedSource|null { if (! $identifier->isClass()) { return null; @@ -45,7 +45,7 @@ private function getClassSource(Identifier $identifier): ?InternalLocatedSource return $this->createLocatedSourceFromStubData($identifier, $this->stubber->generateClassStub($className)); } - private function getFunctionSource(Identifier $identifier): ?InternalLocatedSource + private function getFunctionSource(Identifier $identifier): InternalLocatedSource|null { if (! $identifier->isFunction()) { return null; @@ -54,7 +54,7 @@ private function getFunctionSource(Identifier $identifier): ?InternalLocatedSour return $this->createLocatedSourceFromStubData($identifier, $this->stubber->generateFunctionStub($identifier->getName())); } - private function getConstantSource(Identifier $identifier): ?InternalLocatedSource + private function getConstantSource(Identifier $identifier): InternalLocatedSource|null { if (! $identifier->isConstant()) { return null; @@ -63,7 +63,7 @@ private function getConstantSource(Identifier $identifier): ?InternalLocatedSour return $this->createLocatedSourceFromStubData($identifier, $this->stubber->generateConstantStub($identifier->getName())); } - private function createLocatedSourceFromStubData(Identifier $identifier, ?StubData $stubData): ?InternalLocatedSource + private function createLocatedSourceFromStubData(Identifier $identifier, StubData|null $stubData): InternalLocatedSource|null { if ($stubData === null) { return null; diff --git a/src/SourceLocator/Type/SingleFileSourceLocator.php b/src/SourceLocator/Type/SingleFileSourceLocator.php index 08260d325..da50ef3ea 100644 --- a/src/SourceLocator/Type/SingleFileSourceLocator.php +++ b/src/SourceLocator/Type/SingleFileSourceLocator.php @@ -23,9 +23,7 @@ */ class SingleFileSourceLocator extends AbstractSourceLocator { - /** - * @throws InvalidFileLocation - */ + /** @throws InvalidFileLocation */ public function __construct(private string $fileName, Locator $astLocator) { FileChecker::assertReadableFile($fileName); @@ -39,7 +37,7 @@ public function __construct(private string $fileName, Locator $astLocator) * @throws InvalidArgumentException * @throws InvalidFileLocation */ - protected function createLocatedSource(Identifier $identifier): ?LocatedSource + protected function createLocatedSource(Identifier $identifier): LocatedSource|null { return new LocatedSource( file_get_contents($this->fileName), diff --git a/src/SourceLocator/Type/SourceLocator.php b/src/SourceLocator/Type/SourceLocator.php index 6b303657d..372b51cd6 100644 --- a/src/SourceLocator/Type/SourceLocator.php +++ b/src/SourceLocator/Type/SourceLocator.php @@ -21,7 +21,7 @@ interface SourceLocator * locate the identifier, it should simply return null. If an exception is * thrown, it will break the Generic Reflector. */ - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection; + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null; /** * Find all identifiers of a type diff --git a/src/SourceLocator/Type/StringSourceLocator.php b/src/SourceLocator/Type/StringSourceLocator.php index 95d91c30b..783ba62e0 100644 --- a/src/SourceLocator/Type/StringSourceLocator.php +++ b/src/SourceLocator/Type/StringSourceLocator.php @@ -20,9 +20,7 @@ */ class StringSourceLocator extends AbstractSourceLocator { - /** - * @throws EmptyPhpSourceCode - */ + /** @throws EmptyPhpSourceCode */ public function __construct(private string $source, Locator $astLocator) { parent::__construct($astLocator); @@ -43,7 +41,7 @@ public function __construct(private string $source, Locator $astLocator) * @throws InvalidArgumentException * @throws InvalidFileLocation */ - protected function createLocatedSource(Identifier $identifier): ?LocatedSource + protected function createLocatedSource(Identifier $identifier): LocatedSource|null { return new LocatedSource( $this->source, diff --git a/src/Util/Autoload/ClassLoader.php b/src/Util/Autoload/ClassLoader.php index 457b7741c..546203a03 100644 --- a/src/Util/Autoload/ClassLoader.php +++ b/src/Util/Autoload/ClassLoader.php @@ -47,9 +47,7 @@ public function addClass(ReflectionClass $reflectionClass): void $this->reflections[$reflectionClass->getName()] = $reflectionClass; } - /** - * @throws FailedToLoadClass - */ + /** @throws FailedToLoadClass */ public function __invoke(string $classToLoad): bool { if (! array_key_exists($classToLoad, $this->reflections)) { diff --git a/src/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailed.php b/src/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailed.php index 6d13d401e..469d0e19b 100644 --- a/src/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailed.php +++ b/src/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailed.php @@ -9,9 +9,7 @@ use function sprintf; -/** - * @deprecated - */ +/** @deprecated */ final class SignatureCheckFailed extends RuntimeException { public static function fromReflectionClass(ReflectionClass $reflectionClass): self diff --git a/src/Util/Autoload/ClassLoaderMethod/LoaderMethodInterface.php b/src/Util/Autoload/ClassLoaderMethod/LoaderMethodInterface.php index 92b2fc4d7..8fcef5942 100644 --- a/src/Util/Autoload/ClassLoaderMethod/LoaderMethodInterface.php +++ b/src/Util/Autoload/ClassLoaderMethod/LoaderMethodInterface.php @@ -6,9 +6,7 @@ use Roave\BetterReflection\Reflection\ReflectionClass; -/** - * @deprecated - */ +/** @deprecated */ interface LoaderMethodInterface { public function __invoke(ReflectionClass $classInfo): void; diff --git a/src/Util/Autoload/ClassPrinter/ClassPrinterInterface.php b/src/Util/Autoload/ClassPrinter/ClassPrinterInterface.php index 92970ca35..f82802a3c 100644 --- a/src/Util/Autoload/ClassPrinter/ClassPrinterInterface.php +++ b/src/Util/Autoload/ClassPrinter/ClassPrinterInterface.php @@ -6,9 +6,7 @@ use Roave\BetterReflection\Reflection\ReflectionClass; -/** - * @deprecated - */ +/** @deprecated */ interface ClassPrinterInterface { public function __invoke(ReflectionClass $classInfo): string; diff --git a/src/Util/Autoload/Exception/ClassAlreadyLoaded.php b/src/Util/Autoload/Exception/ClassAlreadyLoaded.php index 3d360c112..95f7e1031 100644 --- a/src/Util/Autoload/Exception/ClassAlreadyLoaded.php +++ b/src/Util/Autoload/Exception/ClassAlreadyLoaded.php @@ -9,9 +9,7 @@ use function sprintf; -/** - * @deprecated - */ +/** @deprecated */ final class ClassAlreadyLoaded extends LogicException { public static function fromReflectionClass(ReflectionClass $reflectionClass): self diff --git a/src/Util/Autoload/Exception/ClassAlreadyRegistered.php b/src/Util/Autoload/Exception/ClassAlreadyRegistered.php index 02ab1dac7..1662505bf 100644 --- a/src/Util/Autoload/Exception/ClassAlreadyRegistered.php +++ b/src/Util/Autoload/Exception/ClassAlreadyRegistered.php @@ -9,9 +9,7 @@ use function sprintf; -/** - * @deprecated - */ +/** @deprecated */ final class ClassAlreadyRegistered extends LogicException { public static function fromReflectionClass(ReflectionClass $reflectionClass): self diff --git a/src/Util/Autoload/Exception/FailedToLoadClass.php b/src/Util/Autoload/Exception/FailedToLoadClass.php index 22919a6a1..2e87fcc71 100644 --- a/src/Util/Autoload/Exception/FailedToLoadClass.php +++ b/src/Util/Autoload/Exception/FailedToLoadClass.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @deprecated - */ +/** @deprecated */ final class FailedToLoadClass extends LogicException { public static function fromClassName(string $className): self diff --git a/src/Util/CalculateReflectionColumn.php b/src/Util/CalculateReflectionColumn.php index 741417437..75486d95d 100644 --- a/src/Util/CalculateReflectionColumn.php +++ b/src/Util/CalculateReflectionColumn.php @@ -11,9 +11,7 @@ use function strlen; use function strrpos; -/** - * @internal - */ +/** @internal */ final class CalculateReflectionColumn { /** @@ -42,9 +40,7 @@ public static function getEndColumn(string $source, Node $node): int return self::calculateColumn($source, $node->getEndFilePos()); } - /** - * @throws InvalidNodePosition - */ + /** @throws InvalidNodePosition */ private static function calculateColumn(string $source, int $position): int { $sourceLength = strlen($source); diff --git a/src/Util/ClassExistenceChecker.php b/src/Util/ClassExistenceChecker.php index 7d7d65f9b..5f8ea8b6c 100644 --- a/src/Util/ClassExistenceChecker.php +++ b/src/Util/ClassExistenceChecker.php @@ -8,14 +8,10 @@ use function interface_exists; use function trait_exists; -/** - * @internal - */ +/** @internal */ class ClassExistenceChecker { - /** - * @psalm-assert-if-true class-string $name - */ + /** @psalm-assert-if-true class-string $name */ public static function exists(string $name): bool { return self::classExists($name) || self::interfaceExists($name) || self::traitExists($name); diff --git a/src/Util/ConstantNodeChecker.php b/src/Util/ConstantNodeChecker.php index c81372ea1..3c7f74b6e 100644 --- a/src/Util/ConstantNodeChecker.php +++ b/src/Util/ConstantNodeChecker.php @@ -10,16 +10,12 @@ use function count; use function in_array; -/** - * @internal - */ +/** @internal */ final class ConstantNodeChecker { private const DEFINE_ARGUMENTS_COUNTS = [2, 3]; - /** - * @throws InvalidConstantNode - */ + /** @throws InvalidConstantNode */ public static function assertValidDefineFunctionCall(Node\Expr\FuncCall $node): void { if (! ($node->name instanceof Node\Name)) { diff --git a/src/Util/GetLastDocComment.php b/src/Util/GetLastDocComment.php index 25248159c..2ba16b5de 100644 --- a/src/Util/GetLastDocComment.php +++ b/src/Util/GetLastDocComment.php @@ -6,9 +6,7 @@ use PhpParser\NodeAbstract; -/** - * @internal - */ +/** @internal */ final class GetLastDocComment { public static function forNode(NodeAbstract $node): string diff --git a/src/Util/Visitor/ReturnNodeVisitor.php b/src/Util/Visitor/ReturnNodeVisitor.php index b3ba818ed..6b0888447 100644 --- a/src/Util/Visitor/ReturnNodeVisitor.php +++ b/src/Util/Visitor/ReturnNodeVisitor.php @@ -13,7 +13,7 @@ class ReturnNodeVisitor extends NodeVisitorAbstract /** @var Node\Stmt\Return_[] */ private array $returnNodes = []; - public function enterNode(Node $node): ?int + public function enterNode(Node $node): int|null { if ($this->isScopeChangingNode($node)) { return NodeTraverser::DONT_TRAVERSE_CHILDREN; @@ -31,9 +31,7 @@ private function isScopeChangingNode(Node $node): bool return $node instanceof Node\FunctionLike || $node instanceof Node\Stmt\Class_; } - /** - * @return Node\Stmt\Return_[] - */ + /** @return Node\Stmt\Return_[] */ public function getReturnNodes(): array { return $this->returnNodes; diff --git a/test/benchmark/PhpUnitTestCaseBench.php b/test/benchmark/PhpUnitTestCaseBench.php index d08fd5cc2..e836953d3 100644 --- a/test/benchmark/PhpUnitTestCaseBench.php +++ b/test/benchmark/PhpUnitTestCaseBench.php @@ -14,9 +14,7 @@ use function array_map; use function array_merge; -/** - * @Iterations(5) - */ +/** @Iterations(5) */ class PhpUnitTestCaseBench { private Reflector $reflector; diff --git a/test/unit/BetterReflectionSingleton.php b/test/unit/BetterReflectionSingleton.php index 02b294550..15c702616 100644 --- a/test/unit/BetterReflectionSingleton.php +++ b/test/unit/BetterReflectionSingleton.php @@ -8,7 +8,7 @@ abstract class BetterReflectionSingleton { - private static ?BetterReflection $betterReflection; + private static BetterReflection|null $betterReflection; final private function __construct() { diff --git a/test/unit/BetterReflectionTest.php b/test/unit/BetterReflectionTest.php index 9017b37f5..8d13da6a5 100644 --- a/test/unit/BetterReflectionTest.php +++ b/test/unit/BetterReflectionTest.php @@ -14,9 +14,7 @@ use Roave\BetterReflection\SourceLocator\Type\SourceLocator; use Roave\BetterReflection\Util\FindReflectionOnLine; -/** - * @covers \Roave\BetterReflection\BetterReflection - */ +/** @covers \Roave\BetterReflection\BetterReflection */ final class BetterReflectionTest extends TestCase { public function testAccessorsReturnTypes(): void diff --git a/test/unit/Identifier/Exception/InvalidIdentifierNameTest.php b/test/unit/Identifier/Exception/InvalidIdentifierNameTest.php index 3f009b09c..70d0e0181 100644 --- a/test/unit/Identifier/Exception/InvalidIdentifierNameTest.php +++ b/test/unit/Identifier/Exception/InvalidIdentifierNameTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Identifier\Exception\InvalidIdentifierName; -/** - * @covers \Roave\BetterReflection\Identifier\Exception\InvalidIdentifierName - */ +/** @covers \Roave\BetterReflection\Identifier\Exception\InvalidIdentifierName */ class InvalidIdentifierNameTest extends TestCase { public function testFromInvalidName(): void diff --git a/test/unit/Identifier/IdentifierTest.php b/test/unit/Identifier/IdentifierTest.php index 82e078749..2bb8e6d53 100644 --- a/test/unit/Identifier/IdentifierTest.php +++ b/test/unit/Identifier/IdentifierTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflection\Reflection\ReflectionClass; use Roave\BetterReflection\Reflection\ReflectionFunction; -/** - * @covers \Roave\BetterReflection\Identifier\Identifier - */ +/** @covers \Roave\BetterReflection\Identifier\Identifier */ class IdentifierTest extends TestCase { public function testGetName(): void @@ -78,9 +76,7 @@ public function testGetNameForWildcard(): void self::assertSame(Identifier::WILDCARD, $identifier->getName()); } - /** - * @return list - */ + /** @return list */ public function validNamesProvider(): array { return [ @@ -101,18 +97,14 @@ public function validNamesProvider(): array ]; } - /** - * @dataProvider validNamesProvider - */ + /** @dataProvider validNamesProvider */ public function testValidName(string $name, string $expectedName): void { $identifier = new Identifier($name, new IdentifierType(IdentifierType::IDENTIFIER_CLASS)); self::assertSame($expectedName, $identifier->getName()); } - /** - * @return list - */ + /** @return list */ public function invalidNamesProvider(): array { return [ @@ -123,9 +115,7 @@ public function invalidNamesProvider(): array ]; } - /** - * @dataProvider invalidNamesProvider - */ + /** @dataProvider invalidNamesProvider */ public function testThrowExceptionForInvalidName(string $invalidName): void { $this->expectException(InvalidIdentifierName::class); diff --git a/test/unit/Identifier/IdentifierTypeTest.php b/test/unit/Identifier/IdentifierTypeTest.php index 07e73c7d5..9d067b04a 100644 --- a/test/unit/Identifier/IdentifierTypeTest.php +++ b/test/unit/Identifier/IdentifierTypeTest.php @@ -8,14 +8,10 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Identifier\IdentifierType; -/** - * @covers \Roave\BetterReflection\Identifier\IdentifierType - */ +/** @covers \Roave\BetterReflection\Identifier\IdentifierType */ class IdentifierTypeTest extends TestCase { - /** - * @return list> - */ + /** @return list> */ public function possibleIdentifierTypesProvider(): array { return [ @@ -25,9 +21,7 @@ public function possibleIdentifierTypesProvider(): array ]; } - /** - * @dataProvider possibleIdentifierTypesProvider - */ + /** @dataProvider possibleIdentifierTypesProvider */ public function testPossibleIdentifierTypes(string $full): void { $type = new IdentifierType($full); diff --git a/test/unit/NodeCompiler/CompileNodeToValueTest.php b/test/unit/NodeCompiler/CompileNodeToValueTest.php index 4a5f1db3b..3443ba276 100644 --- a/test/unit/NodeCompiler/CompileNodeToValueTest.php +++ b/test/unit/NodeCompiler/CompileNodeToValueTest.php @@ -43,9 +43,7 @@ use const PHP_INT_MAX; use const PHP_VERSION_ID; -/** - * @covers \Roave\BetterReflection\NodeCompiler\CompileNodeToValue - */ +/** @covers \Roave\BetterReflection\NodeCompiler\CompileNodeToValue */ class CompileNodeToValueTest extends TestCase { private Parser $parser; @@ -64,9 +62,7 @@ protected function setUp(): void $this->sourceStubber = $configuration->sourceStubber(); } - /** - * @return Node\Stmt\Expression - */ + /** @return Node\Stmt\Expression */ private function parseCode(string $phpCode): Node\Stmt { $node = $this->parser->parse(' - */ + /** @return list */ public function nodeProvider(): array { return [ @@ -201,9 +195,7 @@ public function nodeProvider(): array ]; } - /** - * @dataProvider nodeProvider - */ + /** @dataProvider nodeProvider */ public function testVariousNodeCompilations(string $phpCode, mixed $expectedValue): void { $node = $this->parseCode($phpCode); @@ -231,9 +223,7 @@ public function testConstantFunctionCall(): void self::assertSame(PHP_VERSION_ID, $compiledValue->value); } - /** - * @return list - */ + /** @return list */ public function dataTrueFalseNullShouldNotHaveConstantName(): array { return [ @@ -246,9 +236,7 @@ public function dataTrueFalseNullShouldNotHaveConstantName(): array ]; } - /** - * @dataProvider dataTrueFalseNullShouldNotHaveConstantName - */ + /** @dataProvider dataTrueFalseNullShouldNotHaveConstantName */ public function testTrueFalseNullShouldNotHaveConstantName(string $value): void { $node = $this->parseCode($value); @@ -650,9 +638,7 @@ class Foo extends Baz { self::assertSame('parentConstant', $classInfo->getProperty('parentConstant')->getDefaultValue()); } - /** - * @return list - */ + /** @return list */ public function magicConstantsWithoutNamespaceProvider(): array { $dir = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../Fixture')); @@ -669,9 +655,7 @@ public function magicConstantsWithoutNamespaceProvider(): array ]; } - /** - * @dataProvider magicConstantsWithoutNamespaceProvider - */ + /** @dataProvider magicConstantsWithoutNamespaceProvider */ public function testMagicConstantsWithoutNamespace(string $constantName, mixed $expectedValue): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(realpath(__DIR__ . '/../Fixture/MagicConstants.php'), $this->astLocator)); @@ -680,9 +664,7 @@ public function testMagicConstantsWithoutNamespace(string $constantName, mixed $ self::assertSame($expectedValue, $constant->getValue()); } - /** - * @return list - */ + /** @return list */ public function magicConstantsInNamespaceProvider(): array { $dir = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../Fixture')); @@ -724,12 +706,12 @@ public function getSource(): string return $this->next->getSource(); } - public function getName(): ?string + public function getName(): string|null { return $this->next->getName(); } - public function getFileName(): ?string + public function getFileName(): string|null { return '/non/existing/path/to/sources.php'; } @@ -739,7 +721,7 @@ public function isInternal(): bool return false; } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return null; } @@ -749,7 +731,7 @@ public function isEvaled(): bool return false; } - public function getAliasName(): ?string + public function getAliasName(): string|null { return null; } @@ -796,9 +778,7 @@ public function findReflectionsOfType( ); } - /** - * @dataProvider magicConstantsInNamespaceProvider - */ + /** @dataProvider magicConstantsInNamespaceProvider */ public function testMagicConstantsInNamespace(string $constantName, mixed $expectedValue): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(realpath(__DIR__ . '/../Fixture/MagicConstants.php'), $this->astLocator)); @@ -807,9 +787,7 @@ public function testMagicConstantsInNamespace(string $constantName, mixed $expec self::assertSame($expectedValue, $constant->getValue()); } - /** - * @return list - */ + /** @return list */ public function magicConstantsInTraitProvider(): array { $dir = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../Fixture')); @@ -826,9 +804,7 @@ public function magicConstantsInTraitProvider(): array ]; } - /** - * @dataProvider magicConstantsInTraitProvider - */ + /** @dataProvider magicConstantsInTraitProvider */ public function testMagicConstantsInTrait(string $propertyName, mixed $expectedValue): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(realpath(__DIR__ . '/../Fixture/MagicConstants.php'), $this->astLocator)); @@ -838,9 +814,7 @@ public function testMagicConstantsInTrait(string $propertyName, mixed $expectedV self::assertSame($expectedValue, $property->getDefaultValue()); } - /** - * @return list - */ + /** @return list */ public function magicConstantsInClassProvider(): array { $dir = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../Fixture')); @@ -857,9 +831,7 @@ public function magicConstantsInClassProvider(): array ]; } - /** - * @dataProvider magicConstantsInClassProvider - */ + /** @dataProvider magicConstantsInClassProvider */ public function testMagicConstantsInClass(string $propertyName, mixed $expectedValue): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(realpath(__DIR__ . '/../Fixture/MagicConstants.php'), $this->astLocator)); @@ -869,9 +841,7 @@ public function testMagicConstantsInClass(string $propertyName, mixed $expectedV self::assertSame($expectedValue, $property->getDefaultValue()); } - /** - * @return list - */ + /** @return list */ public function magicConstantsInMethodProvider(): array { $dir = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../Fixture')); @@ -888,9 +858,7 @@ public function magicConstantsInMethodProvider(): array ]; } - /** - * @dataProvider magicConstantsInMethodProvider - */ + /** @dataProvider magicConstantsInMethodProvider */ public function testMagicConstantsInMethod(string $parameterName, mixed $expectedValue): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(realpath(__DIR__ . '/../Fixture/MagicConstants.php'), $this->astLocator)); @@ -901,9 +869,7 @@ public function testMagicConstantsInMethod(string $parameterName, mixed $expecte self::assertSame($expectedValue, $parameter->getDefaultValue()); } - /** - * @return list - */ + /** @return list */ public function magicConstantsInFunctionProvider(): array { $dir = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../Fixture')); @@ -920,9 +886,7 @@ public function magicConstantsInFunctionProvider(): array ]; } - /** - * @dataProvider magicConstantsInFunctionProvider - */ + /** @dataProvider magicConstantsInFunctionProvider */ public function testMagicConstantsInFunction(string $parameterName, mixed $expectedValue): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(realpath(__DIR__ . '/../Fixture/MagicConstants.php'), $this->astLocator)); @@ -932,9 +896,7 @@ public function testMagicConstantsInFunction(string $parameterName, mixed $expec self::assertSame($expectedValue, $parameter->getDefaultValue()); } - /** - * @return list - */ + /** @return list */ public function fileAndDirectoryMagicConstantsWithoutFileNameProvider(): array { return [ @@ -943,9 +905,7 @@ public function fileAndDirectoryMagicConstantsWithoutFileNameProvider(): array ]; } - /** - * @dataProvider fileAndDirectoryMagicConstantsWithoutFileNameProvider - */ + /** @dataProvider fileAndDirectoryMagicConstantsWithoutFileNameProvider */ public function testFileAndDirectoryMagicConstantsWithoutFileName(string $parameterName): void { $php = ' - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionAttribute::class); @@ -30,9 +26,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionTypeAdapterReflection = new CoreReflectionClass(ReflectionAttributeAdapter::class); @@ -41,9 +35,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionAttributeAdapter::class, $reflectionTypeAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list}> - */ + /** @return list}> */ public function methodExpectationProvider(): array { return [ @@ -61,7 +53,7 @@ public function methodExpectationProvider(): array * * @dataProvider methodExpectationProvider */ - public function testAdapterMethods(string $methodName, ?string $expectedException, mixed $returnValue, array $args): void + public function testAdapterMethods(string $methodName, string|null $expectedException, mixed $returnValue, array $args): void { $reflectionStub = $this->createMock(BetterReflectionAttribute::class); diff --git a/test/unit/Reflection/Adapter/ReflectionClassConstantTest.php b/test/unit/Reflection/Adapter/ReflectionClassConstantTest.php index 199166b74..c931b6abd 100644 --- a/test/unit/Reflection/Adapter/ReflectionClassConstantTest.php +++ b/test/unit/Reflection/Adapter/ReflectionClassConstantTest.php @@ -21,14 +21,10 @@ use function array_map; use function get_class_methods; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionClassConstant - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionClassConstant */ class ReflectionClassConstantTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionClassConstant::class); @@ -36,9 +32,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionClassConstantAdapterReflection = new CoreReflectionClass(ReflectionClassConstantAdapter::class); @@ -47,9 +41,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionClassConstantAdapter::class, $reflectionClassConstantAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list}> - */ + /** @return list}> */ public function methodExpectationProvider(): array { return [ @@ -72,7 +64,7 @@ public function methodExpectationProvider(): array * * @dataProvider methodExpectationProvider */ - public function testAdapterMethods(string $methodName, ?string $expectedException, mixed $returnValue, array $args): void + public function testAdapterMethods(string $methodName, string|null $expectedException, mixed $returnValue, array $args): void { $reflectionStub = $this->createMock(BetterReflectionClassConstant::class); @@ -91,9 +83,7 @@ public function testAdapterMethods(string $methodName, ?string $expectedExceptio $adapter->{$methodName}(...$args); } - /** - * @return list - */ + /** @return list */ public function dataAdapterMethodsForEnumCase(): array { return [ @@ -105,9 +95,7 @@ public function dataAdapterMethodsForEnumCase(): array ]; } - /** - * @dataProvider dataAdapterMethodsForEnumCase - */ + /** @dataProvider dataAdapterMethodsForEnumCase */ public function testAdapterMethodsForEnumCase(string $methodName, mixed $expectedValue): void { $reflectionClassConstantAdapter = new ReflectionClassConstantAdapter($this->createMock(BetterReflectionEnumCase::class)); @@ -115,9 +103,7 @@ public function testAdapterMethodsForEnumCase(string $methodName, mixed $expecte self::assertSame($expectedValue, $reflectionClassConstantAdapter->{$methodName}()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testGetValueForEnumCase(): void { require_once __DIR__ . '/../../Fixture/Enums.php'; @@ -322,9 +308,7 @@ public function testGetAttributesThrowsExceptionForInvalidFlags(): void $reflectionClassConstantAdapter->getAttributes(null, 123); } - /** - * @return list - */ + /** @return list */ public function dataIsEnumCase(): array { return [ @@ -333,9 +317,7 @@ public function dataIsEnumCase(): array ]; } - /** - * @dataProvider dataIsEnumCase - */ + /** @dataProvider dataIsEnumCase */ public function testIsEnumCase(BetterReflectionClassConstant|BetterReflectionEnumCase $classConstantOrEnum, bool $isEnumCase): void { $reflectionClassConstantAdapter = new ReflectionClassConstantAdapter($classConstantOrEnum); diff --git a/test/unit/Reflection/Adapter/ReflectionClassTest.php b/test/unit/Reflection/Adapter/ReflectionClassTest.php index 72044ceed..036431fc6 100644 --- a/test/unit/Reflection/Adapter/ReflectionClassTest.php +++ b/test/unit/Reflection/Adapter/ReflectionClassTest.php @@ -33,14 +33,10 @@ use function get_class_methods; use function is_array; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionClass - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionClass */ class ReflectionClassTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionClass::class); @@ -48,9 +44,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionClassAdapterReflection = new CoreReflectionClass(ReflectionClassAdapter::class); @@ -59,9 +53,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionClassAdapter::class, $reflectionClassAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> - */ + /** @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> */ public function methodExpectationProvider(): array { $mockMethod = $this->createMock(BetterReflectionMethod::class); @@ -136,9 +128,9 @@ public function testAdapterMethods( string $methodName, array $args, mixed $returnValue, - ?string $expectedException, + string|null $expectedException, mixed $expectedReturnValue, - ?string $expectedReturnValueInstance, + string|null $expectedReturnValueInstance, ): void { $reflectionStub = $this->createMock(BetterReflectionClass::class); diff --git a/test/unit/Reflection/Adapter/ReflectionEnumBackedCaseTest.php b/test/unit/Reflection/Adapter/ReflectionEnumBackedCaseTest.php index 55189bbb1..3b92f7fed 100644 --- a/test/unit/Reflection/Adapter/ReflectionEnumBackedCaseTest.php +++ b/test/unit/Reflection/Adapter/ReflectionEnumBackedCaseTest.php @@ -22,14 +22,10 @@ use function array_map; use function get_class_methods; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionEnumBackedCase - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionEnumBackedCase */ class ReflectionEnumBackedCaseTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionEnumBackedCase::class); @@ -37,9 +33,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionEnumBackedCaseAdapterReflection = new CoreReflectionClass(ReflectionEnumBackedCaseAdapter::class); @@ -48,9 +42,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionEnumBackedCaseAdapter::class, $reflectionEnumBackedCaseAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list}> - */ + /** @return list}> */ public function methodExpectationProvider(): array { return [ @@ -69,7 +61,7 @@ public function methodExpectationProvider(): array * * @dataProvider methodExpectationProvider */ - public function testAdapterMethods(string $methodName, ?string $expectedException, mixed $returnValue, array $args): void + public function testAdapterMethods(string $methodName, string|null $expectedException, mixed $returnValue, array $args): void { $reflectionStub = $this->createMock(BetterReflectionEnumCase::class); diff --git a/test/unit/Reflection/Adapter/ReflectionEnumTest.php b/test/unit/Reflection/Adapter/ReflectionEnumTest.php index 1880a47cb..47d86844a 100644 --- a/test/unit/Reflection/Adapter/ReflectionEnumTest.php +++ b/test/unit/Reflection/Adapter/ReflectionEnumTest.php @@ -37,14 +37,10 @@ use function get_class_methods; use function is_array; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionEnum - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionEnum */ class ReflectionEnumTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionEnum::class); @@ -52,9 +48,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionEnumAdapterReflection = new CoreReflectionClass(ReflectionEnumAdapter::class); @@ -63,9 +57,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionEnumAdapter::class, $reflectionEnumAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> - */ + /** @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> */ public function methodExpectationProvider(): array { $mockClassLike = $this->createMock(BetterReflectionClass::class); @@ -148,9 +140,9 @@ public function testAdapterMethods( string $methodName, array $args, mixed $returnValue, - ?string $expectedException, + string|null $expectedException, mixed $expectedReturnValue, - ?string $expectedReturnValueInstance, + string|null $expectedReturnValueInstance, ): void { $reflectionStub = $this->createMock(BetterReflectionEnum::class); diff --git a/test/unit/Reflection/Adapter/ReflectionEnumUnitCaseTest.php b/test/unit/Reflection/Adapter/ReflectionEnumUnitCaseTest.php index 80096ae1a..51ea115f4 100644 --- a/test/unit/Reflection/Adapter/ReflectionEnumUnitCaseTest.php +++ b/test/unit/Reflection/Adapter/ReflectionEnumUnitCaseTest.php @@ -22,14 +22,10 @@ use function array_map; use function get_class_methods; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionEnumUnitCase - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionEnumUnitCase */ class ReflectionEnumUnitCaseTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionEnumUnitCase::class); @@ -37,9 +33,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionEnumUnitCaseAdapterReflection = new CoreReflectionClass(ReflectionEnumUnitCaseAdapter::class); @@ -48,9 +42,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionEnumUnitCaseAdapter::class, $reflectionEnumUnitCaseAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list}> - */ + /** @return list}> */ public function methodExpectationProvider(): array { return [ @@ -69,7 +61,7 @@ public function methodExpectationProvider(): array * * @dataProvider methodExpectationProvider */ - public function testAdapterMethods(string $methodName, ?string $expectedException, mixed $returnValue, array $args): void + public function testAdapterMethods(string $methodName, string|null $expectedException, mixed $returnValue, array $args): void { $reflectionStub = $this->createMock(BetterReflectionEnumCase::class); diff --git a/test/unit/Reflection/Adapter/ReflectionFunctionTest.php b/test/unit/Reflection/Adapter/ReflectionFunctionTest.php index b3ab7a628..007cae948 100644 --- a/test/unit/Reflection/Adapter/ReflectionFunctionTest.php +++ b/test/unit/Reflection/Adapter/ReflectionFunctionTest.php @@ -30,14 +30,10 @@ use function get_class_methods; use function is_array; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionFunction - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionFunction */ class ReflectionFunctionTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionFunction::class); @@ -45,9 +41,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionFunctionAdapterReflection = new CoreReflectionClass(ReflectionFunctionAdapter::class); @@ -56,9 +50,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionFunctionAdapter::class, $reflectionFunctionAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> - */ + /** @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> */ public function methodExpectationProvider(): array { $mockParameter = $this->createMock(BetterReflectionParameter::class); @@ -121,9 +113,9 @@ public function testAdapterMethods( string $methodName, array $args, mixed $returnValue, - ?string $expectedException, + string|null $expectedException, mixed $expectedReturnValue, - ?string $expectedReturnValueInstance, + string|null $expectedReturnValueInstance, ): void { $reflectionStub = $this->createMock(BetterReflectionFunction::class); diff --git a/test/unit/Reflection/Adapter/ReflectionIntersectionTypeTest.php b/test/unit/Reflection/Adapter/ReflectionIntersectionTypeTest.php index d2bcd1f93..0dc545588 100644 --- a/test/unit/Reflection/Adapter/ReflectionIntersectionTypeTest.php +++ b/test/unit/Reflection/Adapter/ReflectionIntersectionTypeTest.php @@ -14,14 +14,10 @@ use function array_map; use function get_class_methods; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionIntersectionType - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionIntersectionType */ class ReflectionIntersectionTypeTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionIntersectionType::class); @@ -29,9 +25,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionTypeAdapterReflection = new CoreReflectionClass(ReflectionIntersectionTypeAdapter::class); @@ -40,9 +34,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionIntersectionTypeAdapter::class, $reflectionTypeAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list}> - */ + /** @return list}> */ public function methodExpectationProvider(): array { return [ @@ -57,7 +49,7 @@ public function methodExpectationProvider(): array * * @dataProvider methodExpectationProvider */ - public function testAdapterMethods(string $methodName, ?string $expectedException, mixed $returnValue, array $args): void + public function testAdapterMethods(string $methodName, string|null $expectedException, mixed $returnValue, array $args): void { $reflectionStub = $this->createMock(BetterReflectionIntersectionType::class); diff --git a/test/unit/Reflection/Adapter/ReflectionMethodTest.php b/test/unit/Reflection/Adapter/ReflectionMethodTest.php index 395f085aa..24eb4419c 100644 --- a/test/unit/Reflection/Adapter/ReflectionMethodTest.php +++ b/test/unit/Reflection/Adapter/ReflectionMethodTest.php @@ -31,14 +31,10 @@ use function get_class_methods; use function is_array; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionMethod - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionMethod */ class ReflectionMethodTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionMethod::class); @@ -46,9 +42,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionMethodAdapterReflection = new CoreReflectionClass(ReflectionMethodAdapter::class); @@ -57,9 +51,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionMethodAdapter::class, $reflectionMethodAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> - */ + /** @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> */ public function methodExpectationProvider(): array { $mockParameter = $this->createMock(BetterReflectionParameter::class); @@ -136,9 +128,9 @@ public function testAdapterMethods( string $methodName, array $args, mixed $returnValue, - ?string $expectedException, + string|null $expectedException, mixed $expectedReturnValue, - ?string $expectedReturnValueInstance, + string|null $expectedReturnValueInstance, ): void { $reflectionStub = $this->createMock(BetterReflectionMethod::class); diff --git a/test/unit/Reflection/Adapter/ReflectionNamedTypeTest.php b/test/unit/Reflection/Adapter/ReflectionNamedTypeTest.php index 442ec37c6..82e7dbdb2 100644 --- a/test/unit/Reflection/Adapter/ReflectionNamedTypeTest.php +++ b/test/unit/Reflection/Adapter/ReflectionNamedTypeTest.php @@ -17,14 +17,10 @@ use function array_map; use function get_class_methods; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionNamedType - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionNamedType */ class ReflectionNamedTypeTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionNamedType::class); @@ -32,9 +28,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionTypeAdapterReflection = new CoreReflectionClass(ReflectionNamedTypeAdapter::class); @@ -53,9 +47,7 @@ public function testWillRenderNullabilityMarkerWhenGiven(): void self::assertSame('?foo', (new ReflectionNamedTypeAdapter($reflectionStub, true))->__toString()); } - /** - * @return list - */ + /** @return list */ public function dataNoNullabilityMarkerForMixed(): array { return [ @@ -64,9 +56,7 @@ public function dataNoNullabilityMarkerForMixed(): array ]; } - /** - * @dataProvider dataNoNullabilityMarkerForMixed - */ + /** @dataProvider dataNoNullabilityMarkerForMixed */ public function testNoNullabilityMarkerForMixed(string $mixedType): void { $reflectionStub = $this->createMock(BetterReflectionNamedType::class); @@ -86,9 +76,7 @@ public function testWillReportThatItAcceptsOrRejectsNull(): void self::assertTrue((new ReflectionNamedTypeAdapter($reflectionStub, true))->allowsNull()); } - /** - * @return list}> - */ + /** @return list}> */ public function methodExpectationProvider(): array { return [ @@ -102,7 +90,7 @@ public function methodExpectationProvider(): array * * @dataProvider methodExpectationProvider */ - public function testAdapterMethods(string $methodName, ?string $expectedException, mixed $returnValue, array $args): void + public function testAdapterMethods(string $methodName, string|null $expectedException, mixed $returnValue, array $args): void { $reflectionStub = $this->createMock(BetterReflectionNamedType::class); @@ -121,9 +109,7 @@ public function testAdapterMethods(string $methodName, ?string $expectedExceptio $adapter->{$methodName}(...$args); } - /** - * @return list - */ + /** @return list */ public function dataNotBuildin(): array { return [ @@ -136,9 +122,7 @@ public function dataNotBuildin(): array ]; } - /** - * @dataProvider dataNotBuildin - */ + /** @dataProvider dataNotBuildin */ public function testIsNotBuiltin(string $type): void { $reflector = $this->createMock(Reflector::class); diff --git a/test/unit/Reflection/Adapter/ReflectionObjectTest.php b/test/unit/Reflection/Adapter/ReflectionObjectTest.php index 10704008c..4610f32ca 100644 --- a/test/unit/Reflection/Adapter/ReflectionObjectTest.php +++ b/test/unit/Reflection/Adapter/ReflectionObjectTest.php @@ -32,14 +32,10 @@ use function get_class_methods; use function is_array; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionObject - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionObject */ class ReflectionObjectTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionObject::class); @@ -47,9 +43,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionObjectAdapterReflection = new CoreReflectionClass(ReflectionObjectAdapter::class); @@ -58,9 +52,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionObjectAdapter::class, $reflectionObjectAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> - */ + /** @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> */ public function methodExpectationProvider(): array { $mockMethod = $this->createMock(BetterReflectionMethod::class); @@ -135,9 +127,9 @@ public function testAdapterMethods( string $methodName, array $args, mixed $returnValue, - ?string $expectedException, + string|null $expectedException, mixed $expectedReturnValue, - ?string $expectedReturnValueInstance, + string|null $expectedReturnValueInstance, ): void { $reflectionStub = $this->createMock(BetterReflectionObject::class); diff --git a/test/unit/Reflection/Adapter/ReflectionParameterTest.php b/test/unit/Reflection/Adapter/ReflectionParameterTest.php index bd437901f..b36937e0f 100644 --- a/test/unit/Reflection/Adapter/ReflectionParameterTest.php +++ b/test/unit/Reflection/Adapter/ReflectionParameterTest.php @@ -27,14 +27,10 @@ use function get_class_methods; use function is_array; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionParameter - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionParameter */ class ReflectionParameterTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionParameter::class); @@ -42,9 +38,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionParameterAdapterReflection = new CoreReflectionClass(ReflectionParameterAdapter::class); @@ -53,9 +47,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionParameterAdapter::class, $reflectionParameterAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> - */ + /** @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> */ public function methodExpectationProvider(): array { $mockFunction = $this->createMock(BetterReflectionFunction::class); @@ -105,9 +97,9 @@ public function testAdapterMethods( string $methodName, array $args, mixed $returnValue, - ?string $expectedException, + string|null $expectedException, mixed $expectedReturnValue, - ?string $expectedReturnValueInstance, + string|null $expectedReturnValueInstance, ): void { $reflectionStub = $this->createMock(BetterReflectionParameter::class); diff --git a/test/unit/Reflection/Adapter/ReflectionPropertyTest.php b/test/unit/Reflection/Adapter/ReflectionPropertyTest.php index 440e07d4f..f424cec3e 100644 --- a/test/unit/Reflection/Adapter/ReflectionPropertyTest.php +++ b/test/unit/Reflection/Adapter/ReflectionPropertyTest.php @@ -30,14 +30,10 @@ use function get_class_methods; use function is_array; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionProperty - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionProperty */ class ReflectionPropertyTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionProperty::class); @@ -45,9 +41,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionPropertyAdapterReflection = new CoreReflectionClass(ReflectionPropertyAdapter::class); @@ -56,9 +50,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionPropertyAdapter::class, $reflectionPropertyAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> - */ + /** @return list, 2: mixed, 3: string|null, 4: mixed, 5: string|null}> */ public function methodExpectationProvider(): array { $mockType = $this->createMock(BetterReflectionNamedType::class); @@ -94,9 +86,9 @@ public function testAdapterMethods( string $methodName, array $args, mixed $returnValue, - ?string $expectedException, + string|null $expectedException, mixed $expectedReturnValue, - ?string $expectedReturnValueInstance, + string|null $expectedReturnValueInstance, ): void { $reflectionStub = $this->createMock(BetterReflectionProperty::class); diff --git a/test/unit/Reflection/Adapter/ReflectionTypeTest.php b/test/unit/Reflection/Adapter/ReflectionTypeTest.php index 78235a715..544454509 100644 --- a/test/unit/Reflection/Adapter/ReflectionTypeTest.php +++ b/test/unit/Reflection/Adapter/ReflectionTypeTest.php @@ -22,14 +22,10 @@ use function array_map; use function get_class_methods; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionType - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionType */ class ReflectionTypeTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionType::class); @@ -37,9 +33,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionTypeAdapterReflection = new CoreReflectionClass(ReflectionNamedTypeAdapter::class); @@ -58,9 +52,7 @@ public function testFromTypeOrNullWithNamedType(): void self::assertInstanceOf(ReflectionNamedTypeAdapter::class, ReflectionTypeAdapter::fromTypeOrNull($this->createMock(BetterReflectionNamedType::class))); } - /** - * @return list - */ + /** @return list */ public function dataWillMakeNullableNamedTypeOutOfNullableUnionWithOnlyOneType(): array { return [ @@ -69,9 +61,7 @@ public function dataWillMakeNullableNamedTypeOutOfNullableUnionWithOnlyOneType() ]; } - /** - * @dataProvider dataWillMakeNullableNamedTypeOutOfNullableUnionWithOnlyOneType - */ + /** @dataProvider dataWillMakeNullableNamedTypeOutOfNullableUnionWithOnlyOneType */ public function testWillMakeNullableNamedTypeOutOfNullableUnionWithOnlyOneType(string $firstType, string $secondType): void { $unionType = $this->createMock(BetterReflectionUnionType::class); diff --git a/test/unit/Reflection/Adapter/ReflectionUnionTypeTest.php b/test/unit/Reflection/Adapter/ReflectionUnionTypeTest.php index 9eac107f8..bdbafc472 100644 --- a/test/unit/Reflection/Adapter/ReflectionUnionTypeTest.php +++ b/test/unit/Reflection/Adapter/ReflectionUnionTypeTest.php @@ -14,14 +14,10 @@ use function array_map; use function get_class_methods; -/** - * @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionUnionType - */ +/** @covers \Roave\BetterReflection\Reflection\Adapter\ReflectionUnionType */ class ReflectionUnionTypeTest extends TestCase { - /** - * @return array - */ + /** @return array */ public function coreReflectionMethodNamesProvider(): array { $methods = get_class_methods(CoreReflectionUnionType::class); @@ -29,9 +25,7 @@ public function coreReflectionMethodNamesProvider(): array return array_combine($methods, array_map(static fn (string $i): array => [$i], $methods)); } - /** - * @dataProvider coreReflectionMethodNamesProvider - */ + /** @dataProvider coreReflectionMethodNamesProvider */ public function testCoreReflectionMethods(string $methodName): void { $reflectionTypeAdapterReflection = new CoreReflectionClass(ReflectionUnionTypeAdapter::class); @@ -40,9 +34,7 @@ public function testCoreReflectionMethods(string $methodName): void self::assertSame(ReflectionUnionTypeAdapter::class, $reflectionTypeAdapterReflection->getMethod($methodName)->getDeclaringClass()->getName()); } - /** - * @return list}> - */ + /** @return list}> */ public function methodExpectationProvider(): array { return [ @@ -57,7 +49,7 @@ public function methodExpectationProvider(): array * * @dataProvider methodExpectationProvider */ - public function testAdapterMethods(string $methodName, ?string $expectedException, mixed $returnValue, array $args): void + public function testAdapterMethods(string $methodName, string|null $expectedException, mixed $returnValue, array $args): void { $reflectionStub = $this->createMock(BetterReflectionUnionType::class); diff --git a/test/unit/Reflection/Annotation/AnnotationHelperTest.php b/test/unit/Reflection/Annotation/AnnotationHelperTest.php index 589617fe5..34beacf7b 100644 --- a/test/unit/Reflection/Annotation/AnnotationHelperTest.php +++ b/test/unit/Reflection/Annotation/AnnotationHelperTest.php @@ -7,14 +7,10 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Annotation\AnnotationHelper; -/** - * @covers \Roave\BetterReflection\Reflection\Annotation\AnnotationHelper - */ +/** @covers \Roave\BetterReflection\Reflection\Annotation\AnnotationHelper */ class AnnotationHelperTest extends TestCase { - /** - * @return list - */ + /** @return list */ public function deprecatedDocCommentProvider(): array { return [ @@ -42,17 +38,13 @@ public function deprecatedDocCommentProvider(): array ]; } - /** - * @dataProvider deprecatedDocCommentProvider - */ + /** @dataProvider deprecatedDocCommentProvider */ public function testIsDeprecated(string $docComment, bool $isDeprecated): void { self::assertSame($isDeprecated, AnnotationHelper::isDeprecated($docComment)); } - /** - * @return list - */ + /** @return list */ public function tentativeReturnTypeDocCommentProvider(): array { return [ @@ -74,9 +66,7 @@ public function tentativeReturnTypeDocCommentProvider(): array ]; } - /** - * @dataProvider tentativeReturnTypeDocCommentProvider - */ + /** @dataProvider tentativeReturnTypeDocCommentProvider */ public function testhasTentativeReturnType(string $docComment, bool $isDeprecated): void { self::assertSame($isDeprecated, AnnotationHelper::hasTentativeReturnType($docComment)); diff --git a/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php b/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php index 44a0e7122..7f2a0b45b 100644 --- a/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php +++ b/test/unit/Reflection/Attribute/ReflectionAttributeHelperTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflection\Reflection\ReflectionClass; use Roave\BetterReflection\Reflector\Reflector; -/** - * @covers \Roave\BetterReflection\Reflection\Attribute\ReflectionAttributeHelper - */ +/** @covers \Roave\BetterReflection\Reflection\Attribute\ReflectionAttributeHelper */ class ReflectionAttributeHelperTest extends TestCase { public function testCreateAttributes(): void diff --git a/test/unit/Reflection/Exception/ClassDoesNotExistTest.php b/test/unit/Reflection/Exception/ClassDoesNotExistTest.php index 000cd2d1d..103949ba0 100644 --- a/test/unit/Reflection/Exception/ClassDoesNotExistTest.php +++ b/test/unit/Reflection/Exception/ClassDoesNotExistTest.php @@ -8,9 +8,7 @@ use Roave\BetterReflection\Reflection\Exception\ClassDoesNotExist; use Roave\BetterReflection\Reflection\Reflection; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\ClassDoesNotExist - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\ClassDoesNotExist */ class ClassDoesNotExistTest extends TestCase { public function testForDifferentReflectionType(): void diff --git a/test/unit/Reflection/Exception/FunctionDoesNotExistTest.php b/test/unit/Reflection/Exception/FunctionDoesNotExistTest.php index 5057f5bfe..91ba4f6b1 100644 --- a/test/unit/Reflection/Exception/FunctionDoesNotExistTest.php +++ b/test/unit/Reflection/Exception/FunctionDoesNotExistTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\FunctionDoesNotExist; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\FunctionDoesNotExist - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\FunctionDoesNotExist */ class FunctionDoesNotExistTest extends TestCase { public function testFromName(): void diff --git a/test/unit/Reflection/Exception/InvalidArrowFunctionBodyNodeTest.php b/test/unit/Reflection/Exception/InvalidArrowFunctionBodyNodeTest.php index bec80625f..e8a9b48b7 100644 --- a/test/unit/Reflection/Exception/InvalidArrowFunctionBodyNodeTest.php +++ b/test/unit/Reflection/Exception/InvalidArrowFunctionBodyNodeTest.php @@ -9,9 +9,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\InvalidArrowFunctionBodyNode; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\InvalidArrowFunctionBodyNode - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\InvalidArrowFunctionBodyNode */ class InvalidArrowFunctionBodyNodeTest extends TestCase { public function testCreate(): void diff --git a/test/unit/Reflection/Exception/InvalidConstantNodeTest.php b/test/unit/Reflection/Exception/InvalidConstantNodeTest.php index c528062bf..1d93e88ea 100644 --- a/test/unit/Reflection/Exception/InvalidConstantNodeTest.php +++ b/test/unit/Reflection/Exception/InvalidConstantNodeTest.php @@ -8,9 +8,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\InvalidConstantNode; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\InvalidConstantNode - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\InvalidConstantNode */ class InvalidConstantNodeTest extends TestCase { public function testCreate(): void diff --git a/test/unit/Reflection/Exception/NoObjectProvidedTest.php b/test/unit/Reflection/Exception/NoObjectProvidedTest.php index bf4bd2f29..dd27b9894 100644 --- a/test/unit/Reflection/Exception/NoObjectProvidedTest.php +++ b/test/unit/Reflection/Exception/NoObjectProvidedTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\NoObjectProvided; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\NoObjectProvided - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\NoObjectProvided */ class NoObjectProvidedTest extends TestCase { public function testFromClassName(): void diff --git a/test/unit/Reflection/Exception/NotAClassReflectionTest.php b/test/unit/Reflection/Exception/NotAClassReflectionTest.php index 363630335..790e57dc9 100644 --- a/test/unit/Reflection/Exception/NotAClassReflectionTest.php +++ b/test/unit/Reflection/Exception/NotAClassReflectionTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflectionTest\BetterReflectionSingleton; use Roave\BetterReflectionTest\Fixture; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\NotAClassReflection - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\NotAClassReflection */ class NotAClassReflectionTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/Reflection/Exception/NotAnInterfaceReflectionTest.php b/test/unit/Reflection/Exception/NotAnInterfaceReflectionTest.php index 098c814fd..0e9364ae2 100644 --- a/test/unit/Reflection/Exception/NotAnInterfaceReflectionTest.php +++ b/test/unit/Reflection/Exception/NotAnInterfaceReflectionTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflectionTest\BetterReflectionSingleton; use Roave\BetterReflectionTest\Fixture; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\NotAnInterfaceReflection - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\NotAnInterfaceReflection */ class NotAnInterfaceReflectionTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/Reflection/Exception/NotAnObjectTest.php b/test/unit/Reflection/Exception/NotAnObjectTest.php index 266cbe96a..586e88ac9 100644 --- a/test/unit/Reflection/Exception/NotAnObjectTest.php +++ b/test/unit/Reflection/Exception/NotAnObjectTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\NotAnObject; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\NotAnObject - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\NotAnObject */ class NotAnObjectTest extends TestCase { public function testFromNonObject(): void diff --git a/test/unit/Reflection/Exception/ObjectNotInstanceOfClassTest.php b/test/unit/Reflection/Exception/ObjectNotInstanceOfClassTest.php index b3a436bf6..48415bb69 100644 --- a/test/unit/Reflection/Exception/ObjectNotInstanceOfClassTest.php +++ b/test/unit/Reflection/Exception/ObjectNotInstanceOfClassTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\ObjectNotInstanceOfClass; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\ObjectNotInstanceOfClass - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\ObjectNotInstanceOfClass */ class ObjectNotInstanceOfClassTest extends TestCase { public function testFromClassName(): void diff --git a/test/unit/Reflection/Exception/PropertyDoesNotExistTest.php b/test/unit/Reflection/Exception/PropertyDoesNotExistTest.php index b11bb9769..65213104b 100644 --- a/test/unit/Reflection/Exception/PropertyDoesNotExistTest.php +++ b/test/unit/Reflection/Exception/PropertyDoesNotExistTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\PropertyDoesNotExist; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\PropertyDoesNotExist - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\PropertyDoesNotExist */ class PropertyDoesNotExistTest extends TestCase { public function testFromName(): void diff --git a/test/unit/Reflection/Exception/PropertyIsNotStaticTest.php b/test/unit/Reflection/Exception/PropertyIsNotStaticTest.php index 7735763a6..8e926ee40 100644 --- a/test/unit/Reflection/Exception/PropertyIsNotStaticTest.php +++ b/test/unit/Reflection/Exception/PropertyIsNotStaticTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\PropertyIsNotStatic; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\PropertyIsNotStatic - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\PropertyIsNotStatic */ class PropertyIsNotStaticTest extends TestCase { public function testFromName(): void diff --git a/test/unit/Reflection/Exception/UncloneableTest.php b/test/unit/Reflection/Exception/UncloneableTest.php index 8155f487d..bf4c77912 100644 --- a/test/unit/Reflection/Exception/UncloneableTest.php +++ b/test/unit/Reflection/Exception/UncloneableTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Reflection\Exception\Uncloneable; -/** - * @covers \Roave\BetterReflection\Reflection\Exception\Uncloneable - */ +/** @covers \Roave\BetterReflection\Reflection\Exception\Uncloneable */ class UncloneableTest extends TestCase { public function testFromNonObject(): void diff --git a/test/unit/Reflection/ReflectionAttributeTest.php b/test/unit/Reflection/ReflectionAttributeTest.php index 4868002b1..22b67e9ba 100644 --- a/test/unit/Reflection/ReflectionAttributeTest.php +++ b/test/unit/Reflection/ReflectionAttributeTest.php @@ -20,9 +20,7 @@ use Roave\BetterReflectionTest\Fixture\ClassWithRepeatedAttributes; use Roave\BetterReflectionTest\Fixture\EnumWithAttributes; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionAttribute - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionAttribute */ class ReflectionAttributeTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/Reflection/ReflectionClassConstantTest.php b/test/unit/Reflection/ReflectionClassConstantTest.php index c93cf69df..973445ac3 100644 --- a/test/unit/Reflection/ReflectionClassConstantTest.php +++ b/test/unit/Reflection/ReflectionClassConstantTest.php @@ -39,7 +39,7 @@ private function getComposerLocator(): ComposerSourceLocator ); } - private function getExampleConstant(string $name): ?ReflectionClassConstant + private function getExampleConstant(string $name): ReflectionClassConstant|null { $reflector = new DefaultReflector($this->getComposerLocator()); $classInfo = $reflector->reflectClass(ExampleClass::class); @@ -82,17 +82,13 @@ public function testToString(): void self::assertSame("Constant [ public integer MY_CONST_1 ] { 123 }\n", (string) $this->getExampleConstant('MY_CONST_1')); } - /** - * @dataProvider getModifiersProvider - */ + /** @dataProvider getModifiersProvider */ public function testGetModifiers(string $const, int $expected): void { self::assertSame($expected, $this->getExampleConstant($const)->getModifiers()); } - /** - * @return list - */ + /** @return list */ public function getModifiersProvider(): array { return [ @@ -125,9 +121,7 @@ public function testGetDeclaringClass(): void self::assertSame($classInfo, $const->getDeclaringClass()); } - /** - * @dataProvider startEndLineProvider - */ + /** @dataProvider startEndLineProvider */ public function testStartEndLine(string $php, int $startLine, int $endLine): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -137,9 +131,7 @@ public function testStartEndLine(string $php, int $startLine, int $endLine): voi self::assertEquals($endLine, $constReflection->getEndLine()); } - /** - * @return list - */ + /** @return list */ public function startEndLineProvider(): array { return [ @@ -150,9 +142,7 @@ public function startEndLineProvider(): array ]; } - /** - * @return list - */ + /** @return list */ public function columnsProvider(): array { return [ @@ -162,9 +152,7 @@ public function columnsProvider(): array ]; } - /** - * @dataProvider columnsProvider - */ + /** @dataProvider columnsProvider */ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, int $endColumn): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -175,9 +163,7 @@ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, in self::assertEquals($endColumn, $constantReflection->getEndColumn()); } - /** - * @return list - */ + /** @return list */ public function getAstProvider(): array { return [ @@ -186,9 +172,7 @@ public function getAstProvider(): array ]; } - /** - * @dataProvider getAstProvider - */ + /** @dataProvider getAstProvider */ public function testGetAst(string $constantName, int $positionInAst): void { $php = <<<'PHP' @@ -211,9 +195,7 @@ class Foo self::assertSame($constantName, $ast->consts[$positionInAst]->name->name); } - /** - * @return list - */ + /** @return list */ public function deprecatedDocCommentProvider(): array { return [ @@ -236,9 +218,7 @@ public function deprecatedDocCommentProvider(): array ]; } - /** - * @dataProvider deprecatedDocCommentProvider - */ + /** @dataProvider deprecatedDocCommentProvider */ public function testIsDeprecated(string $docComment, bool $isDeprecated): void { $php = sprintf('getShortName()); } - /** - * @coversNothing - */ + /** @coversNothing */ public function testReflectingAClassDoesNotLoadTheClass(): void { self::assertFalse(class_exists(ExampleClass::class, false)); @@ -233,9 +229,7 @@ public function testGetMethodsForBackedEnum(): void self::assertCount(3, $methods); } - /** - * @return list, 2: class-string, 3: string}> - */ + /** @return list, 2: class-string, 3: string}> */ public function dataMethodsOfBackedEnum(): array { return [ @@ -299,9 +293,7 @@ public function testMethodsOfBackedEnum(string $methodName, array $parameters, s self::assertSame($returnType, $methodReturnType->__toString()); } - /** - * @return list - */ + /** @return list */ public function getMethodsWithFilterDataProvider(): array { return [ @@ -323,9 +315,7 @@ public function getMethodsWithFilterDataProvider(): array ]; } - /** - * @dataProvider getMethodsWithFilterDataProvider - */ + /** @dataProvider getMethodsWithFilterDataProvider */ public function testGetMethodsWithFilter(int $filter, int $count): void { $reflector = new DefaultReflector($this->getComposerLocator()); @@ -582,9 +572,7 @@ public function testGetPropertiesForPureEnum(): void self::assertTrue($property->isDefault()); } - /** - * @return list}> - */ + /** @return list}> */ public function dataGetPropertiesForBackedEnum(): array { return [ @@ -664,9 +652,7 @@ class Foo self::assertSame($expectedPropertiesNames, array_keys($properties)); } - /** - * @return list - */ + /** @return list */ public function getPropertiesWithFilterDataProvider(): array { return [ @@ -684,9 +670,7 @@ public function getPropertiesWithFilterDataProvider(): array ]; } - /** - * @dataProvider getPropertiesWithFilterDataProvider - */ + /** @dataProvider getPropertiesWithFilterDataProvider */ public function testGetPropertiesWithFilter(int $filter, int $count): void { $reflector = new DefaultReflector($this->getComposerLocator()); @@ -708,9 +692,7 @@ public function testGetPropertiesReturnsInheritedProperties(): void self::assertContainsOnlyInstancesOf(ReflectionProperty::class, $properties); } - /** - * @return list - */ + /** @return list */ public function dataInheritedProperties(): array { return [ @@ -723,9 +705,7 @@ public function dataInheritedProperties(): array ]; } - /** - * @dataProvider dataInheritedProperties - */ + /** @dataProvider dataInheritedProperties */ public function testInheritedProperties(string $propertyName, string $expectedDeclaringClassName, string $expectedImplementingClassName): void { $classInfo = (new DefaultReflector(new SingleFileSourceLocator( @@ -834,9 +814,7 @@ public function testGetParentClassNames(): void self::assertSame(['Roave\\BetterReflectionTest\\Fixture\\ClassWithParent', 'Roave\\BetterReflectionTest\\Fixture\\ExampleClass'], $childReflection->getParentClassNames()); } - /** - * @return list - */ + /** @return list */ public function startEndLineProvider(): array { return [ @@ -846,9 +824,7 @@ public function startEndLineProvider(): array ]; } - /** - * @dataProvider startEndLineProvider - */ + /** @dataProvider startEndLineProvider */ public function testStartEndLine(string $php, int $expectedStart, int $expectedEnd): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -858,9 +834,7 @@ public function testStartEndLine(string $php, int $expectedStart, int $expectedE self::assertSame($expectedEnd, $classInfo->getEndLine()); } - /** - * @return list - */ + /** @return list */ public function columnsProvider(): array { return [ @@ -870,9 +844,7 @@ public function columnsProvider(): array ]; } - /** - * @dataProvider columnsProvider - */ + /** @dataProvider columnsProvider */ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, int $endColumn): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -1158,9 +1130,7 @@ public function testIsFinalForEnum(): void self::assertTrue($classInfo->isFinal()); } - /** - * @return list}> - */ + /** @return list}> */ public function modifierProvider(): array { return [ @@ -1247,9 +1217,7 @@ public function testGetDeclaringClassForTraits(): void self::assertSame('TraitFixtureTraitA', $classInfo->getMethod('foo')->getDeclaringClass()->getName()); } - /** - * @return list - */ + /** @return list */ public function declaringClassProvider(): array { return [ @@ -1305,9 +1273,7 @@ public function declaringClassProvider(): array ]; } - /** - * @dataProvider declaringClassProvider - */ + /** @dataProvider declaringClassProvider */ public function testGetDeclaringClassWithTraitAndParent( string $className, string $methodName, @@ -2005,9 +1971,7 @@ public function testGetStaticPropertyValueThrowsExceptionWhenPropertyDoesNotExis $classInfo->getStaticPropertyValue('foo'); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testSetStaticPropertyValue(): void { $staticPropertyGetSetFixtureFile = __DIR__ . '/../Fixture/StaticPropertyGetSet.php'; @@ -2504,9 +2468,7 @@ public function __toString(): string self::assertSame(['Iterator', 'Traversable', 'Stringable'], $class->getInterfaceNames()); } - /** - * @return list - */ + /** @return list */ public function deprecatedDocCommentProvider(): array { return [ @@ -2529,9 +2491,7 @@ public function deprecatedDocCommentProvider(): array ]; } - /** - * @dataProvider deprecatedDocCommentProvider - */ + /** @dataProvider deprecatedDocCommentProvider */ public function testIsDeprecated(string $docComment, bool $isDeprecated): void { $php = sprintf('getDocComment()); } - /** - * @return list - */ + /** @return list */ public function startEndLineProvider(): array { return [ @@ -269,9 +265,7 @@ public function startEndLineProvider(): array ]; } - /** - * @dataProvider startEndLineProvider - */ + /** @dataProvider startEndLineProvider */ public function testStartEndLine(string $php, int $expectedStart, int $expectedEnd): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -281,9 +275,7 @@ public function testStartEndLine(string $php, int $expectedStart, int $expectedE self::assertSame($expectedEnd, $reflection->getEndLine()); } - /** - * @return list - */ + /** @return list */ public function columnsProvider(): array { return [ @@ -292,9 +284,7 @@ public function columnsProvider(): array ]; } - /** - * @dataProvider columnsProvider - */ + /** @dataProvider columnsProvider */ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, int $endColumn): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -331,9 +321,7 @@ public function testGetAstByDefine(): void self::assertSame('FOO', $ast->args[0]->value->value); } - /** - * @return list - */ + /** @return list */ public function deprecatedDocCommentProvider(): array { return [ @@ -356,9 +344,7 @@ public function deprecatedDocCommentProvider(): array ]; } - /** - * @dataProvider deprecatedDocCommentProvider - */ + /** @dataProvider deprecatedDocCommentProvider */ public function testIsDeprecated(string $docComment, bool $isDeprecated): void { $php = sprintf('reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Enums.php', $this->astLocator)); } - /** - * @return list - */ + /** @return list */ public function data(): array { return [ @@ -50,9 +46,7 @@ public function data(): array ]; } - /** - * @dataProvider data - */ + /** @dataProvider data */ public function testCanReflect(string $enumName, string $caseName): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -65,9 +59,7 @@ public function testCanReflect(string $enumName, string $caseName): void self::assertSame($caseName, $caseReflection->getName()); } - /** - * @return list - */ + /** @return list */ public function dataGetValue(): array { return [ @@ -76,9 +68,7 @@ public function dataGetValue(): array ]; } - /** - * @dataProvider dataGetValue - */ + /** @dataProvider dataGetValue */ public function testGetValue(string $enumName, string $caseName, int|string $value): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -103,9 +93,7 @@ public function testGetValueThrowsExceptionForPureEnum(): void $caseReflection->getValue(); } - /** - * @dataProvider data - */ + /** @dataProvider data */ public function testGetAst(string $enumName, string $caseName): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -119,9 +107,7 @@ public function testGetAst(string $enumName, string $caseName): void self::assertSame($caseName, $ast->name->toString()); } - /** - * @return list - */ + /** @return list */ public function dataLinesAndColums(): array { return [ @@ -131,9 +117,7 @@ public function dataLinesAndColums(): array ]; } - /** - * @dataProvider dataLinesAndColums - */ + /** @dataProvider dataLinesAndColums */ public function testLinesAndColums(string $enumName, string $caseName, int $startLine, int $endLine, int $startColumn, int $endColumn): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -148,9 +132,7 @@ public function testLinesAndColums(string $enumName, string $caseName, int $star self::assertSame($endColumn, $caseReflection->getEndColumn()); } - /** - * @dataProvider data - */ + /** @dataProvider data */ public function testGetDeclaringClassAndEnum(string $enumName, string $caseName): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -163,9 +145,7 @@ public function testGetDeclaringClassAndEnum(string $enumName, string $caseName) self::assertSame($enumReflection, $caseReflection->getDeclaringEnum()); } - /** - * @return list - */ + /** @return list */ public function dataGetDocComment(): array { return [ @@ -174,9 +154,7 @@ public function dataGetDocComment(): array ]; } - /** - * @dataProvider dataGetDocComment - */ + /** @dataProvider dataGetDocComment */ public function testGetDocComment(string $caseName, string $docComment): void { $enumReflection = $this->reflector->reflectClass(DocComment::class); @@ -188,9 +166,7 @@ public function testGetDocComment(string $caseName, string $docComment): void self::assertSame($docComment, $caseReflection->getDocComment()); } - /** - * @return list - */ + /** @return list */ public function dataIsDeprecated(): array { return [ @@ -199,9 +175,7 @@ public function dataIsDeprecated(): array ]; } - /** - * @dataProvider dataIsDeprecated - */ + /** @dataProvider dataIsDeprecated */ public function testIsDeprecated(string $caseName, bool $isDeprecated): void { $enumReflection = $this->reflector->reflectClass(IsDeprecated::class); diff --git a/test/unit/Reflection/ReflectionEnumTest.php b/test/unit/Reflection/ReflectionEnumTest.php index c3c2cdb62..b5e33b07b 100644 --- a/test/unit/Reflection/ReflectionEnumTest.php +++ b/test/unit/Reflection/ReflectionEnumTest.php @@ -18,9 +18,7 @@ use Roave\BetterReflectionTest\Fixture\PureEnum; use Roave\BetterReflectionTest\Fixture\StringEnum; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionEnum - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionEnum */ class ReflectionEnumTest extends TestCase { private Locator $astLocator; @@ -35,9 +33,7 @@ public function setUp(): void $this->reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Enums.php', $this->astLocator)); } - /** - * @return list - */ + /** @return list */ public function dataCanReflect(): array { return [ @@ -47,9 +43,7 @@ public function dataCanReflect(): array ]; } - /** - * @dataProvider dataCanReflect - */ + /** @dataProvider dataCanReflect */ public function testCanReflect(string $enumName): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -57,9 +51,7 @@ public function testCanReflect(string $enumName): void self::assertInstanceOf(ReflectionEnum::class, $enumReflection); } - /** - * @return list - */ + /** @return list */ public function dataHasAndGetCase(): array { return [ @@ -70,9 +62,7 @@ public function dataHasAndGetCase(): array ]; } - /** - * @dataProvider dataHasAndGetCase - */ + /** @dataProvider dataHasAndGetCase */ public function testHasAndGetCase(string $caseName, bool $exists): void { $enumReflection = $this->reflector->reflectClass(PureEnum::class); @@ -90,9 +80,7 @@ public function testHasAndGetCase(string $caseName, bool $exists): void } } - /** - * @return list - */ + /** @return list */ public function dataGetCases(): array { return [ @@ -102,9 +90,7 @@ public function dataGetCases(): array ]; } - /** - * @dataProvider dataGetCases - */ + /** @dataProvider dataGetCases */ public function testGetCases(string $enumName, int $casesCount): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -117,9 +103,7 @@ public function testGetCases(string $enumName, int $casesCount): void self::assertContainsOnlyInstancesOf(ReflectionEnumCase::class, $cases); } - /** - * @return list - */ + /** @return list */ public function dataIsBacked(): array { return [ @@ -129,9 +113,7 @@ public function dataIsBacked(): array ]; } - /** - * @dataProvider dataIsBacked - */ + /** @dataProvider dataIsBacked */ public function testIsBacked(string $enumName, bool $isBacked): void { $enumReflection = $this->reflector->reflectClass($enumName); @@ -140,9 +122,7 @@ public function testIsBacked(string $enumName, bool $isBacked): void self::assertSame($isBacked, $enumReflection->isBacked()); } - /** - * @return list - */ + /** @return list */ public function dataGetBackingType(): array { return [ @@ -151,9 +131,7 @@ public function dataGetBackingType(): array ]; } - /** - * @dataProvider dataGetBackingType - */ + /** @dataProvider dataGetBackingType */ public function testGetBackingType(string $enumName, string $expectedBackingType): void { $enumReflection = $this->reflector->reflectClass($enumName); diff --git a/test/unit/Reflection/ReflectionFunctionAbstractTest.php b/test/unit/Reflection/ReflectionFunctionAbstractTest.php index 9b344934a..bb088af39 100644 --- a/test/unit/Reflection/ReflectionFunctionAbstractTest.php +++ b/test/unit/Reflection/ReflectionFunctionAbstractTest.php @@ -34,9 +34,7 @@ use function reset; use function sprintf; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionFunctionAbstract - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionFunctionAbstract */ class ReflectionFunctionAbstractTest extends TestCase { private Parser $parser; @@ -141,9 +139,7 @@ public function testIsClosureWithArrowFunction(): void self::assertTrue($function->isClosure()); } - /** - * @dataProvider nonDeprecatedProvider - */ + /** @dataProvider nonDeprecatedProvider */ public function testIsDeprecated(string $comment): void { $php = sprintf('isDeprecated()); } - /** - * @return list - */ + /** @return list */ public function nonDeprecatedProvider(): array { return [ @@ -183,9 +177,7 @@ public function testIsInternal(): void self::assertNull($function->getExtensionName()); } - /** - * @return list - */ + /** @return list */ public function variadicProvider(): array { return [ @@ -195,9 +187,7 @@ public function variadicProvider(): array ]; } - /** - * @dataProvider variadicProvider - */ + /** @dataProvider variadicProvider */ public function testIsVariadic(string $php, bool $expectingVariadic): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -237,9 +227,7 @@ public function generatorProvider(): array ]; } - /** - * @dataProvider generatorProvider - */ + /** @dataProvider generatorProvider */ public function testIsGenerator(string $php, bool $expectingGenerator): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -248,9 +236,7 @@ public function testIsGenerator(string $php, bool $expectingGenerator): void self::assertSame($expectingGenerator, $function->isGenerator()); } - /** - * @return list - */ + /** @return list */ public function startEndLineProvider(): array { return [ @@ -260,9 +246,7 @@ public function startEndLineProvider(): array ]; } - /** - * @dataProvider startEndLineProvider - */ + /** @dataProvider startEndLineProvider */ public function testStartEndLine(string $php, int $expectedStart, int $expectedEnd): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -272,9 +256,7 @@ public function testStartEndLine(string $php, int $expectedStart, int $expectedE self::assertSame($expectedEnd, $function->getEndLine()); } - /** - * @return list - */ + /** @return list */ public function columnsProvider(): array { return [ @@ -284,9 +266,7 @@ public function columnsProvider(): array ]; } - /** - * @dataProvider columnsProvider - */ + /** @dataProvider columnsProvider */ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, int $endColumn): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -296,9 +276,7 @@ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, in self::assertSame($endColumn, $function->getEndColumn()); } - /** - * @return list - */ + /** @return list */ public function returnsReferenceProvider(): array { return [ @@ -307,9 +285,7 @@ public function returnsReferenceProvider(): array ]; } - /** - * @dataProvider returnsReferenceProvider - */ + /** @dataProvider returnsReferenceProvider */ public function testReturnsReference(string $php, bool $expectingReturnsReference): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -421,9 +397,7 @@ public function testGetLocatedSource(): void self::assertSame($locatedSource, $functionInfo->getLocatedSource()); } - /** - * @return list - */ + /** @return list */ public function returnTypeFunctionProvider(): array { return [ @@ -435,9 +409,7 @@ public function returnTypeFunctionProvider(): array ]; } - /** - * @dataProvider returnTypeFunctionProvider - */ + /** @dataProvider returnTypeFunctionProvider */ public function testGetReturnTypeWithDeclaredType(string $functionToReflect, string $expectedType): void { $functionInfo = (new DefaultReflector( @@ -476,9 +448,7 @@ public function testHasReturnTypeWhenTypeIsNotDeclared(): void self::assertFalse($functionInfo->hasReturnType()); } - /** - * @return list - */ + /** @return list */ public function nullableReturnTypeFunctionProvider(): array { return [ @@ -488,9 +458,7 @@ public function nullableReturnTypeFunctionProvider(): array ]; } - /** - * @dataProvider nullableReturnTypeFunctionProvider - */ + /** @dataProvider nullableReturnTypeFunctionProvider */ public function testGetNullableReturnTypeWithDeclaredType(string $functionToReflect, string $expectedType): void { $functionInfo = (new DefaultReflector( @@ -503,9 +471,7 @@ public function testGetNullableReturnTypeWithDeclaredType(string $functionToRefl self::assertTrue($reflectionType->allowsNull()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testHasTentativeReturnType(): void { $classInfo = (new DefaultReflector(new PhpInternalSourceLocator($this->astLocator, new ReflectionSourceStubber())))->reflectClass(CoreReflectionClass::class); @@ -525,9 +491,7 @@ public function testHasNotTentativeReturnType(): void self::assertTrue($functionInfo->hasReturnType()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testGetTentativeReturnType(): void { $classInfo = (new DefaultReflector(new PhpInternalSourceLocator($this->astLocator, new ReflectionSourceStubber())))->reflectClass(CoreReflectionClass::class); @@ -751,9 +715,7 @@ public function testGetReturnStatementAstForArrowFunction(): void self::assertContainsOnlyInstancesOf(Return_::class, $nodes); } - /** - * @dataProvider deprecatedDocCommentsProvider - */ + /** @dataProvider deprecatedDocCommentsProvider */ public function testFunctionsCanBeDeprecated(string $comment): void { $php = sprintf('isDeprecated()); } - /** - * @return list - */ + /** @return list */ public function deprecatedDocCommentsProvider(): array { return [ diff --git a/test/unit/Reflection/ReflectionFunctionTest.php b/test/unit/Reflection/ReflectionFunctionTest.php index 02998cb74..a28058ce4 100644 --- a/test/unit/Reflection/ReflectionFunctionTest.php +++ b/test/unit/Reflection/ReflectionFunctionTest.php @@ -20,9 +20,7 @@ use Roave\BetterReflectionTest\Fixture\ClassWithStaticMethod; use stdClass; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionFunction - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionFunction */ class ReflectionFunctionTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/Reflection/ReflectionIntersectionTypeTest.php b/test/unit/Reflection/ReflectionIntersectionTypeTest.php index ace1d3c04..545750e61 100644 --- a/test/unit/Reflection/ReflectionIntersectionTypeTest.php +++ b/test/unit/Reflection/ReflectionIntersectionTypeTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflection\Reflection\ReflectionParameter; use Roave\BetterReflection\Reflector\Reflector; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionIntersectionType - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionIntersectionType */ class ReflectionIntersectionTypeTest extends TestCase { private Reflector $reflector; @@ -27,9 +25,7 @@ protected function setUp(): void $this->owner = $this->createMock(ReflectionParameter::class); } - /** - * @return list - */ + /** @return list */ public function dataProvider(): array { return [ @@ -38,9 +34,7 @@ public function dataProvider(): array ]; } - /** - * @dataProvider dataProvider - */ + /** @dataProvider dataProvider */ public function test(Node\IntersectionType $intersectionType, string $expectedString): void { $typeReflection = new ReflectionIntersectionType($this->reflector, $this->owner, $intersectionType); diff --git a/test/unit/Reflection/ReflectionMethodTest.php b/test/unit/Reflection/ReflectionMethodTest.php index a012588bc..c2ba6cc79 100644 --- a/test/unit/Reflection/ReflectionMethodTest.php +++ b/test/unit/Reflection/ReflectionMethodTest.php @@ -50,9 +50,7 @@ use function basename; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionMethod - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionMethod */ class ReflectionMethodTest extends TestCase { private Reflector $reflector; @@ -96,9 +94,7 @@ public function testIsClosure(): void self::assertFalse($method->isClosure()); } - /** - * @return array - */ + /** @return array */ public function visibilityProvider(): array { return [ @@ -112,9 +108,7 @@ public function visibilityProvider(): array ]; } - /** - * @dataProvider visibilityProvider - */ + /** @dataProvider visibilityProvider */ public function testVisibilityOfMethods( string $methodName, bool $shouldBePublic, @@ -280,9 +274,7 @@ public function someMethod() : object {} self::assertSame('object', (string) $returnType); } - /** - * @return list}> - */ + /** @return list}> */ public function modifierProvider(): array { return [ @@ -313,9 +305,7 @@ public function testGetModifiers(string $methodName, int $expectedModifier, arra ); } - /** - * @return list - */ + /** @return list */ public function prototypeProvider(): array { return [ @@ -333,10 +323,8 @@ public function prototypeProvider(): array ]; } - /** - * @dataProvider prototypeProvider - */ - public function testGetPrototype(string $class, string $method, ?string $expectedPrototype): void + /** @dataProvider prototypeProvider */ + public function testGetPrototype(string $class, string $method, string|null $expectedPrototype): void { $fixture = __DIR__ . '/../Fixture/PrototypeTree.php'; $reflector = new DefaultReflector(new SingleFileSourceLocator($fixture, $this->astLocator)); @@ -350,9 +338,7 @@ public function testGetPrototype(string $class, string $method, ?string $expecte self::assertSame($expectedPrototype, $b->getDeclaringClass()->getName()); } - /** - * @return list - */ + /** @return list */ public function overwrittenMethodProvider(): array { return [ diff --git a/test/unit/Reflection/ReflectionNamedTypeTest.php b/test/unit/Reflection/ReflectionNamedTypeTest.php index 35a9ac7b9..5a44ca839 100644 --- a/test/unit/Reflection/ReflectionNamedTypeTest.php +++ b/test/unit/Reflection/ReflectionNamedTypeTest.php @@ -19,9 +19,7 @@ use function sprintf; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionNamedType - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionNamedType */ class ReflectionNamedTypeTest extends TestCase { private Reflector $reflector; @@ -52,9 +50,7 @@ public function testAllowsNull(): void self::assertFalse($noNullType->allowsNull()); } - /** - * @return list - */ + /** @return list */ public function dataMixedAllowsNull(): array { return [ @@ -63,9 +59,7 @@ public function dataMixedAllowsNull(): array ]; } - /** - * @dataProvider dataMixedAllowsNull - */ + /** @dataProvider dataMixedAllowsNull */ public function testMixedAllowsNull(string $mixedType): void { $noNullType = $this->createType($mixedType); @@ -94,9 +88,7 @@ public function isBuildinProvider(): Generator yield ['TRUE']; } - /** - * @dataProvider isBuildinProvider - */ + /** @dataProvider isBuildinProvider */ public function testIsBuiltin(string $type): void { $reflectionType = $this->createType($type); @@ -111,9 +103,7 @@ public function isNotBuildinProvider(): Generator yield ['\foo']; } - /** - * @dataProvider isNotBuildinProvider - */ + /** @dataProvider isNotBuildinProvider */ public function testIsNotBuiltin(string $type): void { $reflectionType = $this->createType($type); @@ -265,9 +255,7 @@ function withSelf(self $parameter) {} $typeReflection->getClass(); } - /** - * @return list - */ + /** @return list */ public function dataGetClassWithSelfOrStatic(): array { return [ @@ -282,9 +270,7 @@ public function dataGetClassWithSelfOrStatic(): array ]; } - /** - * @dataProvider dataGetClassWithSelfOrStatic - */ + /** @dataProvider dataGetClassWithSelfOrStatic */ public function testGetClassWithSelfOrStatic(string $classNameToReflect, string $type, string $typeClassName): void { $php = sprintf('getName()); } - /** - * @return list - */ + /** @return list */ public function dataGetClassWithParent(): array { return [ @@ -317,9 +301,7 @@ public function dataGetClassWithParent(): array ]; } - /** - * @dataProvider dataGetClassWithParent - */ + /** @dataProvider dataGetClassWithParent */ public function testGetClassWithParent(string $parentType): void { $php = sprintf('phpParser()->parse($code); } - /** - * @return list - */ + /** @return list */ public function anonymousClassInstancesProvider(): array { $file = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../Fixture/AnonymousClassInstances.php')); @@ -60,9 +54,7 @@ public function anonymousClassInstancesProvider(): array ]; } - /** - * @dataProvider anonymousClassInstancesProvider - */ + /** @dataProvider anonymousClassInstancesProvider */ public function testReflectionForAnonymousClass(object $anonymousClass, string $file, int $startLine, int $endLine): void { $classInfo = ReflectionObject::createFromInstance($anonymousClass); diff --git a/test/unit/Reflection/ReflectionParameterTest.php b/test/unit/Reflection/ReflectionParameterTest.php index 8bc47f684..ae84125f9 100644 --- a/test/unit/Reflection/ReflectionParameterTest.php +++ b/test/unit/Reflection/ReflectionParameterTest.php @@ -39,9 +39,7 @@ use const SORT_ASC as SORT_ASC_TEST; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionParameter - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionParameter */ class ReflectionParameterTest extends TestCase { private Reflector $reflector; @@ -173,9 +171,7 @@ public function testCreateFromSpecWithInvalidSpecThrowsException(): void ReflectionParameter::createFromSpec([], 'index'); } - /** - * @return list - */ + /** @return list */ public function defaultParameterProvider(): array { return [ @@ -189,9 +185,7 @@ public function defaultParameterProvider(): array ]; } - /** - * @dataProvider defaultParameterProvider - */ + /** @dataProvider defaultParameterProvider */ public function testDefaultParametersTypes(string $defaultExpression, mixed $expectedValue): void { $content = sprintf('getPosition()); } - /** - * @return list - */ + /** @return list */ public function typeProvider(): array { return [ @@ -305,9 +297,7 @@ public function testPhp7TypeDeclarationWithoutType(): void self::assertNull($method->getParameter('noTypeParam')->getType()); } - /** - * @return list - */ + /** @return list */ public function allowsNullProvider(): array { return [ @@ -321,9 +311,7 @@ public function allowsNullProvider(): array ]; } - /** - * @dataProvider allowsNullProvider - */ + /** @dataProvider allowsNullProvider */ public function testAllowsNull(string $parameterName, bool $allowsNull): void { $classInfo = $this->reflector->reflectClass(NullableParameterTypeDeclarations::class); @@ -349,9 +337,7 @@ public function testHasTypeReturnsFalseWithoutType(): void self::assertFalse($method->getParameter('noTypeParam')->hasType()); } - /** - * @return list - */ + /** @return list */ public function isCallableProvider(): array { return [ @@ -370,9 +356,7 @@ public function isCallableProvider(): array ]; } - /** - * @dataProvider isCallableProvider - */ + /** @dataProvider isCallableProvider */ public function testIsCallable(string $parameterName, bool $isCallable): void { $classReflection = $this->reflector->reflectClass(Methods::class); @@ -382,9 +366,7 @@ public function testIsCallable(string $parameterName, bool $isCallable): void self::assertSame($isCallable, $parameterReflection->isCallable()); } - /** - * @return list - */ + /** @return list */ public function isArrayProvider(): array { return [ @@ -403,9 +385,7 @@ public function isArrayProvider(): array ]; } - /** - * @dataProvider isArrayProvider - */ + /** @dataProvider isArrayProvider */ public function testIsArray(string $parameterName, bool $isArray): void { $classReflection = $this->reflector->reflectClass(Methods::class); @@ -484,9 +464,7 @@ public function testParameterWithDefaultValueBeforeVariadicParameterShouldBeOpti self::assertTrue($secondParam->isVariadic()); } - /** - * @group 109 - */ + /** @group 109 */ public function testVariadicParametersAreAlsoImplicitlyOptional(): void { $classInfo = $this->reflector->reflectClass(Methods::class); @@ -623,9 +601,7 @@ public function testGetDeclaringClassForFunctionReturnsNull(): void self::assertNull($paramInfo->getDeclaringClass()); } - /** - * @return list - */ + /** @return list */ public function getClassProvider(): array { return [ @@ -638,10 +614,8 @@ public function getClassProvider(): array ]; } - /** - * @dataProvider getClassProvider - */ - public function testGetClass(string $parameterName, ?string $className): void + /** @dataProvider getClassProvider */ + public function testGetClass(string $parameterName, string|null $className): void { $reflector = new DefaultReflector(new AggregateSourceLocator([ new PhpInternalSourceLocator($this->astLocator, $this->sourceStubber), @@ -713,9 +687,7 @@ public function testGetClassFromObjectTypeHintedProperty(): void self::assertSame('object', $type->__toString()); } - /** - * @return list - */ + /** @return list */ public function columnsProvider(): array { return [ @@ -726,9 +698,7 @@ public function columnsProvider(): array ]; } - /** - * @dataProvider columnsProvider - */ + /** @dataProvider columnsProvider */ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, int $endColumn): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); diff --git a/test/unit/Reflection/ReflectionPropertyTest.php b/test/unit/Reflection/ReflectionPropertyTest.php index 3291b57f7..af9c40206 100644 --- a/test/unit/Reflection/ReflectionPropertyTest.php +++ b/test/unit/Reflection/ReflectionPropertyTest.php @@ -43,9 +43,7 @@ use function sprintf; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionProperty - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionProperty */ class ReflectionPropertyTest extends TestCase { private Reflector $reflector; @@ -158,9 +156,7 @@ public function testGetDocCommentReturnsEmptyStringWithNoComment(): void self::assertSame('', $property->getDocComment()); } - /** - * @return list}> - */ + /** @return list}> */ public function modifierProvider(): array { return [ @@ -239,9 +235,7 @@ public function testToString(): void self::assertSame('Property [ public $publicProperty ]', (string) $classInfo->getProperty('publicProperty')); } - /** - * @return list - */ + /** @return list */ public function propertyDefaultValueProvider(): array { return [ @@ -255,9 +249,7 @@ public function propertyDefaultValueProvider(): array ]; } - /** - * @dataProvider propertyDefaultValueProvider - */ + /** @dataProvider propertyDefaultValueProvider */ public function testPropertyDefaultValue(string $propertyName, bool $hasDefaultValue, mixed $defaultValue): void { $classInfo = (new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/DefaultProperties.php', $this->astLocator)))->reflectClass(DefaultProperties::class); @@ -276,9 +268,7 @@ public function testCannotClone(): void clone $publicProp; } - /** - * @dataProvider startEndLineProvider - */ + /** @dataProvider startEndLineProvider */ public function testStartEndLine(string $php, int $startLine, int $endLine): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -288,9 +278,7 @@ public function testStartEndLine(string $php, int $startLine, int $endLine): voi self::assertEquals($endLine, $constReflection->getEndLine()); } - /** - * @return list - */ + /** @return list */ public function startEndLineProvider(): array { return [ @@ -301,9 +289,7 @@ public function startEndLineProvider(): array ]; } - /** - * @return list - */ + /** @return list */ public function columnsProvider(): array { return [ @@ -313,9 +299,7 @@ public function columnsProvider(): array ]; } - /** - * @dataProvider columnsProvider - */ + /** @dataProvider columnsProvider */ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, int $endColumn): void { $reflector = new DefaultReflector(new StringSourceLocator($php, $this->astLocator)); @@ -326,9 +310,7 @@ public function testGetStartColumnAndEndColumn(string $php, int $startColumn, in self::assertEquals($endColumn, $constantReflection->getEndColumn()); } - /** - * @return list - */ + /** @return list */ public function getAstProvider(): array { return [ @@ -339,9 +321,7 @@ public function getAstProvider(): array ]; } - /** - * @dataProvider getAstProvider - */ + /** @dataProvider getAstProvider */ public function testGetAst(string $propertyName, int $positionInAst): void { $php = <<<'PHP' @@ -398,9 +378,7 @@ public function testGetDeclaringAndImplementingClassWithPropertyFromParentClass( self::assertSame($propertyReflection->getDeclaringClass(), $propertyReflection->getImplementingClass()); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testSetAndGetValueOfStaticProperty(): void { $staticPropertyGetSetFixture = __DIR__ . '/../Fixture/StaticPropertyGetSet.php'; @@ -448,9 +426,7 @@ public function testSetAndGetValueOfStaticPropertyOnClassUsingTrait(): void self::assertSame('value', $propertyReflection->getValue()); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testSetValueOfStaticPropertyWithValueAsSecondParameter(): void { $staticPropertyGetSetFixture = __DIR__ . '/../Fixture/StaticPropertyGetSet.php'; @@ -611,9 +587,7 @@ public function testAllowsNull(): void self::assertTrue($nullableStringPropertyReflection->allowsNull()); } - /** - * @return list - */ + /** @return list */ public function hasTypeProvider(): array { return [ @@ -625,9 +599,7 @@ public function hasTypeProvider(): array ]; } - /** - * @dataProvider hasTypeProvider - */ + /** @dataProvider hasTypeProvider */ public function testHasType( string $propertyName, bool $expectedHasType, @@ -638,9 +610,7 @@ public function testHasType( self::assertSame($expectedHasType, $propertyReflection->hasType()); } - /** - * @return list - */ + /** @return list */ public function getTypeProvider(): array { return [ @@ -652,9 +622,7 @@ public function getTypeProvider(): array ]; } - /** - * @dataProvider getTypeProvider - */ + /** @dataProvider getTypeProvider */ public function testGetType( string $propertyName, string $expectedType, @@ -667,9 +635,7 @@ public function testGetType( self::assertSame($expectedType, (string) $type); } - /** - * @return list - */ + /** @return list */ public function isInitializedProvider(): array { $object = new InitializedProperties(); @@ -686,10 +652,8 @@ public function isInitializedProvider(): array ]; } - /** - * @dataProvider isInitializedProvider - */ - public function testIsInitialized(string $propertyName, ?object $object, bool $isInitialized): void + /** @dataProvider isInitializedProvider */ + public function testIsInitialized(string $propertyName, object|null $object, bool $isInitialized): void { $classReflection = $this->reflector->reflectClass(InitializedProperties::class); @@ -716,9 +680,7 @@ public function testIsInitializedThrowsError(): void $classReflection->getProperty('toBeRemoved')->isInitialized($object); } - /** - * @return list - */ + /** @return list */ public function deprecatedDocCommentProvider(): array { return [ @@ -741,9 +703,7 @@ public function deprecatedDocCommentProvider(): array ]; } - /** - * @dataProvider deprecatedDocCommentProvider - */ + /** @dataProvider deprecatedDocCommentProvider */ public function testIsDeprecated(string $docComment, bool $isDeprecated): void { $php = sprintf(' - */ + /** @return list */ public function dataGetAttributes(): array { return [ @@ -780,9 +738,7 @@ public function dataGetAttributes(): array ]; } - /** - * @dataProvider dataGetAttributes - */ + /** @dataProvider dataGetAttributes */ public function testGetAttributesWithAttributes(string $propertyName): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Attributes.php', $this->astLocator)); @@ -793,9 +749,7 @@ public function testGetAttributesWithAttributes(string $propertyName): void self::assertCount(2, $attributes); } - /** - * @dataProvider dataGetAttributes - */ + /** @dataProvider dataGetAttributes */ public function testGetAttributesByName(string $propertyName): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Attributes.php', $this->astLocator)); @@ -806,9 +760,7 @@ public function testGetAttributesByName(string $propertyName): void self::assertCount(1, $attributes); } - /** - * @dataProvider dataGetAttributes - */ + /** @dataProvider dataGetAttributes */ public function testGetAttributesByInstance(string $propertyName): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../Fixture/Attributes.php', $this->astLocator)); diff --git a/test/unit/Reflection/ReflectionTypeTest.php b/test/unit/Reflection/ReflectionTypeTest.php index 608c63f7c..89e7ddcad 100644 --- a/test/unit/Reflection/ReflectionTypeTest.php +++ b/test/unit/Reflection/ReflectionTypeTest.php @@ -32,9 +32,7 @@ protected function setUp(): void $this->owner = $this->createMock(ReflectionParameter::class); } - /** - * @return array - */ + /** @return array */ public function dataProvider(): array { return [ @@ -73,9 +71,7 @@ public function dataProvider(): array ]; } - /** - * @dataProvider dataProvider - */ + /** @dataProvider dataProvider */ public function test( Node\Identifier|Node\Name|Node\NullableType|Node\UnionType|Node\IntersectionType $node, bool $forceAllowsNull, diff --git a/test/unit/Reflection/ReflectionUnionTypeTest.php b/test/unit/Reflection/ReflectionUnionTypeTest.php index 8aa3cd7a2..b176737fe 100644 --- a/test/unit/Reflection/ReflectionUnionTypeTest.php +++ b/test/unit/Reflection/ReflectionUnionTypeTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflection\Reflection\ReflectionUnionType; use Roave\BetterReflection\Reflector\Reflector; -/** - * @covers \Roave\BetterReflection\Reflection\ReflectionUnionType - */ +/** @covers \Roave\BetterReflection\Reflection\ReflectionUnionType */ class ReflectionUnionTypeTest extends TestCase { private Reflector $reflector; @@ -27,9 +25,7 @@ protected function setUp(): void $this->owner = $this->createMock(ReflectionParameter::class); } - /** - * @return list - */ + /** @return list */ public function dataProvider(): array { return [ @@ -38,9 +34,7 @@ public function dataProvider(): array ]; } - /** - * @dataProvider dataProvider - */ + /** @dataProvider dataProvider */ public function test(Node\UnionType $unionType, string $expectedString, bool $expectedNullable): void { $typeReflection = new ReflectionUnionType($this->reflector, $this->owner, $unionType); diff --git a/test/unit/Reflection/StringCast/ReflectionAttributeStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionAttributeStringCastTest.php index 0fd160bc2..b3c2c4c08 100644 --- a/test/unit/Reflection/StringCast/ReflectionAttributeStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionAttributeStringCastTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflectionTest\BetterReflectionSingleton; use Roave\BetterReflectionTest\Fixture\ClassWithAttributesForStringCast; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionAttributeStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionAttributeStringCast */ class ReflectionAttributeStringCastTest extends TestCase { private Locator $astLocator; @@ -27,9 +25,7 @@ protected function setUp(): void $this->astLocator = $betterReflection->astLocator(); } - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { return [ @@ -38,9 +34,7 @@ public function toStringProvider(): array ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString(string $attributeName, string $expectedString): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../../Fixture/StringCastAttributes.php', $this->astLocator)); diff --git a/test/unit/Reflection/StringCast/ReflectionClassConstantStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionClassConstantStringCastTest.php index 05cfaa359..f4eca028a 100644 --- a/test/unit/Reflection/StringCast/ReflectionClassConstantStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionClassConstantStringCastTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflectionTest\BetterReflectionSingleton; use Roave\BetterReflectionTest\Fixture\StringCastConstants; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionClassConstantStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionClassConstantStringCast */ class ReflectionClassConstantStringCastTest extends TestCase { private Locator $astLocator; @@ -25,9 +23,7 @@ protected function setUp(): void $this->astLocator = BetterReflectionSingleton::instance()->astLocator(); } - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { return [ @@ -39,9 +35,7 @@ public function toStringProvider(): array ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString(string $constantName, string $expectedString): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../../Fixture/StringCastClassConstants.php', $this->astLocator)); diff --git a/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php index acf57b102..c08aef8ce 100644 --- a/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionClassStringCastTest.php @@ -22,9 +22,7 @@ use function file_get_contents; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionClassStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionClassStringCast */ class ReflectionClassStringCastTest extends TestCase { private Locator $astLocator; @@ -52,9 +50,7 @@ public function testToString(): void ); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testPureEnumToString(): void { $reflector = new DefaultReflector(new AggregateSourceLocator([ @@ -69,9 +65,7 @@ public function testPureEnumToString(): void ); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testBackedEnumToString(): void { $reflector = new DefaultReflector(new AggregateSourceLocator([ diff --git a/test/unit/Reflection/StringCast/ReflectionConstantStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionConstantStringCastTest.php index 9134dfd1d..3c5cdc0ff 100644 --- a/test/unit/Reflection/StringCast/ReflectionConstantStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionConstantStringCastTest.php @@ -14,9 +14,7 @@ use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionConstantStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionConstantStringCast */ class ReflectionConstantStringCastTest extends TestCase { private Locator $astLocator; @@ -33,9 +31,7 @@ protected function setUp(): void $this->sourceStubber = $betterReflection->sourceStubber(); } - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { return [ @@ -47,9 +43,7 @@ public function toStringProvider(): array ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString(string $constantName, string $expectedString): void { $sourceLocator = new AggregateSourceLocator([ diff --git a/test/unit/Reflection/StringCast/ReflectionEnumCaseStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionEnumCaseStringCastTest.php index 446b73f20..dea3e3ca9 100644 --- a/test/unit/Reflection/StringCast/ReflectionEnumCaseStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionEnumCaseStringCastTest.php @@ -13,9 +13,7 @@ use Roave\BetterReflectionTest\Fixture\StringCastBackedEnum; use Roave\BetterReflectionTest\Fixture\StringCastPureEnum; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionEnumCaseStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionEnumCaseStringCast */ class ReflectionEnumCaseStringCastTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/Reflection/StringCast/ReflectionFunctionStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionFunctionStringCastTest.php index 4cb2b7ddc..b5612b688 100644 --- a/test/unit/Reflection/StringCast/ReflectionFunctionStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionFunctionStringCastTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionFunctionStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionFunctionStringCast */ class ReflectionFunctionStringCastTest extends TestCase { private Locator $astLocator; @@ -28,9 +26,7 @@ protected function setUp(): void $this->astLocator = $betterReflection->astLocator(); } - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { return [ @@ -40,9 +36,7 @@ public function toStringProvider(): array ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString(string $functionName, string $expectedString): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../../Fixture/StringCastFunctions.php', $this->astLocator)); diff --git a/test/unit/Reflection/StringCast/ReflectionMethodStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionMethodStringCastTest.php index c1bc6d426..d825b5b60 100644 --- a/test/unit/Reflection/StringCast/ReflectionMethodStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionMethodStringCastTest.php @@ -14,9 +14,7 @@ use Roave\BetterReflectionTest\BetterReflectionSingleton; use Roave\BetterReflectionTest\Fixture\StringCastMethods; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionMethodStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionMethodStringCast */ class ReflectionMethodStringCastTest extends TestCase { private Locator $astLocator; @@ -33,9 +31,7 @@ protected function setUp(): void $this->sourceStubber = $betterReflection->sourceStubber(); } - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { return [ @@ -56,9 +52,7 @@ public function toStringProvider(): array ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString(string $methodName, string $expectedString): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../../Fixture/StringCastMethods.php', $this->astLocator)); diff --git a/test/unit/Reflection/StringCast/ReflectionParameterStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionParameterStringCastTest.php index 3bdfbee0c..f9270fa8f 100644 --- a/test/unit/Reflection/StringCast/ReflectionParameterStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionParameterStringCastTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflectionTest\BetterReflectionSingleton; use Roave\BetterReflectionTest\Fixture\StringCastParameters; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionParameterStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionParameterStringCast */ class ReflectionParameterStringCastTest extends TestCase { private Locator $astLocator; @@ -25,9 +23,7 @@ protected function setUp(): void $this->astLocator = BetterReflectionSingleton::instance()->astLocator(); } - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { return [ @@ -80,9 +76,7 @@ public function toStringProvider(): array ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString(string $methodName, string $parameterName, string $expectedString): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../../Fixture/StringCastParameters.php', $this->astLocator)); diff --git a/test/unit/Reflection/StringCast/ReflectionPropertyStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionPropertyStringCastTest.php index 447430697..730d22ad9 100644 --- a/test/unit/Reflection/StringCast/ReflectionPropertyStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionPropertyStringCastTest.php @@ -11,9 +11,7 @@ use Roave\BetterReflectionTest\BetterReflectionSingleton; use Roave\BetterReflectionTest\Fixture\StringCastProperties; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionPropertyStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionPropertyStringCast */ class ReflectionPropertyStringCastTest extends TestCase { private Locator $astLocator; @@ -25,9 +23,7 @@ protected function setUp(): void $this->astLocator = BetterReflectionSingleton::instance()->astLocator(); } - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { return [ @@ -42,9 +38,7 @@ public function toStringProvider(): array ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString(string $propertyName, string $expectedString): void { $reflector = new DefaultReflector(new SingleFileSourceLocator(__DIR__ . '/../../Fixture/StringCastProperties.php', $this->astLocator)); diff --git a/test/unit/Reflection/StringCast/ReflectionTypeStringCastTest.php b/test/unit/Reflection/StringCast/ReflectionTypeStringCastTest.php index 7cf298f2e..e552d3979 100644 --- a/test/unit/Reflection/StringCast/ReflectionTypeStringCastTest.php +++ b/test/unit/Reflection/StringCast/ReflectionTypeStringCastTest.php @@ -15,14 +15,10 @@ use function assert; -/** - * @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionTypeStringCast - */ +/** @covers \Roave\BetterReflection\Reflection\StringCast\ReflectionTypeStringCast */ final class ReflectionTypeStringCastTest extends TestCase { - /** - * @return list - */ + /** @return list */ public function toStringProvider(): array { $reflector = new DefaultReflector(new StringSourceLocator( @@ -64,9 +60,7 @@ function g(): string|null|int {} ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testToString( ReflectionNamedType|ReflectionUnionType|ReflectionIntersectionType $type, string $expectedString, diff --git a/test/unit/Reflector/DefaultReflectorTest.php b/test/unit/Reflector/DefaultReflectorTest.php index 33a93c9fe..3b72045af 100644 --- a/test/unit/Reflector/DefaultReflectorTest.php +++ b/test/unit/Reflector/DefaultReflectorTest.php @@ -16,9 +16,7 @@ use Roave\BetterReflection\SourceLocator\Type\SourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\Reflector\DefaultReflector - */ +/** @covers \Roave\BetterReflection\Reflector\DefaultReflector */ class DefaultReflectorTest extends TestCase { private Reflector $reflector; diff --git a/test/unit/Reflector/Exception/IdentifierNotFoundTest.php b/test/unit/Reflector/Exception/IdentifierNotFoundTest.php index 67574eb26..752846eda 100644 --- a/test/unit/Reflector/Exception/IdentifierNotFoundTest.php +++ b/test/unit/Reflector/Exception/IdentifierNotFoundTest.php @@ -9,9 +9,7 @@ use Roave\BetterReflection\Identifier\IdentifierType; use Roave\BetterReflection\Reflector\Exception\IdentifierNotFound; -/** - * @covers \Roave\BetterReflection\Reflector\Exception\IdentifierNotFound - */ +/** @covers \Roave\BetterReflection\Reflector\Exception\IdentifierNotFound */ class IdentifierNotFoundTest extends TestCase { public function testFromNonObject(): void diff --git a/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php b/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php index 1bbfe2a1a..7d08a1cdf 100644 --- a/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php +++ b/test/unit/SourceLocator/Ast/Exception/ParseToAstFailureTest.php @@ -10,9 +10,7 @@ use ReflectionProperty; use Roave\BetterReflection\SourceLocator\Located\LocatedSource; -/** - * @covers \Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure - */ +/** @covers \Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure */ class ParseToAstFailureTest extends TestCase { public function testErrorInTheMiddleOfSource(): void diff --git a/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php b/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php index 4b925d029..592b145bd 100644 --- a/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php +++ b/test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php @@ -20,14 +20,10 @@ use function sprintf; -/** - * @covers \Roave\BetterReflection\SourceLocator\Ast\FindReflectionsInTree - */ +/** @covers \Roave\BetterReflection\SourceLocator\Ast\FindReflectionsInTree */ class FindReflectionsInTreeTest extends TestCase { - /** - * @return Node[] - */ + /** @return Node[] */ private function getAstForSource(LocatedSource $source): array { return BetterReflectionSingleton::instance()->phpParser()->parse($source->getSource()); @@ -75,9 +71,7 @@ public function testInvokeDoesNotCallReflectNodesWhenNoNodesFoundInPopulatedAst( ); } - /** - * @return list - */ + /** @return list */ public function dataClassTypes(): array { return [ @@ -88,9 +82,7 @@ public function dataClassTypes(): array ]; } - /** - * @dataProvider dataClassTypes - */ + /** @dataProvider dataClassTypes */ public function testInvokeCallsReflectNodesForClassTypeWithoutNamespace(string $classType): void { $strategy = $this->createMock(NodeToReflection::class); @@ -115,9 +107,7 @@ public function testInvokeCallsReflectNodesForClassTypeWithoutNamespace(string $ ); } - /** - * @dataProvider dataClassTypes - */ + /** @dataProvider dataClassTypes */ public function testInvokeCallsReflectNodesForNamespacedClassType(string $classType): void { $strategy = $this->createMock(NodeToReflection::class); diff --git a/test/unit/SourceLocator/Ast/LocatorTest.php b/test/unit/SourceLocator/Ast/LocatorTest.php index 29b43d5d4..9ecd8bbe0 100644 --- a/test/unit/SourceLocator/Ast/LocatorTest.php +++ b/test/unit/SourceLocator/Ast/LocatorTest.php @@ -18,9 +18,7 @@ use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\SourceLocator\Ast\Locator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Ast\Locator */ class LocatorTest extends TestCase { private Locator $locator; diff --git a/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php b/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php index 7ef5ba832..789390117 100644 --- a/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php +++ b/test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php @@ -18,9 +18,7 @@ use function spl_object_hash; use function uniqid; -/** - * @covers \Roave\BetterReflection\SourceLocator\Ast\Parser\MemoizingParser - */ +/** @covers \Roave\BetterReflection\SourceLocator\Ast\Parser\MemoizingParser */ class MemoizingParserTest extends TestCase { public function testParse(): void diff --git a/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php b/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php index ee0deee2c..fba135b62 100644 --- a/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php +++ b/test/unit/SourceLocator/Ast/Strategy/NodeToReflectionTest.php @@ -20,9 +20,7 @@ use function reset; -/** - * @covers \Roave\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection - */ +/** @covers \Roave\BetterReflection\SourceLocator\Ast\Strategy\NodeToReflection */ class NodeToReflectionTest extends TestCase { private Parser $phpParser; diff --git a/test/unit/SourceLocator/Exception/EvaledAnonymousClassCannotBeLocatedTest.php b/test/unit/SourceLocator/Exception/EvaledAnonymousClassCannotBeLocatedTest.php index 3d7849d75..e83111dad 100644 --- a/test/unit/SourceLocator/Exception/EvaledAnonymousClassCannotBeLocatedTest.php +++ b/test/unit/SourceLocator/Exception/EvaledAnonymousClassCannotBeLocatedTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Exception\EvaledAnonymousClassCannotBeLocated; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\EvaledAnonymousClassCannotBeLocated - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\EvaledAnonymousClassCannotBeLocated */ class EvaledAnonymousClassCannotBeLocatedTest extends TestCase { public function testCreate(): void diff --git a/test/unit/SourceLocator/Exception/EvaledClosureCannotBeLocatedTest.php b/test/unit/SourceLocator/Exception/EvaledClosureCannotBeLocatedTest.php index 39fbc2913..9503b1a5e 100644 --- a/test/unit/SourceLocator/Exception/EvaledClosureCannotBeLocatedTest.php +++ b/test/unit/SourceLocator/Exception/EvaledClosureCannotBeLocatedTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Exception\EvaledClosureCannotBeLocated; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\EvaledClosureCannotBeLocated - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\EvaledClosureCannotBeLocated */ class EvaledClosureCannotBeLocatedTest extends TestCase { public function testCreate(): void diff --git a/test/unit/SourceLocator/Exception/InvalidDirectoryTest.php b/test/unit/SourceLocator/Exception/InvalidDirectoryTest.php index 53d5ede4c..9fc825e4a 100644 --- a/test/unit/SourceLocator/Exception/InvalidDirectoryTest.php +++ b/test/unit/SourceLocator/Exception/InvalidDirectoryTest.php @@ -12,14 +12,10 @@ use function sys_get_temp_dir; use function uniqid; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\InvalidDirectory - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\InvalidDirectory */ class InvalidDirectoryTest extends TestCase { - /** - * @return list - */ + /** @return list */ public function nonStringValuesProvider(): array { return [ diff --git a/test/unit/SourceLocator/Exception/InvalidFileInfoTest.php b/test/unit/SourceLocator/Exception/InvalidFileInfoTest.php index 89f71f59c..ca4c80813 100644 --- a/test/unit/SourceLocator/Exception/InvalidFileInfoTest.php +++ b/test/unit/SourceLocator/Exception/InvalidFileInfoTest.php @@ -8,14 +8,10 @@ use Roave\BetterReflection\SourceLocator\Exception\InvalidFileInfo; use stdClass; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\InvalidFileInfo - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\InvalidFileInfo */ class InvalidFileInfoTest extends TestCase { - /** - * @dataProvider nonSplFileInfoProvider - */ + /** @dataProvider nonSplFileInfoProvider */ public function testFromNonSplFileInfo(string $expectedMessage, mixed $value): void { $exception = InvalidFileInfo::fromNonSplFileInfo($value); @@ -24,9 +20,7 @@ public function testFromNonSplFileInfo(string $expectedMessage, mixed $value): v self::assertSame($expectedMessage, $exception->getMessage()); } - /** - * @return list - */ + /** @return list */ public function nonSplFileInfoProvider(): array { return [ diff --git a/test/unit/SourceLocator/Exception/NoAnonymousClassOnLineTest.php b/test/unit/SourceLocator/Exception/NoAnonymousClassOnLineTest.php index 1f9d287c1..8302cbb7b 100644 --- a/test/unit/SourceLocator/Exception/NoAnonymousClassOnLineTest.php +++ b/test/unit/SourceLocator/Exception/NoAnonymousClassOnLineTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Exception\NoAnonymousClassOnLine; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\NoAnonymousClassOnLine - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\NoAnonymousClassOnLine */ class NoAnonymousClassOnLineTest extends TestCase { public function testCreate(): void diff --git a/test/unit/SourceLocator/Exception/NoClosureOnLineTest.php b/test/unit/SourceLocator/Exception/NoClosureOnLineTest.php index c1df4adaf..5b4dd8477 100644 --- a/test/unit/SourceLocator/Exception/NoClosureOnLineTest.php +++ b/test/unit/SourceLocator/Exception/NoClosureOnLineTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Exception\NoClosureOnLine; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\NoClosureOnLine - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\NoClosureOnLine */ class NoClosureOnLineTest extends TestCase { public function testCreate(): void diff --git a/test/unit/SourceLocator/Exception/TwoAnonymousClassesOnSameLineTest.php b/test/unit/SourceLocator/Exception/TwoAnonymousClassesOnSameLineTest.php index 4efacbbe9..9b4dfc3a1 100644 --- a/test/unit/SourceLocator/Exception/TwoAnonymousClassesOnSameLineTest.php +++ b/test/unit/SourceLocator/Exception/TwoAnonymousClassesOnSameLineTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Exception\TwoAnonymousClassesOnSameLine; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\TwoAnonymousClassesOnSameLine - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\TwoAnonymousClassesOnSameLine */ class TwoAnonymousClassesOnSameLineTest extends TestCase { public function testCreate(): void diff --git a/test/unit/SourceLocator/Exception/TwoClosuresOnSameLineTest.php b/test/unit/SourceLocator/Exception/TwoClosuresOnSameLineTest.php index fb09275ed..f56c1ebcd 100644 --- a/test/unit/SourceLocator/Exception/TwoClosuresOnSameLineTest.php +++ b/test/unit/SourceLocator/Exception/TwoClosuresOnSameLineTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Exception\TwoClosuresOnSameLine; -/** - * @covers \Roave\BetterReflection\SourceLocator\Exception\TwoClosuresOnSameLine - */ +/** @covers \Roave\BetterReflection\SourceLocator\Exception\TwoClosuresOnSameLine */ class TwoClosuresOnSameLineTest extends TestCase { public function testCreate(): void diff --git a/test/unit/SourceLocator/FileCheckerTest.php b/test/unit/SourceLocator/FileCheckerTest.php index 1c7c99bc2..209bc286d 100644 --- a/test/unit/SourceLocator/FileCheckerTest.php +++ b/test/unit/SourceLocator/FileCheckerTest.php @@ -16,9 +16,7 @@ use const PHP_OS; -/** - * @covers \Roave\BetterReflection\SourceLocator\FileChecker - */ +/** @covers \Roave\BetterReflection\SourceLocator\FileChecker */ class FileCheckerTest extends TestCase { public function testCheckFileThrowsExceptionIfEmptyFileGiven(): void diff --git a/test/unit/SourceLocator/Located/AliasLocatedSourceTest.php b/test/unit/SourceLocator/Located/AliasLocatedSourceTest.php index 76cd663ca..83dde2189 100644 --- a/test/unit/SourceLocator/Located/AliasLocatedSourceTest.php +++ b/test/unit/SourceLocator/Located/AliasLocatedSourceTest.php @@ -8,9 +8,7 @@ use Roave\BetterReflection\SourceLocator\Located\AliasLocatedSource; use Roave\BetterReflection\Util\FileHelper; -/** - * @covers \Roave\BetterReflection\SourceLocator\Located\AliasLocatedSource - */ +/** @covers \Roave\BetterReflection\SourceLocator\Located\AliasLocatedSource */ class AliasLocatedSourceTest extends TestCase { public function testInternalsLocatedSource(): void diff --git a/test/unit/SourceLocator/Located/AnonymousLocatedSourceTest.php b/test/unit/SourceLocator/Located/AnonymousLocatedSourceTest.php index 106f28374..4ef66163c 100644 --- a/test/unit/SourceLocator/Located/AnonymousLocatedSourceTest.php +++ b/test/unit/SourceLocator/Located/AnonymousLocatedSourceTest.php @@ -8,9 +8,7 @@ use Roave\BetterReflection\SourceLocator\Located\AnonymousLocatedSource; use Roave\BetterReflection\Util\FileHelper; -/** - * @covers \Roave\BetterReflection\SourceLocator\Located\AnonymousLocatedSource - */ +/** @covers \Roave\BetterReflection\SourceLocator\Located\AnonymousLocatedSource */ class AnonymousLocatedSourceTest extends TestCase { public function testInternalsLocatedSource(): void diff --git a/test/unit/SourceLocator/Located/EvaledLocatedSourceTest.php b/test/unit/SourceLocator/Located/EvaledLocatedSourceTest.php index 40cb1b346..c50d3fc4a 100644 --- a/test/unit/SourceLocator/Located/EvaledLocatedSourceTest.php +++ b/test/unit/SourceLocator/Located/EvaledLocatedSourceTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Located\EvaledLocatedSource; -/** - * @covers \Roave\BetterReflection\SourceLocator\Located\EvaledLocatedSource - */ +/** @covers \Roave\BetterReflection\SourceLocator\Located\EvaledLocatedSource */ class EvaledLocatedSourceTest extends TestCase { public function testInternalsLocatedSource(): void diff --git a/test/unit/SourceLocator/Located/InternalLocatedSourceTest.php b/test/unit/SourceLocator/Located/InternalLocatedSourceTest.php index 5a743138f..c2e8e3e57 100644 --- a/test/unit/SourceLocator/Located/InternalLocatedSourceTest.php +++ b/test/unit/SourceLocator/Located/InternalLocatedSourceTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Located\InternalLocatedSource; -/** - * @covers \Roave\BetterReflection\SourceLocator\Located\InternalLocatedSource - */ +/** @covers \Roave\BetterReflection\SourceLocator\Located\InternalLocatedSource */ class InternalLocatedSourceTest extends TestCase { public function testInternalsLocatedSource(): void diff --git a/test/unit/SourceLocator/Located/LocatedSourceTest.php b/test/unit/SourceLocator/Located/LocatedSourceTest.php index 358056388..2efc76219 100644 --- a/test/unit/SourceLocator/Located/LocatedSourceTest.php +++ b/test/unit/SourceLocator/Located/LocatedSourceTest.php @@ -9,9 +9,7 @@ use Roave\BetterReflection\SourceLocator\Located\LocatedSource; use Roave\BetterReflection\Util\FileHelper; -/** - * @covers \Roave\BetterReflection\SourceLocator\Located\LocatedSource - */ +/** @covers \Roave\BetterReflection\SourceLocator\Located\LocatedSource */ class LocatedSourceTest extends TestCase { public function testValuesHappyPath(): void diff --git a/test/unit/SourceLocator/SourceStubber/AggregateSourceStubberTest.php b/test/unit/SourceLocator/SourceStubber/AggregateSourceStubberTest.php index 4d8e39563..e2ef28e20 100644 --- a/test/unit/SourceLocator/SourceStubber/AggregateSourceStubberTest.php +++ b/test/unit/SourceLocator/SourceStubber/AggregateSourceStubberTest.php @@ -9,9 +9,7 @@ use Roave\BetterReflection\SourceLocator\SourceStubber\SourceStubber; use Roave\BetterReflection\SourceLocator\SourceStubber\StubData; -/** - * @covers \Roave\BetterReflection\SourceLocator\SourceStubber\AggregateSourceStubber - */ +/** @covers \Roave\BetterReflection\SourceLocator\SourceStubber\AggregateSourceStubber */ class AggregateSourceStubberTest extends TestCase { public function testTraverseAllGivenSourceStubbersAndFailToGenerateClassStub(): void diff --git a/test/unit/SourceLocator/SourceStubber/Exception/CouldNotFindPhpStormStubsTest.php b/test/unit/SourceLocator/SourceStubber/Exception/CouldNotFindPhpStormStubsTest.php index 2f959c944..50a23f0a7 100644 --- a/test/unit/SourceLocator/SourceStubber/Exception/CouldNotFindPhpStormStubsTest.php +++ b/test/unit/SourceLocator/SourceStubber/Exception/CouldNotFindPhpStormStubsTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\SourceStubber\Exception\CouldNotFindPhpStormStubs; -/** - * @covers \Roave\BetterReflection\SourceLocator\SourceStubber\Exception\CouldNotFindPhpStormStubs - */ +/** @covers \Roave\BetterReflection\SourceLocator\SourceStubber\Exception\CouldNotFindPhpStormStubs */ class CouldNotFindPhpStormStubsTest extends TestCase { public function testCreate(): void diff --git a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php index 3c729e7d5..353e33ac4 100644 --- a/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php +++ b/test/unit/SourceLocator/SourceStubber/PhpStormStubsSourceStubberTest.php @@ -94,9 +94,7 @@ protected function setUp(): void $this->reflector = new DefaultReflector($this->phpInternalSourceLocator); } - /** - * @return list - */ + /** @return list */ public function internalClassesProvider(): array { $classNames = array_merge( @@ -123,9 +121,7 @@ static function (string $className): bool { ); } - /** - * @dataProvider internalClassesProvider - */ + /** @dataProvider internalClassesProvider */ public function testInternalClasses(string $className): void { $class = $this->reflector->reflectClass($className); @@ -272,9 +268,7 @@ private function assertSameParameterAttributes( } } - /** - * @return list - */ + /** @return list */ public function internalFunctionsProvider(): array { /** @var list $functionNames */ @@ -294,9 +288,7 @@ static function (string $functionName): bool { ); } - /** - * @dataProvider internalFunctionsProvider - */ + /** @dataProvider internalFunctionsProvider */ public function testInternalFunctions(string $functionName): void { $stubbedReflection = $this->reflector->reflectFunction($functionName); @@ -342,9 +334,7 @@ public function testInternalFunctions(string $functionName): void } } - /** - * @return list> - */ + /** @return list> */ public function internalConstantsProvider(): array { $provider = []; @@ -366,9 +356,7 @@ public function internalConstantsProvider(): array return $provider; } - /** - * @dataProvider internalConstantsProvider - */ + /** @dataProvider internalConstantsProvider */ public function testInternalConstants(string $constantName, mixed $constantValue, string $extensionName): void { $constantReflection = $this->reflector->reflectConstant($constantName); @@ -391,9 +379,7 @@ public function testInternalConstants(string $constantName, mixed $constantValue self::assertSame($constantValue, $constantReflection->getValue()); } - /** - * @return list - */ + /** @return list */ public function dataClassInNamespace(): array { return [ @@ -403,9 +389,7 @@ public function dataClassInNamespace(): array ]; } - /** - * @dataProvider dataClassInNamespace - */ + /** @dataProvider dataClassInNamespace */ public function testClassInNamespace(string $className): void { $classReflection = $this->reflector->reflectClass($className); @@ -413,9 +397,7 @@ public function testClassInNamespace(string $className): void $this->assertSame($className, $classReflection->getName()); } - /** - * @return list - */ + /** @return list */ public function dataFunctionInNamespace(): array { return [ @@ -424,9 +406,7 @@ public function dataFunctionInNamespace(): array ]; } - /** - * @dataProvider dataFunctionInNamespace - */ + /** @dataProvider dataFunctionInNamespace */ public function testFunctionInNamespace(string $functionName): void { $functionReflection = $this->reflector->reflectFunction($functionName); @@ -434,9 +414,7 @@ public function testFunctionInNamespace(string $functionName): void $this->assertSame($functionName, $functionReflection->getName()); } - /** - * @return list - */ + /** @return list */ public function dataConstantInNamespace(): array { return [ @@ -446,9 +424,7 @@ public function dataConstantInNamespace(): array ]; } - /** - * @dataProvider dataConstantInNamespace - */ + /** @dataProvider dataConstantInNamespace */ public function testConstantInNamespace(string $constantName): void { $constantReflection = $this->reflector->reflectConstant($constantName); @@ -531,9 +507,7 @@ public function testStubForConstantDeclaredByConst(): void self::assertInstanceOf(StubData::class, $stub); } - /** - * @return list - */ + /** @return list */ public function dataCaseInsensitiveClass(): array { return [ @@ -548,9 +522,7 @@ public function dataCaseInsensitiveClass(): array ]; } - /** - * @dataProvider dataCaseInsensitiveClass - */ + /** @dataProvider dataCaseInsensitiveClass */ public function testCaseInsensitiveClass(string $className, string $expectedClassName): void { $classReflection = $this->reflector->reflectClass($className); @@ -558,9 +530,7 @@ public function testCaseInsensitiveClass(string $className, string $expectedClas $this->assertSame($expectedClassName, $classReflection->getName()); } - /** - * @return list - */ + /** @return list */ public function dataCaseInsensitiveFunction(): array { return [ @@ -575,9 +545,7 @@ public function dataCaseInsensitiveFunction(): array ]; } - /** - * @dataProvider dataCaseInsensitiveFunction - */ + /** @dataProvider dataCaseInsensitiveFunction */ public function testCaseInsensitiveFunction(string $functionName, string $expectedFunctionName): void { $functionReflection = $this->reflector->reflectFunction($functionName); @@ -585,9 +553,7 @@ public function testCaseInsensitiveFunction(string $functionName, string $expect $this->assertSame($expectedFunctionName, $functionReflection->getName()); } - /** - * @return list - */ + /** @return list */ public function dataCaseInsensitiveConstant(): array { return [ @@ -606,9 +572,7 @@ public function dataCaseInsensitiveConstant(): array ]; } - /** - * @dataProvider dataCaseInsensitiveConstant - */ + /** @dataProvider dataCaseInsensitiveConstant */ public function testCaseInsensitiveConstant(string $constantName, string $expectedConstantName): void { $reflector = $this->reflector->reflectConstant($constantName); @@ -616,9 +580,7 @@ public function testCaseInsensitiveConstant(string $constantName, string $expect $this->assertSame($expectedConstantName, $reflector->getName()); } - /** - * @return list - */ + /** @return list */ public function dataCaseSensitiveConstantSearchedByWrongCase(): array { return [ @@ -628,9 +590,7 @@ public function dataCaseSensitiveConstantSearchedByWrongCase(): array ]; } - /** - * @dataProvider dataCaseSensitiveConstantSearchedByWrongCase - */ + /** @dataProvider dataCaseSensitiveConstantSearchedByWrongCase */ public function testCaseSensitiveConstantSearchedByWrongCase(string $constantName): void { self::expectException(IdentifierNotFound::class); @@ -638,9 +598,7 @@ public function testCaseSensitiveConstantSearchedByWrongCase(string $constantNam $this->reflector->reflectConstant($constantName); } - /** - * @return list - */ + /** @return list */ public function dataCaseSensitiveConstantSearchedByRightCase(): array { return [ @@ -650,9 +608,7 @@ public function dataCaseSensitiveConstantSearchedByRightCase(): array ]; } - /** - * @dataProvider dataCaseSensitiveConstantSearchedByRightCase - */ + /** @dataProvider dataCaseSensitiveConstantSearchedByRightCase */ public function testCaseSensitiveConstantSearchedByRightCase(string $constantName): void { self::assertInstanceOf(ReflectionConstant::class, $this->reflector->reflectConstant($constantName)); @@ -667,9 +623,7 @@ public function testCaseSensitiveConstantSearchOptimization(): void self::assertNull($this->sourceStubber->generateConstantStub('date_atom')); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testUpdateConstantValue(): void { require __DIR__ . '/../../Fixture/FakeConstants.php'; @@ -708,9 +662,7 @@ public function testUpdateConstantValue(): void self::assertStringContainsString("const CONST_CONSTANT = 'actualValue';", $constConstantStub->getStub()); } - /** - * @return list - */ + /** @return list */ public function dataClassInPhpVersion(): array { return [ @@ -727,9 +679,7 @@ public function dataClassInPhpVersion(): array ]; } - /** - * @dataProvider dataClassInPhpVersion - */ + /** @dataProvider dataClassInPhpVersion */ public function testClassInPhpVersion(string $className, int $phpVersion, bool $isSupported): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -743,9 +693,7 @@ public function testClassInPhpVersion(string $className, int $phpVersion, bool $ } } - /** - * @return list - */ + /** @return list */ public function dataClassConstantInPhpVersion(): array { return [ @@ -761,9 +709,7 @@ public function dataClassConstantInPhpVersion(): array ]; } - /** - * @dataProvider dataClassConstantInPhpVersion - */ + /** @dataProvider dataClassConstantInPhpVersion */ public function testClassConstantInPhpVersion(string $className, string $constantName, int $phpVersion, bool $isSupported): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -775,9 +721,7 @@ public function testClassConstantInPhpVersion(string $className, string $constan self::assertSame($isSupported, array_key_exists($constantName, $constants)); } - /** - * @return list - */ + /** @return list */ public function dataMethodInPhpVersion(): array { return [ @@ -803,16 +747,14 @@ public function dataMethodInPhpVersion(): array ]; } - /** - * @dataProvider dataMethodInPhpVersion - */ + /** @dataProvider dataMethodInPhpVersion */ public function testMethodInPhpVersion( string $className, string $methodName, int $phpVersion, bool $isSupported, - ?string $returnType = null, - ?string $tentativeReturnType = null, + string|null $returnType = null, + string|null $tentativeReturnType = null, ): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); $sourceLocator = new AggregateSourceLocator([ @@ -838,9 +780,7 @@ public function testMethodInPhpVersion( } } - /** - * @return list - */ + /** @return list */ public function dataMethodParameterInPhpVersion(): array { return [ @@ -853,17 +793,15 @@ public function dataMethodParameterInPhpVersion(): array ]; } - /** - * @dataProvider dataMethodParameterInPhpVersion - */ + /** @dataProvider dataMethodParameterInPhpVersion */ public function testMethodParameterInPhpVersion( string $className, string $methodName, string $parameterName, - ?int $phpVersion, + int|null $phpVersion, bool $isSupported, - ?string $type = null, - ?bool $allowsNull = null, + string|null $type = null, + bool|null $allowsNull = null, ): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); $phpInternalSourceLocator = new PhpInternalSourceLocator($this->astLocator, $sourceStubber); @@ -884,9 +822,7 @@ public function testMethodParameterInPhpVersion( } } - /** - * @return list - */ + /** @return list */ public function dataPropertyInPhpVersion(): array { return [ @@ -902,10 +838,8 @@ public function dataPropertyInPhpVersion(): array ]; } - /** - * @dataProvider dataPropertyInPhpVersion - */ - public function testPropertyInPhpVersion(string $className, string $propertyName, int $phpVersion, bool $isSupported, ?string $type = null): void + /** @dataProvider dataPropertyInPhpVersion */ + public function testPropertyInPhpVersion(string $className, string $propertyName, int $phpVersion, bool $isSupported, string|null $type = null): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); $phpInternalSourceLocator = new PhpInternalSourceLocator($this->astLocator, $sourceStubber); @@ -924,9 +858,7 @@ public function testPropertyInPhpVersion(string $className, string $propertyName } } - /** - * @return list - */ + /** @return list */ public function dataFunctionInPhpVersion(): array { return [ @@ -952,10 +884,8 @@ public function dataFunctionInPhpVersion(): array ]; } - /** - * @dataProvider dataFunctionInPhpVersion - */ - public function testFunctionInPhpVersion(string $functionName, int $phpVersion, bool $isSupported, ?string $returnType = null): void + /** @dataProvider dataFunctionInPhpVersion */ + public function testFunctionInPhpVersion(string $functionName, int $phpVersion, bool $isSupported, string|null $returnType = null): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); $phpInternalSourceLocator = new PhpInternalSourceLocator($this->astLocator, $sourceStubber); @@ -973,9 +903,7 @@ public function testFunctionInPhpVersion(string $functionName, int $phpVersion, } } - /** - * @return list - */ + /** @return list */ public function dataFunctionParameterInPhpVersion(): array { return [ @@ -994,16 +922,14 @@ public function dataFunctionParameterInPhpVersion(): array ]; } - /** - * @dataProvider dataFunctionParameterInPhpVersion - */ + /** @dataProvider dataFunctionParameterInPhpVersion */ public function testFunctionParameterInPhpVersion( string $functionName, string $parameterName, - ?int $phpVersion, + int|null $phpVersion, bool $isSupported, - ?string $type = null, - ?bool $allowsNull = null, + string|null $type = null, + bool|null $allowsNull = null, ): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); $phpInternalSourceLocator = new PhpInternalSourceLocator($this->astLocator, $sourceStubber); @@ -1023,9 +949,7 @@ public function testFunctionParameterInPhpVersion( } } - /** - * @return list - */ + /** @return list */ public function dataConstantInPhpVersion(): array { return [ @@ -1042,9 +966,7 @@ public function dataConstantInPhpVersion(): array ]; } - /** - * @dataProvider dataConstantInPhpVersion - */ + /** @dataProvider dataConstantInPhpVersion */ public function testConstantInPhpVersion(string $constantName, int $phpVersion, bool $isSupported): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -1058,9 +980,7 @@ public function testConstantInPhpVersion(string $constantName, int $phpVersion, } } - /** - * @return list - */ + /** @return list */ public function dataClassIsDeprecatedInPhpVersion(): array { return [ @@ -1071,9 +991,7 @@ public function dataClassIsDeprecatedInPhpVersion(): array ]; } - /** - * @dataProvider dataClassIsDeprecatedInPhpVersion - */ + /** @dataProvider dataClassIsDeprecatedInPhpVersion */ public function testClassIsDeprecatedInPhpVersion(string $className, int $phpVersion, bool $isDeprecated): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -1084,9 +1002,7 @@ public function testClassIsDeprecatedInPhpVersion(string $className, int $phpVer self::assertSame($isDeprecated, $classReflection->isDeprecated()); } - /** - * @return list - */ + /** @return list */ public function dataClassConstantIsDeprecatedInPhpVersion(): array { return [ @@ -1097,9 +1013,7 @@ public function dataClassConstantIsDeprecatedInPhpVersion(): array ]; } - /** - * @dataProvider dataClassConstantIsDeprecatedInPhpVersion - */ + /** @dataProvider dataClassConstantIsDeprecatedInPhpVersion */ public function testClassConstantIsDeprecatedInPhpVersion(string $className, string $constantName, int $phpVersion, bool $isDeprecated): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -1111,9 +1025,7 @@ public function testClassConstantIsDeprecatedInPhpVersion(string $className, str self::assertSame($isDeprecated, $constantReflection->isDeprecated()); } - /** - * @return list - */ + /** @return list */ public function dataMethodIsDeprecatedInPhpVersion(): array { return [ @@ -1124,9 +1036,7 @@ public function dataMethodIsDeprecatedInPhpVersion(): array ]; } - /** - * @dataProvider dataMethodIsDeprecatedInPhpVersion - */ + /** @dataProvider dataMethodIsDeprecatedInPhpVersion */ public function testMethodIsDeprecatedInPhpVersion(string $className, string $methodName, int $phpVersion, bool $isDeprecated): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -1143,9 +1053,7 @@ public function testMethodIsDeprecatedInPhpVersion(string $className, string $me self::assertSame($isDeprecated, $methodReflection->isDeprecated()); } - /** - * @return list - */ + /** @return list */ public function dataPropertyIsDeprecatedInPhpVersion(): array { return [ @@ -1156,9 +1064,7 @@ public function dataPropertyIsDeprecatedInPhpVersion(): array ]; } - /** - * @dataProvider dataPropertyIsDeprecatedInPhpVersion - */ + /** @dataProvider dataPropertyIsDeprecatedInPhpVersion */ public function testPropertyIsDeprecatedInPhpVersion(string $className, string $propertyName, int $phpVersion, bool $isDeprecated): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -1170,9 +1076,7 @@ public function testPropertyIsDeprecatedInPhpVersion(string $className, string $ self::assertSame($isDeprecated, $propertyReflection->isDeprecated()); } - /** - * @return list - */ + /** @return list */ public function dataFunctionIsDeprecatedInPhpVersion(): array { return [ @@ -1187,9 +1091,7 @@ public function dataFunctionIsDeprecatedInPhpVersion(): array ]; } - /** - * @dataProvider dataFunctionIsDeprecatedInPhpVersion - */ + /** @dataProvider dataFunctionIsDeprecatedInPhpVersion */ public function testFunctionIsDeprecatedInPhpVersion(string $functionName, int $phpVersion, bool $isDeprecated): void { $sourceStubber = new PhpStormStubsSourceStubber($this->phpParser, $phpVersion); @@ -1215,9 +1117,7 @@ public function testModifiedStubForGeneratorClass(): void self::assertTrue($classReflection->hasMethod('throw')); } - /** - * @return list, 2: int}> - */ + /** @return list, 2: int}> */ public function dataImmediateInterfaces(): array { return [ @@ -1302,9 +1202,7 @@ public function testImmediateInterfaces( self::assertSame($interfaceNames, array_keys($class->getImmediateInterfaces())); } - /** - * @return list - */ + /** @return list */ public function dataSubclass(): array { return [ @@ -1326,9 +1224,7 @@ public function dataSubclass(): array ]; } - /** - * @dataProvider dataSubclass - */ + /** @dataProvider dataSubclass */ public function testSubclass( string $className, string $subclassName, diff --git a/test/unit/SourceLocator/SourceStubber/ReflectionSourceStubberTest.php b/test/unit/SourceLocator/SourceStubber/ReflectionSourceStubberTest.php index c4027b9f0..a7a828014 100644 --- a/test/unit/SourceLocator/SourceStubber/ReflectionSourceStubberTest.php +++ b/test/unit/SourceLocator/SourceStubber/ReflectionSourceStubberTest.php @@ -45,9 +45,7 @@ use function method_exists; use function sort; -/** - * @covers \Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber - */ +/** @covers \Roave\BetterReflection\SourceLocator\SourceStubber\ReflectionSourceStubber */ class ReflectionSourceStubberTest extends TestCase { private const EXTENSIONS = ['Core', 'standard', 'pcre', 'SPL']; @@ -119,9 +117,7 @@ public function testClassStub(): void self::assertNull($stubData->getExtensionName()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testPureEnumStub(): void { require_once __DIR__ . '/../../Fixture/EnumPureForSourceStubber.php'; @@ -133,9 +129,7 @@ public function testPureEnumStub(): void self::assertNull($stubData->getExtensionName()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testBackedEnumStub(): void { require_once __DIR__ . '/../../Fixture/EnumBackedForSourceStubber.php'; @@ -165,9 +159,7 @@ public function testClassStubWithPHP8Syntax(): void self::assertNull($stubData->getExtensionName()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testClassStubWithPHP81Syntax(): void { require_once __DIR__ . '/../../Fixture/PHP81ClassForSourceStubber.php'; @@ -190,9 +182,7 @@ public function testClassWithoutNamespaceStub(): void self::assertNull($stubData->getExtensionName()); } - /** - * @requires PHP < 8.1 - */ + /** @requires PHP < 8.1 */ public function testClassStubWithDefaultStaticPropertyWithUnsupportedValueOnPHP80(): void { require_once __DIR__ . '/../../Fixture/ClassForSourceStubberWithDefaultStaticProperty.php'; @@ -205,9 +195,7 @@ public function testClassStubWithDefaultStaticPropertyWithUnsupportedValueOnPHP8 self::assertStringEqualsFile(__DIR__ . '/../../Fixture/ClassForSourceStubberWithDefaultStaticPropertyExpectedOnPhp80.php', $stubData->getStub()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testClassStubWithDefaultStaticPropertyWithUnsupportedValueOnPHP81(): void { require_once __DIR__ . '/../../Fixture/ClassForSourceStubberWithDefaultStaticProperty.php'; @@ -253,9 +241,7 @@ public function testFunctionWithoutNamespaceStub(): void self::assertNull($stubData->getExtensionName()); } - /** - * @return list - */ + /** @return list */ public function internalClassesProvider(): array { $allSymbols = array_merge( @@ -426,9 +412,7 @@ private function assertSameParameterAttributes( } } - /** - * @return list - */ + /** @return list */ public function internalFunctionsProvider(): array { /** @var list $functionNames */ @@ -447,9 +431,7 @@ static function (string $functionName): bool { ); } - /** - * @dataProvider internalFunctionsProvider - */ + /** @dataProvider internalFunctionsProvider */ public function testInternalFunctionsReturnType(string $functionName): void { $stubbedReflection = $this->reflector->reflectFunction($functionName); @@ -497,9 +479,7 @@ public function testFunctionWithOptionalParameter(): void self::assertTrue($parameterReflection->isOptional()); } - /** - * @return list - */ + /** @return list */ public function variadicParametersProvider(): array { return [ @@ -508,9 +488,7 @@ public function variadicParametersProvider(): array ]; } - /** - * @dataProvider variadicParametersProvider - */ + /** @dataProvider variadicParametersProvider */ public function testFunctionWithVariadicParameter(string $functionName, int $parameterPosition, bool $parameterIsVariadic, bool $parameterIsOptional): void { $functionReflection = $this->reflector->reflectFunction($functionName); @@ -540,9 +518,7 @@ public function testCanStubConstant(): void self::assertSame('Core', $stubData->getExtensionName()); } - /** - * @return list> - */ + /** @return list> */ public function internalConstantsProvider(): array { $provider = []; @@ -564,9 +540,7 @@ public function internalConstantsProvider(): array return $provider; } - /** - * @dataProvider internalConstantsProvider - */ + /** @dataProvider internalConstantsProvider */ public function testInternalConstants(string $constantName, mixed $constantValue, string $extensionName): void { $constantReflection = $this->reflector->reflectConstant($constantName); diff --git a/test/unit/SourceLocator/SourceStubber/StubDataTest.php b/test/unit/SourceLocator/SourceStubber/StubDataTest.php index 33766c022..0f3781ba6 100644 --- a/test/unit/SourceLocator/SourceStubber/StubDataTest.php +++ b/test/unit/SourceLocator/SourceStubber/StubDataTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\SourceStubber\StubData; -/** - * @covers \Roave\BetterReflection\SourceLocator\SourceStubber\StubData - */ +/** @covers \Roave\BetterReflection\SourceLocator\SourceStubber\StubData */ class StubDataTest extends TestCase { public function testGetters(): void diff --git a/test/unit/SourceLocator/Type/AbstractSourceLocatorTest.php b/test/unit/SourceLocator/Type/AbstractSourceLocatorTest.php index 9d5dc8d25..2984a14d0 100644 --- a/test/unit/SourceLocator/Type/AbstractSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/AbstractSourceLocatorTest.php @@ -14,9 +14,7 @@ use Roave\BetterReflection\SourceLocator\Located\LocatedSource; use Roave\BetterReflection\SourceLocator\Type\AbstractSourceLocator; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\AbstractSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\AbstractSourceLocator */ class AbstractSourceLocatorTest extends TestCase { public function testLocateIdentifierCallsFindReflection(): void diff --git a/test/unit/SourceLocator/Type/AggregateSourceLocatorTest.php b/test/unit/SourceLocator/Type/AggregateSourceLocatorTest.php index f465dbe30..cbad1e07c 100644 --- a/test/unit/SourceLocator/Type/AggregateSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/AggregateSourceLocatorTest.php @@ -16,9 +16,7 @@ use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\AggregateSourceLocator */ class AggregateSourceLocatorTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/SourceLocator/Type/AnonymousClassObjectSourceLocatorTest.php b/test/unit/SourceLocator/Type/AnonymousClassObjectSourceLocatorTest.php index 8fe70d599..328894068 100644 --- a/test/unit/SourceLocator/Type/AnonymousClassObjectSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/AnonymousClassObjectSourceLocatorTest.php @@ -23,9 +23,7 @@ use function realpath; use function sprintf; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\AnonymousClassObjectSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\AnonymousClassObjectSourceLocator */ class AnonymousClassObjectSourceLocatorTest extends TestCase { private Parser $parser; @@ -40,9 +38,7 @@ protected function setUp(): void $this->reflector = $this->createMock(Reflector::class); } - /** - * @return list - */ + /** @return list */ public function anonymousClassInstancesProvider(): array { $fileWithClasses = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../../Fixture/AnonymousClassInstances.php')); @@ -60,9 +56,7 @@ public function anonymousClassInstancesProvider(): array ]; } - /** - * @dataProvider anonymousClassInstancesProvider - */ + /** @dataProvider anonymousClassInstancesProvider */ public function testLocateIdentifier(object $class, string $file, int $startLine, int $endLine): void { $reflection = (new AnonymousClassObjectSourceLocator($class, $this->parser))->locateIdentifier( @@ -112,9 +106,7 @@ public function testLocateIdentifierWithFunctionIdentifier(): void self::assertNull($reflection); } - /** - * @dataProvider anonymousClassInstancesProvider - */ + /** @dataProvider anonymousClassInstancesProvider */ public function testLocateIdentifiersByType(object $class, string $file, int $startLine, int $endLine): void { /** @var list $reflections */ @@ -176,9 +168,7 @@ public function testExceptionIfAnonymousClassNotFoundOnExpectedLine(): void $sourceLocator->locateIdentifiersByType($this->reflector, new IdentifierType(IdentifierType::IDENTIFIER_CLASS)); } - /** - * @return list - */ + /** @return list */ public function exceptionIfTwoAnonymousClassesOnSameLineProvider(): array { $file = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../../Fixture/AnonymousClassInstancesOnSameLine.php')); @@ -190,9 +180,7 @@ public function exceptionIfTwoAnonymousClassesOnSameLineProvider(): array ]; } - /** - * @dataProvider exceptionIfTwoAnonymousClassesOnSameLineProvider - */ + /** @dataProvider exceptionIfTwoAnonymousClassesOnSameLineProvider */ public function testExceptionIfTwoAnonymousClassesOnSameLine(string $file, object $class): void { $this->expectException(TwoAnonymousClassesOnSameLine::class); @@ -207,9 +195,7 @@ public function testExceptionIfTwoAnonymousClassesOnSameLine(string $file, objec ); } - /** - * @return list - */ + /** @return list */ public function nestedAnonymousClassInstancesProvider(): array { $class = require __DIR__ . '/../../Fixture/NestedAnonymousClassInstances.php'; diff --git a/test/unit/SourceLocator/Type/AutoloadSourceLocatorTest.php b/test/unit/SourceLocator/Type/AutoloadSourceLocatorTest.php index 46965311a..04bbaa6c5 100644 --- a/test/unit/SourceLocator/Type/AutoloadSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/AutoloadSourceLocatorTest.php @@ -47,9 +47,7 @@ use function uniqid; use function unlink; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\AutoloadSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\AutoloadSourceLocator */ class AutoloadSourceLocatorTest extends TestCase { private Locator $astLocator; @@ -92,9 +90,7 @@ public function testClassLoadsWorksWithExistingClass(): void self::assertSame('ClassForHinting', $classInfo->getShortName()); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testCanLocateAutoloadableInterface(): void { self::assertFalse(interface_exists(AutoloadableInterface::class, false)); @@ -111,9 +107,7 @@ public function testCanLocateAutoloadableInterface(): void self::assertFalse(interface_exists(AutoloadableInterface::class, false)); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testCanLocateAutoloadedInterface(): void { self::assertTrue(interface_exists(AutoloadableInterface::class)); @@ -128,9 +122,7 @@ public function testCanLocateAutoloadedInterface(): void self::assertInstanceOf(LocatedSource::class, $reflectionClass->getLocatedSource()); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testCanLocateAutoloadableTrait(): void { self::assertFalse(trait_exists(AutoloadableTrait::class, false)); @@ -145,9 +137,7 @@ public function testCanLocateAutoloadableTrait(): void self::assertInstanceOf(LocatedSource::class, $reflectionClass->getLocatedSource()); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testCanLocateAutoloadedTrait(): void { self::assertTrue(trait_exists(AutoloadableTrait::class)); @@ -198,9 +188,7 @@ public function testCanLocateAutoloadedEnum(): void self::assertInstanceOf(LocatedSource::class, $reflectionClass->getLocatedSource()); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testCanLocateAutoloadedClassByAlias(): void { require __DIR__ . '/../../Fixture/AutoloadableByAlias.php'; @@ -413,9 +401,7 @@ public function testCanAutoloadPsr4ClassesInPotentiallyMultipleDirectories(): vo self::assertFalse(class_exists(AutoloadableClassWithTwoDirectories::class, false)); } - /** - * @runInSeparateProcess - */ + /** @runInSeparateProcess */ public function testWillLocateSourcesInPharPath(): void { require_once 'phar://' . __DIR__ . '/../../Fixture/autoload.phar/vendor/autoload.php'; @@ -436,7 +422,7 @@ public function testWillLocateSourcesInPharPath(): void public function testBrokenAutoloader(): void { - $getErrorHandler = static function (): ?callable { + $getErrorHandler = static function (): callable|null { $errorHandler = set_error_handler(static fn (): bool => true); restore_error_handler(); diff --git a/test/unit/SourceLocator/Type/ClosureSourceLocatorTest.php b/test/unit/SourceLocator/Type/ClosureSourceLocatorTest.php index 593aef03c..0545ebd42 100644 --- a/test/unit/SourceLocator/Type/ClosureSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/ClosureSourceLocatorTest.php @@ -24,9 +24,7 @@ use function realpath; use function sprintf; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\ClosureSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\ClosureSourceLocator */ class ClosureSourceLocatorTest extends TestCase { private Parser $parser; @@ -41,9 +39,7 @@ protected function setUp(): void $this->reflector = $this->createMock(Reflector::class); } - /** - * @return list - */ + /** @return list */ public function closuresProvider(): array { $fileWithClosureInNamespace = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../../Fixture/ClosureInNamespace.php')); @@ -59,9 +55,7 @@ public function closuresProvider(): array ]; } - /** - * @dataProvider closuresProvider - */ + /** @dataProvider closuresProvider */ public function testLocateIdentifier(Closure $closure, string $namespace, string $file, int $startLine, int $endLine): void { $locator = new ClosureSourceLocator($closure, $this->parser); @@ -102,9 +96,7 @@ public function testEvaledClosureThrowsInvalidFileLocation(): void ); } - /** - * @dataProvider closuresProvider - */ + /** @dataProvider closuresProvider */ public function testLocateIdentifiersByType(Closure $closure, string $namespace, string $file, int $startLine, int $endLine): void { /** @var list $reflections */ @@ -165,9 +157,7 @@ public function testLocateIdentifiersByTypeWithClassIdentifier(): void self::assertCount(0, $reflections); } - /** - * @return list - */ + /** @return list */ public function exceptionIfTwoClosuresOnSameLineProvider(): array { $file = FileHelper::normalizeWindowsPath(realpath(__DIR__ . '/../../Fixture/ClosuresOnSameLine.php')); @@ -179,9 +169,7 @@ public function exceptionIfTwoClosuresOnSameLineProvider(): array ]; } - /** - * @dataProvider exceptionIfTwoClosuresOnSameLineProvider - */ + /** @dataProvider exceptionIfTwoClosuresOnSameLineProvider */ public function testTwoClosuresSameLineFails(string $file, Closure $closure): void { $this->expectException(TwoClosuresOnSameLine::class); diff --git a/test/unit/SourceLocator/Type/Composer/Factory/Exception/FailedToParseJsonTest.php b/test/unit/SourceLocator/Type/Composer/Factory/Exception/FailedToParseJsonTest.php index 4ea325528..650c8eb8f 100644 --- a/test/unit/SourceLocator/Type/Composer/Factory/Exception/FailedToParseJsonTest.php +++ b/test/unit/SourceLocator/Type/Composer/Factory/Exception/FailedToParseJsonTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\FailedToParseJson; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\FailedToParseJson - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\FailedToParseJson */ class FailedToParseJsonTest extends TestCase { public function testInFile(): void diff --git a/test/unit/SourceLocator/Type/Composer/Factory/Exception/InvalidProjectDirectoryTest.php b/test/unit/SourceLocator/Type/Composer/Factory/Exception/InvalidProjectDirectoryTest.php index 8c4f8daef..0c8f59f30 100644 --- a/test/unit/SourceLocator/Type/Composer/Factory/Exception/InvalidProjectDirectoryTest.php +++ b/test/unit/SourceLocator/Type/Composer/Factory/Exception/InvalidProjectDirectoryTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\InvalidProjectDirectory; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\InvalidProjectDirectory - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\InvalidProjectDirectory */ class InvalidProjectDirectoryTest extends TestCase { public function testAtPath(): void diff --git a/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingComposerJsonTest.php b/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingComposerJsonTest.php index 9d6644f12..32eedccd1 100644 --- a/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingComposerJsonTest.php +++ b/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingComposerJsonTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\MissingComposerJson; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\MissingComposerJson - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\MissingComposerJson */ class MissingComposerJsonTest extends TestCase { public function testInProjectPath(): void diff --git a/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingInstalledJsonTest.php b/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingInstalledJsonTest.php index dc4ac2d64..974fa90d3 100644 --- a/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingInstalledJsonTest.php +++ b/test/unit/SourceLocator/Type/Composer/Factory/Exception/MissingInstalledJsonTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\MissingInstalledJson; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\MissingInstalledJson - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\Exception\MissingInstalledJson */ class MissingInstalledJsonTest extends TestCase { public function testInProjectPath(): void diff --git a/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerInstalledJsonTest.php b/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerInstalledJsonTest.php index 2dfd7605a..8b22b3ebb 100644 --- a/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerInstalledJsonTest.php +++ b/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerInstalledJsonTest.php @@ -23,9 +23,7 @@ use function array_combine; use function realpath; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\MakeLocatorForInstalledJson - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\MakeLocatorForInstalledJson */ class MakeLocatorForComposerInstalledJsonTest extends TestCase { /** @dataProvider expectedLocators */ @@ -38,9 +36,7 @@ public function testLocatorEquality(string $projectDirectory, SourceLocator $exp ); } - /** - * @return array - */ + /** @return array */ public function expectedLocators(): array { $astLocator = BetterReflectionSingleton::instance()->astLocator(); diff --git a/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJsonTest.php b/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJsonTest.php index 378652cec..15177d61a 100644 --- a/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJsonTest.php +++ b/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonAndInstalledJsonTest.php @@ -23,9 +23,7 @@ use function array_combine; use function realpath; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\MakeLocatorForComposerJsonAndInstalledJson - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\MakeLocatorForComposerJsonAndInstalledJson */ class MakeLocatorForComposerJsonAndInstalledJsonTest extends TestCase { /** @dataProvider expectedLocators */ @@ -38,9 +36,7 @@ public function testLocatorEquality(string $projectDirectory, SourceLocator $exp ); } - /** - * @return array - */ + /** @return array */ public function expectedLocators(): array { $astLocator = BetterReflectionSingleton::instance()->astLocator(); diff --git a/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonTest.php b/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonTest.php index 305da5c19..f30e2479e 100644 --- a/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonTest.php +++ b/test/unit/SourceLocator/Type/Composer/Factory/MakeLocatorForComposerJsonTest.php @@ -22,9 +22,7 @@ use function array_combine; use function realpath; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\MakeLocatorForComposerJson - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Factory\MakeLocatorForComposerJson */ class MakeLocatorForComposerJsonTest extends TestCase { /** @dataProvider expectedLocators */ @@ -37,9 +35,7 @@ public function testLocatorEquality(string $projectDirectory, SourceLocator $exp ); } - /** - * @return array - */ + /** @return array */ public function expectedLocators(): array { $astLocator = BetterReflectionSingleton::instance()->astLocator(); diff --git a/test/unit/SourceLocator/Type/Composer/Psr/Excetion/InvalidPrefixMappingTest.php b/test/unit/SourceLocator/Type/Composer/Psr/Excetion/InvalidPrefixMappingTest.php index fc740699c..0c5b8c15b 100644 --- a/test/unit/SourceLocator/Type/Composer/Psr/Excetion/InvalidPrefixMappingTest.php +++ b/test/unit/SourceLocator/Type/Composer/Psr/Excetion/InvalidPrefixMappingTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Exception\InvalidPrefixMapping; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Exception\InvalidPrefixMapping - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Exception\InvalidPrefixMapping */ final class InvalidPrefixMappingTest extends TestCase { public function testEmptyPrefixGiven(): void diff --git a/test/unit/SourceLocator/Type/Composer/Psr/Psr0MappingTest.php b/test/unit/SourceLocator/Type/Composer/Psr/Psr0MappingTest.php index 9191e4d68..a0e25699c 100644 --- a/test/unit/SourceLocator/Type/Composer/Psr/Psr0MappingTest.php +++ b/test/unit/SourceLocator/Type/Composer/Psr/Psr0MappingTest.php @@ -14,9 +14,7 @@ use function tempnam; use function uniqid; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Psr0Mapping - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Psr0Mapping */ class Psr0MappingTest extends TestCase { /** diff --git a/test/unit/SourceLocator/Type/Composer/Psr/Psr4MappingTest.php b/test/unit/SourceLocator/Type/Composer/Psr/Psr4MappingTest.php index b0c8ebb1f..dcd5a9576 100644 --- a/test/unit/SourceLocator/Type/Composer/Psr/Psr4MappingTest.php +++ b/test/unit/SourceLocator/Type/Composer/Psr/Psr4MappingTest.php @@ -14,9 +14,7 @@ use function tempnam; use function uniqid; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Psr4Mapping - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\Psr\Psr4Mapping */ class Psr4MappingTest extends TestCase { /** diff --git a/test/unit/SourceLocator/Type/Composer/PsrAutoloaderLocatorTest.php b/test/unit/SourceLocator/Type/Composer/PsrAutoloaderLocatorTest.php index f8675583a..ede50d3b8 100644 --- a/test/unit/SourceLocator/Type/Composer/PsrAutoloaderLocatorTest.php +++ b/test/unit/SourceLocator/Type/Composer/PsrAutoloaderLocatorTest.php @@ -23,9 +23,7 @@ use function array_map; use function sort; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\Composer\PsrAutoloaderLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\Composer\PsrAutoloaderLocator */ class PsrAutoloaderLocatorTest extends TestCase { /** @var PsrAutoloaderMapping&MockObject */ diff --git a/test/unit/SourceLocator/Type/ComposerSourceLocatorTest.php b/test/unit/SourceLocator/Type/ComposerSourceLocatorTest.php index 4bf572798..e05f66c36 100644 --- a/test/unit/SourceLocator/Type/ComposerSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/ComposerSourceLocatorTest.php @@ -15,9 +15,7 @@ use Roave\BetterReflection\SourceLocator\Type\ComposerSourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\ComposerSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\ComposerSourceLocator */ class ComposerSourceLocatorTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/SourceLocator/Type/DirectoriesSourceLocatorTest.php b/test/unit/SourceLocator/Type/DirectoriesSourceLocatorTest.php index 7655ad819..ebfdaaab2 100644 --- a/test/unit/SourceLocator/Type/DirectoriesSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/DirectoriesSourceLocatorTest.php @@ -19,9 +19,7 @@ use function sort; use function uniqid; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\DirectoriesSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\DirectoriesSourceLocator */ class DirectoriesSourceLocatorTest extends TestCase { private DirectoriesSourceLocator $sourceLocator; @@ -88,9 +86,7 @@ public function testInvalidDirectory(array $directories): void new DirectoriesSourceLocator($directories, BetterReflectionSingleton::instance()->astLocator()); } - /** - * @return list}> - */ + /** @return list}> */ public function invalidDirectoriesProvider(): array { $validDir = __DIR__ . '/../../Assets/DirectoryScannerAssets'; diff --git a/test/unit/SourceLocator/Type/EvaledCodeSourceLocatorTest.php b/test/unit/SourceLocator/Type/EvaledCodeSourceLocatorTest.php index 808bc2cf7..7baf59f90 100644 --- a/test/unit/SourceLocator/Type/EvaledCodeSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/EvaledCodeSourceLocatorTest.php @@ -21,9 +21,7 @@ use function sprintf; use function uniqid; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\EvaledCodeSourceLocator */ class EvaledCodeSourceLocatorTest extends TestCase { private Locator $astLocator; @@ -102,9 +100,7 @@ public function testCanReflectEvaledTrait(): void self::assertStringMatchesFormat('%Atrait%A' . $traitName . '%A', $reflection->getLocatedSource()->getSource()); } - /** - * @requires PHP >= 8.1 - */ + /** @requires PHP >= 8.1 */ public function testCanReflectEvaledEnum(): void { $enumName = uniqid('foo', false); diff --git a/test/unit/SourceLocator/Type/FileIteratorSourceLocatorTest.php b/test/unit/SourceLocator/Type/FileIteratorSourceLocatorTest.php index 7a8a8e8b0..f5cc3165a 100644 --- a/test/unit/SourceLocator/Type/FileIteratorSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/FileIteratorSourceLocatorTest.php @@ -21,9 +21,7 @@ use function array_map; use function sort; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\FileIteratorSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\FileIteratorSourceLocator */ class FileIteratorSourceLocatorTest extends TestCase { private FileIteratorSourceLocator $sourceLocator; diff --git a/test/unit/SourceLocator/Type/MemoizingSourceLocatorTest.php b/test/unit/SourceLocator/Type/MemoizingSourceLocatorTest.php index f73ba4d53..d3397ec3c 100644 --- a/test/unit/SourceLocator/Type/MemoizingSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/MemoizingSourceLocatorTest.php @@ -24,9 +24,7 @@ use function spl_object_hash; use function uniqid; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\MemoizingSourceLocator */ class MemoizingSourceLocatorTest extends TestCase { private Reflector|MockObject $reflector1; @@ -134,7 +132,7 @@ public function testMemoizationByTypeDistinguishesBetweenSourceLocatorsAndType() IdentifierType $identifierType, ) use ( $symbols1, - $symbols2 + $symbols2, ): array { if ($reflector === $this->reflector1) { return $symbols1[$identifierType->getName()]; @@ -188,8 +186,8 @@ private function assertMemoization( Reflector $reflector, Identifier $identifier, ) use ( - &$fetchedSymbolsCount - ): ?Reflection { + &$fetchedSymbolsCount, + ): Reflection|null { $identifierId = spl_object_hash($identifier); $reflectorId = spl_object_hash($reflector); $hash = $reflectorId . $identifierId; diff --git a/test/unit/SourceLocator/Type/PhpInternalSourceLocatorTest.php b/test/unit/SourceLocator/Type/PhpInternalSourceLocatorTest.php index 951f314a4..2cfe692d1 100644 --- a/test/unit/SourceLocator/Type/PhpInternalSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/PhpInternalSourceLocatorTest.php @@ -34,9 +34,7 @@ use const ARRAY_FILTER_USE_KEY; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator */ class PhpInternalSourceLocatorTest extends TestCase { private PhpInternalSourceLocator $phpInternalSourceLocator; @@ -58,9 +56,7 @@ private function getMockReflector(): Reflector|MockObject return $this->createMock(Reflector::class); } - /** - * @dataProvider internalClassesProvider - */ + /** @dataProvider internalClassesProvider */ public function testCanFetchInternalLocatedSourceForClasses(string $className): void { try { @@ -84,9 +80,7 @@ public function testCanFetchInternalLocatedSourceForClasses(string $className): } } - /** - * @return list - */ + /** @return list */ public function internalClassesProvider(): array { $allSymbols = array_merge( @@ -108,9 +102,7 @@ static function (string $symbol): bool { ); } - /** - * @dataProvider internalFunctionsProvider - */ + /** @dataProvider internalFunctionsProvider */ public function testCanFetchInternalLocatedSourceForFunctions(string $functionName): void { try { @@ -134,9 +126,7 @@ public function testCanFetchInternalLocatedSourceForFunctions(string $functionNa } } - /** - * @return list - */ + /** @return list */ public function internalFunctionsProvider(): array { /** @var list $allSymbols */ @@ -148,9 +138,7 @@ public function internalFunctionsProvider(): array ); } - /** - * @dataProvider internalConstantsProvider - */ + /** @dataProvider internalConstantsProvider */ public function testCanFetchInternalLocatedSourceForConstants(string $constantName): void { $reflection = $this->phpInternalSourceLocator->locateIdentifier( @@ -166,9 +154,7 @@ public function testCanFetchInternalLocatedSourceForConstants(string $constantNa self::assertNotEmpty($source->getSource()); } - /** - * @return list - */ + /** @return list */ public function internalConstantsProvider(): array { /** @var array> $allSymbols */ diff --git a/test/unit/SourceLocator/Type/SingleFileSourceLocatorTest.php b/test/unit/SourceLocator/Type/SingleFileSourceLocatorTest.php index ba06cb49c..a3762e1c0 100644 --- a/test/unit/SourceLocator/Type/SingleFileSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/SingleFileSourceLocatorTest.php @@ -14,9 +14,7 @@ use Roave\BetterReflection\SourceLocator\Type\SingleFileSourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\SingleFileSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\SingleFileSourceLocator */ class SingleFileSourceLocatorTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/SourceLocator/Type/StringSourceLocatorTest.php b/test/unit/SourceLocator/Type/StringSourceLocatorTest.php index cd2d9da2c..77dabf089 100644 --- a/test/unit/SourceLocator/Type/StringSourceLocatorTest.php +++ b/test/unit/SourceLocator/Type/StringSourceLocatorTest.php @@ -14,9 +14,7 @@ use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\SourceLocator\Type\StringSourceLocator - */ +/** @covers \Roave\BetterReflection\SourceLocator\Type\StringSourceLocator */ class StringSourceLocatorTest extends TestCase { private Locator $astLocator; diff --git a/test/unit/TestListener.php b/test/unit/TestListener.php index 229e3bab3..93b2e29f4 100644 --- a/test/unit/TestListener.php +++ b/test/unit/TestListener.php @@ -22,7 +22,7 @@ class TestListener implements BaseTestListener { use TestListenerDefaultImplementation; - private ?TestSuite $currentSuite; + private TestSuite|null $currentSuite; /** * Determine the "full" test name (including the suite name if it is set) diff --git a/test/unit/Util/Autoload/ClassLoaderMethod/EvalLoaderTest.php b/test/unit/Util/Autoload/ClassLoaderMethod/EvalLoaderTest.php index 21289c437..7adb47aec 100644 --- a/test/unit/Util/Autoload/ClassLoaderMethod/EvalLoaderTest.php +++ b/test/unit/Util/Autoload/ClassLoaderMethod/EvalLoaderTest.php @@ -13,9 +13,7 @@ use function ob_get_contents; use function ob_start; -/** - * @covers \Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\EvalLoader - */ +/** @covers \Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\EvalLoader */ final class EvalLoaderTest extends TestCase { public function testEvalExecutes(): void diff --git a/test/unit/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailedTest.php b/test/unit/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailedTest.php index b7c3408b2..7084f233f 100644 --- a/test/unit/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailedTest.php +++ b/test/unit/Util/Autoload/ClassLoaderMethod/Exception/SignatureCheckFailedTest.php @@ -11,9 +11,7 @@ use function sprintf; use function uniqid; -/** - * @covers \Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\Exception\SignatureCheckFailed - */ +/** @covers \Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\Exception\SignatureCheckFailed */ final class SignatureCheckFailedTest extends TestCase { public function testFromReflectionClass(): void diff --git a/test/unit/Util/Autoload/ClassLoaderMethod/FileCacheLoaderTest.php b/test/unit/Util/Autoload/ClassLoaderMethod/FileCacheLoaderTest.php index a02bf5436..5d85f8c34 100644 --- a/test/unit/Util/Autoload/ClassLoaderMethod/FileCacheLoaderTest.php +++ b/test/unit/Util/Autoload/ClassLoaderMethod/FileCacheLoaderTest.php @@ -17,9 +17,7 @@ use function uniqid; use function unlink; -/** - * @covers \Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\FileCacheLoader - */ +/** @covers \Roave\BetterReflection\Util\Autoload\ClassLoaderMethod\FileCacheLoader */ final class FileCacheLoaderTest extends TestCase { public function testFileCacheWriterCreatesFileWithPrintedCode(): void diff --git a/test/unit/Util/Autoload/ClassLoaderTest.php b/test/unit/Util/Autoload/ClassLoaderTest.php index fe8abaec3..51c994e57 100644 --- a/test/unit/Util/Autoload/ClassLoaderTest.php +++ b/test/unit/Util/Autoload/ClassLoaderTest.php @@ -23,12 +23,10 @@ use function spl_autoload_functions; use function spl_autoload_unregister; -/** - * @covers \Roave\BetterReflection\Util\Autoload\ClassLoader - */ +/** @covers \Roave\BetterReflection\Util\Autoload\ClassLoader */ final class ClassLoaderTest extends TestCase { - private ?ClassLoader $loader = null; + private ClassLoader|null $loader = null; protected function tearDown(): void { diff --git a/test/unit/Util/Autoload/ClassPrinter/PhpParserPrinterTest.php b/test/unit/Util/Autoload/ClassPrinter/PhpParserPrinterTest.php index aa586346a..cfe91e517 100644 --- a/test/unit/Util/Autoload/ClassPrinter/PhpParserPrinterTest.php +++ b/test/unit/Util/Autoload/ClassPrinter/PhpParserPrinterTest.php @@ -9,9 +9,7 @@ use Roave\BetterReflection\Util\Autoload\ClassPrinter\PhpParserPrinter; use Roave\BetterReflectionTest\Fixture\TestClassForPhpParserPrinterTest; -/** - * @covers \Roave\BetterReflection\Util\Autoload\ClassPrinter\PhpParserPrinter - */ +/** @covers \Roave\BetterReflection\Util\Autoload\ClassPrinter\PhpParserPrinter */ final class PhpParserPrinterTest extends TestCase { public function testPrinting(): void diff --git a/test/unit/Util/Autoload/Exception/ClassAlreadyLoadedTest.php b/test/unit/Util/Autoload/Exception/ClassAlreadyLoadedTest.php index f284d097c..548de8eeb 100644 --- a/test/unit/Util/Autoload/Exception/ClassAlreadyLoadedTest.php +++ b/test/unit/Util/Autoload/Exception/ClassAlreadyLoadedTest.php @@ -11,9 +11,7 @@ use function sprintf; use function uniqid; -/** - * @covers \Roave\BetterReflection\Util\Autoload\Exception\ClassAlreadyLoaded - */ +/** @covers \Roave\BetterReflection\Util\Autoload\Exception\ClassAlreadyLoaded */ final class ClassAlreadyLoadedTest extends TestCase { public function testFromReflectionClass(): void diff --git a/test/unit/Util/Autoload/Exception/ClassAlreadyRegisteredTest.php b/test/unit/Util/Autoload/Exception/ClassAlreadyRegisteredTest.php index e77931e05..93e258d56 100644 --- a/test/unit/Util/Autoload/Exception/ClassAlreadyRegisteredTest.php +++ b/test/unit/Util/Autoload/Exception/ClassAlreadyRegisteredTest.php @@ -11,9 +11,7 @@ use function sprintf; use function uniqid; -/** - * @covers \Roave\BetterReflection\Util\Autoload\Exception\ClassAlreadyRegistered - */ +/** @covers \Roave\BetterReflection\Util\Autoload\Exception\ClassAlreadyRegistered */ final class ClassAlreadyRegisteredTest extends TestCase { public function testFromReflectionClass(): void diff --git a/test/unit/Util/Autoload/Exception/FailedToLoadClassTest.php b/test/unit/Util/Autoload/Exception/FailedToLoadClassTest.php index 66cc48582..543116e74 100644 --- a/test/unit/Util/Autoload/Exception/FailedToLoadClassTest.php +++ b/test/unit/Util/Autoload/Exception/FailedToLoadClassTest.php @@ -10,9 +10,7 @@ use function sprintf; use function uniqid; -/** - * @covers \Roave\BetterReflection\Util\Autoload\Exception\FailedToLoadClass - */ +/** @covers \Roave\BetterReflection\Util\Autoload\Exception\FailedToLoadClass */ final class FailedToLoadClassTest extends TestCase { public function testFromReflectionClass(): void diff --git a/test/unit/Util/CalculateReflectionColumnTest.php b/test/unit/Util/CalculateReflectionColumnTest.php index 2f40e00bb..44b8538c3 100644 --- a/test/unit/Util/CalculateReflectionColumnTest.php +++ b/test/unit/Util/CalculateReflectionColumnTest.php @@ -10,9 +10,7 @@ use Roave\BetterReflection\Util\Exception\InvalidNodePosition; use Roave\BetterReflection\Util\Exception\NoNodePosition; -/** - * @covers \Roave\BetterReflection\Util\CalculateReflectionColumn - */ +/** @covers \Roave\BetterReflection\Util\CalculateReflectionColumn */ class CalculateReflectionColumnTest extends TestCase { public function testGetStartColumn(): void diff --git a/test/unit/Util/ClassExistenceCheckerTest.php b/test/unit/Util/ClassExistenceCheckerTest.php index 58c19c23c..0c7475a87 100644 --- a/test/unit/Util/ClassExistenceCheckerTest.php +++ b/test/unit/Util/ClassExistenceCheckerTest.php @@ -17,12 +17,10 @@ use function spl_autoload_register; use function spl_autoload_unregister; -/** - * @covers \Roave\BetterReflection\Util\ClassExistenceChecker - */ +/** @covers \Roave\BetterReflection\Util\ClassExistenceChecker */ class ClassExistenceCheckerTest extends TestCase { - private ?Closure $loader = null; + private Closure|null $loader = null; protected function setUp(): void { @@ -44,9 +42,7 @@ protected function tearDown(): void spl_autoload_unregister($this->loader); } - /** - * @return list - */ + /** @return list */ public function dataClassExists(): array { return [ @@ -57,17 +53,13 @@ public function dataClassExists(): array ]; } - /** - * @dataProvider dataClassExists - */ + /** @dataProvider dataClassExists */ public function testClassExists(string $name, bool $exists): void { self::assertSame($exists, ClassExistenceChecker::classExists($name)); } - /** - * @return list - */ + /** @return list */ public function dataExists(): array { return [ @@ -83,17 +75,13 @@ public function dataExists(): array ]; } - /** - * @dataProvider dataExists - */ + /** @dataProvider dataExists */ public function testExists(string $name, bool $exists): void { self::assertSame($exists, ClassExistenceChecker::exists($name)); } - /** - * @return list - */ + /** @return list */ public function dataInterfaceExists(): array { return [ @@ -104,17 +92,13 @@ public function dataInterfaceExists(): array ]; } - /** - * @dataProvider dataInterfaceExists - */ + /** @dataProvider dataInterfaceExists */ public function testInterfaceExists(string $name, bool $exists): void { self::assertSame($exists, ClassExistenceChecker::interfaceExists($name)); } - /** - * @return list - */ + /** @return list */ public function dataTraitExists(): array { return [ @@ -125,9 +109,7 @@ public function dataTraitExists(): array ]; } - /** - * @dataProvider dataTraitExists - */ + /** @dataProvider dataTraitExists */ public function testTraitExists(string $name, bool $exists): void { self::assertSame($exists, ClassExistenceChecker::traitExists($name)); diff --git a/test/unit/Util/ConstantNodeCheckerTest.php b/test/unit/Util/ConstantNodeCheckerTest.php index e19ba5cd5..a49234d6b 100644 --- a/test/unit/Util/ConstantNodeCheckerTest.php +++ b/test/unit/Util/ConstantNodeCheckerTest.php @@ -9,9 +9,7 @@ use Roave\BetterReflection\Reflection\Exception\InvalidConstantNode; use Roave\BetterReflection\Util\ConstantNodeChecker; -/** - * @covers \Roave\BetterReflection\Util\ConstantNodeChecker - */ +/** @covers \Roave\BetterReflection\Util\ConstantNodeChecker */ class ConstantNodeCheckerTest extends TestCase { public function testWithoutName(): void @@ -109,9 +107,7 @@ public function testValueAsVariable(): void ConstantNodeChecker::assertValidDefineFunctionCall($node); } - /** - * @return list - */ + /** @return list */ public function validValuesProvider(): array { return [ @@ -130,9 +126,7 @@ public function validValuesProvider(): array ]; } - /** - * @dataProvider validValuesProvider - */ + /** @dataProvider validValuesProvider */ public function testValidValues(Node\Expr $valueNode): void { self::expectNotToPerformAssertions(); diff --git a/test/unit/Util/Exception/InvalidNodePositionTest.php b/test/unit/Util/Exception/InvalidNodePositionTest.php index 4251f055e..d5b108531 100644 --- a/test/unit/Util/Exception/InvalidNodePositionTest.php +++ b/test/unit/Util/Exception/InvalidNodePositionTest.php @@ -7,9 +7,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Util\Exception\InvalidNodePosition; -/** - * @covers \Roave\BetterReflection\Util\Exception\InvalidNodePosition - */ +/** @covers \Roave\BetterReflection\Util\Exception\InvalidNodePosition */ class InvalidNodePositionTest extends TestCase { public function testFromPosition(): void diff --git a/test/unit/Util/Exception/NoNodePositionTest.php b/test/unit/Util/Exception/NoNodePositionTest.php index 02f473581..0f150d4b0 100644 --- a/test/unit/Util/Exception/NoNodePositionTest.php +++ b/test/unit/Util/Exception/NoNodePositionTest.php @@ -11,9 +11,7 @@ use function sprintf; -/** - * @covers \Roave\BetterReflection\Util\Exception\NoNodePosition - */ +/** @covers \Roave\BetterReflection\Util\Exception\NoNodePosition */ class NoNodePositionTest extends TestCase { public function testFromPosition(): void diff --git a/test/unit/Util/FileHelperTest.php b/test/unit/Util/FileHelperTest.php index e8ee7ad0f..be04af13e 100644 --- a/test/unit/Util/FileHelperTest.php +++ b/test/unit/Util/FileHelperTest.php @@ -11,9 +11,7 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \Roave\BetterReflection\Util\FileHelper - */ +/** @covers \Roave\BetterReflection\Util\FileHelper */ class FileHelperTest extends TestCase { public function testNormalizeWindowsPath(): void diff --git a/test/unit/Util/FindReflectionOnLineTest.php b/test/unit/Util/FindReflectionOnLineTest.php index a3306e335..cec4f4720 100644 --- a/test/unit/Util/FindReflectionOnLineTest.php +++ b/test/unit/Util/FindReflectionOnLineTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\Util\FindReflectionOnLine; use Roave\BetterReflectionTest\BetterReflectionSingleton; -/** - * @covers \Roave\BetterReflection\Util\FindReflectionOnLine - */ +/** @covers \Roave\BetterReflection\Util\FindReflectionOnLine */ class FindReflectionOnLineTest extends TestCase { private FindReflectionOnLine $finder; diff --git a/test/unit/Util/GetLastDocCommentTest.php b/test/unit/Util/GetLastDocCommentTest.php index e6eae949f..e3f0ec30f 100644 --- a/test/unit/Util/GetLastDocCommentTest.php +++ b/test/unit/Util/GetLastDocCommentTest.php @@ -10,9 +10,7 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Util\GetLastDocComment; -/** - * @covers \Roave\BetterReflection\Util\GetLastDocComment - */ +/** @covers \Roave\BetterReflection\Util\GetLastDocComment */ class GetLastDocCommentTest extends TestCase { public function testWithComment(): void diff --git a/test/unit/Util/Visitor/ReturnNodeVisitorTest.php b/test/unit/Util/Visitor/ReturnNodeVisitorTest.php index 4d13cc190..ccdd47968 100644 --- a/test/unit/Util/Visitor/ReturnNodeVisitorTest.php +++ b/test/unit/Util/Visitor/ReturnNodeVisitorTest.php @@ -9,14 +9,10 @@ use PHPUnit\Framework\TestCase; use Roave\BetterReflection\Util\Visitor\ReturnNodeVisitor; -/** - * @covers \Roave\BetterReflection\Util\Visitor\ReturnNodeVisitor - */ +/** @covers \Roave\BetterReflection\Util\Visitor\ReturnNodeVisitor */ class ReturnNodeVisitorTest extends TestCase { - /** - * @return array, 1: int}> - */ + /** @return array, 1: int}> */ public function outOfScopeNodeTypeProvider(): array { return [