From 5c1a5657843c8513153d5cde8918c538547dea9b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Aug 2022 03:35:03 +0000 Subject: [PATCH 1/2] Bump doctrine/coding-standard from 9.0.0 to 10.0.0 Bumps [doctrine/coding-standard](https://github.com/doctrine/coding-standard) from 9.0.0 to 10.0.0. - [Release notes](https://github.com/doctrine/coding-standard/releases) - [Commits](https://github.com/doctrine/coding-standard/compare/9.0.0...10.0.0) --- updated-dependencies: - dependency-name: doctrine/coding-standard dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 46 +++++++++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/composer.json b/composer.json index ac97e842..269e832a 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ } ], "require-dev": { - "doctrine/coding-standard": "^9.0.0", + "doctrine/coding-standard": "^10.0.0", "php-standard-library/psalm-plugin": "^1.1.5", "phpunit/phpunit": "^9.5.23", "psalm/plugin-phpunit": "^0.17.0", diff --git a/composer.lock b/composer.lock index 7c4db4f7..35507bd6 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": "7211dd04a9408267a8b4b9319aea5000", + "content-hash": "c13290b5df6584353264dee1d8085de2", "packages": [ { "name": "azjezz/psl", @@ -2752,23 +2752,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/", @@ -2801,9 +2801,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", @@ -5929,37 +5929,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": { @@ -5974,7 +5974,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": [ { @@ -5986,7 +5986,7 @@ "type": "tidelift" } ], - "time": "2022-05-25T10:58:12+00:00" + "time": "2022-08-09T19:03:45+00:00" }, { "name": "squizlabs/php_codesniffer", From 13cec010a6a7479853f1a9c6ca749a7976a96cda Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Mon, 29 Aug 2022 10:42:40 +0200 Subject: [PATCH 2/2] Applied `doctrine/coding-standar:^10` ruleset --- bin/roave-backward-compatibility-check.php | 126 +++++++++--------- src/Change.php | 16 +-- src/Changes.php | 12 +- src/Command/AssertBackwardsCompatible.php | 42 +++--- src/CompareApi.php | 2 +- src/CompareClasses.php | 27 ++-- .../BCBreak/ClassBased/AncestorRemoved.php | 6 +- .../ClassBased/ClassBecameAbstract.php | 2 +- .../BCBreak/ClassBased/ClassBecameFinal.php | 2 +- .../ClassBased/ClassBecameInterface.php | 2 +- .../ClassBased/ClassBecameInternal.php | 4 +- .../BCBreak/ClassBased/ClassBecameTrait.php | 2 +- .../BCBreak/ClassBased/ConstantChanged.php | 7 +- .../BCBreak/ClassBased/ConstantRemoved.php | 4 +- .../ClassBased/ExcludeAnonymousClasses.php | 5 +- .../ClassBased/ExcludeInternalClass.php | 5 +- .../BCBreak/ClassBased/FinalClassChanged.php | 5 +- .../BCBreak/ClassBased/MethodChanged.php | 7 +- .../BCBreak/ClassBased/MethodRemoved.php | 4 +- .../BCBreak/ClassBased/OpenClassChanged.php | 5 +- .../BCBreak/ClassBased/PropertyChanged.php | 7 +- .../BCBreak/ClassBased/PropertyRemoved.php | 8 +- .../ClassBased/SkipClassBasedErrors.php | 5 +- .../ClassConstantValueChanged.php | 4 +- .../ClassConstantVisibilityReduced.php | 4 +- .../OnlyProtectedClassConstantChanged.php | 5 +- .../OnlyPublicClassConstantChanged.php | 5 +- .../SkipClassConstantBasedErrors.php | 5 +- .../FunctionBased/ExcludeInternalFunction.php | 7 +- .../BCBreak/FunctionBased/FunctionBased.php | 2 +- .../FunctionBased/FunctionBecameInternal.php | 4 +- .../MultipleChecksOnAFunction.php | 4 +- .../ParameterByReferenceChanged.php | 6 +- .../ParameterDefaultValueChanged.php | 8 +- .../FunctionBased/ParameterNameChanged.php | 16 +-- .../FunctionBased/ParameterTypeChanged.php | 14 +- .../ParameterTypeContravarianceChanged.php | 15 +-- .../RequiredParameterAmountIncreased.php | 6 +- .../ReturnTypeByReferenceChanged.php | 6 +- .../FunctionBased/ReturnTypeChanged.php | 8 +- .../ReturnTypeCovarianceChanged.php | 15 +-- .../FunctionBased/SkipFunctionBasedErrors.php | 7 +- .../InterfaceBased/AncestorRemoved.php | 6 +- .../ExcludeInternalInterface.php | 5 +- .../InterfaceBased/InterfaceBecameClass.php | 2 +- .../InterfaceBased/InterfaceBecameTrait.php | 2 +- .../BCBreak/InterfaceBased/MethodAdded.php | 8 +- .../SkipInterfaceBasedErrors.php | 5 +- .../UseClassBasedChecksOnAnInterface.php | 5 +- .../MethodBased/AccessibleMethodChange.php | 5 +- .../MethodBased/ExcludeInternalMethod.php | 5 +- .../BCBreak/MethodBased/MethodBecameFinal.php | 4 +- .../MethodBased/MethodConcretenessChanged.php | 4 +- .../MethodFunctionDefinitionChanged.php | 5 +- .../MethodBased/MethodScopeChanged.php | 4 +- .../MethodBased/MethodVisibilityReduced.php | 4 +- .../OnlyProtectedMethodChanged.php | 5 +- .../MethodBased/OnlyPublicMethodChanged.php | 5 +- .../MethodBased/SkipMethodBasedErrors.php | 5 +- .../AccessiblePropertyChanged.php | 5 +- .../PropertyBased/ExcludeInternalProperty.php | 5 +- .../OnlyProtectedPropertyChanged.php | 5 +- .../OnlyPublicPropertyChanged.php | 5 +- .../PropertyBased/PropertyBecameInternal.php | 2 +- .../PropertyDefaultValueChanged.php | 4 +- .../PropertyBased/PropertyScopeChanged.php | 4 +- .../PropertyBased/PropertyTypeChanged.php | 6 +- .../PropertyVisibilityReduced.php | 4 +- .../PropertyBased/SkipPropertyBasedErrors.php | 5 +- .../TraitBased/ExcludeInternalTrait.php | 5 +- .../TraitBased/SkipTraitBasedErrors.php | 5 +- .../BCBreak/TraitBased/TraitBecameClass.php | 2 +- .../TraitBased/TraitBecameInterface.php | 2 +- .../Variance/TypeIsContravariant.php | 2 +- .../Variance/TypeIsCovariant.php | 4 +- .../ComposerInstallationReflectorFactory.php | 9 +- src/Formatter/GithubActionsFormatter.php | 4 +- ...MarkdownPipedToSymfonyConsoleFormatter.php | 17 +-- src/Formatter/SymbolStartColumn.php | 2 +- src/Formatter/SymfonyConsoleTextFormatter.php | 5 +- .../GetVersionCollectionFromGitRepository.php | 2 +- .../GitCheckoutRevisionToTemporaryPath.php | 16 +-- .../PickLastMinorVersionFromCollection.php | 4 +- src/Git/Revision.php | 2 +- .../LocateDependenciesViaComposer.php | 9 +- .../LocateSourcesViaComposerJson.php | 9 +- ...atedSourceWithStrippedSourcesDirectory.php | 10 +- .../ReplaceSourcePathOfLocatedSources.php | 6 +- .../StaticClassMapSourceLocator.php | 4 +- test/unit/Assertion.php | 6 +- test/unit/ChangeTest.php | 4 +- test/unit/ChangesTest.php | 18 ++- .../Command/AssertBackwardsCompatibleTest.php | 72 +++++----- test/unit/CompareClassesTest.php | 49 ++++--- .../ClassBased/AncestorRemovedTest.php | 16 +-- .../ClassBased/ClassBecameAbstractTest.php | 16 +-- .../ClassBased/ClassBecameFinalTest.php | 8 +- .../ClassBased/ClassBecameInterfaceTest.php | 12 +- .../ClassBased/ClassBecameInternalTest.php | 8 +- .../ClassBased/ClassBecameTraitTest.php | 16 +-- .../ClassBased/ConstantChangedTest.php | 14 +- .../ClassBased/ConstantRemovedTest.php | 8 +- .../ExcludeAnonymousClassesTest.php | 4 +- .../ClassBased/ExcludeInternalClassTest.php | 8 +- .../ClassBased/FinalClassChangedTest.php | 4 +- .../BCBreak/ClassBased/MethodChangedTest.php | 14 +- .../BCBreak/ClassBased/MethodRemovedTest.php | 8 +- .../ClassBased/MultipleChecksOnAClassTest.php | 6 +- .../ClassBased/OpenClassChangedTest.php | 4 +- .../ClassBased/PropertyChangedTest.php | 14 +- .../ClassBased/PropertyRemovedTest.php | 20 +-- .../ClassBased/SkipClassBasedErrorsTest.php | 8 +- .../ClassConstantValueChangedTest.php | 16 +-- .../MultipleChecksOnAClassConstantTest.php | 6 +- .../OnlyProtectedClassConstantChangedTest.php | 8 +- .../OnlyPublicClassConstantChangedTest.php | 8 +- .../SkipClassConstantBasedErrorsTest.php | 8 +- .../ExcludeInternalFunctionTest.php | 8 +- .../FunctionBecameInternalTest.php | 12 +- .../MultipleChecksOnAFunctionTest.php | 6 +- .../ParameterNameChangedTest.php | 20 ++- .../SkipFunctionBasedErrorsTest.php | 8 +- .../InterfaceBased/AncestorRemovedTest.php | 16 +-- .../ExcludeInternalInterfaceTest.php | 8 +- .../InterfaceBecameClassTest.php | 12 +- .../InterfaceBecameTraitTest.php | 12 +- .../InterfaceBased/MethodAddedTest.php | 12 +- .../MultipleChecksOnAnInterfaceTest.php | 6 +- .../SkipInterfaceBasedErrorsTest.php | 8 +- .../UseClassBasedChecksOnAnInterfaceTest.php | 6 +- .../AccessibleMethodChangeTest.php | 4 +- .../MethodBased/ExcludeInternalMethodTest.php | 8 +- .../MethodBased/MethodBecameFinalTest.php | 16 +-- .../MethodConcretenessChangedTest.php | 16 +-- .../MethodFunctionDefinitionChangedTest.php | 4 +- .../MethodBased/MethodScopeChangedTest.php | 16 +-- .../MethodVisibilityReducedTest.php | 16 +-- .../MultipleChecksOnAMethodTest.php | 6 +- .../OnlyProtectedMethodChangedTest.php | 4 +- .../OnlyPublicMethodChangedTest.php | 4 +- .../MethodBased/SkipMethodBasedErrorsTest.php | 8 +- .../AccessiblePropertyChangedTest.php | 8 +- .../ExcludeInternalPropertyTest.php | 8 +- .../MultipleChecksOnAPropertyTest.php | 6 +- .../OnlyProtectedPropertyChangedTest.php | 8 +- .../OnlyPublicPropertyChangedTest.php | 8 +- .../PropertyBecameInternalTest.php | 16 +-- .../PropertyDefaultValueChangedTest.php | 16 +-- .../PropertyScopeChangedTest.php | 16 +-- .../PropertyBased/PropertyTypeChangedTest.php | 18 ++- .../PropertyVisibilityReducedTest.php | 16 +-- .../SkipPropertyBasedErrorsTest.php | 8 +- .../TraitBased/ExcludeInternalTraitTest.php | 8 +- .../TraitBased/MultipleChecksOnATraitTest.php | 6 +- .../TraitBased/SkipTraitBasedErrorsTest.php | 8 +- .../TraitBased/TraitBecameClassTest.php | 16 +-- .../TraitBased/TraitBecameInterfaceTest.php | 16 +-- .../UseClassBasedChecksOnATraitTest.php | 4 +- .../Variance/TypeIsContravariantTest.php | 40 +++--- .../Variance/TypeIsCovariantTest.php | 44 +++--- ...mposerInstallationReflectorFactoryTest.php | 10 +- test/unit/Formatter/FunctionNameTest.php | 10 +- .../Formatter/GithubActionsFormatterTest.php | 8 +- ...downPipedToSymfonyConsoleFormatterTest.php | 6 +- .../Formatter/ReflectionPropertyNameTest.php | 14 +- test/unit/Formatter/SymbolStartColumnTest.php | 12 +- .../SymfonyConsoleTextFormatterTest.php | 12 +- test/unit/Git/CheckedOutRepositoryTest.php | 4 +- ...VersionCollectionFromGitRepositoryTest.php | 6 +- ...GitCheckoutRevisionToTemporaryPathTest.php | 10 +- test/unit/Git/GitParseRevisionTest.php | 16 +-- ...PickLastMinorVersionFromCollectionTest.php | 8 +- test/unit/Git/RevisionTest.php | 12 +- .../LocateDependenciesViaComposerTest.php | 6 +- .../LocateSourcesViaComposerJsonTest.php | 8 +- ...SourceWithStrippedSourcesDirectoryTest.php | 38 +++--- .../ReplaceSourcePathOfLocatedSourcesTest.php | 14 +- .../StaticClassMapSourceLocatorTest.php | 20 ++- test/unit/StringReflectorFactory.php | 6 +- test/unit/TypeRestriction.php | 2 +- 180 files changed, 742 insertions(+), 1058 deletions(-) diff --git a/bin/roave-backward-compatibility-check.php b/bin/roave-backward-compatibility-check.php index 3eee22bc..e50e43f4 100644 --- a/bin/roave-backward-compatibility-check.php +++ b/bin/roave-backward-compatibility-check.php @@ -77,12 +77,12 @@ static function (string $installationPath) use ($composerIo): Installer { $composerIo, null, true, - $installationPath - ) - ) + $installationPath, + ), + ), ); }, - $astLocator + $astLocator, ), new CompareClasses( new ClassBased\SkipClassBasedErrors(new ClassBased\ExcludeAnonymousClasses(new ClassBased\ExcludeInternalClass( @@ -103,16 +103,16 @@ static function (string $installationPath) use ($composerIo): Installer { new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\OnlyPublicClassConstantChanged( new ClassConstantBased\MultipleChecksOnAClassConstant( new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantVisibilityReduced()), - new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()) - ) + new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()), + ), )), new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\OnlyProtectedClassConstantChanged( new ClassConstantBased\MultipleChecksOnAClassConstant( new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantVisibilityReduced()), - new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()) - ) - )) - ) + new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()), + ), + )), + ), )), new ClassBased\SkipClassBasedErrors(new ClassBased\PropertyChanged( new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\ExcludeInternalProperty(new PropertyBased\MultipleChecksOnAProperty( @@ -122,8 +122,8 @@ static function (string $installationPath) use ($composerIo): Installer { new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyTypeChanged(new TypeIsContravariant(), new TypeIsCovariant())), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyDefaultValueChanged()), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyVisibilityReduced()), - new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()) - ) + new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()), + ), )), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\OnlyProtectedPropertyChanged( new PropertyBased\MultipleChecksOnAProperty( @@ -131,10 +131,10 @@ static function (string $installationPath) use ($composerIo): Installer { new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyTypeChanged(new TypeIsContravariant(), new TypeIsCovariant())), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyDefaultValueChanged()), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyVisibilityReduced()), - new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()) - ) - )) - ))) + new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()), + ), + )), + ))), )), new ClassBased\SkipClassBasedErrors(new ClassBased\MethodChanged( new MethodBased\SkipMethodBasedErrors(new MethodBased\ExcludeInternalMethod(new MethodBased\MultipleChecksOnAMethod( @@ -155,10 +155,10 @@ static function (string $installationPath) use ($composerIo): Installer { new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ReturnTypeChanged()), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeContravarianceChanged(new TypeIsContravariant())), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeChanged()), - new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()) - ) - )) - ) + new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()), + ), + )), + ), )), new MethodBased\SkipMethodBasedErrors(new MethodBased\OnlyProtectedMethodChanged( new MethodBased\MultipleChecksOnAMethod( @@ -177,14 +177,14 @@ static function (string $installationPath) use ($composerIo): Installer { new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ReturnTypeChanged()), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeContravarianceChanged(new TypeIsContravariant())), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeChanged()), - new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()) - ) - )) - ) - )) - ))) - )) - ) + new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()), + ), + )), + ), + )), + ))), + )), + ), )), new ClassBased\SkipClassBasedErrors(new ClassBased\FinalClassChanged( new ClassBased\MultipleChecksOnAClass( @@ -192,9 +192,9 @@ static function (string $installationPath) use ($composerIo): Installer { new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\OnlyPublicClassConstantChanged( new ClassConstantBased\MultipleChecksOnAClassConstant( new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantVisibilityReduced()), - new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()) - ) - )) + new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()), + ), + )), )), new ClassBased\SkipClassBasedErrors(new ClassBased\PropertyChanged( new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\OnlyPublicPropertyChanged( @@ -203,9 +203,9 @@ static function (string $installationPath) use ($composerIo): Installer { new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyTypeChanged(new TypeIsContravariant(), new TypeIsCovariant())), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyDefaultValueChanged()), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyVisibilityReduced()), - new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()) - ) - )) + new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()), + ), + )), )), new ClassBased\SkipClassBasedErrors(new ClassBased\MethodChanged( new MethodBased\SkipMethodBasedErrors(new MethodBased\OnlyPublicMethodChanged( @@ -222,15 +222,15 @@ static function (string $installationPath) use ($composerIo): Installer { new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\RequiredParameterAmountIncreased()), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterDefaultValueChanged()), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ReturnTypeCovarianceChanged(new TypeIsCovariant())), - new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeContravarianceChanged(new TypeIsContravariant())) - ) - )) - ) - )) - )) - ) - )) - ) + new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeContravarianceChanged(new TypeIsContravariant())), + ), + )), + ), + )), + )), + ), + )), + ), ))), new InterfaceBased\SkipInterfaceBasedErrors(new InterfaceBased\ExcludeInternalInterface(new InterfaceBased\MultipleChecksOnAnInterface( new InterfaceBased\SkipInterfaceBasedErrors(new InterfaceBased\InterfaceBecameClass()), @@ -243,7 +243,7 @@ static function (string $installationPath) use ($composerIo): Installer { new ClassBased\SkipClassBasedErrors(new ClassBased\ConstantRemoved()), new ClassBased\SkipClassBasedErrors(new ClassBased\MethodRemoved()), new ClassBased\SkipClassBasedErrors(new ClassBased\ConstantChanged( - new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()) + new ClassConstantBased\SkipClassConstantBasedErrors(new ClassConstantBased\ClassConstantValueChanged()), )), new ClassBased\SkipClassBasedErrors(new ClassBased\MethodChanged( new MethodBased\MultipleChecksOnAMethod( @@ -259,13 +259,13 @@ static function (string $installationPath) use ($composerIo): Installer { new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ReturnTypeChanged()), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeContravarianceChanged(new TypeIsContravariant())), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeChanged()), - new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()) - ) - )) - ) - )) - ) - )) + new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()), + ), + )), + ), + )), + ), + )), ))), new TraitBased\SkipTraitBasedErrors(new TraitBased\ExcludeInternalTrait(new TraitBased\MultipleChecksOnATrait( new TraitBased\SkipTraitBasedErrors(new TraitBased\TraitBecameInterface()), @@ -282,8 +282,8 @@ static function (string $installationPath) use ($composerIo): Installer { new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyTypeChanged(new TypeIsContravariant(), new TypeIsCovariant())), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyDefaultValueChanged()), new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyVisibilityReduced()), - new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()) - ) + new PropertyBased\SkipPropertyBasedErrors(new PropertyBased\PropertyScopeChanged()), + ), )), new ClassBased\SkipClassBasedErrors(new ClassBased\MethodChanged( new MethodBased\MultipleChecksOnAMethod( @@ -303,16 +303,16 @@ static function (string $installationPath) use ($composerIo): Installer { new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ReturnTypeChanged()), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeContravarianceChanged(new TypeIsContravariant())), new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterTypeChanged()), - new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()) - ) - )) - ) - ) - )) - ) - )) - ))) - ) + new FunctionBased\SkipFunctionBasedErrors(new FunctionBased\ParameterNameChanged()), + ), + )), + ), + ), + )), + ), + )), + ))), + ), ); $application->add($apiCompareCommand); diff --git a/src/Change.php b/src/Change.php index 710e9949..85854a0d 100644 --- a/src/Change.php +++ b/src/Change.php @@ -20,9 +20,9 @@ private function __construct( private string $modificationType, public string $description, private bool $isBcBreak, - public ?string $file = null, - public ?int $line = null, - public ?int $column = null + public string|null $file = null, + public int|null $line = null, + public int|null $column = null, ) { } @@ -73,9 +73,9 @@ public function isSkipped(): bool /** @internal */ public function withFilePositionsIfNotAlreadySet( - ?string $file, + string|null $file, int $line, - ?int $column + int|null $column, ): self { $instance = clone $this; @@ -86,7 +86,7 @@ public function withFilePositionsIfNotAlreadySet( return $instance; } - public function onFile(?string $file): self + public function onFile(string|null $file): self { $instance = clone $this; @@ -104,7 +104,7 @@ public function onLine(int $line): self return $instance; } - public function onColumn(?int $column): self + public function onColumn(int|null $column): self { $instance = clone $this; @@ -119,7 +119,7 @@ public function __toString(): string '%s%s: %s', $this->isBcBreak ? '[BC] ' : ' ', Str\uppercase($this->modificationType), - $this->description + $this->description, ); } } diff --git a/src/Changes.php b/src/Changes.php index 778ed6d4..199652d7 100644 --- a/src/Changes.php +++ b/src/Changes.php @@ -12,21 +12,15 @@ use function array_values; -/** - * @implements IteratorAggregate - */ +/** @implements IteratorAggregate */ final class Changes implements IteratorAggregate, Countable { - /** @var list */ - private array $bufferedChanges; - /** @var iterable|null */ - private ?iterable $unBufferedChanges = null; + private iterable|null $unBufferedChanges = null; /** @param list $bufferedChanges */ - private function __construct(array $bufferedChanges) + private function __construct(private array $bufferedChanges) { - $this->bufferedChanges = $bufferedChanges; } public static function empty(): self diff --git a/src/Command/AssertBackwardsCompatible.php b/src/Command/AssertBackwardsCompatible.php index 524063d7..b788db8d 100644 --- a/src/Command/AssertBackwardsCompatible.php +++ b/src/Command/AssertBackwardsCompatible.php @@ -33,9 +33,7 @@ final class AssertBackwardsCompatible extends Command { - /** - * @throws LogicException - */ + /** @throws LogicException */ public function __construct( private PerformCheckoutOfRevision $git, private ComposerInstallationReflectorFactory $makeComposerInstallationReflector, @@ -43,14 +41,12 @@ public function __construct( private GetVersionCollection $getVersions, private PickVersionFromVersionCollection $pickFromVersion, private LocateDependencies $locateDependencies, - private CompareApi $compareApi + private CompareApi $compareApi, ) { parent::__construct(); } - /** - * @throws InvalidArgumentException - */ + /** @throws InvalidArgumentException */ protected function configure(): void { $this @@ -60,27 +56,27 @@ protected function configure(): void 'from', null, InputOption::VALUE_OPTIONAL, - 'Git reference for the base version of the library, which is considered "stable"' + 'Git reference for the base version of the library, which is considered "stable"', ) ->addOption( 'to', null, InputOption::VALUE_REQUIRED, 'Git reference for the new version of the library, which is verified against "from" for BC breaks', - 'HEAD' + 'HEAD', ) ->addOption( 'format', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Currently supports "console", "markdown" or "github-actions"', - ['console'] + ['console'], ) ->addOption( 'install-development-dependencies', null, InputOption::VALUE_NONE, - 'Whether to also install "require-dev" dependencies too' + 'Whether to also install "require-dev" dependencies too', ) ->addUsage( <<<'USAGE' @@ -104,13 +100,11 @@ protected function configure(): void If you want to produce `STDOUT` output, then please use the `--format` flag. -USAGE +USAGE, ); } - /** - * @throws InvalidArgumentException - */ + /** @throws InvalidArgumentException */ public function execute(InputInterface $input, OutputInterface $output): int { $output = Type\object(ConsoleOutputInterface::class)->assert($output); @@ -132,7 +126,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $stdErr->writeln(Str\format( 'Comparing from %s to %s...', Type\string()->coerce($fromRevision), - Type\string()->coerce($toRevision) + Type\string()->coerce($toRevision), )); $fromPath = $this->git->checkout($sourceRepo, $fromRevision); @@ -142,16 +136,16 @@ public function execute(InputInterface $input, OutputInterface $output): int $changes = ($this->compareApi)( ($this->makeComposerInstallationReflector)( $fromPath->__toString(), - new AggregateSourceLocator() // no dependencies + new AggregateSourceLocator(), // no dependencies ), ($this->makeComposerInstallationReflector)( $fromPath->__toString(), - ($this->locateDependencies)($fromPath->__toString(), $includeDevelopmentDependencies) + ($this->locateDependencies)($fromPath->__toString(), $includeDevelopmentDependencies), ), ($this->makeComposerInstallationReflector)( $toPath->__toString(), - ($this->locateDependencies)($toPath->__toString(), $includeDevelopmentDependencies) - ) + ($this->locateDependencies)($toPath->__toString(), $includeDevelopmentDependencies), + ), ); $formatters = [ @@ -190,9 +184,7 @@ private function printOutcomeAndExit(Changes $changes, OutputInterface $stdErr): return $hasBcBreaks ? 3 : 0; } - /** - * @throws InvalidArgumentException - */ + /** @throws InvalidArgumentException */ private function parseRevisionFromInput(InputInterface $input, CheckedOutRepository $repository): Revision { $from = Type\string()->coerce($input->getOption('from')); @@ -202,7 +194,7 @@ private function parseRevisionFromInput(InputInterface $input, CheckedOutReposit private function determineFromRevisionFromRepository( CheckedOutRepository $repository, - OutputInterface $output + OutputInterface $output, ): Revision { $versions = $this->getVersions->fromRepository($repository); @@ -214,7 +206,7 @@ private function determineFromRevisionFromRepository( return $this->parseRevision->fromStringForRepository( $versionString, - $repository + $repository, ); } } diff --git a/src/CompareApi.php b/src/CompareApi.php index 6c2b42a8..029a3eb3 100644 --- a/src/CompareApi.php +++ b/src/CompareApi.php @@ -18,6 +18,6 @@ interface CompareApi public function __invoke( Reflector $definedSymbols, Reflector $pastSourcesWithDependencies, - Reflector $newSourcesWithDependencies + Reflector $newSourcesWithDependencies, ): Changes; } diff --git a/src/CompareClasses.php b/src/CompareClasses.php index 2e213566..0fd69d7e 100644 --- a/src/CompareClasses.php +++ b/src/CompareClasses.php @@ -16,43 +16,34 @@ final class CompareClasses implements CompareApi { - private ClassBased $classBasedComparisons; - - private InterfaceBased $interfaceBasedComparisons; - - private TraitBased $traitBasedComparisons; - public function __construct( - ClassBased $classBasedComparisons, - InterfaceBased $interfaceBasedComparisons, - TraitBased $traitBasedComparisons + private ClassBased $classBasedComparisons, + private InterfaceBased $interfaceBasedComparisons, + private TraitBased $traitBasedComparisons, ) { - $this->classBasedComparisons = $classBasedComparisons; - $this->interfaceBasedComparisons = $interfaceBasedComparisons; - $this->traitBasedComparisons = $traitBasedComparisons; } public function __invoke( Reflector $definedSymbols, Reflector $pastSourcesWithDependencies, - Reflector $newSourcesWithDependencies + Reflector $newSourcesWithDependencies, ): Changes { $definedApiClassNames = Dict\map( Dict\filter( $definedSymbols->reflectAllClasses(), function (ReflectionClass $class): bool { return ! ($class->isAnonymous() || $this->isInternalDocComment($class->getDocComment())); - } + }, ), static function (ReflectionClass $class): string { return $class->getName(); - } + }, ); return Changes::fromIterator($this->makeSymbolsIterator( $definedApiClassNames, $pastSourcesWithDependencies, - $newSourcesWithDependencies + $newSourcesWithDependencies, )); } @@ -64,7 +55,7 @@ static function (ReflectionClass $class): string { private function makeSymbolsIterator( array $definedApiClassNames, Reflector $pastSourcesWithDependencies, - Reflector $newSourcesWithDependencies + Reflector $newSourcesWithDependencies, ): iterable { foreach ($definedApiClassNames as $apiClassName) { $oldSymbol = $pastSourcesWithDependencies->reflectClass($apiClassName); @@ -76,7 +67,7 @@ private function makeSymbolsIterator( /** @return iterable */ private function examineSymbol( ReflectionClass $oldSymbol, - Reflector $newSourcesWithDependencies + Reflector $newSourcesWithDependencies, ): iterable { try { $newClass = $newSourcesWithDependencies->reflectClass($oldSymbol->getName()); diff --git a/src/DetectChanges/BCBreak/ClassBased/AncestorRemoved.php b/src/DetectChanges/BCBreak/ClassBased/AncestorRemoved.php index 9d50bd3a..e7caa07e 100644 --- a/src/DetectChanges/BCBreak/ClassBased/AncestorRemoved.php +++ b/src/DetectChanges/BCBreak/ClassBased/AncestorRemoved.php @@ -22,7 +22,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): { $removedAncestors = Vec\concat( Vec\values(Dict\diff($fromClass->getParentClassNames(), $toClass->getParentClassNames())), - Vec\values(Dict\diff($fromClass->getInterfaceNames(), $toClass->getInterfaceNames())) + Vec\values(Dict\diff($fromClass->getInterfaceNames(), $toClass->getInterfaceNames())), ); if (! $removedAncestors) { @@ -33,8 +33,8 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Str\format( 'These ancestors of %s have been removed: %s', $fromClass->getName(), - Json\encode($removedAncestors) - ) + Json\encode($removedAncestors), + ), )); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/ClassBecameAbstract.php b/src/DetectChanges/BCBreak/ClassBased/ClassBecameAbstract.php index 34cde3b3..aa240241 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ClassBecameAbstract.php +++ b/src/DetectChanges/BCBreak/ClassBased/ClassBecameAbstract.php @@ -28,7 +28,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): } return Changes::fromList(Change::changed( - Str\format('Class %s became abstract', $fromClass->getName()) + Str\format('Class %s became abstract', $fromClass->getName()), )); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/ClassBecameFinal.php b/src/DetectChanges/BCBreak/ClassBased/ClassBecameFinal.php index b9559429..ffe806bb 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ClassBecameFinal.php +++ b/src/DetectChanges/BCBreak/ClassBased/ClassBecameFinal.php @@ -22,7 +22,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): } return Changes::fromList(Change::changed( - Str\format('Class %s became final', $fromClass->getName()) + Str\format('Class %s became final', $fromClass->getName()), )); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/ClassBecameInterface.php b/src/DetectChanges/BCBreak/ClassBased/ClassBecameInterface.php index e9796fa5..56ee8d0b 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ClassBecameInterface.php +++ b/src/DetectChanges/BCBreak/ClassBased/ClassBecameInterface.php @@ -24,7 +24,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): } return Changes::fromList(Change::changed( - Str\format('Class %s became an interface', $fromClass->getName()) + Str\format('Class %s became an interface', $fromClass->getName()), )); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php b/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php index 8b9fb4b3..56952645 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php +++ b/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php @@ -24,8 +24,8 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): return Changes::fromList(Change::changed( Str\format( '%s was marked "@internal"', - $fromClass->getName() - ) + $fromClass->getName(), + ), )); } diff --git a/src/DetectChanges/BCBreak/ClassBased/ClassBecameTrait.php b/src/DetectChanges/BCBreak/ClassBased/ClassBecameTrait.php index 94f4b77e..1742d2a6 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ClassBecameTrait.php +++ b/src/DetectChanges/BCBreak/ClassBased/ClassBecameTrait.php @@ -23,7 +23,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): } return Changes::fromList(Change::changed( - Str\format('Class %s became a trait', $fromClass->getName()) + Str\format('Class %s became a trait', $fromClass->getName()), )); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/ConstantChanged.php b/src/DetectChanges/BCBreak/ClassBased/ConstantChanged.php index 9198cc5c..5bb3397e 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ConstantChanged.php +++ b/src/DetectChanges/BCBreak/ClassBased/ConstantChanged.php @@ -14,18 +14,15 @@ final class ConstantChanged implements ClassBased { - private ClassConstantBased $checkConstant; - - public function __construct(ClassConstantBased $checkConstant) + public function __construct(private ClassConstantBased $checkConstant) { - $this->checkConstant = $checkConstant; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes { return Changes::fromIterator($this->checkSymbols( $fromClass->getReflectionConstants(), - $toClass->getReflectionConstants() + $toClass->getReflectionConstants(), )); } diff --git a/src/DetectChanges/BCBreak/ClassBased/ConstantRemoved.php b/src/DetectChanges/BCBreak/ClassBased/ConstantRemoved.php index 4787d62f..3e4c8e03 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ConstantRemoved.php +++ b/src/DetectChanges/BCBreak/ClassBased/ConstantRemoved.php @@ -18,12 +18,12 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): { $removedConstants = Dict\diff_by_key( $this->accessibleConstants($fromClass), - $this->accessibleConstants($toClass) + $this->accessibleConstants($toClass), ); return Changes::fromList(...Vec\map($removedConstants, static function (ReflectionClassConstant $constant) use ($fromClass): Change { return Change::removed( - Str\format('Constant %s::%s was removed', $fromClass->getName(), $constant->getName()) + Str\format('Constant %s::%s was removed', $fromClass->getName(), $constant->getName()), ); })); } diff --git a/src/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClasses.php b/src/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClasses.php index fc218924..6e4d45b5 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClasses.php +++ b/src/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClasses.php @@ -9,11 +9,8 @@ final class ExcludeAnonymousClasses implements ClassBased { - private ClassBased $check; - - public function __construct(ClassBased $check) + public function __construct(private ClassBased $check) { - $this->check = $check; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes diff --git a/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php b/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php index 7b0e24ef..c33ba888 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php +++ b/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php @@ -13,11 +13,8 @@ */ final class ExcludeInternalClass implements ClassBased { - private ClassBased $check; - - public function __construct(ClassBased $check) + public function __construct(private ClassBased $check) { - $this->check = $check; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes diff --git a/src/DetectChanges/BCBreak/ClassBased/FinalClassChanged.php b/src/DetectChanges/BCBreak/ClassBased/FinalClassChanged.php index 6cc5f78f..6464bc88 100644 --- a/src/DetectChanges/BCBreak/ClassBased/FinalClassChanged.php +++ b/src/DetectChanges/BCBreak/ClassBased/FinalClassChanged.php @@ -9,11 +9,8 @@ final class FinalClassChanged implements ClassBased { - private ClassBased $checkClass; - - public function __construct(ClassBased $checkClass) + public function __construct(private ClassBased $checkClass) { - $this->checkClass = $checkClass; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes diff --git a/src/DetectChanges/BCBreak/ClassBased/MethodChanged.php b/src/DetectChanges/BCBreak/ClassBased/MethodChanged.php index 73b94a8d..9131f799 100644 --- a/src/DetectChanges/BCBreak/ClassBased/MethodChanged.php +++ b/src/DetectChanges/BCBreak/ClassBased/MethodChanged.php @@ -15,11 +15,8 @@ final class MethodChanged implements ClassBased { - private MethodBased $checkMethod; - - public function __construct(MethodBased $checkMethod) + public function __construct(private MethodBased $checkMethod) { - $this->checkMethod = $checkMethod; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes @@ -49,7 +46,7 @@ private function methods(ReflectionClass $class): array Vec\map($methods, static function (ReflectionMethod $method): string { return Str\lowercase($method->getName()); }), - $methods + $methods, ); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php b/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php index 24c3d79f..0e9be959 100644 --- a/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php +++ b/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php @@ -36,7 +36,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): return Changes::fromList(...Vec\map($removedMethods, function (ReflectionMethod $method): Change { return Change::removed( - Str\format('Method %s was removed', ($this->formatFunction)($method)) + Str\format('Method %s was removed', ($this->formatFunction)($method)), ); })); } @@ -54,7 +54,7 @@ private function accessibleMethods(ReflectionClass $class): array Vec\map($methods, static function (ReflectionMethod $method): string { return $method->getName(); }), - $methods + $methods, ); } diff --git a/src/DetectChanges/BCBreak/ClassBased/OpenClassChanged.php b/src/DetectChanges/BCBreak/ClassBased/OpenClassChanged.php index f67115c4..e5926cd9 100644 --- a/src/DetectChanges/BCBreak/ClassBased/OpenClassChanged.php +++ b/src/DetectChanges/BCBreak/ClassBased/OpenClassChanged.php @@ -9,11 +9,8 @@ final class OpenClassChanged implements ClassBased { - private ClassBased $checkClass; - - public function __construct(ClassBased $checkClass) + public function __construct(private ClassBased $checkClass) { - $this->checkClass = $checkClass; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes diff --git a/src/DetectChanges/BCBreak/ClassBased/PropertyChanged.php b/src/DetectChanges/BCBreak/ClassBased/PropertyChanged.php index 437e5106..1c016c60 100644 --- a/src/DetectChanges/BCBreak/ClassBased/PropertyChanged.php +++ b/src/DetectChanges/BCBreak/ClassBased/PropertyChanged.php @@ -14,18 +14,15 @@ final class PropertyChanged implements ClassBased { - private PropertyBased $checkProperty; - - public function __construct(PropertyBased $checkProperty) + public function __construct(private PropertyBased $checkProperty) { - $this->checkProperty = $checkProperty; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes { return Changes::fromIterator($this->checkSymbols( $fromClass->getProperties(), - $toClass->getProperties() + $toClass->getProperties(), )); } diff --git a/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php b/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php index cb6ea7c2..b3cbb316 100644 --- a/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php +++ b/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php @@ -28,19 +28,17 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): $fromProperties = $this->accessibleProperties($fromClass); $removedProperties = Dict\diff( Vec\keys($fromProperties), - Vec\keys($this->accessibleProperties($toClass)) + Vec\keys($this->accessibleProperties($toClass)), ); return Changes::fromList(...Vec\map($removedProperties, function (string $property) use ($fromProperties): Change { return Change::removed( - Str\format('Property %s was removed', ($this->formatProperty)($fromProperties[$property])) + Str\format('Property %s was removed', ($this->formatProperty)($fromProperties[$property])), ); })); } - /** - * @return array - */ + /** @return array */ private function accessibleProperties(ReflectionClass $class): array { $classIsOpen = ! $class->isFinal(); diff --git a/src/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrors.php b/src/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrors.php index 9543a28f..2cb38330 100644 --- a/src/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrors.php +++ b/src/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrors.php @@ -11,11 +11,8 @@ final class SkipClassBasedErrors implements ClassBased { - private ClassBased $next; - - public function __construct(ClassBased $next) + public function __construct(private ClassBased $next) { - $this->next = $next; } public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): Changes diff --git a/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChanged.php b/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChanged.php index b9979851..3f8bfc5a 100644 --- a/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChanged.php +++ b/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChanged.php @@ -34,8 +34,8 @@ public function __invoke(ReflectionClassConstant $fromConstant, ReflectionClassC $fromConstant->getDeclaringClass()->getName(), $fromConstant->getName(), var_export($fromValue, true), - var_export($toValue, true) - ) + var_export($toValue, true), + ), )); } } diff --git a/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReduced.php b/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReduced.php index 515ce9a9..e41b9df2 100644 --- a/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReduced.php +++ b/src/DetectChanges/BCBreak/ClassConstantBased/ClassConstantVisibilityReduced.php @@ -33,8 +33,8 @@ public function __invoke(ReflectionClassConstant $fromConstant, ReflectionClassC $fromConstant->getDeclaringClass()->getName(), $fromConstant->getName(), $visibilityFrom, - $visibilityTo - ) + $visibilityTo, + ), )); } diff --git a/src/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChanged.php b/src/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChanged.php index e2fe7910..1a5b6cd9 100644 --- a/src/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChanged.php +++ b/src/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChanged.php @@ -9,11 +9,8 @@ final class OnlyProtectedClassConstantChanged implements ClassConstantBased { - private ClassConstantBased $constantCheck; - - public function __construct(ClassConstantBased $constantCheck) + public function __construct(private ClassConstantBased $constantCheck) { - $this->constantCheck = $constantCheck; } public function __invoke(ReflectionClassConstant $fromConstant, ReflectionClassConstant $toConstant): Changes diff --git a/src/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChanged.php b/src/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChanged.php index d57a0a74..dae85342 100644 --- a/src/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChanged.php +++ b/src/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChanged.php @@ -9,11 +9,8 @@ final class OnlyPublicClassConstantChanged implements ClassConstantBased { - private ClassConstantBased $constantCheck; - - public function __construct(ClassConstantBased $constantCheck) + public function __construct(private ClassConstantBased $constantCheck) { - $this->constantCheck = $constantCheck; } public function __invoke(ReflectionClassConstant $fromConstant, ReflectionClassConstant $toConstant): Changes diff --git a/src/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrors.php b/src/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrors.php index da6944fc..97da0229 100644 --- a/src/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrors.php +++ b/src/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrors.php @@ -11,11 +11,8 @@ final class SkipClassConstantBasedErrors implements ClassConstantBased { - private ClassConstantBased $next; - - public function __construct(ClassConstantBased $next) + public function __construct(private ClassConstantBased $next) { - $this->next = $next; } public function __invoke(ReflectionClassConstant $fromConstant, ReflectionClassConstant $toConstant): Changes diff --git a/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php b/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php index c3d11511..4cda2f56 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php @@ -14,16 +14,13 @@ */ final class ExcludeInternalFunction implements FunctionBased { - private FunctionBased $check; - - public function __construct(FunctionBased $check) + public function __construct(private FunctionBased $check) { - $this->check = $check; } public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { if ($this->isInternalDocComment($fromFunction->getDocComment())) { return Changes::empty(); diff --git a/src/DetectChanges/BCBreak/FunctionBased/FunctionBased.php b/src/DetectChanges/BCBreak/FunctionBased/FunctionBased.php index 5fd756c2..a7b70bf5 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/FunctionBased.php +++ b/src/DetectChanges/BCBreak/FunctionBased/FunctionBased.php @@ -18,6 +18,6 @@ interface FunctionBased */ public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes; } diff --git a/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php b/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php index 5c85fec0..354d61f1 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php +++ b/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php @@ -26,7 +26,7 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { if ( $this->isInternalDocComment($toFunction->getDocComment()) @@ -36,7 +36,7 @@ public function __invoke( Str\format( '%s was marked "@internal"', ($this->formatFunction)($fromFunction), - ) + ), )); } diff --git a/src/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunction.php b/src/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunction.php index c664b5c0..9aac9ab7 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunction.php +++ b/src/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunction.php @@ -22,7 +22,7 @@ public function __construct(FunctionBased ...$checks) public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { return Changes::fromIterator($this->multipleChecks($fromFunction, $toFunction)); } @@ -37,7 +37,7 @@ public function __invoke( */ private function multipleChecks( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): iterable { $toFile = $toFunction->getFileName(); $toLine = $toFunction->getStartLine(); diff --git a/src/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChanged.php index aa15b045..3a9cf68d 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ParameterByReferenceChanged.php @@ -29,7 +29,7 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromParameters = $fromFunction->getParameters(); $toParameters = $toFunction->getParameters(); @@ -57,8 +57,8 @@ private function compareParameter(ReflectionParameter $fromParameter, Reflection $fromParameter->getName(), ($this->formatFunction)($fromParameter->getDeclaringFunction()), $this->referenceToString($fromByReference), - $this->referenceToString($toByReference) - ) + $this->referenceToString($toByReference), + ), )); } diff --git a/src/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChanged.php index f6daf27e..4635b12e 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ParameterDefaultValueChanged.php @@ -30,7 +30,7 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromParametersWithDefaults = $this->defaultParameterValues($fromFunction); $toParametersWithDefaults = $this->defaultParameterValues($toFunction); @@ -51,8 +51,8 @@ public function __invoke( $parameter->getName(), ($this->formatFunction)($fromFunction), var_export($defaultValueFrom, true), - var_export($defaultValueTo, true) - ) + var_export($defaultValueTo, true), + ), ))); } @@ -66,7 +66,7 @@ private function defaultParameterValues(ReflectionMethod|ReflectionFunction $fun $function->getParameters(), static function (ReflectionParameter $parameter): bool { return $parameter->isDefaultValueAvailable(); - } + }, ); } } diff --git a/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php index 0b5e322d..7e2ee4d2 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ParameterNameChanged.php @@ -35,7 +35,7 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromHadNoNamedArgumentsAnnotation = $this->methodHasNoNamedArgumentsAnnotation($fromFunction); $toHasNoNamedArgumentsAnnotation = $this->methodHasNoNamedArgumentsAnnotation($toFunction); @@ -47,8 +47,8 @@ public function __invoke( 'The %s annotation was removed from %s', self::NO_NAMED_ARGUMENTS_ANNOTATION, $this->formatFunction->__invoke($fromFunction), - ) - ) + ), + ), ); } @@ -59,8 +59,8 @@ public function __invoke( 'The %s annotation was added from %s', self::NO_NAMED_ARGUMENTS_ANNOTATION, $this->formatFunction->__invoke($fromFunction), - ) - ) + ), + ), ); } @@ -70,7 +70,7 @@ public function __invoke( return Changes::fromIterator($this->checkSymbols( $fromFunction->getParameters(), - $toFunction->getParameters() + $toFunction->getParameters(), )); } @@ -103,8 +103,8 @@ private function compareParameter(ReflectionParameter $fromParameter, Reflection $fromParameter->getPosition(), $this->formatFunction->__invoke($fromParameter->getDeclaringFunction()), $fromName, - $toName - ) + $toName, + ), ); } diff --git a/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeChanged.php index 9c10f00d..3797c2d1 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeChanged.php @@ -31,11 +31,11 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { return Changes::fromIterator($this->checkSymbols( $fromFunction->getParameters(), - $toFunction->getParameters() + $toFunction->getParameters(), )); } @@ -52,9 +52,7 @@ private function checkSymbols(array $from, array $to): iterable } } - /** - * @return iterable - */ + /** @return iterable */ private function compareParameter(ReflectionParameter $fromParameter, ReflectionParameter $toParameter): iterable { $fromType = $this->typeToString($fromParameter->getType()); @@ -70,12 +68,12 @@ private function compareParameter(ReflectionParameter $fromParameter, Reflection $fromParameter->getName(), ($this->formatFunction)($fromParameter->getDeclaringFunction()), $fromType, - $toType - ) + $toType, + ), ); } - private function typeToString(?ReflectionType $type): string + private function typeToString(ReflectionType|null $type): string { if (! $type) { return 'no type'; diff --git a/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChanged.php index 2d665803..1b209026 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ParameterTypeContravarianceChanged.php @@ -21,19 +21,16 @@ */ final class ParameterTypeContravarianceChanged implements FunctionBased { - private TypeIsContravariant $typeIsContravariant; - private FunctionName $formatFunction; - public function __construct(TypeIsContravariant $typeIsContravariant) + public function __construct(private TypeIsContravariant $typeIsContravariant) { - $this->typeIsContravariant = $typeIsContravariant; - $this->formatFunction = new FunctionName(); + $this->formatFunction = new FunctionName(); } public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromParameters = $fromFunction->getParameters(); $toParameters = $toFunction->getParameters(); @@ -61,12 +58,12 @@ private function compareParameter(ReflectionParameter $fromParameter, Reflection $fromParameter->getName(), ($this->formatFunction)($fromParameter->getDeclaringFunction()), $this->typeToString($fromType), - $this->typeToString($toType) - ) + $this->typeToString($toType), + ), )); } - private function typeToString(?ReflectionType $type): string + private function typeToString(ReflectionType|null $type): string { if (! $type) { return 'no type'; diff --git a/src/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreased.php b/src/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreased.php index 57af2d22..bd908042 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreased.php +++ b/src/DetectChanges/BCBreak/FunctionBased/RequiredParameterAmountIncreased.php @@ -26,7 +26,7 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromRequiredParameters = $fromFunction->getNumberOfRequiredParameters(); $toRequiredParameters = $toFunction->getNumberOfRequiredParameters(); @@ -40,8 +40,8 @@ public function __invoke( 'The number of required arguments for %s increased from %d to %d', ($this->formatFunction)($fromFunction), $fromRequiredParameters, - $toRequiredParameters - ) + $toRequiredParameters, + ), )); } } diff --git a/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChanged.php index dd2d49fe..1877212b 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeByReferenceChanged.php @@ -26,7 +26,7 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromReturnsReference = $fromFunction->returnsReference(); $toReturnsReference = $toFunction->returnsReference(); @@ -40,8 +40,8 @@ public function __invoke( 'The return value of %s changed from %s to %s', ($this->formatFunction)($fromFunction), $this->referenceToString($fromReturnsReference), - $this->referenceToString($toReturnsReference) - ) + $this->referenceToString($toReturnsReference), + ), )); } diff --git a/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeChanged.php index 2568b99a..a8b489bc 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeChanged.php @@ -28,7 +28,7 @@ public function __construct() public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromReturnType = $this->typeToString($fromFunction->getReturnType()); $toReturnType = $this->typeToString($toFunction->getReturnType()); @@ -42,12 +42,12 @@ public function __invoke( 'The return type of %s changed from %s to %s', ($this->formatFunction)($fromFunction), $fromReturnType, - $toReturnType - ) + $toReturnType, + ), )); } - private function typeToString(?ReflectionType $type): string + private function typeToString(ReflectionType|null $type): string { if (! $type) { return 'no type'; diff --git a/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChanged.php b/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChanged.php index 69393580..586eeaa9 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChanged.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ReturnTypeCovarianceChanged.php @@ -20,19 +20,16 @@ */ final class ReturnTypeCovarianceChanged implements FunctionBased { - private TypeIsCovariant $typeIsCovariant; - private FunctionName $formatFunction; - public function __construct(TypeIsCovariant $typeIsCovariant) + public function __construct(private TypeIsCovariant $typeIsCovariant) { - $this->typeIsCovariant = $typeIsCovariant; - $this->formatFunction = new FunctionName(); + $this->formatFunction = new FunctionName(); } public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { $fromReturnType = $fromFunction->getReturnType(); $toReturnType = $toFunction->getReturnType(); @@ -46,12 +43,12 @@ public function __invoke( 'The return type of %s changed from %s to the non-covariant %s', ($this->formatFunction)($fromFunction), $this->typeToString($fromReturnType), - $this->typeToString($toReturnType) - ) + $this->typeToString($toReturnType), + ), )); } - private function typeToString(?ReflectionType $type): string + private function typeToString(ReflectionType|null $type): string { if (! $type) { return 'no type'; diff --git a/src/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrors.php b/src/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrors.php index 6de411cb..ac126438 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrors.php +++ b/src/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrors.php @@ -12,16 +12,13 @@ final class SkipFunctionBasedErrors implements FunctionBased { - private FunctionBased $next; - - public function __construct(FunctionBased $next) + public function __construct(private FunctionBased $next) { - $this->next = $next; } public function __invoke( ReflectionMethod|ReflectionFunction $fromFunction, - ReflectionMethod|ReflectionFunction $toFunction + ReflectionMethod|ReflectionFunction $toFunction, ): Changes { try { return ($this->next)($fromFunction, $toFunction); diff --git a/src/DetectChanges/BCBreak/InterfaceBased/AncestorRemoved.php b/src/DetectChanges/BCBreak/InterfaceBased/AncestorRemoved.php index a8e332e6..f7e70fa9 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/AncestorRemoved.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/AncestorRemoved.php @@ -20,7 +20,7 @@ final class AncestorRemoved implements InterfaceBased public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInterface): Changes { $removedAncestors = Vec\values( - Dict\diff($fromInterface->getInterfaceNames(), $toInterface->getInterfaceNames()) + Dict\diff($fromInterface->getInterfaceNames(), $toInterface->getInterfaceNames()), ); if (! $removedAncestors) { @@ -31,8 +31,8 @@ public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInte Str\format( 'These ancestors of %s have been removed: %s', $fromInterface->getName(), - Json\encode($removedAncestors) - ) + Json\encode($removedAncestors), + ), )); } } diff --git a/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php b/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php index 1259ca7e..2fc7ccf0 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php @@ -13,11 +13,8 @@ */ final class ExcludeInternalInterface implements InterfaceBased { - private InterfaceBased $check; - - public function __construct(InterfaceBased $check) + public function __construct(private InterfaceBased $check) { - $this->check = $check; } public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInterface): Changes diff --git a/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClass.php b/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClass.php index b7068e71..1861bb37 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClass.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClass.php @@ -23,7 +23,7 @@ public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInte } return Changes::fromList(Change::changed( - Str\format('Interface %s became a class', $fromInterface->getName()) + Str\format('Interface %s became a class', $fromInterface->getName()), )); } diff --git a/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTrait.php b/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTrait.php index a1e73c82..01470e01 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTrait.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTrait.php @@ -23,7 +23,7 @@ public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInte } return Changes::fromList(Change::changed( - Str\format('Interface %s became a trait', $fromInterface->getName()) + Str\format('Interface %s became a trait', $fromInterface->getName()), )); } } diff --git a/src/DetectChanges/BCBreak/InterfaceBased/MethodAdded.php b/src/DetectChanges/BCBreak/InterfaceBased/MethodAdded.php index 8a671cc1..b84f92a2 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/MethodAdded.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/MethodAdded.php @@ -25,14 +25,14 @@ public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInte } return Changes::fromList(...Vec\map($newMethods, static function (ReflectionMethod $method) use ( - $fromInterface + $fromInterface, ): Change { return Change::added( Str\format( 'Method %s() was added to interface %s', $method->getName(), - $fromInterface->getName() - ) + $fromInterface->getName(), + ), ); })); } @@ -46,7 +46,7 @@ private function methods(ReflectionClass $interface): array Vec\map($methods, static function (ReflectionMethod $method): string { return Str\lowercase($method->getName()); }), - $methods + $methods, ); } } diff --git a/src/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrors.php b/src/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrors.php index 21e1cef5..7d61f65d 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrors.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrors.php @@ -11,11 +11,8 @@ final class SkipInterfaceBasedErrors implements InterfaceBased { - private InterfaceBased $next; - - public function __construct(InterfaceBased $next) + public function __construct(private InterfaceBased $next) { - $this->next = $next; } public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInterface): Changes diff --git a/src/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterface.php b/src/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterface.php index 26d4566a..2b5dcab7 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterface.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterface.php @@ -10,11 +10,8 @@ final class UseClassBasedChecksOnAnInterface implements InterfaceBased { - private ClassBased $check; - - public function __construct(ClassBased $check) + public function __construct(private ClassBased $check) { - $this->check = $check; } public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInterface): Changes diff --git a/src/DetectChanges/BCBreak/MethodBased/AccessibleMethodChange.php b/src/DetectChanges/BCBreak/MethodBased/AccessibleMethodChange.php index ea62f8d3..a60b4a55 100644 --- a/src/DetectChanges/BCBreak/MethodBased/AccessibleMethodChange.php +++ b/src/DetectChanges/BCBreak/MethodBased/AccessibleMethodChange.php @@ -12,11 +12,8 @@ */ final class AccessibleMethodChange implements MethodBased { - private MethodBased $check; - - public function __construct(MethodBased $check) + public function __construct(private MethodBased $check) { - $this->check = $check; } public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMethod): Changes diff --git a/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php b/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php index e3b97843..5c62cc07 100644 --- a/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php +++ b/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php @@ -13,11 +13,8 @@ */ final class ExcludeInternalMethod implements MethodBased { - private MethodBased $check; - - public function __construct(MethodBased $check) + public function __construct(private MethodBased $check) { - $this->check = $check; } public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMethod): Changes diff --git a/src/DetectChanges/BCBreak/MethodBased/MethodBecameFinal.php b/src/DetectChanges/BCBreak/MethodBased/MethodBecameFinal.php index 6f01b27f..6d6298d6 100644 --- a/src/DetectChanges/BCBreak/MethodBased/MethodBecameFinal.php +++ b/src/DetectChanges/BCBreak/MethodBased/MethodBecameFinal.php @@ -25,8 +25,8 @@ public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMetho Str\format( 'Method %s() of class %s became final', $fromMethod->getName(), - $fromMethod->getDeclaringClass()->getName() - ) + $fromMethod->getDeclaringClass()->getName(), + ), )); } } diff --git a/src/DetectChanges/BCBreak/MethodBased/MethodConcretenessChanged.php b/src/DetectChanges/BCBreak/MethodBased/MethodConcretenessChanged.php index 0cca0b6c..df4d881d 100644 --- a/src/DetectChanges/BCBreak/MethodBased/MethodConcretenessChanged.php +++ b/src/DetectChanges/BCBreak/MethodBased/MethodConcretenessChanged.php @@ -25,8 +25,8 @@ public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMetho Str\format( 'Method %s() of class %s changed from concrete to abstract', $fromMethod->getName(), - $fromMethod->getDeclaringClass()->getName() - ) + $fromMethod->getDeclaringClass()->getName(), + ), )); } } diff --git a/src/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChanged.php b/src/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChanged.php index 10f40b64..d6521cf4 100644 --- a/src/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChanged.php +++ b/src/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChanged.php @@ -13,11 +13,8 @@ */ final class MethodFunctionDefinitionChanged implements MethodBased { - private FunctionBased $functionCheck; - - public function __construct(FunctionBased $functionCheck) + public function __construct(private FunctionBased $functionCheck) { - $this->functionCheck = $functionCheck; } public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMethod): Changes diff --git a/src/DetectChanges/BCBreak/MethodBased/MethodScopeChanged.php b/src/DetectChanges/BCBreak/MethodBased/MethodScopeChanged.php index c6aa20b2..a3f7e03b 100644 --- a/src/DetectChanges/BCBreak/MethodBased/MethodScopeChanged.php +++ b/src/DetectChanges/BCBreak/MethodBased/MethodScopeChanged.php @@ -30,8 +30,8 @@ public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMetho $fromMethod->getName(), $fromMethod->getDeclaringClass()->getName(), $scopeFrom, - $scopeTo - ) + $scopeTo, + ), )); } diff --git a/src/DetectChanges/BCBreak/MethodBased/MethodVisibilityReduced.php b/src/DetectChanges/BCBreak/MethodBased/MethodVisibilityReduced.php index 81a2c173..be8de3b0 100644 --- a/src/DetectChanges/BCBreak/MethodBased/MethodVisibilityReduced.php +++ b/src/DetectChanges/BCBreak/MethodBased/MethodVisibilityReduced.php @@ -33,8 +33,8 @@ public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMetho $fromMethod->getName(), $fromMethod->getDeclaringClass()->getName(), $visibilityFrom, - $visibilityTo - ) + $visibilityTo, + ), )); } diff --git a/src/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChanged.php b/src/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChanged.php index 8ee56e93..c0d9e4f4 100644 --- a/src/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChanged.php +++ b/src/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChanged.php @@ -12,11 +12,8 @@ */ final class OnlyProtectedMethodChanged implements MethodBased { - private MethodBased $check; - - public function __construct(MethodBased $check) + public function __construct(private MethodBased $check) { - $this->check = $check; } public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMethod): Changes diff --git a/src/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChanged.php b/src/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChanged.php index 1049df99..f343dca5 100644 --- a/src/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChanged.php +++ b/src/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChanged.php @@ -12,11 +12,8 @@ */ final class OnlyPublicMethodChanged implements MethodBased { - private MethodBased $check; - - public function __construct(MethodBased $check) + public function __construct(private MethodBased $check) { - $this->check = $check; } public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMethod): Changes diff --git a/src/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrors.php b/src/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrors.php index 7ad89121..e70fbc0d 100644 --- a/src/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrors.php +++ b/src/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrors.php @@ -11,11 +11,8 @@ final class SkipMethodBasedErrors implements MethodBased { - private MethodBased $next; - - public function __construct(MethodBased $next) + public function __construct(private MethodBased $next) { - $this->next = $next; } public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMethod): Changes diff --git a/src/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChanged.php b/src/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChanged.php index f5491ee8..d78c0df5 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChanged.php +++ b/src/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChanged.php @@ -9,11 +9,8 @@ final class AccessiblePropertyChanged implements PropertyBased { - private PropertyBased $propertyBased; - - public function __construct(PropertyBased $propertyBased) + public function __construct(private PropertyBased $propertyBased) { - $this->propertyBased = $propertyBased; } public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $toProperty): Changes diff --git a/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php b/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php index 77880f2c..385632d0 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php +++ b/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php @@ -10,11 +10,8 @@ final class ExcludeInternalProperty implements PropertyBased { - private PropertyBased $propertyBased; - - public function __construct(PropertyBased $propertyBased) + public function __construct(private PropertyBased $propertyBased) { - $this->propertyBased = $propertyBased; } public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $toProperty): Changes diff --git a/src/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChanged.php b/src/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChanged.php index a83948c9..0fef199e 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChanged.php +++ b/src/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChanged.php @@ -9,11 +9,8 @@ final class OnlyProtectedPropertyChanged implements PropertyBased { - private PropertyBased $propertyBased; - - public function __construct(PropertyBased $propertyBased) + public function __construct(private PropertyBased $propertyBased) { - $this->propertyBased = $propertyBased; } public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $toProperty): Changes diff --git a/src/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChanged.php b/src/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChanged.php index 19d1e109..e27298ea 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChanged.php +++ b/src/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChanged.php @@ -9,11 +9,8 @@ final class OnlyPublicPropertyChanged implements PropertyBased { - private PropertyBased $propertyBased; - - public function __construct(PropertyBased $propertyBased) + public function __construct(private PropertyBased $propertyBased) { - $this->propertyBased = $propertyBased; } public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $toProperty): Changes diff --git a/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php b/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php index 622e749b..6968634e 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php +++ b/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php @@ -33,7 +33,7 @@ public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $t Str\format( 'Property %s was marked "@internal"', ($this->formatProperty)($fromProperty), - ) + ), )); } diff --git a/src/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChanged.php b/src/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChanged.php index 4a66c93f..670c1f36 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChanged.php +++ b/src/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChanged.php @@ -35,8 +35,8 @@ public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $t 'Property %s changed default value from %s to %s', ($this->formatProperty)($fromProperty), var_export($fromPropertyDefaultValue, true), - var_export($toPropertyDefaultValue, true) - ) + var_export($toPropertyDefaultValue, true), + ), )); } } diff --git a/src/DetectChanges/BCBreak/PropertyBased/PropertyScopeChanged.php b/src/DetectChanges/BCBreak/PropertyBased/PropertyScopeChanged.php index 48884c46..203df61e 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/PropertyScopeChanged.php +++ b/src/DetectChanges/BCBreak/PropertyBased/PropertyScopeChanged.php @@ -30,8 +30,8 @@ public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $t $fromProperty->getName(), $fromProperty->getDeclaringClass()->getName(), $fromScope, - $toScope - ) + $toScope, + ), )); } diff --git a/src/DetectChanges/BCBreak/PropertyBased/PropertyTypeChanged.php b/src/DetectChanges/BCBreak/PropertyBased/PropertyTypeChanged.php index 8656a44f..627b4c04 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/PropertyTypeChanged.php +++ b/src/DetectChanges/BCBreak/PropertyBased/PropertyTypeChanged.php @@ -29,7 +29,7 @@ final class PropertyTypeChanged implements PropertyBased public function __construct( private TypeIsContravariant $typeIsContravariant, - private TypeIsCovariant $typeIsCovariant + private TypeIsCovariant $typeIsCovariant, ) { $this->formatProperty = new ReflectionPropertyName(); } @@ -48,8 +48,8 @@ public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $t 'Type type of property %s changed from %s to %s', ($this->formatProperty)($fromProperty), $fromType?->__toString() ?? 'having no type', - $toType?->__toString() ?? 'having no type' - ) + $toType?->__toString() ?? 'having no type', + ), )); } } diff --git a/src/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReduced.php b/src/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReduced.php index ab610b4a..267128a2 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReduced.php +++ b/src/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReduced.php @@ -40,8 +40,8 @@ public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $t 'Property %s visibility reduced from %s to %s', ($this->formatProperty)($fromProperty), $visibilityFrom, - $visibilityTo - ) + $visibilityTo, + ), )); } diff --git a/src/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrors.php b/src/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrors.php index 82249030..0bb455ff 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrors.php +++ b/src/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrors.php @@ -11,11 +11,8 @@ final class SkipPropertyBasedErrors implements PropertyBased { - private PropertyBased $next; - - public function __construct(PropertyBased $next) + public function __construct(private PropertyBased $next) { - $this->next = $next; } public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $toProperty): Changes diff --git a/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php b/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php index a239c2c6..969bfec7 100644 --- a/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php +++ b/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php @@ -13,11 +13,8 @@ */ final class ExcludeInternalTrait implements TraitBased { - private TraitBased $check; - - public function __construct(TraitBased $check) + public function __construct(private TraitBased $check) { - $this->check = $check; } public function __invoke(ReflectionClass $fromTrait, ReflectionClass $toTrait): Changes diff --git a/src/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrors.php b/src/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrors.php index 6f55814f..8e284a3a 100644 --- a/src/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrors.php +++ b/src/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrors.php @@ -11,11 +11,8 @@ final class SkipTraitBasedErrors implements TraitBased { - private TraitBased $next; - - public function __construct(TraitBased $next) + public function __construct(private TraitBased $next) { - $this->next = $next; } public function __invoke(ReflectionClass $fromTrait, ReflectionClass $toTrait): Changes diff --git a/src/DetectChanges/BCBreak/TraitBased/TraitBecameClass.php b/src/DetectChanges/BCBreak/TraitBased/TraitBecameClass.php index e2059eac..26f630a9 100644 --- a/src/DetectChanges/BCBreak/TraitBased/TraitBecameClass.php +++ b/src/DetectChanges/BCBreak/TraitBased/TraitBecameClass.php @@ -22,7 +22,7 @@ public function __invoke(ReflectionClass $fromTrait, ReflectionClass $toTrait): } return Changes::fromList(Change::changed( - Str\format('Trait %s became a class', $fromTrait->getName()) + Str\format('Trait %s became a class', $fromTrait->getName()), )); } diff --git a/src/DetectChanges/BCBreak/TraitBased/TraitBecameInterface.php b/src/DetectChanges/BCBreak/TraitBased/TraitBecameInterface.php index 6c43efa3..ed81755a 100644 --- a/src/DetectChanges/BCBreak/TraitBased/TraitBecameInterface.php +++ b/src/DetectChanges/BCBreak/TraitBased/TraitBecameInterface.php @@ -22,7 +22,7 @@ public function __invoke(ReflectionClass $fromTrait, ReflectionClass $toTrait): } return Changes::fromList(Change::changed( - Str\format('Interface %s became an interface', $fromTrait->getName()) + Str\format('Interface %s became an interface', $fromTrait->getName()), )); } } diff --git a/src/DetectChanges/Variance/TypeIsContravariant.php b/src/DetectChanges/Variance/TypeIsContravariant.php index 4a09fd3e..9893df57 100644 --- a/src/DetectChanges/Variance/TypeIsContravariant.php +++ b/src/DetectChanges/Variance/TypeIsContravariant.php @@ -20,7 +20,7 @@ final class TypeIsContravariant { public function __invoke( ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type, - ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $comparedType + ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $comparedType, ): bool { if ( ($type && $type->__toString() === 'never') diff --git a/src/DetectChanges/Variance/TypeIsCovariant.php b/src/DetectChanges/Variance/TypeIsCovariant.php index 74115020..9b17f2fb 100644 --- a/src/DetectChanges/Variance/TypeIsCovariant.php +++ b/src/DetectChanges/Variance/TypeIsCovariant.php @@ -21,7 +21,7 @@ final class TypeIsCovariant { public function __invoke( ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type, - ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $comparedType + ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $comparedType, ): bool { if ($type === null) { // everything can be covariant to `mixed` @@ -121,7 +121,7 @@ private function compareNamedTypes(ReflectionNamedType $type, ReflectionNamedTyp return Iter\contains( $comparedTypeReflectionClass->getParentClassNames(), - $originalTypeReflectionClass->getName() + $originalTypeReflectionClass->getName(), ); } } diff --git a/src/Factory/ComposerInstallationReflectorFactory.php b/src/Factory/ComposerInstallationReflectorFactory.php index 8b2cf6ae..fe73f50d 100644 --- a/src/Factory/ComposerInstallationReflectorFactory.php +++ b/src/Factory/ComposerInstallationReflectorFactory.php @@ -15,11 +15,8 @@ final class ComposerInstallationReflectorFactory { - private LocateSources $locateSources; - - public function __construct(LocateSources $locateSources) + public function __construct(private LocateSources $locateSources) { - $this->locateSources = $locateSources; } /** @@ -28,13 +25,13 @@ public function __construct(LocateSources $locateSources) */ public function __invoke( string $installationDirectory, - SourceLocator $dependencies + SourceLocator $dependencies, ): Reflector { return new DefaultReflector( new MemoizingSourceLocator(new AggregateSourceLocator([ ($this->locateSources)($installationDirectory), $dependencies, - ])) + ])), ); } } diff --git a/src/Formatter/GithubActionsFormatter.php b/src/Formatter/GithubActionsFormatter.php index 7ed6151e..cb4c18c7 100644 --- a/src/Formatter/GithubActionsFormatter.php +++ b/src/Formatter/GithubActionsFormatter.php @@ -15,7 +15,7 @@ final class GithubActionsFormatter implements OutputFormatter { public function __construct( private OutputInterface $output, - private CheckedOutRepository $basePath + private CheckedOutRepository $basePath, ) { } @@ -31,7 +31,7 @@ public function write(Changes $changes): void ? null : Str\replace($change->file, $basePath, ''), $change->line, - $change->column + $change->column, ); } } diff --git a/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php b/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php index edc706ec..629d6264 100644 --- a/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php +++ b/src/Formatter/MarkdownPipedToSymfonyConsoleFormatter.php @@ -12,11 +12,8 @@ final class MarkdownPipedToSymfonyConsoleFormatter implements OutputFormatter { - private OutputInterface $output; - - public function __construct(OutputInterface $output) + public function __construct(private OutputInterface $output) { - $this->output = $output; } public function write(Changes $changes): void @@ -29,29 +26,29 @@ public function write(Changes $changes): void static function (Change $change): bool { return $change->isAdded(); }, - ...$arrayOfChanges + ...$arrayOfChanges, ), '') . "\n# Changed\n" . Str\join($this->convertFilteredChangesToMarkdownBulletList( static function (Change $change): bool { return $change->isChanged(); }, - ...$arrayOfChanges + ...$arrayOfChanges, ), '') . "\n# Removed\n" . Str\join($this->convertFilteredChangesToMarkdownBulletList( static function (Change $change): bool { return $change->isRemoved(); }, - ...$arrayOfChanges + ...$arrayOfChanges, ), '') . "\n# Skipped\n" . Str\join($this->convertFilteredChangesToMarkdownBulletList( static function (Change $change): bool { return $change->isSkipped(); }, - ...$arrayOfChanges - ), '') + ...$arrayOfChanges, + ), ''), ); } @@ -66,7 +63,7 @@ private function convertFilteredChangesToMarkdownBulletList(callable $filterFunc Vec\filter($changes, $filterFunction), static function (Change $change): string { return ' - ' . Str\replace_every(Str\trim($change->__toString()), ['ADDED: ' => '', 'CHANGED: ' => '', 'REMOVED: ' => '', 'SKIPPED: ' => '']) . "\n"; - } + }, ); } } diff --git a/src/Formatter/SymbolStartColumn.php b/src/Formatter/SymbolStartColumn.php index 1df86af3..564054c1 100644 --- a/src/Formatter/SymbolStartColumn.php +++ b/src/Formatter/SymbolStartColumn.php @@ -26,7 +26,7 @@ final class SymbolStartColumn * in {@see \Stringable::__toString()}). */ public static function get( - ReflectionFunction|ReflectionMethod|ReflectionProperty|ReflectionClass|ReflectionClassConstant|ReflectionConstant $symbol + ReflectionFunction|ReflectionMethod|ReflectionProperty|ReflectionClass|ReflectionClassConstant|ReflectionConstant $symbol, ): int|null { try { return $symbol->getStartColumn(); diff --git a/src/Formatter/SymfonyConsoleTextFormatter.php b/src/Formatter/SymfonyConsoleTextFormatter.php index 43b7d1ab..b87feab9 100644 --- a/src/Formatter/SymfonyConsoleTextFormatter.php +++ b/src/Formatter/SymfonyConsoleTextFormatter.php @@ -9,11 +9,8 @@ final class SymfonyConsoleTextFormatter implements OutputFormatter { - private OutputInterface $output; - - public function __construct(OutputInterface $output) + public function __construct(private OutputInterface $output) { - $this->output = $output; } public function write(Changes $changes): void diff --git a/src/Git/GetVersionCollectionFromGitRepository.php b/src/Git/GetVersionCollectionFromGitRepository.php index 403b463b..e0b7fdc6 100644 --- a/src/Git/GetVersionCollectionFromGitRepository.php +++ b/src/Git/GetVersionCollectionFromGitRepository.php @@ -22,7 +22,7 @@ public function fromRepository(CheckedOutRepository $repository): VersionCollect { $output = Shell\execute('git', ['tag', '-l'], $repository->__toString()); - return new VersionCollection(...Vec\filter_nulls(Vec\map(Str\split($output, "\n"), static function (string $maybeVersion): ?Version { + return new VersionCollection(...Vec\filter_nulls(Vec\map(Str\split($output, "\n"), static function (string $maybeVersion): Version|null { try { return Type\object(Version::class) ->coerce(Version::fromString($maybeVersion)); diff --git a/src/Git/GitCheckoutRevisionToTemporaryPath.php b/src/Git/GitCheckoutRevisionToTemporaryPath.php index 17e4bc0b..0156ab15 100644 --- a/src/Git/GitCheckoutRevisionToTemporaryPath.php +++ b/src/Git/GitCheckoutRevisionToTemporaryPath.php @@ -16,14 +16,12 @@ final class GitCheckoutRevisionToTemporaryPath implements PerformCheckoutOfRevis private $uniquenessFunction; /** @param (callable(string): string)|null $uniquenessFunction*/ - public function __construct(?callable $uniquenessFunction = null) + public function __construct(callable|null $uniquenessFunction = null) { $this->uniquenessFunction = $uniquenessFunction ?? 'uniqid'; } - /** - * @throws Shell\Exception\RuntimeException - */ + /** @throws Shell\Exception\RuntimeException */ public function checkout(CheckedOutRepository $sourceRepository, Revision $revision): CheckedOutRepository { $checkoutDirectory = $this->generateTemporaryPathFor($revision); @@ -34,17 +32,13 @@ public function checkout(CheckedOutRepository $sourceRepository, Revision $revis return CheckedOutRepository::fromPath($checkoutDirectory); } - /** - * @throws Shell\Exception\RuntimeException - */ + /** @throws Shell\Exception\RuntimeException */ public function remove(CheckedOutRepository $checkedOutRepository): void { Shell\execute('rm', ['-rf', $checkedOutRepository->__toString()]); } - /** - * @throws RuntimeException - */ + /** @throws RuntimeException */ private function generateTemporaryPathFor(Revision $revision): string { $uniquePathGenerator = $this->uniquenessFunction; @@ -54,7 +48,7 @@ private function generateTemporaryPathFor(Revision $revision): string throw new RuntimeException(Str\format( 'Tried to check out revision "%s" to directory "%s" which already exists', $revision->__toString(), - $checkoutDirectory + $checkoutDirectory, )); } diff --git a/src/Git/PickLastMinorVersionFromCollection.php b/src/Git/PickLastMinorVersionFromCollection.php index d4a43a7a..25623cdf 100644 --- a/src/Git/PickLastMinorVersionFromCollection.php +++ b/src/Git/PickLastMinorVersionFromCollection.php @@ -36,8 +36,8 @@ public function assert(Version $version): bool Type\object(OperationConstraint::class) ->coerce(OperationConstraint::greaterOrEqualTo( Type\object(Version::class) - ->coerce(Version::fromString($lastVersion->getMajor() . '.' . $lastVersion->getMinor() . '.0')) - )) + ->coerce(Version::fromString($lastVersion->getMajor() . '.' . $lastVersion->getMinor() . '.0')), + )), )) ->sortedAscending(); diff --git a/src/Git/Revision.php b/src/Git/Revision.php index 20146acb..17904c37 100644 --- a/src/Git/Revision.php +++ b/src/Git/Revision.php @@ -22,7 +22,7 @@ public static function fromSha1(string $sha1): self return new self( Type\non_empty_string() - ->assert(Str\trim_right($sha1)) + ->assert(Str\trim_right($sha1)), ); } diff --git a/src/LocateDependencies/LocateDependenciesViaComposer.php b/src/LocateDependencies/LocateDependenciesViaComposer.php index ec46b974..0fec4ee3 100644 --- a/src/LocateDependencies/LocateDependenciesViaComposer.php +++ b/src/LocateDependencies/LocateDependenciesViaComposer.php @@ -19,21 +19,16 @@ final class LocateDependenciesViaComposer implements LocateDependencies { - private Locator $astLocator; - /** @psalm-var callable(string): Installer $makeComposerInstaller */ private $makeComposerInstaller; - /** - * @psalm-param callable(string): Installer $makeComposerInstaller - */ + /** @psalm-param callable(string): Installer $makeComposerInstaller */ public function __construct( callable $makeComposerInstaller, - Locator $astLocator + private Locator $astLocator, ) { // This is needed because the CWD of composer cannot be changed at runtime, but only at startup $this->makeComposerInstaller = $makeComposerInstaller; - $this->astLocator = $astLocator; } public function __invoke(string $installationPath, bool $includeDevelopmentDependencies): SourceLocator diff --git a/src/LocateSources/LocateSourcesViaComposerJson.php b/src/LocateSources/LocateSourcesViaComposerJson.php index 01e81c04..ddc8e288 100644 --- a/src/LocateSources/LocateSourcesViaComposerJson.php +++ b/src/LocateSources/LocateSourcesViaComposerJson.php @@ -11,11 +11,8 @@ final class LocateSourcesViaComposerJson implements LocateSources { - private Locator $astLocator; - - public function __construct(Locator $astLocator) + public function __construct(private Locator $astLocator) { - $this->astLocator = $astLocator; } public function __invoke(string $installationPath): SourceLocator @@ -24,8 +21,8 @@ public function __invoke(string $installationPath): SourceLocator $installationPath, new ReplaceSourcePathOfLocatedSources( $this->astLocator, - $installationPath - ) + $installationPath, + ), ); } } diff --git a/src/SourceLocator/LocatedSourceWithStrippedSourcesDirectory.php b/src/SourceLocator/LocatedSourceWithStrippedSourcesDirectory.php index d64f2402..0ea6583e 100644 --- a/src/SourceLocator/LocatedSourceWithStrippedSourcesDirectory.php +++ b/src/SourceLocator/LocatedSourceWithStrippedSourcesDirectory.php @@ -15,7 +15,7 @@ final class LocatedSourceWithStrippedSourcesDirectory extends LocatedSource { public function __construct( private LocatedSource $next, - private string $sourcesDirectory + private string $sourcesDirectory, ) { } @@ -24,12 +24,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 { $fileName = $this->next->getFileName(); @@ -45,7 +45,7 @@ public function isInternal(): bool return $this->next->isInternal(); } - public function getExtensionName(): ?string + public function getExtensionName(): string|null { return $this->next->getExtensionName(); } @@ -55,7 +55,7 @@ public function isEvaled(): bool return $this->next->isEvaled(); } - public function getAliasName(): ?string + public function getAliasName(): string|null { return $this->next->getAliasName(); } diff --git a/src/SourceLocator/ReplaceSourcePathOfLocatedSources.php b/src/SourceLocator/ReplaceSourcePathOfLocatedSources.php index 47b8aaff..c5f12788 100644 --- a/src/SourceLocator/ReplaceSourcePathOfLocatedSources.php +++ b/src/SourceLocator/ReplaceSourcePathOfLocatedSources.php @@ -16,7 +16,7 @@ final class ReplaceSourcePathOfLocatedSources extends Locator { public function __construct( private Locator $next, - private string $sourcesDirectory + private string $sourcesDirectory, ) { } @@ -29,7 +29,7 @@ public function findReflection( return $this->next->findReflection( $reflector, new LocatedSourceWithStrippedSourcesDirectory($locatedSource, $this->sourcesDirectory), - $identifier + $identifier, ); } @@ -42,7 +42,7 @@ public function findReflectionsOfType( return $this->next->findReflectionsOfType( $reflector, new LocatedSourceWithStrippedSourcesDirectory($locatedSource, $this->sourcesDirectory), - $identifierType + $identifierType, ); } } diff --git a/src/SourceLocator/StaticClassMapSourceLocator.php b/src/SourceLocator/StaticClassMapSourceLocator.php index 55c77af1..ee5e42df 100644 --- a/src/SourceLocator/StaticClassMapSourceLocator.php +++ b/src/SourceLocator/StaticClassMapSourceLocator.php @@ -25,7 +25,7 @@ final class StaticClassMapSourceLocator extends AbstractSourceLocator */ public function __construct( array $classMap, - Locator $astLocator + Locator $astLocator, ) { parent::__construct($astLocator); @@ -40,7 +40,7 @@ public function __construct( $this->classMap = Type\dict(Type\non_empty_string(), Type\string())->coerce($realPaths); } - protected function createLocatedSource(Identifier $identifier): ?LocatedSource + protected function createLocatedSource(Identifier $identifier): LocatedSource|null { if (! $identifier->isClass()) { return null; diff --git a/test/unit/Assertion.php b/test/unit/Assertion.php index db31681f..7f089b30 100644 --- a/test/unit/Assertion.php +++ b/test/unit/Assertion.php @@ -11,7 +11,7 @@ abstract class Assertion { - private static ?ReflectionProperty $unBufferedChangesReflection = null; + private static ReflectionProperty|null $unBufferedChangesReflection = null; final private function __construct() { @@ -20,11 +20,11 @@ final private function __construct() public static function assertChangesEqual( Changes $expected, Changes $actual, - string $message = '' + string $message = '', ): void { Assert::assertNotNull( self::reflectionUnBufferedChanges()->getValue($actual), - 'Buffer must NOT be exhausted' + 'Buffer must NOT be exhausted', ); // Forces eager initialisation of the `Changes` instances, allowing us to compare them by value Assert::assertCount(Iter\count($expected), $actual); diff --git a/test/unit/ChangeTest.php b/test/unit/ChangeTest.php index b7eb45a1..b5354048 100644 --- a/test/unit/ChangeTest.php +++ b/test/unit/ChangeTest.php @@ -10,9 +10,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\Change - */ +/** @covers \Roave\BackwardCompatibility\Change */ final class ChangeTest extends TestCase { public function testAdded(): void diff --git a/test/unit/ChangesTest.php b/test/unit/ChangesTest.php index 8929a676..d5b76710 100644 --- a/test/unit/ChangesTest.php +++ b/test/unit/ChangesTest.php @@ -16,9 +16,7 @@ use function serialize; use function unserialize; -/** - * @covers \Roave\BackwardCompatibility\Changes - */ +/** @covers \Roave\BackwardCompatibility\Changes */ final class ChangesTest extends TestCase { public function testMergeWith(): void @@ -34,16 +32,16 @@ public function testMergeWith(): void Assertion::assertChangesEqual( Changes::fromList( Change::changed('a', true), - Change::removed('b', false) + Change::removed('b', false), ), - $changes1->mergeWith($changes2) + $changes1->mergeWith($changes2), ); Assertion::assertChangesEqual( Changes::fromList( Change::removed('b', false), - Change::changed('a', true) + Change::changed('a', true), ), - $changes2->mergeWith($changes1) + $changes2->mergeWith($changes1), ); self::assertEquals($frozen1, $changes1, 'Original Changes instance not mutated'); @@ -84,7 +82,7 @@ public function testFromIteratorBuffersAllChangesWithoutLoadingThemEagerly(): vo self::assertEquals( $expectedChanges, iterator_to_array($changes), - 'Changes can be iterated upon more than once (they are buffered)' + 'Changes can be iterated upon more than once (they are buffered)', ); self::assertCount(2, $changes); } @@ -107,7 +105,7 @@ public function testFromList(): void self::assertSame( [$change], - iterator_to_array(Changes::fromList($change)) + iterator_to_array(Changes::fromList($change)), ); } @@ -117,7 +115,7 @@ public function testCount(): void self::assertCount( $count, - Changes::fromList(...array_fill(0, $count, Change::added('foo', true))) + Changes::fromList(...array_fill(0, $count, Change::added('foo', true))), ); } } diff --git a/test/unit/Command/AssertBackwardsCompatibleTest.php b/test/unit/Command/AssertBackwardsCompatibleTest.php index bfb221fb..d5a0d5ed 100644 --- a/test/unit/Command/AssertBackwardsCompatibleTest.php +++ b/test/unit/Command/AssertBackwardsCompatibleTest.php @@ -36,9 +36,7 @@ use function assert; use function is_string; -/** - * @covers \Roave\BackwardCompatibility\Command\AssertBackwardsCompatible - */ +/** @covers \Roave\BackwardCompatibility\Command\AssertBackwardsCompatible */ final class AssertBackwardsCompatibleTest extends TestCase { private CheckedOutRepository $sourceRepository; @@ -89,7 +87,7 @@ public function setUp(): void $this->getVersions, $this->pickVersion, $this->locateDependencies, - $this->compareApi + $this->compareApi, ); $this @@ -102,7 +100,7 @@ public function testDefinition(): void { self::assertSame( 'roave-backwards-compatibility-check:assert-backwards-compatible', - $this->compare->getName() + $this->compare->getName(), ); $usages = Type\shape([ @@ -112,7 +110,7 @@ public function testDefinition(): void self::assertCount(1, $usages); self::assertStringStartsWith( 'roave-backwards-compatibility-check:assert-backwards-compatible', - $usages[0] + $usages[0], ); self::assertStringContainsString('Without arguments, this command will attempt to detect', $usages[0]); self::assertStringStartsWith('Verifies that the revision being', $this->compare->getDescription()); @@ -121,7 +119,7 @@ public function testDefinition(): void '[--from [FROM]] [--to TO] [--format [FORMAT]] [--install-development-dependencies]', $this->compare ->getDefinition() - ->getSynopsis() + ->getSynopsis(), ); } @@ -143,27 +141,27 @@ public function testExecuteWhenRevisionsAreProvidedAsOptions(): void ->method('checkout') ->withConsecutive( [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha] + [$this->sourceRepository, $toSha], )->willReturnOnConsecutiveCalls( $this->sourceRepository, - $this->sourceRepository + $this->sourceRepository, ); $this->performCheckout->expects(self::exactly(2)) ->method('remove') ->withConsecutive( [$this->sourceRepository], - [$this->sourceRepository] + [$this->sourceRepository], ); $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') ->withConsecutive( [$fromSha], - [$toSha] + [$toSha], )->willReturnOnConsecutiveCalls( Revision::fromSha1($fromSha), - Revision::fromSha1($toSha) + Revision::fromSha1($toSha), ); $this @@ -195,27 +193,27 @@ public function testExecuteWhenDevelopmentDependenciesAreRequested(): void ->method('checkout') ->withConsecutive( [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha] + [$this->sourceRepository, $toSha], )->willReturnOnConsecutiveCalls( $this->sourceRepository, - $this->sourceRepository + $this->sourceRepository, ); $this->performCheckout->expects(self::exactly(2)) ->method('remove') ->withConsecutive( [$this->sourceRepository], - [$this->sourceRepository] + [$this->sourceRepository], ); $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') ->withConsecutive( [$fromSha], - [$toSha] + [$toSha], )->willReturnOnConsecutiveCalls( Revision::fromSha1($fromSha), - Revision::fromSha1($toSha) + Revision::fromSha1($toSha), ); $this @@ -248,27 +246,27 @@ public function testExecuteReturnsNonZeroExitCodeWhenChangesAreDetected(): void ->method('checkout') ->withConsecutive( [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha] + [$this->sourceRepository, $toSha], )->willReturnOnConsecutiveCalls( $this->sourceRepository, - $this->sourceRepository + $this->sourceRepository, ); $this->performCheckout->expects(self::exactly(2)) ->method('remove') ->withConsecutive( [$this->sourceRepository], - [$this->sourceRepository] + [$this->sourceRepository], ); $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') ->withConsecutive( [$fromSha], - [$toSha] + [$toSha], )->willReturnOnConsecutiveCalls( Revision::fromSha1($fromSha), - Revision::fromSha1($toSha) + Revision::fromSha1($toSha), ); $this @@ -278,7 +276,7 @@ public function testExecuteReturnsNonZeroExitCodeWhenChangesAreDetected(): void ->willReturn($this->dependencies); $this->compareApi->expects(self::once())->method('__invoke')->willReturn(Changes::fromList( - Change::added('added' . SecureRandom\string(8), true) + Change::added('added' . SecureRandom\string(8), true), )); $this @@ -288,7 +286,7 @@ public function testExecuteReturnsNonZeroExitCodeWhenChangesAreDetected(): void ->with(self::logicalOr( self::matches('Comparing from %a to %a...'), self::matches('[BC] ADDED: added%a'), - self::matches('1 backwards-incompatible changes detected') + self::matches('1 backwards-incompatible changes detected'), )); self::assertSame(3, $this->compare->execute($this->input, $this->output)); @@ -316,24 +314,24 @@ public function testProvidingMarkdownOptionWritesMarkdownOutput(): void [$this->sourceRepository, $toSha], )->willReturnOnConsecutiveCalls( $this->sourceRepository, - $this->sourceRepository + $this->sourceRepository, ); $this->performCheckout->expects(self::exactly(2)) ->method('remove') ->withConsecutive( [$this->sourceRepository], - [$this->sourceRepository] + [$this->sourceRepository], ); $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') ->withConsecutive( [$fromSha], - [$toSha] + [$toSha], )->willReturnOnConsecutiveCalls( Revision::fromSha1($fromSha), - Revision::fromSha1($toSha) + Revision::fromSha1($toSha), ); $this @@ -344,7 +342,7 @@ public function testProvidingMarkdownOptionWritesMarkdownOutput(): void $changeToExpect = SecureRandom\string(8); $this->compareApi->expects(self::once())->method('__invoke')->willReturn(Changes::fromList( - Change::removed($changeToExpect, true) + Change::removed($changeToExpect, true), )); $this->output @@ -395,9 +393,7 @@ public function testExecuteWithDefaultRevisionsNotProvidedAndNoDetectedTags(): v $this->compare->execute($this->input, $this->output); } - /** - * @dataProvider validVersionCollections - */ + /** @dataProvider validVersionCollections */ public function testExecuteWithDefaultRevisionsNotProvided(VersionCollection $versions): void { $fromSha = Hash\Context::forAlgorithm('sha1')->update('fromRevision')->finalize(); @@ -417,27 +413,27 @@ public function testExecuteWithDefaultRevisionsNotProvided(VersionCollection $ve ->method('checkout') ->withConsecutive( [$this->sourceRepository, $fromSha], - [$this->sourceRepository, $toSha] + [$this->sourceRepository, $toSha], )->willReturnOnConsecutiveCalls( $this->sourceRepository, - $this->sourceRepository + $this->sourceRepository, ); $this->performCheckout->expects(self::exactly(2)) ->method('remove') ->withConsecutive( [$this->sourceRepository], - [$this->sourceRepository] + [$this->sourceRepository], ); $this->parseRevision->expects(self::exactly(2)) ->method('fromStringForRepository') ->withConsecutive( [(string) $pickedVersion], - ['HEAD'] + ['HEAD'], )->willReturnOnConsecutiveCalls( Revision::fromSha1($fromSha), - Revision::fromSha1($toSha) + Revision::fromSha1($toSha), ); $this->getVersions->expects(self::once()) @@ -460,7 +456,7 @@ public function testExecuteWithDefaultRevisionsNotProvided(VersionCollection $ve ->with(self::logicalOr( 'Detected last minor version: 1.0.0', self::matches('Comparing from %a to %a...'), - self::matches('No backwards-incompatible changes detected') + self::matches('No backwards-incompatible changes detected'), )); $this->compareApi->expects(self::once())->method('__invoke')->willReturn(Changes::empty()); diff --git a/test/unit/CompareClassesTest.php b/test/unit/CompareClassesTest.php index 03dd5aae..aa1c57ab 100644 --- a/test/unit/CompareClassesTest.php +++ b/test/unit/CompareClassesTest.php @@ -13,9 +13,7 @@ use Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\InterfaceBased; use Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\TraitBased; -/** - * @covers \Roave\BackwardCompatibility\CompareClasses - */ +/** @covers \Roave\BackwardCompatibility\CompareClasses */ final class CompareClassesTest extends TestCase { private static StringReflectorFactory $stringReflectorFactory; @@ -46,7 +44,7 @@ protected function setUp(): void $this->compareClasses = new CompareClasses( $this->classBasedComparison, $this->interfaceBasedComparison, - $this->traitBasedComparison + $this->traitBasedComparison, ); } @@ -69,7 +67,7 @@ class A { public $aProperty; public function aMethod() {} } -PHP +PHP, ), (self::$stringReflectorFactory)( <<<'PHP' @@ -80,9 +78,9 @@ class A { public $aProperty; public function aMethod() {} } -PHP - ) - ) +PHP, + ), + ), ); } @@ -105,16 +103,16 @@ class A { public $aProperty; public function aMethod() {} } -PHP +PHP, ), (self::$stringReflectorFactory)( <<<'PHP' compareClasses)( (self::$stringReflectorFactory)('compareClasses)( (self::$stringReflectorFactory)('compareClasses)( (self::$stringReflectorFactory)('compareClasses)( (self::$stringReflectorFactory)('compareClasses)( (self::$stringReflectorFactory)('__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -75,7 +73,7 @@ class ClassWithRemovedVeryIndirectInterface implements ID {} class ClassWithInvertedInterfaceNames implements IE, IG {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -103,7 +101,7 @@ class ClassWithRemovedVeryIndirectInterface implements ID {} class ClassWithInvertedInterfaceNames implements IG, IE {} PHP , - $locator + $locator, )); $classes = [ @@ -138,8 +136,8 @@ class ClassWithInvertedInterfaceNames implements IG, IE {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php index 6bc700ac..e411b72e 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameAbstractTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\ClassBecameAbstract - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\ClassBecameAbstract */ final class ClassBecameAbstractTest extends TestCase { /** @@ -30,7 +28,7 @@ final class ClassBecameAbstractTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ClassBecameAbstract())($fromClass, $toClass); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -64,7 +62,7 @@ interface InterfaceToAbstract {} abstract class AbstractToInterface {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -81,7 +79,7 @@ abstract class InterfaceToAbstract {} interface AbstractToInterface {} PHP , - $locator + $locator, )); $classes = [ @@ -105,8 +103,8 @@ interface AbstractToInterface {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php index 2f8b09a3..eef01122 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameFinalTest.php @@ -25,7 +25,7 @@ final class ClassBecameFinalTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ClassBecameFinal())($fromClass, $toClass); @@ -33,7 +33,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -54,7 +54,7 @@ class C {} final class D {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -66,7 +66,7 @@ class C {} final class D {} PHP , - $locator + $locator, )); return [ diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php index 9635d4cc..eb06a61f 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInterfaceTest.php @@ -27,7 +27,7 @@ final class ClassBecameInterfaceTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ClassBecameInterface())($fromClass, $toClass); @@ -35,7 +35,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -64,7 +64,7 @@ trait TraitToClass {} trait TraitToTrait {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -84,7 +84,7 @@ class TraitToClass {} trait TraitToTrait {} PHP , - $locator + $locator, )); $classes = [ @@ -111,8 +111,8 @@ trait TraitToTrait {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php index cf50cb2a..eedbf069 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameInternalTest.php @@ -26,7 +26,7 @@ final class ClassBecameInternalTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ClassBecameInternal())($fromClass, $toClass); @@ -34,7 +34,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -57,7 +57,7 @@ class C {} class D {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -71,7 +71,7 @@ class C {} class D {} PHP , - $locator + $locator, )); return [ diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php index ad5868ba..e7b78032 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ClassBecameTraitTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\ClassBecameTrait - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\ClassBecameTrait */ final class ClassBecameTraitTest extends TestCase { /** @@ -30,7 +28,7 @@ final class ClassBecameTraitTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ClassBecameTrait())($fromClass, $toClass); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -67,7 +65,7 @@ trait TraitToClass {} trait TraitToTrait {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -87,7 +85,7 @@ class TraitToClass {} trait TraitToTrait {} PHP , - $locator + $locator, )); $classes = [ @@ -114,8 +112,8 @@ trait TraitToTrait {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ConstantChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ConstantChangedTest.php index 8bd3c6b9..a362a41c 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ConstantChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ConstantChangedTest.php @@ -15,9 +15,7 @@ use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\ConstantChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\ConstantChanged */ final class ConstantChangedTest extends TestCase { public function testWillDetectChangesInConstants(): void @@ -37,7 +35,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -53,7 +51,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $comparator = $this->createMock(ClassConstantBased::class); @@ -72,12 +70,12 @@ class TheClass { Assertion::assertChangesEqual( Changes::fromList( Change::added('b', true), - Change::added('d', true) + Change::added('d', true), ), (new ConstantChanged($comparator))( (new DefaultReflector($fromLocator))->reflectClass('TheClass'), - (new DefaultReflector($toLocator))->reflectClass('TheClass') - ) + (new DefaultReflector($toLocator))->reflectClass('TheClass'), + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php index 2c5fb4ec..1ffaf8a2 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ConstantRemovedTest.php @@ -25,7 +25,7 @@ final class ConstantRemovedTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ConstantRemoved())($fromClass, $toClass); @@ -33,7 +33,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -49,11 +49,11 @@ public function classesToBeTested(): array 'RoaveTestAsset\\ClassWithConstantsBeingRemoved' => [ (new DefaultReflector(new SingleFileSourceLocator( __DIR__ . '/../../../../asset/api/old/ClassWithConstantsBeingRemoved.php', - $locator + $locator, )))->reflectClass('RoaveTestAsset\\ClassWithConstantsBeingRemoved'), (new DefaultReflector(new SingleFileSourceLocator( __DIR__ . '/../../../../asset/api/new/ClassWithConstantsBeingRemoved.php', - $locator + $locator, )))->reflectClass('RoaveTestAsset\\ClassWithConstantsBeingRemoved'), [ '[BC] REMOVED: Constant RoaveTestAsset\ClassWithConstantsBeingRemoved::removedPublicConstant was removed', diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClassesTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClassesTest.php index d98f76fa..52df018b 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClassesTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeAnonymousClassesTest.php @@ -27,7 +27,7 @@ public function testNormalClassesAreNotExcluded(): void class ANormalClass {} PHP , - $locator + $locator, )); $fromReflection = $reflector->reflectClass('ANormalClass'); $toReflection = $reflector->reflectClass('ANormalClass'); @@ -51,7 +51,7 @@ public function testAnonymousClassesAreExcluded(): void $anonClass = new class {}; PHP , - $locator + $locator, )); $allClasses = $reflector->reflectAllClasses(); $anonymousClassReflection = reset($allClasses); diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeInternalClassTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeInternalClassTest.php index da994b63..3097aeeb 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeInternalClassTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/ExcludeInternalClassTest.php @@ -26,7 +26,7 @@ public function testNormalClassesAreNotExcluded(): void class ANormalClass {} PHP , - $locator + $locator, )); $fromReflection = $reflector->reflectClass('ANormalClass'); $toReflection = $reflector->reflectClass('ANormalClass'); @@ -39,7 +39,7 @@ class ANormalClass {} self::assertEquals( Changes::fromList(Change::removed('foo', true)), - (new ExcludeInternalClass($check))($fromReflection, $toReflection) + (new ExcludeInternalClass($check))($fromReflection, $toReflection), ); } @@ -54,7 +54,7 @@ public function testInternalClassesAreExcluded(): void class AnInternalClass {} PHP , - $locator + $locator, )); $reflection = $reflector->reflectClass('AnInternalClass'); @@ -63,7 +63,7 @@ class AnInternalClass {} self::assertEquals( Changes::empty(), - (new ExcludeInternalClass($check))($reflection, $reflection) + (new ExcludeInternalClass($check))($reflection, $reflection), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/FinalClassChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/FinalClassChangedTest.php index 897008f5..c5d0e1e4 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/FinalClassChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/FinalClassChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\FinalClassChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\FinalClassChanged */ final class FinalClassChangedTest extends TestCase { /** @var ClassBased&MockObject */ diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/MethodChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/MethodChangedTest.php index 0fb3f4be..fec8124a 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/MethodChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/MethodChangedTest.php @@ -17,9 +17,7 @@ use function strtolower; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\MethodChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\MethodChanged */ final class MethodChangedTest extends TestCase { public function testWillDetectChangesInMethods(): void @@ -39,7 +37,7 @@ public function G() {} } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -55,7 +53,7 @@ public function g() {} } PHP , - $astLocator + $astLocator, ); $comparator = $this->createMock(MethodBased::class); @@ -75,12 +73,12 @@ public function g() {} Changes::fromList( Change::added('b', true), Change::added('d', true), - Change::added('G', true) + Change::added('G', true), ), (new MethodChanged($comparator))( (new DefaultReflector($fromLocator))->reflectClass('TheClass'), - (new DefaultReflector($toLocator))->reflectClass('TheClass') - ) + (new DefaultReflector($toLocator))->reflectClass('TheClass'), + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php index a841bdbb..aca411c1 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/MethodRemovedTest.php @@ -25,7 +25,7 @@ final class MethodRemovedTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new MethodRemoved())($fromClass, $toClass); @@ -33,7 +33,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -49,11 +49,11 @@ public function classesToBeTested(): array 'RoaveTestAsset\\ClassWithMethodsBeingRemoved' => [ (new DefaultReflector(new SingleFileSourceLocator( __DIR__ . '/../../../../asset/api/old/ClassWithMethodsBeingRemoved.php', - $locator + $locator, )))->reflectClass('RoaveTestAsset\\ClassWithMethodsBeingRemoved'), (new DefaultReflector(new SingleFileSourceLocator( __DIR__ . '/../../../../asset/api/new/ClassWithMethodsBeingRemoved.php', - $locator + $locator, )))->reflectClass('RoaveTestAsset\\ClassWithMethodsBeingRemoved'), [ '[BC] REMOVED: Method RoaveTestAsset\ClassWithMethodsBeingRemoved#removedPublicMethod() was removed', diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/MultipleChecksOnAClassTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/MultipleChecksOnAClassTest.php index 3d45de16..ffc7084c 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/MultipleChecksOnAClassTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/MultipleChecksOnAClassTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\Reflection\ReflectionClass; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\MultipleChecksOnAClass - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\MultipleChecksOnAClass */ final class MultipleChecksOnAClassTest extends TestCase { public function testChecksAllGivenCheckers(): void @@ -68,7 +66,7 @@ public function testChecksAllGivenCheckers(): void ->onLine(10) ->onColumn(5), ), - $multiCheck($from, $to) + $multiCheck($from, $to), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/OpenClassChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/OpenClassChangedTest.php index 230fb632..87c68e09 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/OpenClassChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/OpenClassChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\OpenClassChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\OpenClassChanged */ final class OpenClassChangedTest extends TestCase { /** @var ClassBased&MockObject */ diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/PropertyChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/PropertyChangedTest.php index 17bb37c5..ff976cc2 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/PropertyChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/PropertyChangedTest.php @@ -15,9 +15,7 @@ use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\PropertyChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\PropertyChanged */ final class PropertyChangedTest extends TestCase { public function testWillDetectChangesInProperties(): void @@ -37,7 +35,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -53,7 +51,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $comparator = $this->createMock(PropertyBased::class); @@ -72,12 +70,12 @@ class TheClass { Assertion::assertChangesEqual( Changes::fromList( Change::added('b', true), - Change::added('d', true) + Change::added('d', true), ), (new PropertyChanged($comparator))( (new DefaultReflector($fromLocator))->reflectClass('TheClass'), - (new DefaultReflector($toLocator))->reflectClass('TheClass') - ) + (new DefaultReflector($toLocator))->reflectClass('TheClass'), + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php index 7e8e934d..447047b8 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/PropertyRemovedTest.php @@ -26,7 +26,7 @@ final class PropertyRemovedTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new PropertyRemoved())($fromClass, $toClass); @@ -34,7 +34,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -50,11 +50,11 @@ public function classesToBeTested(): array 'RoaveTestAsset\\ClassWithPropertiesBeingRemoved' => [ (new DefaultReflector(new SingleFileSourceLocator( __DIR__ . '/../../../../asset/api/old/ClassWithPropertiesBeingRemoved.php', - $locator + $locator, )))->reflectClass('RoaveTestAsset\\ClassWithPropertiesBeingRemoved'), (new DefaultReflector(new SingleFileSourceLocator( __DIR__ . '/../../../../asset/api/new/ClassWithPropertiesBeingRemoved.php', - $locator + $locator, )))->reflectClass('RoaveTestAsset\\ClassWithPropertiesBeingRemoved'), [ '[BC] REMOVED: Property RoaveTestAsset\ClassWithPropertiesBeingRemoved#$removedPublicProperty was removed', @@ -78,7 +78,7 @@ final class FinalClass } PHP , - $locator + $locator, )))->reflectClass('FinalClass'), (new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -91,7 +91,7 @@ final class FinalClass } PHP , - $locator + $locator, )))->reflectClass('FinalClass'), [ '[BC] REMOVED: Property FinalClass#$decreasedVisibilityPublicProperty was removed', @@ -113,7 +113,7 @@ class TestClass } PHP , - $locator + $locator, )))->reflectClass('TestClass'), (new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -124,7 +124,7 @@ class TestClass } PHP , - $locator + $locator, )))->reflectClass('TestClass'), ['[BC] REMOVED: Property TestClass#$testProperty was removed'], ], @@ -143,7 +143,7 @@ class TestClass } PHP , - $locator + $locator, )))->reflectClass('TestClass'), (new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -159,7 +159,7 @@ class TestClass } PHP , - $locator + $locator, )))->reflectClass('TestClass'), ['[BC] REMOVED: Property TestClass#$testProperty was removed'], ], diff --git a/test/unit/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrorsTest.php b/test/unit/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrorsTest.php index 3351fcb4..dfeb4854 100644 --- a/test/unit/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrorsTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassBased/SkipClassBasedErrorsTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\SkipClassBasedErrors - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassBased\SkipClassBasedErrors */ final class SkipClassBasedErrorsTest extends TestCase { /** @var ClassBased&MockObject */ @@ -37,7 +35,7 @@ public function testWillForwardChecks(): void $toClass = $this->createMock(ReflectionClass::class); $expectedChanges = Changes::fromList(Change::added( uniqid('foo', true), - true + true, )); $this @@ -65,7 +63,7 @@ public function testWillCollectFailures(): void self::assertEquals( Changes::fromList(Change::skippedDueToFailure($exception)), - ($this->check)($fromClass, $toClass) + ($this->check)($fromClass, $toClass), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php index 601c2c9c..edbfb634 100644 --- a/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassConstantBased/ClassConstantValueChangedTest.php @@ -18,9 +18,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\ClassConstantValueChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\ClassConstantValueChanged */ final class ClassConstantValueChangedTest extends TestCase { /** @@ -31,7 +29,7 @@ final class ClassConstantValueChangedTest extends TestCase public function testDiffs( ReflectionClassConstant $fromConstant, ReflectionClassConstant $toConstant, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ClassConstantValueChanged())($fromConstant, $toConstant); @@ -39,7 +37,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -76,7 +74,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -101,7 +99,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -135,8 +133,8 @@ class TheClass { $errorMessages, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassConstantBased/MultipleChecksOnAClassConstantTest.php b/test/unit/DetectChanges/BCBreak/ClassConstantBased/MultipleChecksOnAClassConstantTest.php index 3a1db744..5487bacd 100644 --- a/test/unit/DetectChanges/BCBreak/ClassConstantBased/MultipleChecksOnAClassConstantTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassConstantBased/MultipleChecksOnAClassConstantTest.php @@ -13,9 +13,7 @@ use Roave\BetterReflection\Reflection\ReflectionClassConstant; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\MultipleChecksOnAClassConstant - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\MultipleChecksOnAClassConstant */ final class MultipleChecksOnAClassConstantTest extends TestCase { public function testChecksAllGivenCheckers(): void @@ -72,7 +70,7 @@ public function testChecksAllGivenCheckers(): void ->onLine(10) ->onColumn(5), ), - $multiCheck($from, $to) + $multiCheck($from, $to), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChangedTest.php index c3a76145..a9b0a6bd 100644 --- a/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyProtectedClassConstantChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\OnlyProtectedClassConstantChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\OnlyProtectedClassConstantChanged */ final class OnlyProtectedClassConstantChangedTest extends TestCase { /** @var ClassConstantBased&MockObject */ @@ -54,7 +52,7 @@ public function testSkipsNonProtectedConstant(): void self::assertEquals( Changes::empty(), - ($this->changed)($this->fromConstant, $this->toConstant) + ($this->changed)($this->fromConstant, $this->toConstant), ); } @@ -76,7 +74,7 @@ public function testChecksProtectedConstant(): void self::assertEquals( $changes, - ($this->changed)($this->fromConstant, $this->toConstant) + ($this->changed)($this->fromConstant, $this->toConstant), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChangedTest.php b/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChangedTest.php index 8fa96da5..09f8c7a2 100644 --- a/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassConstantBased/OnlyPublicClassConstantChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\OnlyPublicClassConstantChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\OnlyPublicClassConstantChanged */ final class OnlyPublicClassConstantChangedTest extends TestCase { /** @var ClassConstantBased&MockObject */ @@ -54,7 +52,7 @@ public function testSkipsNonPublicConstant(): void self::assertEquals( Changes::empty(), - ($this->changed)($this->fromConstant, $this->toConstant) + ($this->changed)($this->fromConstant, $this->toConstant), ); } @@ -76,7 +74,7 @@ public function testChecksPublicConstant(): void self::assertEquals( $changes, - ($this->changed)($this->fromConstant, $this->toConstant) + ($this->changed)($this->fromConstant, $this->toConstant), ); } } diff --git a/test/unit/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrorsTest.php b/test/unit/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrorsTest.php index 4155effd..136ac975 100644 --- a/test/unit/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrorsTest.php +++ b/test/unit/DetectChanges/BCBreak/ClassConstantBased/SkipClassConstantBasedErrorsTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\SkipClassConstantBasedErrors - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\ClassConstantBased\SkipClassConstantBasedErrors */ final class SkipClassConstantBasedErrorsTest extends TestCase { /** @var ClassConstantBased&MockObject */ @@ -37,7 +35,7 @@ public function testWillForwardChecks(): void $toConstant = $this->createMock(ReflectionClassConstant::class); $expectedChanges = Changes::fromList(Change::added( uniqid('foo', true), - true + true, )); $this @@ -65,7 +63,7 @@ public function testWillCollectFailures(): void self::assertEquals( Changes::fromList(Change::skippedDueToFailure($exception)), - ($this->check)($fromConstant, $toConstant) + ($this->check)($fromConstant, $toConstant), ); } } diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunctionTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunctionTest.php index 6844a66f..1977ab01 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunctionTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunctionTest.php @@ -25,7 +25,7 @@ public function testNormalFunctionsAreNotExcluded(): void function a() {} PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ); $function = (new DefaultReflector($source)) ->reflectFunction('a'); @@ -38,7 +38,7 @@ function a() {} self::assertEquals( Changes::fromList(Change::removed('foo', true)), - (new ExcludeInternalFunction($check))($function, $function) + (new ExcludeInternalFunction($check))($function, $function), ); } @@ -52,7 +52,7 @@ public function testInternalFunctionsAreExcluded(): void function a() {} PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ); $function = (new DefaultReflector($source)) ->reflectFunction('a'); @@ -63,7 +63,7 @@ function a() {} self::assertEquals( Changes::empty(), - (new ExcludeInternalFunction($check))($function, $function) + (new ExcludeInternalFunction($check))($function, $function), ); } } diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php index 0f66d491..c203619c 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternalTest.php @@ -29,7 +29,7 @@ final class FunctionBecameInternalTest extends TestCase public function testDiffs( ReflectionMethod|ReflectionFunction $fromFunction, ReflectionMethod|ReflectionFunction $toFunction, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new FunctionBecameInternal())($fromFunction, $toFunction); @@ -37,7 +37,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -64,7 +64,7 @@ function c() {} function d() {} PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -79,7 +79,7 @@ function c() {} function d() {} PHP , - $astLocator + $astLocator, ); $fromReflector = new DefaultReflector($fromLocator); @@ -101,8 +101,8 @@ function d() {} $errors, ], array_keys($functions), - $functions - ) + $functions, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunctionTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunctionTest.php index 5e114575..cf216a22 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunctionTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/MultipleChecksOnAFunctionTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\Reflection\ReflectionFunction; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\MultipleChecksOnAFunction - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\MultipleChecksOnAFunction */ final class MultipleChecksOnAFunctionTest extends TestCase { public function testChecksAllGivenCheckers(): void @@ -68,7 +66,7 @@ public function testChecksAllGivenCheckers(): void ->onLine(10) ->onColumn(5), ), - $multiCheck($from, $to) + $multiCheck($from, $to), ); } } diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php index 10032357..40a4be23 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/ParameterNameChangedTest.php @@ -18,9 +18,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\ParameterNameChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\ParameterNameChanged */ final class ParameterNameChangedTest extends TestCase { /** @@ -31,7 +29,7 @@ final class ParameterNameChangedTest extends TestCase public function testDiffs( ReflectionMethod|ReflectionFunction $fromFunction, ReflectionMethod|ReflectionFunction $toFunction, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new ParameterNameChanged()) ->__invoke($fromFunction, $toFunction); @@ -40,7 +38,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -70,7 +68,7 @@ function addedArgumentsShouldNotBeDetected($a, $b) {} function removedArgumentsShouldNotBeDetected($a, $b, $c) {} PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -88,7 +86,7 @@ function addedArgumentsShouldNotBeDetected($a, $b, $c) {} function removedArgumentsShouldNotBeDetected($a, $b) {} PHP , - $astLocator + $astLocator, ); $fromReflector = new DefaultReflector($fromLocator); @@ -116,8 +114,8 @@ function removedArgumentsShouldNotBeDetected($a, $b) {} $errorMessages, ], array_keys($functions), - $functions - ) + $functions, + ), ); } @@ -135,7 +133,7 @@ public function theMethod(int $a) {} } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -148,7 +146,7 @@ public function theMethod(int $b) {} } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); diff --git a/test/unit/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrorsTest.php b/test/unit/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrorsTest.php index b5ff7c13..0c0fcaf4 100644 --- a/test/unit/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrorsTest.php +++ b/test/unit/DetectChanges/BCBreak/FunctionBased/SkipFunctionBasedErrorsTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\SkipFunctionBasedErrors - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\FunctionBased\SkipFunctionBasedErrors */ final class SkipFunctionBasedErrorsTest extends TestCase { /** @var FunctionBased&MockObject */ @@ -37,7 +35,7 @@ public function testWillForwardChecks(): void $toFunction = $this->createMock(ReflectionFunction::class); $expectedChanges = Changes::fromList(Change::added( uniqid('foo', true), - true + true, )); $this @@ -65,7 +63,7 @@ public function testWillCollectFailures(): void self::assertEquals( Changes::fromList(Change::skippedDueToFailure($exception)), - ($this->check)($fromFunction, $toFunction) + ($this->check)($fromFunction, $toFunction), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php index b03a4401..7e4326ca 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/AncestorRemovedTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\AncestorRemoved - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\AncestorRemoved */ final class AncestorRemovedTest extends TestCase { /** @@ -30,7 +28,7 @@ final class AncestorRemovedTest extends TestCase public function testDiffs( ReflectionClass $fromInterface, ReflectionClass $toInterace, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new AncestorRemoved())($fromInterface, $toInterace); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -64,7 +62,7 @@ interface ParentInterfaceVeryIndirectlyRemoved extends IC {} interface ParentInterfaceOrderSwapped extends IA, ID {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -81,7 +79,7 @@ interface ParentInterfaceVeryIndirectlyRemoved extends IC {} interface ParentInterfaceOrderSwapped extends ID, IA {} PHP , - $locator + $locator, )); $interfaces = [ @@ -104,8 +102,8 @@ interface ParentInterfaceOrderSwapped extends ID, IA {} $errors, ], array_keys($interfaces), - $interfaces - ) + $interfaces, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterfaceTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterfaceTest.php index a01058a3..cf1d8b56 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterfaceTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterfaceTest.php @@ -26,7 +26,7 @@ public function testNormalInterfacesAreNotExcluded(): void interface ANormalInterface {} PHP , - $locator + $locator, )); $reflection = $reflector->reflectClass('ANormalInterface'); @@ -38,7 +38,7 @@ interface ANormalInterface {} self::assertEquals( Changes::fromList(Change::removed('foo', true)), - (new ExcludeInternalInterface($check))($reflection, $reflection) + (new ExcludeInternalInterface($check))($reflection, $reflection), ); } @@ -53,7 +53,7 @@ public function testInternalInterfacesAreExcluded(): void interface AnInternalInterface {} PHP , - $locator + $locator, )); $reflection = $reflector->reflectClass('AnInternalInterface'); @@ -62,7 +62,7 @@ interface AnInternalInterface {} self::assertEquals( Changes::empty(), - (new ExcludeInternalInterface($check))($reflection, $reflection) + (new ExcludeInternalInterface($check))($reflection, $reflection), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php index 71202467..9067174d 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameClassTest.php @@ -27,7 +27,7 @@ final class InterfaceBecameClassTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new InterfaceBecameClass())($fromClass, $toClass); @@ -35,7 +35,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -64,7 +64,7 @@ trait TraitToInterface {} trait TraitToTrait {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -84,7 +84,7 @@ interface TraitToInterface {} trait TraitToTrait {} PHP , - $locator + $locator, )); $classes = [ @@ -111,8 +111,8 @@ trait TraitToTrait {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php index ce9fc26e..2f7d1366 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/InterfaceBecameTraitTest.php @@ -27,7 +27,7 @@ final class InterfaceBecameTraitTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new InterfaceBecameTrait())($fromClass, $toClass); @@ -35,7 +35,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -64,7 +64,7 @@ trait TraitToInterface {} trait TraitToTrait {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -84,7 +84,7 @@ interface TraitToInterface {} trait TraitToTrait {} PHP , - $locator + $locator, )); $classes = [ @@ -111,8 +111,8 @@ trait TraitToTrait {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php index f686aba5..92213a57 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/MethodAddedTest.php @@ -27,7 +27,7 @@ final class MethodAddedTest extends TestCase public function testDiffs( ReflectionClass $fromInterface, ReflectionClass $toInterface, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new MethodAdded())($fromInterface, $toInterface); @@ -35,7 +35,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -68,7 +68,7 @@ public function c() {} } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -97,7 +97,7 @@ public function c() {} } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -125,8 +125,8 @@ public function c() {} $errors, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/MultipleChecksOnAnInterfaceTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/MultipleChecksOnAnInterfaceTest.php index 5c6effb2..ce62b1a4 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/MultipleChecksOnAnInterfaceTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/MultipleChecksOnAnInterfaceTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\Reflection\ReflectionClass; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\MultipleChecksOnAnInterface - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\MultipleChecksOnAnInterface */ final class MultipleChecksOnAnInterfaceTest extends TestCase { public function testChecksAllGivenCheckers(): void @@ -68,7 +66,7 @@ public function testChecksAllGivenCheckers(): void ->onLine(10) ->onColumn(5), ), - $multiCheck($from, $to) + $multiCheck($from, $to), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrorsTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrorsTest.php index d24ed300..46546545 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrorsTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/SkipInterfaceBasedErrorsTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\SkipInterfaceBasedErrors - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\SkipInterfaceBasedErrors */ final class SkipInterfaceBasedErrorsTest extends TestCase { /** @var InterfaceBased&MockObject */ @@ -37,7 +35,7 @@ public function testWillForwardChecks(): void $toInterface = $this->createMock(ReflectionClass::class); $expectedChanges = Changes::fromList(Change::added( uniqid('foo', true), - true + true, )); $this @@ -65,7 +63,7 @@ public function testWillCollectFailures(): void self::assertEquals( Changes::fromList(Change::skippedDueToFailure($exception)), - ($this->check)($fromInterface, $toInterface) + ($this->check)($fromInterface, $toInterface), ); } } diff --git a/test/unit/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterfaceTest.php b/test/unit/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterfaceTest.php index 5219ce57..a08dfadb 100644 --- a/test/unit/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterfaceTest.php +++ b/test/unit/DetectChanges/BCBreak/InterfaceBased/UseClassBasedChecksOnAnInterfaceTest.php @@ -13,9 +13,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\UseClassBasedChecksOnAnInterface - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\InterfaceBased\UseClassBasedChecksOnAnInterface */ final class UseClassBasedChecksOnAnInterfaceTest extends TestCase { public function testCompare(): void @@ -34,7 +32,7 @@ public function testCompare(): void self::assertSame( $changes, - (new UseClassBasedChecksOnAnInterface($classBased))($fromInterface, $toInterface) + (new UseClassBasedChecksOnAnInterface($classBased))($fromInterface, $toInterface), ); } } diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/AccessibleMethodChangeTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/AccessibleMethodChangeTest.php index 86ff3a62..0f4ba615 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/AccessibleMethodChangeTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/AccessibleMethodChangeTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\AccessibleMethodChange - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\AccessibleMethodChange */ final class AccessibleMethodChangeTest extends TestCase { /** @var MethodBased&MockObject */ diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethodTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethodTest.php index a8a991da..ed19e713 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethodTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethodTest.php @@ -27,7 +27,7 @@ function method() {} } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ))) ->reflectClass('A') ->getMethod('method'); @@ -40,7 +40,7 @@ function method() {} self::assertEquals( Changes::fromList(Change::removed('foo', true)), - (new ExcludeInternalMethod($check))($method, $method) + (new ExcludeInternalMethod($check))($method, $method), ); } @@ -56,7 +56,7 @@ function method() {} } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ))) ->reflectClass('A') ->getMethod('method'); @@ -67,7 +67,7 @@ function method() {} self::assertEquals( Changes::empty(), - (new ExcludeInternalMethod($check))($method, $method) + (new ExcludeInternalMethod($check))($method, $method), ); } } diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php index 3f3e5f45..1d02c231 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodBecameFinalTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodBecameFinal - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodBecameFinal */ final class MethodBecameFinalTest extends TestCase { /** @@ -30,7 +28,7 @@ final class MethodBecameFinalTest extends TestCase public function testDiffs( ReflectionMethod $fromMethod, ReflectionMethod $toMethod, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new MethodBecameFinal())($fromMethod, $toMethod); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -72,7 +70,7 @@ private final function privateFinalToFinal() {} } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -97,7 +95,7 @@ private final function privateFinalToFinal() {} } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -131,8 +129,8 @@ private final function privateFinalToFinal() {} $errors, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php index 15d70a1f..466d2f7d 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodConcretenessChangedTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodConcretenessChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodConcretenessChanged */ final class MethodConcretenessChangedTest extends TestCase { /** @@ -30,7 +28,7 @@ final class MethodConcretenessChangedTest extends TestCase public function testDiffs( ReflectionMethod $fromMethod, ReflectionMethod $toMethod, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new MethodConcretenessChanged())($fromMethod, $toMethod); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -72,7 +70,7 @@ private abstract function privateAbstractToAbstract() {} } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -97,7 +95,7 @@ private abstract function privateAbstractToAbstract() {} } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -131,8 +129,8 @@ private abstract function privateAbstractToAbstract() {} $errors, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChangedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChangedTest.php index 2100b546..71cebbae 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodFunctionDefinitionChangedTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodFunctionDefinitionChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodFunctionDefinitionChanged */ final class MethodFunctionDefinitionChangedTest extends TestCase { /** @var FunctionBased&MockObject */ diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php index 14d15e9a..a6a0b38b 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodScopeChangedTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodScopeChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodScopeChanged */ final class MethodScopeChangedTest extends TestCase { /** @@ -30,7 +28,7 @@ final class MethodScopeChangedTest extends TestCase public function testDiffs( ReflectionMethod $fromMethod, ReflectionMethod $toMethod, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new MethodScopeChanged())($fromMethod, $toMethod); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -72,7 +70,7 @@ private static function privateStaticToStatic() {} } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -97,7 +95,7 @@ private static function privateStaticToStatic() {} } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -131,8 +129,8 @@ private static function privateStaticToStatic() {} $errors, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php index 1d69bd4b..6a6d88d3 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MethodVisibilityReducedTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodVisibilityReduced - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MethodVisibilityReduced */ final class MethodVisibilityReducedTest extends TestCase { /** @@ -30,7 +28,7 @@ final class MethodVisibilityReducedTest extends TestCase public function testDiffs( ReflectionMethod $fromMethod, ReflectionMethod $toMethod, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new MethodVisibilityReduced())($fromMethod, $toMethod); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -67,7 +65,7 @@ private function privateIncreasedToPublic() {} } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -87,7 +85,7 @@ public function privateIncreasedToPublic() {} } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -117,8 +115,8 @@ public function privateIncreasedToPublic() {} $errors, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/MultipleChecksOnAMethodTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/MultipleChecksOnAMethodTest.php index 539a7527..b6dff816 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/MultipleChecksOnAMethodTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/MultipleChecksOnAMethodTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\Reflection\ReflectionMethod; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MultipleChecksOnAMethod - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\MultipleChecksOnAMethod */ final class MultipleChecksOnAMethodTest extends TestCase { public function testChecksAllGivenCheckers(): void @@ -68,7 +66,7 @@ public function testChecksAllGivenCheckers(): void ->onLine(10) ->onColumn(5), ), - $multiCheck($from, $to) + $multiCheck($from, $to), ); } } diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChangedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChangedTest.php index de632209..5d32c25e 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/OnlyProtectedMethodChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\OnlyProtectedMethodChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\OnlyProtectedMethodChanged */ final class OnlyProtectedMethodChangedTest extends TestCase { /** @var MethodBased&MockObject */ diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChangedTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChangedTest.php index 35b58b42..3c994324 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/OnlyPublicMethodChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\OnlyPublicMethodChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\OnlyPublicMethodChanged */ final class OnlyPublicMethodChangedTest extends TestCase { /** @var MethodBased&MockObject */ diff --git a/test/unit/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrorsTest.php b/test/unit/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrorsTest.php index 37133cef..d97e7859 100644 --- a/test/unit/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrorsTest.php +++ b/test/unit/DetectChanges/BCBreak/MethodBased/SkipMethodBasedErrorsTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\SkipMethodBasedErrors - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\MethodBased\SkipMethodBasedErrors */ final class SkipMethodBasedErrorsTest extends TestCase { /** @var MethodBased&MockObject */ @@ -37,7 +35,7 @@ public function testWillForwardChecks(): void $toMethod = $this->createMock(ReflectionMethod::class); $expectedChanges = Changes::fromList(Change::added( uniqid('foo', true), - true + true, )); $this @@ -65,7 +63,7 @@ public function testWillCollectFailures(): void self::assertEquals( Changes::fromList(Change::skippedDueToFailure($exception)), - ($this->check)($fromMethod, $toMethod) + ($this->check)($fromMethod, $toMethod), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChangedTest.php index c495e045..47ca72ca 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/AccessiblePropertyChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\AccessiblePropertyChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\AccessiblePropertyChanged */ final class AccessiblePropertyChangedTest extends TestCase { /** @var PropertyBased&MockObject */ @@ -54,7 +52,7 @@ public function testSkipsPrivateProperty(): void self::assertEquals( Changes::empty(), - ($this->accessiblePropertyChanged)($this->fromProperty, $this->toProperty) + ($this->accessiblePropertyChanged)($this->fromProperty, $this->toProperty), ); } @@ -76,7 +74,7 @@ public function testChecksAccessibleProperty(): void self::assertEquals( $changes, - ($this->accessiblePropertyChanged)($this->fromProperty, $this->toProperty) + ($this->accessiblePropertyChanged)($this->fromProperty, $this->toProperty), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/ExcludeInternalPropertyTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/ExcludeInternalPropertyTest.php index 6901a4ab..b17f1b38 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/ExcludeInternalPropertyTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/ExcludeInternalPropertyTest.php @@ -27,7 +27,7 @@ class A { } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ))) ->reflectClass('A') ->getProperty('property'); @@ -42,7 +42,7 @@ class A { self::assertEquals( Changes::fromList(Change::removed('foo', true)), - (new ExcludeInternalProperty($check))($property, $property) + (new ExcludeInternalProperty($check))($property, $property), ); } @@ -58,7 +58,7 @@ class A { } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ))) ->reflectClass('A') ->getProperty('property'); @@ -71,7 +71,7 @@ class A { self::assertEquals( Changes::empty(), - (new ExcludeInternalProperty($check))($property, $property) + (new ExcludeInternalProperty($check))($property, $property), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/MultipleChecksOnAPropertyTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/MultipleChecksOnAPropertyTest.php index 2569d2ca..1cee1a28 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/MultipleChecksOnAPropertyTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/MultipleChecksOnAPropertyTest.php @@ -13,9 +13,7 @@ use Roave\BetterReflection\Reflection\ReflectionProperty; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\MultipleChecksOnAProperty - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\MultipleChecksOnAProperty */ final class MultipleChecksOnAPropertyTest extends TestCase { public function testChecksAllGivenCheckers(): void @@ -72,7 +70,7 @@ public function testChecksAllGivenCheckers(): void ->onLine(10) ->onColumn(5), ), - $multiCheck($from, $to) + $multiCheck($from, $to), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChangedTest.php index 10868213..579a2614 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyProtectedPropertyChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\OnlyProtectedPropertyChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\OnlyProtectedPropertyChanged */ final class OnlyProtectedPropertyChangedTest extends TestCase { /** @var PropertyBased&MockObject */ @@ -54,7 +52,7 @@ public function testSkipsNonProtectedProperty(): void self::assertEquals( Changes::empty(), - ($this->changed)($this->fromProperty, $this->toProperty) + ($this->changed)($this->fromProperty, $this->toProperty), ); } @@ -76,7 +74,7 @@ public function testChecksProtectedProperty(): void self::assertEquals( $changes, - ($this->changed)($this->fromProperty, $this->toProperty) + ($this->changed)($this->fromProperty, $this->toProperty), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChangedTest.php index 546a4387..33e82914 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/OnlyPublicPropertyChangedTest.php @@ -14,9 +14,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\OnlyPublicPropertyChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\OnlyPublicPropertyChanged */ final class OnlyPublicPropertyChangedTest extends TestCase { /** @var PropertyBased&MockObject */ @@ -54,7 +52,7 @@ public function testSkipsNonPublicProperty(): void self::assertEquals( Changes::empty(), - ($this->changed)($this->fromProperty, $this->toProperty) + ($this->changed)($this->fromProperty, $this->toProperty), ); } @@ -76,7 +74,7 @@ public function testChecksPublicProperty(): void self::assertEquals( $changes, - ($this->changed)($this->fromProperty, $this->toProperty) + ($this->changed)($this->fromProperty, $this->toProperty), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php index b6162a82..b8fcf8e3 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternalTest.php @@ -18,9 +18,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyBecameInternal - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyBecameInternal */ final class PropertyBecameInternalTest extends TestCase { /** @@ -31,7 +29,7 @@ final class PropertyBecameInternalTest extends TestCase public function testDiffs( ReflectionProperty $fromFunction, ReflectionProperty $toFunction, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new PropertyBecameInternal())($fromFunction, $toFunction); @@ -39,7 +37,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -65,7 +63,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -82,7 +80,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -106,8 +104,8 @@ class TheClass { $errorMessages, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php index 9e09d8a2..dbf559b9 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyDefaultValueChangedTest.php @@ -18,9 +18,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyDefaultValueChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyDefaultValueChanged */ final class PropertyDefaultValueChangedTest extends TestCase { /** @@ -31,7 +29,7 @@ final class PropertyDefaultValueChangedTest extends TestCase public function testDiffs( ReflectionProperty $fromFunction, ReflectionProperty $toFunction, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new PropertyDefaultValueChanged())($fromFunction, $toFunction); @@ -39,7 +37,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -79,7 +77,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -110,7 +108,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -148,8 +146,8 @@ class TheClass { $errorMessages, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php index ced1d786..c2e302c1 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyScopeChangedTest.php @@ -18,9 +18,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyScopeChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyScopeChanged */ final class PropertyScopeChangedTest extends TestCase { /** @@ -31,7 +29,7 @@ final class PropertyScopeChangedTest extends TestCase public function testDiffs( ReflectionProperty $fromFunction, ReflectionProperty $toFunction, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new PropertyScopeChanged())($fromFunction, $toFunction); @@ -39,7 +37,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -73,7 +71,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -98,7 +96,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -132,8 +130,8 @@ class TheClass { $errorMessages, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php index 7024d24f..fad2fa8c 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyTypeChangedTest.php @@ -20,9 +20,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyTypeChanged - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyTypeChanged */ final class PropertyTypeChangedTest extends TestCase { /** @@ -33,18 +31,18 @@ final class PropertyTypeChangedTest extends TestCase public function testDiffs( ReflectionProperty $fromProperty, ReflectionProperty $toProperty, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new PropertyTypeChanged( new TypeIsContravariant(), - new TypeIsCovariant() + new TypeIsCovariant(), ))($fromProperty, $toProperty); self::assertSame( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -133,7 +131,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -208,7 +206,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -248,8 +246,8 @@ class TheClass { $errorMessages, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php index f9a5560b..2ec9bb6a 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/PropertyVisibilityReducedTest.php @@ -18,9 +18,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyVisibilityReduced - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\PropertyVisibilityReduced */ final class PropertyVisibilityReducedTest extends TestCase { /** @@ -31,7 +29,7 @@ final class PropertyVisibilityReducedTest extends TestCase public function testDiffs( ReflectionProperty $fromProperty, ReflectionProperty $toProperty, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new PropertyVisibilityReduced())($fromProperty, $toProperty); @@ -39,7 +37,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -68,7 +66,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $toLocator = new StringSourceLocator( @@ -88,7 +86,7 @@ class TheClass { } PHP , - $astLocator + $astLocator, ); $fromClassReflector = new DefaultReflector($fromLocator); @@ -117,8 +115,8 @@ class TheClass { $errorMessages, ], array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrorsTest.php b/test/unit/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrorsTest.php index ffe8aa93..c9d3afc0 100644 --- a/test/unit/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrorsTest.php +++ b/test/unit/DetectChanges/BCBreak/PropertyBased/SkipPropertyBasedErrorsTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\SkipPropertyBasedErrors - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\PropertyBased\SkipPropertyBasedErrors */ final class SkipPropertyBasedErrorsTest extends TestCase { /** @var PropertyBased&MockObject */ @@ -37,7 +35,7 @@ public function testWillForwardChecks(): void $toProperty = $this->createMock(ReflectionProperty::class); $expectedChanges = Changes::fromList(Change::added( uniqid('foo', true), - true + true, )); $this @@ -65,7 +63,7 @@ public function testWillCollectFailures(): void self::assertEquals( Changes::fromList(Change::skippedDueToFailure($exception)), - ($this->check)($fromProperty, $toProperty) + ($this->check)($fromProperty, $toProperty), ); } } diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/ExcludeInternalTraitTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/ExcludeInternalTraitTest.php index f4b66ef8..db2328a2 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/ExcludeInternalTraitTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/ExcludeInternalTraitTest.php @@ -26,7 +26,7 @@ public function testNormalTraitsAreNotExcluded(): void trait ANormalTrait {} PHP , - $locator + $locator, )); $reflection = $reflector->reflectClass('ANormalTrait'); @@ -38,7 +38,7 @@ trait ANormalTrait {} self::assertEquals( Changes::fromList(Change::removed('foo', true)), - (new ExcludeInternalTrait($check))($reflection, $reflection) + (new ExcludeInternalTrait($check))($reflection, $reflection), ); } @@ -53,7 +53,7 @@ public function testInternalTraitsAreExcluded(): void trait AnInternalTrait {} PHP , - $locator + $locator, )); $reflection = $reflector->reflectClass('AnInternalTrait'); @@ -62,7 +62,7 @@ trait AnInternalTrait {} self::assertEquals( Changes::empty(), - (new ExcludeInternalTrait($check))($reflection, $reflection) + (new ExcludeInternalTrait($check))($reflection, $reflection), ); } } diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/MultipleChecksOnATraitTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/MultipleChecksOnATraitTest.php index 981d568c..4936b4d0 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/MultipleChecksOnATraitTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/MultipleChecksOnATraitTest.php @@ -12,9 +12,7 @@ use Roave\BetterReflection\Reflection\ReflectionClass; use RoaveTest\BackwardCompatibility\Assertion; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\MultipleChecksOnATrait - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\MultipleChecksOnATrait */ final class MultipleChecksOnATraitTest extends TestCase { public function testChecksAllGivenCheckers(): void @@ -68,7 +66,7 @@ public function testChecksAllGivenCheckers(): void ->onLine(10) ->onColumn(5), ), - $multiCheck($from, $to) + $multiCheck($from, $to), ); } } diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrorsTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrorsTest.php index 4b280795..3634a147 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrorsTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/SkipTraitBasedErrorsTest.php @@ -15,9 +15,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\SkipTraitBasedErrors - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\SkipTraitBasedErrors */ final class SkipTraitBasedErrorsTest extends TestCase { /** @var TraitBased&MockObject */ @@ -37,7 +35,7 @@ public function testWillForwardChecks(): void $toTrait = $this->createMock(ReflectionClass::class); $expectedChanges = Changes::fromList(Change::added( uniqid('foo', true), - true + true, )); $this @@ -65,7 +63,7 @@ public function testWillCollectFailures(): void self::assertEquals( Changes::fromList(Change::skippedDueToFailure($exception)), - ($this->check)($fromTrait, $toTrait) + ($this->check)($fromTrait, $toTrait), ); } } diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php index 37cae936..0d90207c 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameClassTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\TraitBecameClass - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\TraitBecameClass */ final class TraitBecameClassTest extends TestCase { /** @@ -30,7 +28,7 @@ final class TraitBecameClassTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new TraitBecameClass())($fromClass, $toClass); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -62,7 +60,7 @@ interface InterfaceToTrait {} interface InterfaceToInterface {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -77,7 +75,7 @@ trait InterfaceToTrait {} interface InterfaceToInterface {} PHP , - $locator + $locator, )); $classes = [ @@ -99,8 +97,8 @@ interface InterfaceToInterface {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php index f1f25528..4036a4d9 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/TraitBecameInterfaceTest.php @@ -17,9 +17,7 @@ use function array_map; use function iterator_to_array; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\TraitBecameInterface - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\TraitBecameInterface */ final class TraitBecameInterfaceTest extends TestCase { /** @@ -30,7 +28,7 @@ final class TraitBecameInterfaceTest extends TestCase public function testDiffs( ReflectionClass $fromClass, ReflectionClass $toClass, - array $expectedMessages + array $expectedMessages, ): void { $changes = (new TraitBecameInterface())($fromClass, $toClass); @@ -38,7 +36,7 @@ public function testDiffs( $expectedMessages, array_map(static function (Change $change): string { return $change->__toString(); - }, iterator_to_array($changes)) + }, iterator_to_array($changes)), ); } @@ -62,7 +60,7 @@ interface InterfaceToTrait {} interface InterfaceToInterface {} PHP , - $locator + $locator, )); $toReflector = new DefaultReflector(new StringSourceLocator( <<<'PHP' @@ -77,7 +75,7 @@ trait InterfaceToTrait {} interface InterfaceToInterface {} PHP , - $locator + $locator, )); $classes = [ @@ -99,8 +97,8 @@ interface InterfaceToInterface {} $errors, ], array_keys($classes), - $classes - ) + $classes, + ), ); } } diff --git a/test/unit/DetectChanges/BCBreak/TraitBased/UseClassBasedChecksOnATraitTest.php b/test/unit/DetectChanges/BCBreak/TraitBased/UseClassBasedChecksOnATraitTest.php index b3bc3cda..71931a22 100644 --- a/test/unit/DetectChanges/BCBreak/TraitBased/UseClassBasedChecksOnATraitTest.php +++ b/test/unit/DetectChanges/BCBreak/TraitBased/UseClassBasedChecksOnATraitTest.php @@ -13,9 +13,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\UseClassBasedChecksOnATrait - */ +/** @covers \Roave\BackwardCompatibility\DetectChanges\BCBreak\TraitBased\UseClassBasedChecksOnATrait */ final class UseClassBasedChecksOnATraitTest extends TestCase { public function testCompare(): void diff --git a/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php b/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php index 1b1c6afa..e12aa669 100644 --- a/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php +++ b/test/unit/DetectChanges/Variance/TypeIsContravariantTest.php @@ -27,17 +27,15 @@ /** @covers \Roave\BackwardCompatibility\DetectChanges\Variance\TypeIsContravariant */ final class TypeIsContravariantTest extends TestCase { - /** - * @dataProvider checkedTypes - */ + /** @dataProvider checkedTypes */ public function testContravariance( ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type, ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $newType, - bool $expectedToBeContravariant + bool $expectedToBeContravariant, ): void { self::assertSame( $expectedToBeContravariant, - (new TypeIsContravariant())($type, $newType) + (new TypeIsContravariant())($type, $newType), ); } @@ -70,13 +68,13 @@ class CClass extends BClass {} final class OwnerPropertyContainer { private $owner; } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), )); $owner = Type\object(ReflectionProperty::class) ->coerce( $reflector->reflectClass('OwnerPropertyContainer') - ->getProperty('owner') + ->getProperty('owner'), ); $types = [ @@ -380,18 +378,16 @@ final class OwnerPropertyContainer { private $owner; } : self::identifierType($reflector, $owner, $types[1]), $types[2], ], - $types + $types, ); } - /** - * @dataProvider existingTypes - */ + /** @dataProvider existingTypes */ public function testContravarianceConsidersSameTypeAlwaysContravariant( - ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type + ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type, ): void { self::assertTrue( - (new TypeIsContravariant())($type, $type) + (new TypeIsContravariant())($type, $type), ); } @@ -407,13 +403,13 @@ class AClass {} final class OwnerPropertyContainer { private $owner; } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), )); $owner = Type\object(ReflectionProperty::class) ->coerce( $reflector->reflectClass('OwnerPropertyContainer') - ->getProperty('owner') + ->getProperty('owner'), ); return array_merge( @@ -433,14 +429,12 @@ final class OwnerPropertyContainer { private $owner; } 'callable', 'Traversable', 'AClass', - ] - )) + ], + )), ); } - /** - * @dataProvider existingNullableTypeStrings - */ + /** @dataProvider existingNullableTypeStrings */ public function testContravarianceConsidersNullability(string $type): void { $reflector = new DefaultReflector(new StringSourceLocator( @@ -452,13 +446,13 @@ class AClass {} final class OwnerPropertyContainer { private $owner; } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), )); $owner = Type\object(ReflectionProperty::class) ->coerce( $reflector->reflectClass('OwnerPropertyContainer') - ->getProperty('owner') + ->getProperty('owner'), ); $nullable = self::identifierType($reflector, $owner, new NullableType(new Identifier($type))); @@ -489,7 +483,7 @@ public function existingNullableTypeStrings(): array private static function identifierType( Reflector $reflector, ReflectionProperty $owner, - Identifier|NullableType|UnionType|IntersectionType $identifier + Identifier|NullableType|UnionType|IntersectionType $identifier, ): ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType { return ReflectionType::createFromNode($reflector, $owner, $identifier); } diff --git a/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php b/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php index 75516283..7a5ae613 100644 --- a/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php +++ b/test/unit/DetectChanges/Variance/TypeIsCovariantTest.php @@ -27,17 +27,15 @@ /** @covers \Roave\BackwardCompatibility\DetectChanges\Variance\TypeIsCovariant */ final class TypeIsCovariantTest extends TestCase { - /** - * @dataProvider checkedTypes - */ + /** @dataProvider checkedTypes */ public function testCovariance( ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type, ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $newType, - bool $expectedToBeContravariant + bool $expectedToBeContravariant, ): void { self::assertSame( $expectedToBeContravariant, - (new TypeIsCovariant())($type, $newType) + (new TypeIsCovariant())($type, $newType), ); } @@ -70,13 +68,13 @@ class CClass extends BClass {} final class OwnerPropertyContainer { private $owner; } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), )); $owner = Type\object(ReflectionProperty::class) ->coerce( $reflector->reflectClass('OwnerPropertyContainer') - ->getProperty('owner') + ->getProperty('owner'), ); $types = [ @@ -391,24 +389,20 @@ final class OwnerPropertyContainer { private $owner; } : self::identifierType($reflector, $owner, $types[1]), $types[2], ], - $types + $types, ); } - /** - * @dataProvider existingTypes - */ + /** @dataProvider existingTypes */ public function testCovarianceConsidersSameTypeAlwaysCovariant( - ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type + ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType|null $type, ): void { self::assertTrue( - (new TypeIsCovariant())($type, $type) + (new TypeIsCovariant())($type, $type), ); } - /** - * @return list - */ + /** @return list */ public function existingTypes(): array { $reflector = new DefaultReflector(new StringSourceLocator( @@ -420,13 +414,13 @@ class AClass {} final class OwnerPropertyContainer { private $owner; } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), )); $owner = Type\object(ReflectionProperty::class) ->coerce( $reflector->reflectClass('OwnerPropertyContainer') - ->getProperty('owner') + ->getProperty('owner'), ); return array_merge( @@ -451,14 +445,12 @@ final class OwnerPropertyContainer { private $owner; } 'object', 'Traversable', 'AClass', - ] - )) + ], + )), ); } - /** - * @dataProvider existingNullableTypeStrings - */ + /** @dataProvider existingNullableTypeStrings */ public function testCovarianceConsidersNullability(string $type): void { $reflector = new DefaultReflector(new StringSourceLocator( @@ -470,13 +462,13 @@ class AClass {} final class OwnerPropertyContainer { private $owner; } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), )); $owner = Type\object(ReflectionProperty::class) ->coerce( $reflector->reflectClass('OwnerPropertyContainer') - ->getProperty('owner') + ->getProperty('owner'), ); $nullable = self::identifierType($reflector, $owner, new NullableType(new Identifier($type))); @@ -509,7 +501,7 @@ public function existingNullableTypeStrings(): array private static function identifierType( Reflector $reflector, ReflectionProperty $owner, - Identifier|NullableType|UnionType|IntersectionType $identifier + Identifier|NullableType|UnionType|IntersectionType $identifier, ): ReflectionIntersectionType|ReflectionUnionType|ReflectionNamedType { return ReflectionType::createFromNode($reflector, $owner, $identifier); } diff --git a/test/unit/Factory/ComposerInstallationReflectorFactoryTest.php b/test/unit/Factory/ComposerInstallationReflectorFactoryTest.php index fa4fd00d..91f985a9 100644 --- a/test/unit/Factory/ComposerInstallationReflectorFactoryTest.php +++ b/test/unit/Factory/ComposerInstallationReflectorFactoryTest.php @@ -13,9 +13,7 @@ use function uniqid; -/** - * @covers \Roave\BackwardCompatibility\Factory\ComposerInstallationReflectorFactory - */ +/** @covers \Roave\BackwardCompatibility\Factory\ComposerInstallationReflectorFactory */ final class ComposerInstallationReflectorFactoryTest extends TestCase { /** @@ -34,7 +32,7 @@ public function testWillInstantiateLocator(): void class Dummy {} PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ); $locateSources @@ -47,10 +45,10 @@ class Dummy {} '/** an example */', (new ComposerInstallationReflectorFactory($locateSources))( $path, - $this->createMock(SourceLocator::class) + $this->createMock(SourceLocator::class), ) ->reflectClass('Dummy') - ->getDocComment() + ->getDocComment(), ); } } diff --git a/test/unit/Formatter/FunctionNameTest.php b/test/unit/Formatter/FunctionNameTest.php index 8e0120cc..e088e92d 100644 --- a/test/unit/Formatter/FunctionNameTest.php +++ b/test/unit/Formatter/FunctionNameTest.php @@ -12,14 +12,10 @@ use Roave\BetterReflection\Reflector\DefaultReflector; use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; -/** - * @covers \Roave\BackwardCompatibility\Formatter\FunctionName - */ +/** @covers \Roave\BackwardCompatibility\Formatter\FunctionName */ final class FunctionNameTest extends TestCase { - /** - * @dataProvider functionsToBeTested - */ + /** @dataProvider functionsToBeTested */ public function testName(ReflectionFunction|ReflectionMethod $function, string $expectedName): void { self::assertSame($expectedName, (new FunctionName())($function)); @@ -53,7 +49,7 @@ function e() {} } PHP , - (new BetterReflection())->astLocator() + (new BetterReflection())->astLocator(), ); $reflector = new DefaultReflector($locator); diff --git a/test/unit/Formatter/GithubActionsFormatterTest.php b/test/unit/Formatter/GithubActionsFormatterTest.php index d3253bf7..c88615a0 100644 --- a/test/unit/Formatter/GithubActionsFormatterTest.php +++ b/test/unit/Formatter/GithubActionsFormatterTest.php @@ -19,9 +19,7 @@ /** @covers \Roave\BackwardCompatibility\Formatter\GithubActionsFormatter */ final class GithubActionsFormatterTest extends TestCase { - /** - * @throws ReflectionException - */ + /** @throws ReflectionException */ public function testWrite(): void { $output = new BufferedOutput(); @@ -32,7 +30,7 @@ public function testWrite(): void (new GithubActionsFormatter( $output, - CheckedOutRepository::fromPath($temporaryLocation . '/foo/bar') + CheckedOutRepository::fromPath($temporaryLocation . '/foo/bar'), ))->write(Changes::fromList( Change::removed('foo', true), Change::added('bar', false), @@ -67,7 +65,7 @@ public function testWrite(): void OUTPUT , - $output->fetch() + $output->fetch(), ); Filesystem\delete_directory($temporaryLocation, true); diff --git a/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php b/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php index 382c21ce..b1f15881 100644 --- a/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php +++ b/test/unit/Formatter/MarkdownPipedToSymfonyConsoleFormatterTest.php @@ -11,16 +11,14 @@ use Roave\BackwardCompatibility\Formatter\MarkdownPipedToSymfonyConsoleFormatter; use Symfony\Component\Console\Output\OutputInterface; -/** - * @covers \Roave\BackwardCompatibility\Formatter\MarkdownPipedToSymfonyConsoleFormatter - */ +/** @covers \Roave\BackwardCompatibility\Formatter\MarkdownPipedToSymfonyConsoleFormatter */ final class MarkdownPipedToSymfonyConsoleFormatterTest extends TestCase { public function testWrite(): void { $output = $this->createMock(OutputInterface::class); - $changeToExpect = <<astLocator() + (new BetterReflection())->astLocator(), ); $classReflector = new DefaultReflector($locator); @@ -100,8 +96,8 @@ static function (string $expectedMessage, ReflectionProperty $property): array { return [$property, $expectedMessage]; }, array_keys($properties), - $properties - ) + $properties, + ), ); } } diff --git a/test/unit/Formatter/SymbolStartColumnTest.php b/test/unit/Formatter/SymbolStartColumnTest.php index 4decd0ed..3a6c6911 100644 --- a/test/unit/Formatter/SymbolStartColumnTest.php +++ b/test/unit/Formatter/SymbolStartColumnTest.php @@ -20,16 +20,14 @@ use Roave\BetterReflection\SourceLocator\Type\SourceLocator; use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; -/** - * @covers \Roave\BackwardCompatibility\Formatter\SymbolStartColumn - */ +/** @covers \Roave\BackwardCompatibility\Formatter\SymbolStartColumn */ final class SymbolStartColumnTest extends TestCase { public function testCanGetStartColumnForSimpleSymbol(): void { $reflector = new DefaultReflector(new StringSourceLocator( 'astLocator() + (new BetterReflection())->astLocator(), )); self::assertSame(32, SymbolStartColumn::get($reflector->reflectClass('A'))); @@ -39,7 +37,7 @@ public function testCannotGetStartColumnWhenAstHasBeenParsedWithoutColumnLocatio { $reflector = new DefaultReflector(new class implements SourceLocator { /** Retrieves function `foo`, but without sources (invalid position) */ - public function locateIdentifier(Reflector $reflector, Identifier $identifier): ?Reflection + public function locateIdentifier(Reflector $reflector, Identifier $identifier): Reflection|null { $locatedSource = new LocatedSource('', null); $betterReflection = new BetterReflection(); @@ -48,13 +46,13 @@ public function locateIdentifier(Reflector $reflector, Identifier $identifier): 0 => Type\object(Function_::class), ])->coerce( $betterReflection->phpParser() - ->parse('parse('reflector(), $function, - $locatedSource + $locatedSource, ); } diff --git a/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php b/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php index ba799b01..2433ce3d 100644 --- a/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php +++ b/test/unit/Formatter/SymfonyConsoleTextFormatterTest.php @@ -13,14 +13,10 @@ use Roave\BackwardCompatibility\Formatter\SymfonyConsoleTextFormatter; use Symfony\Component\Console\Output\OutputInterface; -/** - * @covers \Roave\BackwardCompatibility\Formatter\SymfonyConsoleTextFormatter - */ +/** @covers \Roave\BackwardCompatibility\Formatter\SymfonyConsoleTextFormatter */ final class SymfonyConsoleTextFormatterTest extends TestCase { - /** - * @throws ReflectionException - */ + /** @throws ReflectionException */ public function testWrite(): void { $change1Text = SecureRandom\string(8); @@ -31,12 +27,12 @@ public function testWrite(): void ->method('writeln') ->withConsecutive( [Str\format('[BC] REMOVED: %s', $change1Text)], - [Str\format(' ADDED: %s', $change2Text)] + [Str\format(' ADDED: %s', $change2Text)], ); (new SymfonyConsoleTextFormatter($output))->write(Changes::fromList( Change::removed($change1Text, true), - Change::added($change2Text, false) + Change::added($change2Text, false), )); } } diff --git a/test/unit/Git/CheckedOutRepositoryTest.php b/test/unit/Git/CheckedOutRepositoryTest.php index cfea7ea1..b6a0c492 100644 --- a/test/unit/Git/CheckedOutRepositoryTest.php +++ b/test/unit/Git/CheckedOutRepositoryTest.php @@ -11,9 +11,7 @@ use Psl\SecureRandom; use Roave\BackwardCompatibility\Git\CheckedOutRepository; -/** - * @covers \Roave\BackwardCompatibility\Git\CheckedOutRepository - */ +/** @covers \Roave\BackwardCompatibility\Git\CheckedOutRepository */ final class CheckedOutRepositoryTest extends TestCase { public function testFromPath(): void diff --git a/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php b/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php index 7ca12150..a4f3f044 100644 --- a/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php +++ b/test/unit/Git/GetVersionCollectionFromGitRepositoryTest.php @@ -15,9 +15,7 @@ use Roave\BackwardCompatibility\Git\GetVersionCollectionFromGitRepository; use Version\Version; -/** - * @covers \Roave\BackwardCompatibility\Git\GetVersionCollectionFromGitRepository - */ +/** @covers \Roave\BackwardCompatibility\Git\GetVersionCollectionFromGitRepository */ final class GetVersionCollectionFromGitRepositoryTest extends TestCase { private CheckedOutRepository $repoPath; @@ -53,7 +51,7 @@ private function getTags(): array Type\vec(Type\object(Version::class)) ->coerce( (new GetVersionCollectionFromGitRepository()) - ->fromRepository($this->repoPath) + ->fromRepository($this->repoPath), ), static function (Version $version): string { return $version->toString(); diff --git a/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php b/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php index 402864a8..a590613b 100644 --- a/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php +++ b/test/unit/Git/GitCheckoutRevisionToTemporaryPathTest.php @@ -13,9 +13,7 @@ use Roave\BackwardCompatibility\Git\Revision; use RuntimeException; -/** - * @covers \Roave\BackwardCompatibility\Git\GitCheckoutRevisionToTemporaryPath - */ +/** @covers \Roave\BackwardCompatibility\Git\GitCheckoutRevisionToTemporaryPath */ final class GitCheckoutRevisionToTemporaryPathTest extends TestCase { private const TEST_REVISION_TO_CHECKOUT = '428327492a803b6e0c612b157a67a50a47275461'; @@ -66,7 +64,7 @@ public function testCheckedOutRevisionIsAtExpectedRevisionState(): void Shell\execute('git', ['commit', '-m', 'initial commit', '--allow-empty'], $repoPath); $firstCommit = Revision::fromSha1( - Shell\execute('git', ['rev-parse', 'HEAD'], $repoPath) + Shell\execute('git', ['rev-parse', 'HEAD'], $repoPath), ); Filesystem\write_file($repoPath . '/a-file.txt', 'file contents'); @@ -75,7 +73,7 @@ public function testCheckedOutRevisionIsAtExpectedRevisionState(): void Shell\execute('git', ['commit', '-m', 'second commit', '--allow-empty'], $repoPath); $secondCommit = Revision::fromSha1( - Shell\execute('git', ['rev-parse', 'HEAD'], $repoPath) + Shell\execute('git', ['rev-parse', 'HEAD'], $repoPath), ); $git = new GitCheckoutRevisionToTemporaryPath(); @@ -112,7 +110,7 @@ public function testExceptionIsThrownWhenTwoPathsCollide(): void } catch (RuntimeException $runtimeException) { self::assertStringMatchesFormat( 'Tried to check out revision "%s" to directory "%s" which already exists', - $runtimeException->getMessage() + $runtimeException->getMessage(), ); } finally { $git->remove($first); diff --git a/test/unit/Git/GitParseRevisionTest.php b/test/unit/Git/GitParseRevisionTest.php index ef44bfd9..5e727205 100644 --- a/test/unit/Git/GitParseRevisionTest.php +++ b/test/unit/Git/GitParseRevisionTest.php @@ -8,14 +8,10 @@ use Roave\BackwardCompatibility\Git\CheckedOutRepository; use Roave\BackwardCompatibility\Git\GitParseRevision; -/** - * @covers \Roave\BackwardCompatibility\Git\GitParseRevision - */ +/** @covers \Roave\BackwardCompatibility\Git\GitParseRevision */ final class GitParseRevisionTest extends TestCase { - /** - * @return string[][] - */ + /** @return string[][] */ public function revisionProvider(): array { return [ @@ -23,17 +19,15 @@ public function revisionProvider(): array ]; } - /** - * @dataProvider revisionProvider - */ + /** @dataProvider revisionProvider */ public function testFromStringForRepository(string $revisionToBeParsed, string $expectedRevision): void { self::assertSame( $expectedRevision, (new GitParseRevision())->fromStringForRepository( $revisionToBeParsed, - CheckedOutRepository::fromPath(__DIR__ . '/../../../') - )->__toString() + CheckedOutRepository::fromPath(__DIR__ . '/../../../'), + )->__toString(), ); } } diff --git a/test/unit/Git/PickLastMinorVersionFromCollectionTest.php b/test/unit/Git/PickLastMinorVersionFromCollectionTest.php index 6984a13b..f311a688 100644 --- a/test/unit/Git/PickLastMinorVersionFromCollectionTest.php +++ b/test/unit/Git/PickLastMinorVersionFromCollectionTest.php @@ -13,9 +13,7 @@ use function array_map; -/** - * @covers \Roave\BackwardCompatibility\Git\PickLastMinorVersionFromCollection - */ +/** @covers \Roave\BackwardCompatibility\Git\PickLastMinorVersionFromCollection */ final class PickLastMinorVersionFromCollectionTest extends TestCase { /** @@ -52,8 +50,8 @@ public function testForRepository(string $expectedVersion, array $collectionOfVe new VersionCollection(...array_map(static function (string $version): Version { return Type\object(Version::class) ->coerce(Version::fromString($version)); - }, $collectionOfVersions)) - )->toString() + }, $collectionOfVersions)), + )->toString(), ); } diff --git a/test/unit/Git/RevisionTest.php b/test/unit/Git/RevisionTest.php index a8ad1abb..711bb264 100644 --- a/test/unit/Git/RevisionTest.php +++ b/test/unit/Git/RevisionTest.php @@ -11,9 +11,7 @@ use Psl\Str; use Roave\BackwardCompatibility\Git\Revision; -/** - * @covers \Roave\BackwardCompatibility\Git\Revision - */ +/** @covers \Roave\BackwardCompatibility\Git\Revision */ final class RevisionTest extends TestCase { public function testFromSha1WithValidSha1(): void @@ -30,9 +28,7 @@ public function testFromSha1WithNewlinesStillProvidesValidSha1(): void self::assertSame($sha1, (string) Revision::fromSha1($sha1 . "\n")); } - /** - * @return string[][] - */ + /** @return string[][] */ public function invalidRevisionProvider(): array { return [ @@ -45,9 +41,7 @@ public function invalidRevisionProvider(): array ]; } - /** - * @dataProvider invalidRevisionProvider - */ + /** @dataProvider invalidRevisionProvider */ public function testInvalidSha1Rejected(string $invalidRevision): void { $this->expectException(InvariantViolationException::class); diff --git a/test/unit/LocateDependencies/LocateDependenciesViaComposerTest.php b/test/unit/LocateDependencies/LocateDependenciesViaComposerTest.php index 2d604977..be86afa8 100644 --- a/test/unit/LocateDependencies/LocateDependenciesViaComposerTest.php +++ b/test/unit/LocateDependencies/LocateDependenciesViaComposerTest.php @@ -19,9 +19,7 @@ use Roave\BetterReflection\SourceLocator\Type\PhpInternalSourceLocator; use Roave\BetterReflection\SourceLocator\Type\SourceLocator; -/** - * @covers \Roave\BackwardCompatibility\LocateDependencies\LocateDependenciesViaComposer - */ +/** @covers \Roave\BackwardCompatibility\LocateDependencies\LocateDependenciesViaComposer */ final class LocateDependenciesViaComposerTest extends TestCase { private string $originalCwd; @@ -131,7 +129,7 @@ public function testInternalReflectionStubsTakePriorityOverInstalledPolyfills(): self::assertTrue( $reflector->reflectClass('Stringable') - ->isInternal() + ->isInternal(), ); } diff --git a/test/unit/LocateSources/LocateSourcesViaComposerJsonTest.php b/test/unit/LocateSources/LocateSourcesViaComposerJsonTest.php index 60bf83ef..10d76ce1 100644 --- a/test/unit/LocateSources/LocateSourcesViaComposerJsonTest.php +++ b/test/unit/LocateSources/LocateSourcesViaComposerJsonTest.php @@ -9,9 +9,7 @@ use Roave\BetterReflection\BetterReflection; use Roave\BetterReflection\Reflector\DefaultReflector; -/** - * @covers \Roave\BackwardCompatibility\LocateSources\LocateSourcesViaComposerJson - */ +/** @covers \Roave\BackwardCompatibility\LocateSources\LocateSourcesViaComposerJson */ final class LocateSourcesViaComposerJsonTest extends TestCase { private LocateSourcesViaComposerJson $locateSources; @@ -26,14 +24,14 @@ protected function setUp(): void public function testCanLocateClassInMappendAutoloadDefinitions(): void { $reflector = new DefaultReflector( - ($this->locateSources)(__DIR__ . '/../../asset/located-sources/composer-definition-with-everything') + ($this->locateSources)(__DIR__ . '/../../asset/located-sources/composer-definition-with-everything'), ); self::assertSame( 'baz\\LocatedClass', $reflector ->reflectClass('baz\\LocatedClass') - ->getName() + ->getName(), ); } } diff --git a/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php b/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php index 9ae14203..ed5c7ae0 100644 --- a/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php +++ b/test/unit/SourceLocator/LocatedSourceWithStrippedSourcesDirectoryTest.php @@ -14,16 +14,14 @@ use function array_filter; use function array_map; -/** - * @covers \Roave\BackwardCompatibility\SourceLocator\LocatedSourceWithStrippedSourcesDirectory - */ +/** @covers \Roave\BackwardCompatibility\SourceLocator\LocatedSourceWithStrippedSourcesDirectory */ final class LocatedSourceWithStrippedSourcesDirectoryTest extends TestCase { /** @dataProvider verifiedPaths */ public function testWillStripPrefixFilePathWhenLocatedSourceInConfiguredPath( string $sourcePath, string $strippedSourcesPath, - string $expectedPath + string $expectedPath, ): void { $source = $this->createMock(LocatedSource::class); @@ -34,7 +32,7 @@ public function testWillStripPrefixFilePathWhenLocatedSourceInConfiguredPath( self::assertSame( $expectedPath, (new LocatedSourceWithStrippedSourcesDirectory($source, $strippedSourcesPath)) - ->getFileName() + ->getFileName(), ); } @@ -55,8 +53,8 @@ public function testWillGetSourcesFromGivenLocatedSource(): void 'SOURCES!!!', (new LocatedSourceWithStrippedSourcesDirectory( new LocatedSource('SOURCES!!!', null, null), - '/some/source/directory' - ))->getSource() + '/some/source/directory', + ))->getSource(), ); } @@ -66,8 +64,8 @@ public function testWillGetSourceNameFromGivenLocatedSource(): void 'NAME!!!', (new LocatedSourceWithStrippedSourcesDirectory( new LocatedSource('', 'NAME!!!', null), - '/some/source/directory' - ))->getName() + '/some/source/directory', + ))->getName(), ); } @@ -87,14 +85,14 @@ public function testWillReportInternalSourceFromGivenLocatedSource(): void self::assertFalse( (new LocatedSourceWithStrippedSourcesDirectory( $nonInternalSource, - '/some/source/directory' - ))->isInternal() + '/some/source/directory', + ))->isInternal(), ); self::assertTrue( (new LocatedSourceWithStrippedSourcesDirectory( $internalSource, - '/some/source/directory' - ))->isInternal() + '/some/source/directory', + ))->isInternal(), ); } @@ -109,7 +107,7 @@ public function testWillGetExtensionNameFromGivenLocatedSource(): void self::assertSame( 'the-extension', (new LocatedSourceWithStrippedSourcesDirectory($extensionSource, '/some/source/directory')) - ->getExtensionName() + ->getExtensionName(), ); } @@ -129,14 +127,14 @@ public function testWillReportEvaledSourceFromGivenLocatedSource(): void self::assertFalse( (new LocatedSourceWithStrippedSourcesDirectory( $nonEvaledSource, - '/some/source/directory' - ))->isEvaled() + '/some/source/directory', + ))->isEvaled(), ); self::assertTrue( (new LocatedSourceWithStrippedSourcesDirectory( $evaledSource, - '/some/source/directory' - ))->isEvaled() + '/some/source/directory', + ))->isEvaled(), ); } @@ -151,7 +149,7 @@ public function testWillGetAliasNameFromGivenLocatedSource(): void self::assertSame( 'the-alias', (new LocatedSourceWithStrippedSourcesDirectory($aliasedSource, '/some/source/directory')) - ->getAliasName() + ->getAliasName(), ); } @@ -167,7 +165,7 @@ public function testAllMethodsOfOriginalLocatedSourceAreOverridden(ReflectionMet $method ->getDeclaringClass() ->getName(), - 'Method is re-declared in the subclass' + 'Method is re-declared in the subclass', ); } diff --git a/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php b/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php index 959d3a31..70abab98 100644 --- a/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php +++ b/test/unit/SourceLocator/ReplaceSourcePathOfLocatedSourcesTest.php @@ -20,9 +20,7 @@ use function array_filter; use function array_map; -/** - * @covers \Roave\BackwardCompatibility\SourceLocator\ReplaceSourcePathOfLocatedSources - */ +/** @covers \Roave\BackwardCompatibility\SourceLocator\ReplaceSourcePathOfLocatedSources */ final class ReplaceSourcePathOfLocatedSourcesTest extends TestCase { public function testWillWrapFoundReflection(): void @@ -38,14 +36,14 @@ public function testWillWrapFoundReflection(): void ->with( $reflector, self::equalTo(new LocatedSourceWithStrippedSourcesDirectory($source, '/foo')), - $identifier + $identifier, ) ->willReturn($reflection); self::assertSame( $reflection, (new ReplaceSourcePathOfLocatedSources($next, '/foo')) - ->findReflection($reflector, $source, $identifier) + ->findReflection($reflector, $source, $identifier), ); } @@ -62,14 +60,14 @@ public function testWillWrapFoundReflectionsOfType(): void ->with( $reflector, self::equalTo(new LocatedSourceWithStrippedSourcesDirectory($source, '/foo')), - $identifierType + $identifierType, ) ->willReturn([$reflection]); self::assertSame( [$reflection], (new ReplaceSourcePathOfLocatedSources($next, '/foo')) - ->findReflectionsOfType($reflector, $source, $identifierType) + ->findReflectionsOfType($reflector, $source, $identifierType), ); } @@ -85,7 +83,7 @@ public function testAllMethodsOfBaseClassAreOverridden(ReflectionMethod $method) $method ->getDeclaringClass() ->getName(), - 'Method is re-declared in the subclass' + 'Method is re-declared in the subclass', ); } diff --git a/test/unit/SourceLocator/StaticClassMapSourceLocatorTest.php b/test/unit/SourceLocator/StaticClassMapSourceLocatorTest.php index a0488d41..bd3d8bb2 100644 --- a/test/unit/SourceLocator/StaticClassMapSourceLocatorTest.php +++ b/test/unit/SourceLocator/StaticClassMapSourceLocatorTest.php @@ -17,9 +17,7 @@ use Roave\BetterReflection\SourceLocator\Ast\Locator; use Roave\BetterReflection\SourceLocator\Located\LocatedSource; -/** - * @covers \Roave\BackwardCompatibility\SourceLocator\StaticClassMapSourceLocator - */ +/** @covers \Roave\BackwardCompatibility\SourceLocator\StaticClassMapSourceLocator */ final class StaticClassMapSourceLocatorTest extends TestCase { /** @var Locator&MockObject */ @@ -43,7 +41,7 @@ public function testRejectsEmptyKeys(): void new StaticClassMapSourceLocator( ['' => __FILE__], - $this->astLocator + $this->astLocator, ); } @@ -53,7 +51,7 @@ public function testRejectsEmptyStringFiles(): void new StaticClassMapSourceLocator( ['foo' => ''], - $this->astLocator + $this->astLocator, ); } @@ -63,13 +61,11 @@ public function testAcceptsEmptySet(): void self::assertNull($locator->locateIdentifier( $this->reflector, - new Identifier(self::class, new IdentifierType(IdentifierType::IDENTIFIER_CLASS)) + new Identifier(self::class, new IdentifierType(IdentifierType::IDENTIFIER_CLASS)), )); } - /** - * @dataProvider thisClassPossiblePaths - */ + /** @dataProvider thisClassPossiblePaths */ public function testWillLocateThisClass(string $thisClassFilePath): void { $locator = new StaticClassMapSourceLocator([self::class => $thisClassFilePath], $this->astLocator); @@ -91,7 +87,7 @@ public function testWillLocateThisClass(string $thisClassFilePath): void self::assertSame($reflection, $locator->locateIdentifier( $this->reflector, - new Identifier(self::class, new IdentifierType(IdentifierType::IDENTIFIER_CLASS)) + new Identifier(self::class, new IdentifierType(IdentifierType::IDENTIFIER_CLASS)), )); } @@ -118,7 +114,7 @@ public function testWillNotLocateUnknownClass(): void self::assertNull($locator->locateIdentifier( $this->reflector, - new Identifier('Unknown\\ClassName', new IdentifierType(IdentifierType::IDENTIFIER_CLASS)) + new Identifier('Unknown\\ClassName', new IdentifierType(IdentifierType::IDENTIFIER_CLASS)), )); } @@ -133,7 +129,7 @@ public function testWillNotLocateFunctions(): void self::assertNull($locator->locateIdentifier( $this->reflector, - new Identifier(self::class, new IdentifierType(IdentifierType::IDENTIFIER_FUNCTION)) + new Identifier(self::class, new IdentifierType(IdentifierType::IDENTIFIER_FUNCTION)), )); } } diff --git a/test/unit/StringReflectorFactory.php b/test/unit/StringReflectorFactory.php index f1c062cc..35e3f2ef 100644 --- a/test/unit/StringReflectorFactory.php +++ b/test/unit/StringReflectorFactory.php @@ -16,9 +16,7 @@ final class StringReflectorFactory { - /** - * @throws EmptyPhpSourceCode - */ + /** @throws EmptyPhpSourceCode */ public function __invoke(string $sourceCode): Reflector { $astLocator = (new BetterReflection())->astLocator(); @@ -29,7 +27,7 @@ public function __invoke(string $sourceCode): Reflector new PhpInternalSourceLocator($astLocator, $stubber), new EvaledCodeSourceLocator($astLocator, $stubber), new StringSourceLocator($sourceCode, $astLocator), - ]) + ]), ); } } diff --git a/test/unit/TypeRestriction.php b/test/unit/TypeRestriction.php index fad6014c..c6ef3464 100644 --- a/test/unit/TypeRestriction.php +++ b/test/unit/TypeRestriction.php @@ -20,7 +20,7 @@ final class TypeRestriction * * @psalm-template ObjectishParameterType of object */ - public static function object(?object $value): object + public static function object(object|null $value): object { assert($value !== null);