From c749ffbd4b45184a3e81e07ddbc283b37365d006 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 23 Oct 2026 23:48:54 +0200 Subject: [PATCH 01/15] remove @api annotations from classes, methods and constants --- .../NodeAnalyzer/ArgumentAddingScope.php | 9 ------ .../ReplaceFuncCallArgumentDefaultValue.php | 3 -- .../EncapsedStringsToSprintfRector.php | 3 -- .../ValueObject/ObjectMagicMethods.php | 3 -- .../PhpDoc/TagRemover/VarTagRemover.php | 3 -- rules/Naming/Naming/UseImportsResolver.php | 1 - rules/Naming/Naming/VariableNaming.php | 32 +++++++++++++++++++ .../NodeFactory/AnonymousFunctionFactory.php | 1 - .../StrStartWithMatchAndRefactorInterface.php | 4 --- ...ertyAssignToConstructorPromotionRector.php | 9 ------ .../AddSensitiveParameterAttributeRector.php | 3 -- .../NestedFuncCallsToPipeOperatorRector.php | 3 -- .../NodeManipulator/VisibilityManipulator.php | 27 ---------------- .../Contract/RenameAnnotationInterface.php | 3 -- .../Renaming/ValueObject/RenameAnnotation.php | 3 -- .../ValueObject/RenameAnnotationByType.php | 3 -- .../Renaming/ValueObject/RenameAttribute.php | 3 -- .../ValueObject/RenameStaticMethod.php | 3 -- .../Empty_/DisallowedEmptyRuleFixerRector.php | 3 -- .../AttributeKeyToClassConstFetchRector.php | 1 - .../ConstFetchToClassConstFetch.php | 3 -- .../ValueObject/FuncCallToMethodCall.php | 3 -- .../ValueObject/FuncCallToStaticCall.php | 3 -- .../ValueObject/MethodCallToFuncCall.php | 3 -- .../ValueObject/MethodCallToStaticCall.php | 3 -- .../ValueObject/ScalarValueToConstFetch.php | 3 -- .../ValueObject/StaticCallToMethodCall.php | 3 -- .../ValueObject/StringToClassConstant.php | 3 -- .../TypedPropertyFromAssignsRector.php | 3 -- .../AddPropertyTypeDeclaration.php | 3 -- .../ValueObject/AddReturnTypeDeclaration.php | 3 -- src/Application/VersionResolver.php | 8 ----- .../PhpDocNodeDecoratorInterface.php | 3 -- .../PhpDocInfo/PhpDocInfo.php | 9 ------ .../PhpDocInfo/PhpDocInfoFactory.php | 3 -- .../PhpDocManipulator/PhpDocTagRemover.php | 3 -- .../PhpDocManipulator/PhpDocTypeChanger.php | 3 -- .../StaticDoctrineAnnotationParser.php | 1 - .../AbstractValuesAwareNode.php | 3 -- src/Bootstrap/ExtensionConfigResolver.php | 1 - src/Bridge/SetRectorsResolver.php | 1 - src/Caching/CacheFactory.php | 3 -- src/Caching/Detector/ChangedFilesDetector.php | 3 -- src/Composer/InstalledPackageResolver.php | 3 -- src/Composer/ValueObject/InstalledPackage.php | 3 -- src/Config/RectorConfig.php | 3 -- src/Configuration/ConfigurationFactory.php | 1 - .../Contract/DeprecatedInterface.php | 2 -- .../Parameter/SimpleParameterProvider.php | 5 --- src/Configuration/RectorConfigBuilder.php | 3 -- src/Console/ExitCode.php | 3 -- src/Console/Style/SymfonyStyleFactory.php | 3 -- .../LazyContainerFactory.php | 3 -- .../PHPStan/RichParserFactory.php | 3 -- .../NodeAnalyzer/ClassChildAnalyzer.php | 8 ----- .../Reflection/FamilyRelationsAnalyzer.php | 1 - src/NodeAnalyzer/DoctrineEntityAnalyzer.php | 3 -- .../BinaryOpConditionsCollector.php | 1 - src/NodeManipulator/AssignManipulator.php | 1 - .../ClassDependencyManipulator.php | 5 --- .../ClassInsertManipulator.php | 3 -- src/NodeManipulator/ClassManipulator.php | 3 -- src/NodeManipulator/PropertyManipulator.php | 3 -- src/NodeNameResolver/NodeNameResolver.php | 5 --- src/NodeNestingScope/ContextAnalyzer.php | 6 ---- .../PHPStanServicesFactory.php | 27 ---------------- src/NodeTypeResolver/Node/AttributeKey.php | 2 -- src/NodeTypeResolver/NodeTypeResolver.php | 1 - ...orBetterReflectionSourceLocatorFactory.php | 3 -- .../DynamicSourceLocatorProvider.php | 6 ---- .../Contract/SerializableInterface.php | 1 - src/Parallel/ValueObject/BridgeItem.php | 1 - .../NodeFactory/PhpAttributeGroupFactory.php | 3 -- .../SimpleCallableNodeTraverser.php | 4 --- .../PhpDocParser/PhpDocNodeTraverser.php | 10 ------ .../CloningPhpDocNodeVisitor.php | 2 -- .../ParentConnectingPhpDocNodeVisitor.php | 2 -- src/PhpDocParser/ValueObject/AttributeKey.php | 3 -- src/PhpParser/AstResolver.php | 3 -- src/PhpParser/Comparing/NodeComparator.php | 1 - src/PhpParser/Node/BetterNodeFinder.php | 4 --- src/PhpParser/Node/NodeFactory.php | 9 ------ src/PhpParser/Node/Value/ValueResolver.php | 1 - .../NodeFinder/PropertyFetchFinder.php | 1 - src/PhpParser/NodeTransformer.php | 8 ----- src/PhpParser/Parser/InlineCodeParser.php | 2 -- src/PhpParser/Parser/RectorParser.php | 2 -- src/PhpParser/Parser/SimplePhpParser.php | 1 - src/Reflection/ReflectionResolver.php | 6 ---- src/RuleDoc/CodeSample/CodeSample.php | 3 -- .../CodeSample/ConfiguredCodeSample.php | 3 -- .../CodeSample/ExtraFileCodeSample.php | 3 -- .../Contract/DocumentedRuleInterface.php | 3 -- src/RuleDoc/RuleDefinition.php | 3 -- src/Set/ValueObject/LevelSetList.php | 3 -- src/Set/ValueObject/Set.php | 2 -- src/Set/ValueObject/SetList.php | 3 -- src/Skipper/Skipper/Skipper.php | 1 - .../ValueObject/Type/AliasedObjectType.php | 3 -- .../Type/FullyQualifiedObjectType.php | 3 -- .../Type/ShortenedGenericObjectType.php | 3 -- .../ValueObject/Type/ShortenedObjectType.php | 3 -- src/Testing/Fixture/FixtureFileFinder.php | 1 - src/Testing/Fixture/FixtureFileUpdater.php | 1 - src/Testing/Fixture/FixtureSplitter.php | 3 -- src/Testing/Fixture/FixtureTempFileDumper.php | 3 -- src/Testing/PHPUnit/AbstractLazyTestCase.php | 1 - .../PHPUnit/AbstractRectorTestCase.php | 5 --- .../PHPUnit/ValueObject/RectorTestResult.php | 3 -- src/Testing/TestingParser/TestingParser.php | 3 -- src/Util/Reflection/PrivatesAccessor.php | 1 - src/Validation/RectorAssert.php | 3 -- src/ValueObject/MethodName.php | 1 - src/ValueObject/PhpVersion.php | 3 -- src/ValueObject/PolyfillPackage.php | 3 -- .../ComposerPackageConstraintInterface.php | 2 -- .../ValueObject/ComposerPackageConstraint.php | 3 -- 117 files changed, 32 insertions(+), 408 deletions(-) create mode 100644 rules/Naming/Naming/VariableNaming.php diff --git a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php index bd0bfc248a2..47546dddc0c 100644 --- a/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php +++ b/rules/Arguments/NodeAnalyzer/ArgumentAddingScope.php @@ -14,19 +14,10 @@ final readonly class ArgumentAddingScope { - /** - * @api - */ public const string SCOPE_PARENT_CALL = 'parent_call'; - /** - * @api - */ public const string SCOPE_METHOD_CALL = 'method_call'; - /** - * @api - */ public const string SCOPE_CLASS_METHOD = 'class_method'; public function __construct( diff --git a/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php b/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php index dcc0bbb92fd..be0e99c3d7b 100644 --- a/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php +++ b/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php @@ -4,9 +4,6 @@ namespace Rector\Arguments\ValueObject; -/** - * @api - */ final readonly class ReplaceFuncCallArgumentDefaultValue { public function __construct( diff --git a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php index ab47c1187f1..43dcf9e6450 100644 --- a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php +++ b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php @@ -18,9 +18,6 @@ */ final class EncapsedStringsToSprintfRector extends AbstractRector implements ConfigurableRectorInterface, DeprecatedInterface { - /** - * @api - */ public const string ALWAYS = 'always'; /** diff --git a/rules/CodingStyle/ValueObject/ObjectMagicMethods.php b/rules/CodingStyle/ValueObject/ObjectMagicMethods.php index 1b334ce9bec..b4b9a9cfa48 100644 --- a/rules/CodingStyle/ValueObject/ObjectMagicMethods.php +++ b/rules/CodingStyle/ValueObject/ObjectMagicMethods.php @@ -6,9 +6,6 @@ use Rector\ValueObject\MethodName; -/** - * @api designed for public use - */ final class ObjectMagicMethods { /** diff --git a/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php b/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php index 35c2430c88b..060f6ca5b34 100644 --- a/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php +++ b/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php @@ -54,9 +54,6 @@ public function removeVarTagIfUseless(PhpDocInfo $phpDocInfo, Property|ClassCons return true; } - /** - * @api generic - */ public function removeVarTag(Node $node): bool { $phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node); diff --git a/rules/Naming/Naming/UseImportsResolver.php b/rules/Naming/Naming/UseImportsResolver.php index f4fcb24ea7d..e6b329ee0e7 100644 --- a/rules/Naming/Naming/UseImportsResolver.php +++ b/rules/Naming/Naming/UseImportsResolver.php @@ -36,7 +36,6 @@ public function resolve(): array } /** - * @api * @return Use_[] */ public function resolveBareUses(): array diff --git a/rules/Naming/Naming/VariableNaming.php b/rules/Naming/Naming/VariableNaming.php new file mode 100644 index 00000000000..38b607ac67b --- /dev/null +++ b/rules/Naming/Naming/VariableNaming.php @@ -0,0 +1,32 @@ +hasVariableType($valueName)->yes()) { + return $valueName; + } + + // we need to add number suffix until the variable is unique + $i = 2; + $countedValueNamePart = $valueName; + while ($scope->hasVariableType($valueName)->yes()) { + $valueName = $countedValueNamePart . $i; + ++$i; + } + + return $valueName; + } +} diff --git a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php index d84f9305b2c..d4f2dd866a6 100644 --- a/rules/Php72/NodeFactory/AnonymousFunctionFactory.php +++ b/rules/Php72/NodeFactory/AnonymousFunctionFactory.php @@ -48,7 +48,6 @@ public function __construct( } /** - * @api * @param Param[] $params * @param Stmt[] $stmts */ diff --git a/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php b/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php index 639de06ce29..5a9eadde45f 100644 --- a/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php +++ b/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php @@ -15,13 +15,9 @@ interface StrStartWithMatchAndRefactorInterface { - /** - * @api implemented by child classes - */ public function match(Identical|NotIdentical|Equal|NotEqual $binaryOp): ?StrStartsWith; /** - * @api implemented by child classes * @return FuncCall|BooleanNot|null */ public function refactorStrStartsWith(StrStartsWith $strStartsWith): ?Node; diff --git a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php index 75f18faffc8..6337b78cc65 100644 --- a/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php +++ b/rules/Php80/Rector/Class_/ClassPropertyAssignToConstructorPromotionRector.php @@ -53,19 +53,10 @@ */ final class ClassPropertyAssignToConstructorPromotionRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface { - /** - * @api - */ public const string INLINE_PUBLIC = 'inline_public'; - /** - * @api - */ public const string RENAME_PROPERTY = 'rename_property'; - /** - * @api - */ public const string ALLOW_MODEL_BASED_CLASSES = 'allow_model_based_classes'; /** diff --git a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php index 6264720440a..86facd84373 100644 --- a/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php +++ b/rules/Php82/Rector/Param/AddSensitiveParameterAttributeRector.php @@ -20,9 +20,6 @@ */ final class AddSensitiveParameterAttributeRector extends AbstractRector implements ConfigurableRectorInterface, MinPhpVersionInterface, DeprecatedInterface { - /** - * @api - */ public const string SENSITIVE_PARAMETERS = 'sensitive_parameters'; /** diff --git a/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php b/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php index bc96bb6fe4b..3d8bf5670bb 100644 --- a/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php +++ b/rules/Php85/Rector/Expression/NestedFuncCallsToPipeOperatorRector.php @@ -21,9 +21,6 @@ */ final class NestedFuncCallsToPipeOperatorRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface, DeprecatedInterface { - /** - * @api - */ public const string MINIMUM_DEPTH = 'minimum_depth'; /** diff --git a/rules/Privatization/NodeManipulator/VisibilityManipulator.php b/rules/Privatization/NodeManipulator/VisibilityManipulator.php index 85aab8be505..9a13b33a39a 100644 --- a/rules/Privatization/NodeManipulator/VisibilityManipulator.php +++ b/rules/Privatization/NodeManipulator/VisibilityManipulator.php @@ -30,17 +30,11 @@ public function hasVisibility(Class_|ClassMethod|Property|ClassConst|Param $node return (bool) ($node->flags & $visibility); } - /** - * @api - */ public function makeStatic(ClassMethod|Property|ClassConst|Param $node): void { $this->addVisibilityFlag($node, Visibility::STATIC); } - /** - * @api - */ public function makeNonStatic(ClassMethod|Property $node): void { if (! $node->isStatic()) { @@ -50,9 +44,6 @@ public function makeNonStatic(ClassMethod|Property $node): void $node->flags -= Modifiers::STATIC; } - /** - * @api - */ public function makeNonAbstract(ClassMethod|Class_ $node): void { if (! $node->isAbstract()) { @@ -62,17 +53,11 @@ public function makeNonAbstract(ClassMethod|Class_ $node): void $node->flags -= Modifiers::ABSTRACT; } - /** - * @api - */ public function makeFinal(Class_|ClassMethod|Param|ClassConst $node): void { $this->addVisibilityFlag($node, Visibility::FINAL); } - /** - * @api - */ public function makeNonFinal(Class_|ClassMethod|Param $node): void { if (! $this->hasVisibility($node, Visibility::FINAL)) { @@ -101,9 +86,6 @@ public function makePublic(ClassMethod|Property|ClassConst|Param $node): void $this->replaceVisibilityFlag($node, Visibility::PUBLIC); } - /** - * @api - */ public function makeProtected(ClassMethod|Property|ClassConst $node): void { $this->replaceVisibilityFlag($node, Visibility::PROTECTED); @@ -121,9 +103,6 @@ public function makePrivate(ClassMethod|Property|ClassConst|Param $node): void $node->flags &= ~Modifiers::FINAL; } - /** - * @api - */ public function removeFinal(Class_|ClassConst $node): void { $node->flags -= Modifiers::FINAL; @@ -134,9 +113,6 @@ public function makeReadonly(Class_|Property|Param $node): void $this->addVisibilityFlag($node, Visibility::READONLY); } - /** - * @api - */ public function isReadonly(Class_|Property|Param $node): bool { return $this->hasVisibility($node, Visibility::READONLY); @@ -204,9 +180,6 @@ private function removeVisibility(ClassMethod|Property|ClassConst|Param $node): } } - /** - * @api - */ private function addVisibilityFlag(Class_|ClassMethod|Property|ClassConst|Param $node, int $visibility): void { $node->flags |= $visibility; diff --git a/rules/Renaming/Contract/RenameAnnotationInterface.php b/rules/Renaming/Contract/RenameAnnotationInterface.php index 14d8800e8e0..326a70e1afa 100644 --- a/rules/Renaming/Contract/RenameAnnotationInterface.php +++ b/rules/Renaming/Contract/RenameAnnotationInterface.php @@ -4,9 +4,6 @@ namespace Rector\Renaming\Contract; -/** - * @api used in deprecated RenameAnnotationRector configs - */ interface RenameAnnotationInterface { public function getOldAnnotation(): string; diff --git a/rules/Renaming/ValueObject/RenameAnnotation.php b/rules/Renaming/ValueObject/RenameAnnotation.php index 5fbee4ada93..f3b60df1b34 100644 --- a/rules/Renaming/ValueObject/RenameAnnotation.php +++ b/rules/Renaming/ValueObject/RenameAnnotation.php @@ -6,9 +6,6 @@ use Rector\Renaming\Contract\RenameAnnotationInterface; -/** - * @api - */ final readonly class RenameAnnotation implements RenameAnnotationInterface { public function __construct( diff --git a/rules/Renaming/ValueObject/RenameAnnotationByType.php b/rules/Renaming/ValueObject/RenameAnnotationByType.php index 5832e73d5ee..5cbcff35380 100644 --- a/rules/Renaming/ValueObject/RenameAnnotationByType.php +++ b/rules/Renaming/ValueObject/RenameAnnotationByType.php @@ -8,9 +8,6 @@ use Rector\Renaming\Contract\RenameAnnotationInterface; use Rector\Validation\RectorAssert; -/** - * @api used in deprecated RenameAnnotationRector configs - */ final readonly class RenameAnnotationByType implements RenameAnnotationInterface { public function __construct( diff --git a/rules/Renaming/ValueObject/RenameAttribute.php b/rules/Renaming/ValueObject/RenameAttribute.php index 285a84bc712..f97b7fbefc6 100644 --- a/rules/Renaming/ValueObject/RenameAttribute.php +++ b/rules/Renaming/ValueObject/RenameAttribute.php @@ -4,9 +4,6 @@ namespace Rector\Renaming\ValueObject; -/** - * @api - */ final readonly class RenameAttribute { public function __construct( diff --git a/rules/Renaming/ValueObject/RenameStaticMethod.php b/rules/Renaming/ValueObject/RenameStaticMethod.php index 7cb3716e65e..3df7fb0b12d 100644 --- a/rules/Renaming/ValueObject/RenameStaticMethod.php +++ b/rules/Renaming/ValueObject/RenameStaticMethod.php @@ -7,9 +7,6 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; -/** - * @api used in deprecated RenameStaticMethodRector configs - */ final readonly class RenameStaticMethod { public function __construct( diff --git a/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php b/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php index dd733decb78..b8111cc736f 100644 --- a/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php +++ b/rules/Strict/Rector/Empty_/DisallowedEmptyRuleFixerRector.php @@ -19,9 +19,6 @@ */ final class DisallowedEmptyRuleFixerRector extends AbstractRector implements ConfigurableRectorInterface, DeprecatedInterface { - /** - * @api - */ public const string TREAT_AS_NON_EMPTY = 'treat_as_non_empty'; /** diff --git a/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php b/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php index 469d3c16600..550d7141eef 100644 --- a/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php +++ b/rules/Transform/Rector/Attribute/AttributeKeyToClassConstFetchRector.php @@ -26,7 +26,6 @@ use Webmozart\Assert\Assert; /** - * @api used in rector-doctrine * @see \Rector\Tests\Transform\Rector\Attribute\AttributeKeyToClassConstFetchRector\AttributeKeyToClassConstFetchRectorTest */ final class AttributeKeyToClassConstFetchRector extends AbstractRector implements ConfigurableRectorInterface diff --git a/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php b/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php index c9079318c2f..dac185a81d5 100644 --- a/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php +++ b/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php @@ -6,9 +6,6 @@ use Rector\Validation\RectorAssert; -/** - * @api kept for deprecated ConstFetchToClassConstFetchRector code sample - */ final readonly class ConstFetchToClassConstFetch { public function __construct( diff --git a/rules/Transform/ValueObject/FuncCallToMethodCall.php b/rules/Transform/ValueObject/FuncCallToMethodCall.php index d7ff6ad76fb..98b93b933b4 100644 --- a/rules/Transform/ValueObject/FuncCallToMethodCall.php +++ b/rules/Transform/ValueObject/FuncCallToMethodCall.php @@ -7,9 +7,6 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; -/** - * @api used in deprecated FuncCallToMethodCallRector configs - */ final readonly class FuncCallToMethodCall { public function __construct( diff --git a/rules/Transform/ValueObject/FuncCallToStaticCall.php b/rules/Transform/ValueObject/FuncCallToStaticCall.php index a203517e4dc..4be740252a2 100644 --- a/rules/Transform/ValueObject/FuncCallToStaticCall.php +++ b/rules/Transform/ValueObject/FuncCallToStaticCall.php @@ -6,9 +6,6 @@ use Rector\Validation\RectorAssert; -/** - * @api used in deprecated FuncCallToStaticCallRector configs - */ final readonly class FuncCallToStaticCall { public function __construct( diff --git a/rules/Transform/ValueObject/MethodCallToFuncCall.php b/rules/Transform/ValueObject/MethodCallToFuncCall.php index eb1582cccef..953a73869ef 100644 --- a/rules/Transform/ValueObject/MethodCallToFuncCall.php +++ b/rules/Transform/ValueObject/MethodCallToFuncCall.php @@ -4,9 +4,6 @@ namespace Rector\Transform\ValueObject; -/** - * @api used in deprecated MethodCallToFuncCallRector configs - */ final readonly class MethodCallToFuncCall { public function __construct( diff --git a/rules/Transform/ValueObject/MethodCallToStaticCall.php b/rules/Transform/ValueObject/MethodCallToStaticCall.php index 7996fc5e173..d91ee08ab6e 100644 --- a/rules/Transform/ValueObject/MethodCallToStaticCall.php +++ b/rules/Transform/ValueObject/MethodCallToStaticCall.php @@ -7,9 +7,6 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; -/** - * @api used in deprecated MethodCallToStaticCallRector configs - */ final readonly class MethodCallToStaticCall { public function __construct( diff --git a/rules/Transform/ValueObject/ScalarValueToConstFetch.php b/rules/Transform/ValueObject/ScalarValueToConstFetch.php index d669905e2aa..91084ffd106 100644 --- a/rules/Transform/ValueObject/ScalarValueToConstFetch.php +++ b/rules/Transform/ValueObject/ScalarValueToConstFetch.php @@ -10,9 +10,6 @@ use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; -/** - * @api used in deprecated ScalarValueToConstFetchRector configs - */ final readonly class ScalarValueToConstFetch { public function __construct( diff --git a/rules/Transform/ValueObject/StaticCallToMethodCall.php b/rules/Transform/ValueObject/StaticCallToMethodCall.php index 693d3c27697..e6cfd1b5300 100644 --- a/rules/Transform/ValueObject/StaticCallToMethodCall.php +++ b/rules/Transform/ValueObject/StaticCallToMethodCall.php @@ -10,9 +10,6 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; -/** - * @api used in deprecated StaticCallToMethodCallRector configs - */ final readonly class StaticCallToMethodCall { public function __construct( diff --git a/rules/Transform/ValueObject/StringToClassConstant.php b/rules/Transform/ValueObject/StringToClassConstant.php index dc8de619ed1..012d6855fb5 100644 --- a/rules/Transform/ValueObject/StringToClassConstant.php +++ b/rules/Transform/ValueObject/StringToClassConstant.php @@ -6,9 +6,6 @@ use Rector\Validation\RectorAssert; -/** - * @api used in deprecated StringToClassConstantRector configs - */ final readonly class StringToClassConstant { public function __construct( diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php index 7a6cc4def96..d65a0ca44ef 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromAssignsRector.php @@ -40,9 +40,6 @@ */ final class TypedPropertyFromAssignsRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface { - /** - * @api - */ public const string INLINE_PUBLIC = 'inline_public'; /** diff --git a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php index 69d4310ac26..538f1ea9050 100644 --- a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php @@ -7,9 +7,6 @@ use PHPStan\Type\Type; use Rector\Validation\RectorAssert; -/** - * @api used in deprecated AddPropertyTypeDeclarationRector configs - */ final readonly class AddPropertyTypeDeclaration { public function __construct( diff --git a/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php index 67ee85f58ca..a3e357f0c2d 100644 --- a/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php @@ -8,9 +8,6 @@ use PHPStan\Type\Type; use Rector\Validation\RectorAssert; -/** - * @api - */ final readonly class AddReturnTypeDeclaration { public function __construct( diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index dffbe0bb260..6bf990e2e67 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -8,8 +8,6 @@ use Rector\Exception\VersionException; /** - * @api - * * Inspired by https://github.com/composer/composer/blob/master/src/Composer/Composer.php * See https://github.com/composer/composer/blob/6587715d0f8cae0cd39073b3bc5f018d0e6b84fe/src/Composer/Compiler.php#L208 * @@ -17,14 +15,8 @@ */ final class VersionResolver { - /** - * @api - */ public const string PACKAGE_VERSION = '@package_version@'; - /** - * @api - */ public const string RELEASE_DATE = '@release_date@'; private const int SUCCESS_CODE = 0; diff --git a/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php b/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php index c95b4bc56b4..7d556956015 100644 --- a/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php +++ b/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php @@ -9,8 +9,5 @@ interface PhpDocNodeDecoratorInterface { - /** - * @api implemented by child classes - */ public function decorate(PhpDocNode $phpDocNode, Node $phpNode): void; } diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index 5313f86c574..2e273b93093 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -83,9 +83,6 @@ public function __construct( } } - /** - * @api - */ public function addPhpDocTagNode(PhpDocChildNode $phpDocChildNode): void { $this->phpDocNode->children[] = $phpDocChildNode; @@ -192,9 +189,6 @@ public function hasByName(string $name): bool return (bool) $this->getTagsByName($name); } - /** - * @api - */ public function getByName(string $name): ?Node { return $this->getTagsByName($name)[0] ?? null; @@ -213,9 +207,6 @@ public function getByAnnotationClasses(array $classes): ?DoctrineAnnotationTagVa return $doctrineAnnotationTagValueNodes[0] ?? null; } - /** - * @api doctrine/symfony - */ public function getByAnnotationClass(string $class): ?DoctrineAnnotationTagValueNode { $doctrineAnnotationTagValueNodes = $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClass( diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php index da18a89d026..a08a9a5a702 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfoFactory.php @@ -84,9 +84,6 @@ public function createFromNode(Node $node): ?PhpDocInfo return $phpDocInfo; } - /** - * @api downgrade - */ public function createEmpty(Node $node): PhpDocInfo { $phpDocNode = new PhpDocNode([]); diff --git a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php index 52dd2f478f8..d808b41ca95 100644 --- a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php +++ b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php @@ -12,9 +12,6 @@ final class PhpDocTagRemover { - /** - * @api phpunit - */ public function removeByName(PhpDocInfo $phpDocInfo, string $name): bool { $hasChanged = false; diff --git a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php index f268cdeb472..36ea90cd960 100644 --- a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php +++ b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTypeChanger.php @@ -241,9 +241,6 @@ public function isAllowed(TypeNode $typeNode): bool return in_array((string) $typeNode, self::ALLOWED_IDENTIFIER_TYPENODE_TYPES, true); } - /** - * @api downgrade - */ public function changeVarTypeNode(Stmt $stmt, PhpDocInfo $phpDocInfo, TypeNode $typeNode): void { $existingVarTagValueNode = $phpDocInfo->getVarTagValueNode(); diff --git a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php index 3201d33f527..9060082495c 100644 --- a/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php +++ b/src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php @@ -49,7 +49,6 @@ public function resolveAnnotationMethodCall(BetterTokenIterator $tokenIterator, } /** - * @api tests * @see https://github.com/doctrine/annotations/blob/c66f06b7c83e9a2a7523351a9d5a4b55f885e574/lib/Doctrine/Common/Annotations/DocParser.php#L1215-L1224 * @return CurlyListNode|string|array|ConstExprNode|DoctrineAnnotationTagValueNode|StringNode */ diff --git a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php index 94d92f64a6b..b5c387dfcb4 100644 --- a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php +++ b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php @@ -26,9 +26,6 @@ public function __construct( ) { } - /** - * @api - */ public function removeValue(string $desiredKey): void { foreach ($this->values as $key => $value) { diff --git a/src/Bootstrap/ExtensionConfigResolver.php b/src/Bootstrap/ExtensionConfigResolver.php index 3d700341342..0e2841d3677 100644 --- a/src/Bootstrap/ExtensionConfigResolver.php +++ b/src/Bootstrap/ExtensionConfigResolver.php @@ -10,7 +10,6 @@ final class ExtensionConfigResolver { /** - * @api * @return string[] */ public function provide(): array diff --git a/src/Bridge/SetRectorsResolver.php b/src/Bridge/SetRectorsResolver.php index c54c7240302..93a505f0e50 100644 --- a/src/Bridge/SetRectorsResolver.php +++ b/src/Bridge/SetRectorsResolver.php @@ -9,7 +9,6 @@ use Webmozart\Assert\Assert; /** - * @api * Utils class to ease building bridges by 3rd-party tools * * @see \Rector\Tests\Bridge\SetRectorsResolverTest diff --git a/src/Caching/CacheFactory.php b/src/Caching/CacheFactory.php index eb1ec6f7b02..f120565ab61 100644 --- a/src/Caching/CacheFactory.php +++ b/src/Caching/CacheFactory.php @@ -16,9 +16,6 @@ public function __construct( ) { } - /** - * @api config factory - */ public function create(): Cache { $cacheDirectory = SimpleParameterProvider::provideStringParameter(Option::CACHE_DIR); diff --git a/src/Caching/Detector/ChangedFilesDetector.php b/src/Caching/Detector/ChangedFilesDetector.php index dcc897dc09a..173cfabc055 100644 --- a/src/Caching/Detector/ChangedFilesDetector.php +++ b/src/Caching/Detector/ChangedFilesDetector.php @@ -97,9 +97,6 @@ public function clear(): void $this->cache->clear(); } - /** - * @api - */ public function setFirstResolvedConfigFileInfo(string $filePath): void { // the first config is core to all → if it was changed, just invalidate it diff --git a/src/Composer/InstalledPackageResolver.php b/src/Composer/InstalledPackageResolver.php index c401866de8e..1a4d568cf12 100644 --- a/src/Composer/InstalledPackageResolver.php +++ b/src/Composer/InstalledPackageResolver.php @@ -47,9 +47,6 @@ public function __construct( Assert::directory($this->projectDirectory); } - /** - * @api used in tests to resolve the versions from a standalone "composer.json" - */ public function changeComposerJsonFilePath(?string $composerJsonFilePath): void { $this->composerJsonFilePath = $composerJsonFilePath; diff --git a/src/Composer/ValueObject/InstalledPackage.php b/src/Composer/ValueObject/InstalledPackage.php index 291c7c389ab..0e19e21c1d1 100644 --- a/src/Composer/ValueObject/InstalledPackage.php +++ b/src/Composer/ValueObject/InstalledPackage.php @@ -4,9 +4,6 @@ namespace Rector\Composer\ValueObject; -/** - * @api - */ final readonly class InstalledPackage { public function __construct( diff --git a/src/Config/RectorConfig.php b/src/Config/RectorConfig.php index deeb9ea9ff3..7c9637c3ca6 100644 --- a/src/Config/RectorConfig.php +++ b/src/Config/RectorConfig.php @@ -27,7 +27,6 @@ use Webmozart\Assert\Assert; /** - * @api * @see \Rector\Tests\Config\RectorConfigTest */ final class RectorConfig extends Container @@ -373,7 +372,6 @@ public function phpVersion(int $phpVersion): void /** * @internal * - * @api only for testing. It is parsed from composer.json "require" packages by default * @param array $polyfillPackages */ public function polyfillPackages(array $polyfillPackages): void @@ -484,7 +482,6 @@ public function indent(string $character, int $count): void /** * @internal - * @api used only in tests */ public function resetRuleConfigurations(): void { diff --git a/src/Configuration/ConfigurationFactory.php b/src/Configuration/ConfigurationFactory.php index b6ccf99055c..e2bceff3ab1 100644 --- a/src/Configuration/ConfigurationFactory.php +++ b/src/Configuration/ConfigurationFactory.php @@ -26,7 +26,6 @@ public function __construct( } /** - * @api used in tests * @param string[] $paths */ public function createForTests(array $paths): Configuration diff --git a/src/Configuration/Deprecation/Contract/DeprecatedInterface.php b/src/Configuration/Deprecation/Contract/DeprecatedInterface.php index 668828f4281..67de8970e15 100644 --- a/src/Configuration/Deprecation/Contract/DeprecatedInterface.php +++ b/src/Configuration/Deprecation/Contract/DeprecatedInterface.php @@ -5,8 +5,6 @@ namespace Rector\Configuration\Deprecation\Contract; /** - * @api - * * Marker interface that should be implemented by all deprecated rules and services. * It helps to notify user about the deprecation on the fly, before they get removed. */ diff --git a/src/Configuration/Parameter/SimpleParameterProvider.php b/src/Configuration/Parameter/SimpleParameterProvider.php index b1dd3641cd5..e3aad337649 100644 --- a/src/Configuration/Parameter/SimpleParameterProvider.php +++ b/src/Configuration/Parameter/SimpleParameterProvider.php @@ -9,9 +9,6 @@ use Rector\Skipper\FileSystem\PathNormalizer; use Webmozart\Assert\Assert; -/** - * @api - */ final class SimpleParameterProvider { /** @@ -154,7 +151,6 @@ public static function provideBoolParameter(string $name, ?bool $default = null) } /** - * @api * Strict hash for cache invalidation. Ignored and directionally compared parameters are left * out, so only a real change to an output-affecting parameter drops the cache. */ @@ -183,7 +179,6 @@ public static function hashForCacheInvalidation(): string } /** - * @api * @return array{rules: mixed[], sets: mixed[], skip: mixed[]} */ public static function provideCacheDirectionalParameters(): array diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 23199b2f1b0..53d885f5888 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -36,9 +36,6 @@ use Symfony\Component\Finder\Finder; use Webmozart\Assert\Assert; -/** - * @api - */ final class RectorConfigBuilder { private const int MAX_LEVEL_GAP = 10; diff --git a/src/Console/ExitCode.php b/src/Console/ExitCode.php index 046efbd7711..5a004e206d7 100644 --- a/src/Console/ExitCode.php +++ b/src/Console/ExitCode.php @@ -6,9 +6,6 @@ use Symfony\Component\Console\Command\Command; -/** - * @api - */ final class ExitCode { public const int SUCCESS = Command::SUCCESS; diff --git a/src/Console/Style/SymfonyStyleFactory.php b/src/Console/Style/SymfonyStyleFactory.php index 55fc6e36be4..f68d70c300a 100644 --- a/src/Console/Style/SymfonyStyleFactory.php +++ b/src/Console/Style/SymfonyStyleFactory.php @@ -18,9 +18,6 @@ public function __construct( ) { } - /** - * @api - */ public function create(): RectorStyle { $_SERVER['argv'] ??= []; diff --git a/src/DependencyInjection/LazyContainerFactory.php b/src/DependencyInjection/LazyContainerFactory.php index 37af84700bc..efeee525f90 100644 --- a/src/DependencyInjection/LazyContainerFactory.php +++ b/src/DependencyInjection/LazyContainerFactory.php @@ -116,9 +116,6 @@ final class LazyContainerFactory ClassReflectionFactory::class, ]; - /** - * @api used as next rectorConfig factory - */ public function create(): RectorConfig { $rectorConfig = new RectorConfig(); diff --git a/src/DependencyInjection/PHPStan/RichParserFactory.php b/src/DependencyInjection/PHPStan/RichParserFactory.php index 8d32a5e65a3..3ac90de0eb2 100644 --- a/src/DependencyInjection/PHPStan/RichParserFactory.php +++ b/src/DependencyInjection/PHPStan/RichParserFactory.php @@ -31,9 +31,6 @@ public function __construct( ) { } - /** - * @api used by config/phpstan/parser.neon - */ public function create(): RichParser { return new RichParser( diff --git a/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php b/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php index cfd91937ce9..ae068aaa8ad 100644 --- a/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php +++ b/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php @@ -10,15 +10,10 @@ use PHPStan\Type\MixedType; use PHPStan\Type\Type; -/** - * @api - */ final readonly class ClassChildAnalyzer { /** * Look both parent class and interface, yes, all PHP interface methods are abstract - * - * @api rector-symfony */ public function hasAbstractParentClassMethod(ClassReflection $classReflection, string $methodName): bool { @@ -33,9 +28,6 @@ public function hasAbstractParentClassMethod(ClassReflection $classReflection, s ); } - /** - * @api downgrade - */ public function resolveParentClassMethodReturnType(ClassReflection $classReflection, string $methodName): Type { $parentClassMethods = $this->resolveParentClassMethods($classReflection, $methodName); diff --git a/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php b/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php index 918a5ab5c8c..ff598ed13a3 100644 --- a/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php +++ b/src/FamilyTree/Reflection/FamilyRelationsAnalyzer.php @@ -20,7 +20,6 @@ public function __construct( } /** - * @api * @return string[] */ public function getClassLikeAncestorNames(Class_|Interface_|Name $classOrName): array diff --git a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php index e9dce6221a8..4508d76cd0a 100644 --- a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php +++ b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php @@ -10,9 +10,6 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; -/** - * @api used in doctrine - */ final readonly class DoctrineEntityAnalyzer { /** diff --git a/src/NodeCollector/BinaryOpConditionsCollector.php b/src/NodeCollector/BinaryOpConditionsCollector.php index ac258021059..6d2f781e36a 100644 --- a/src/NodeCollector/BinaryOpConditionsCollector.php +++ b/src/NodeCollector/BinaryOpConditionsCollector.php @@ -21,7 +21,6 @@ final class BinaryOpConditionsCollector * Similarly, for right-associative operations (e.g. `a ?? b ?? c`), the result produced by * the implicit parenthesization (`[a, b ?? c]`) might not match the expectations. * - * @api * @param class-string $binaryOpClass * @return array */ diff --git a/src/NodeManipulator/AssignManipulator.php b/src/NodeManipulator/AssignManipulator.php index 7240eb46b5e..5c88d209f84 100644 --- a/src/NodeManipulator/AssignManipulator.php +++ b/src/NodeManipulator/AssignManipulator.php @@ -63,7 +63,6 @@ public function matchListAndEach(Assign $assign): ?ListAndEach } /** - * @api doctrine * @return array */ public function resolveAssignsToLocalPropertyFetches(FunctionLike $functionLike): array diff --git a/src/NodeManipulator/ClassDependencyManipulator.php b/src/NodeManipulator/ClassDependencyManipulator.php index e51993b8f55..7b252b08be7 100644 --- a/src/NodeManipulator/ClassDependencyManipulator.php +++ b/src/NodeManipulator/ClassDependencyManipulator.php @@ -33,7 +33,6 @@ use Rector\ValueObject\PhpVersionFeature; /** - * @api used by rector-symfony and rector-doctrine * @see \Rector\Tests\NodeManipulator\ClassDependencyManipulatorTest */ final readonly class ClassDependencyManipulator @@ -104,9 +103,6 @@ public function addConstructorDependency(Class_ $class, PropertyMetadata $proper ); } - /** - * @api doctrine - */ public function addConstructorDependencyWithCustomAssign( Class_ $class, string $name, @@ -160,7 +156,6 @@ public function addConstructorDependencyWithCustomAssign( } /** - * @api doctrine * @param Stmt[] $stmts */ public function addStmtsToConstructorIfNotThereYet(Class_ $class, array $stmts): void diff --git a/src/NodeManipulator/ClassInsertManipulator.php b/src/NodeManipulator/ClassInsertManipulator.php index fda1ab7fd16..2984e94d17c 100644 --- a/src/NodeManipulator/ClassInsertManipulator.php +++ b/src/NodeManipulator/ClassInsertManipulator.php @@ -19,9 +19,6 @@ public function __construct( ) { } - /** - * @api - */ public function addAsFirstMethod(Class_ $class, Property|ClassConst|ClassMethod $addedStmt): void { $scope = $class->getAttribute(AttributeKey::SCOPE); diff --git a/src/NodeManipulator/ClassManipulator.php b/src/NodeManipulator/ClassManipulator.php index 6c8f680975c..bc6e7e85250 100644 --- a/src/NodeManipulator/ClassManipulator.php +++ b/src/NodeManipulator/ClassManipulator.php @@ -36,9 +36,6 @@ public function hasParentMethodOrInterface(ObjectType $objectType, string $oldMe return false; } - /** - * @api phpunit - */ public function hasTrait(Class_ $class, string $desiredTrait): bool { foreach ($class->getTraitUses() as $traitUse) { diff --git a/src/NodeManipulator/PropertyManipulator.php b/src/NodeManipulator/PropertyManipulator.php index 6e081d6bcaf..921c3a75278 100644 --- a/src/NodeManipulator/PropertyManipulator.php +++ b/src/NodeManipulator/PropertyManipulator.php @@ -113,9 +113,6 @@ public function isPropertyChangeableExceptConstructor( return false; } - /** - * @api Used in rector-symfony - */ public function resolveExistingClassPropertyNameByType(Class_ $class, ObjectType $objectType): ?string { foreach ($class->getProperties() as $property) { diff --git a/src/NodeNameResolver/NodeNameResolver.php b/src/NodeNameResolver/NodeNameResolver.php index 1eb49fdd4e5..812760d3e8c 100644 --- a/src/NodeNameResolver/NodeNameResolver.php +++ b/src/NodeNameResolver/NodeNameResolver.php @@ -127,9 +127,6 @@ public function getName(Node|string $node): ?string return (string) $node->name; } - /** - * @api - */ public function areNamesEqual(Node $firstNode, Node $secondNode): bool { $secondResolvedName = $this->getName($secondNode); @@ -141,8 +138,6 @@ public function areNamesEqual(Node $firstNode, Node $secondNode): bool } /** - * @api - * * @param Name[]|Node[] $nodes * @return string[] */ diff --git a/src/NodeNestingScope/ContextAnalyzer.php b/src/NodeNestingScope/ContextAnalyzer.php index 40588d7e85c..a38a23703ea 100644 --- a/src/NodeNestingScope/ContextAnalyzer.php +++ b/src/NodeNestingScope/ContextAnalyzer.php @@ -12,17 +12,11 @@ final class ContextAnalyzer { - /** - * @api - */ public function isInLoop(Node $node): bool { return $node->getAttribute(AttributeKey::IS_IN_LOOP_OR_SWITCH) === true; } - /** - * @api - */ public function isInIf(Node $node): bool { return $node->getAttribute(AttributeKey::IS_IN_IF) === true; diff --git a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php index 8755e439efa..100f3e21766 100644 --- a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php +++ b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php @@ -69,41 +69,26 @@ public function __construct() } } - /** - * @api - */ public function createReflectionProvider(): ReflectionProvider { return $this->container->getByType(ReflectionProvider::class); } - /** - * @api - */ public function createEmulativeLexer(): Lexer { return $this->container->getService('currentPhpVersionLexer'); } - /** - * @api - */ public function createPHPStanParser(): Parser { return $this->container->getService('currentPhpVersionRichParser'); } - /** - * @api - */ public function createNodeScopeResolver(): NodeScopeResolver { return $this->container->getByType(NodeScopeResolver::class); } - /** - * @api - */ public function createScopeFactory(): ScopeFactory { return $this->container->getByType(ScopeFactory::class); @@ -120,33 +105,21 @@ public function getByType(string $type): object return $this->container->getByType($type); } - /** - * @api - */ public function createFileHelper(): FileHelper { return $this->container->getByType(FileHelper::class); } - /** - * @api - */ public function createTypeNodeResolver(): TypeNodeResolver { return $this->container->getByType(TypeNodeResolver::class); } - /** - * @api - */ public function createDynamicSourceLocatorProvider(): DynamicSourceLocatorProvider { return $this->container->getByType(DynamicSourceLocatorProvider::class); } - /** - * @api - */ public function getContainer(): Container { return $this->container; diff --git a/src/NodeTypeResolver/Node/AttributeKey.php b/src/NodeTypeResolver/Node/AttributeKey.php index 0539d4b4dce..6ab073d31ec 100644 --- a/src/NodeTypeResolver/Node/AttributeKey.php +++ b/src/NodeTypeResolver/Node/AttributeKey.php @@ -46,8 +46,6 @@ final class AttributeKey public const string NAMESPACED_NAME = 'namespacedName'; /** - * @api - * * Internal php-parser name. * Do not change this even if you want! */ diff --git a/src/NodeTypeResolver/NodeTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver.php index a516fe7a2b9..36c3ae4595b 100644 --- a/src/NodeTypeResolver/NodeTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver.php @@ -93,7 +93,6 @@ public function __construct( } /** - * @api doctrine symfony * @param ObjectType[] $requiredTypes */ public function isObjectTypes(Node $node, array $requiredTypes): bool diff --git a/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php b/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php index 0c74e8f7c5e..dccfc25a3f3 100644 --- a/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php +++ b/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php @@ -9,9 +9,6 @@ use PHPStan\Reflection\BetterReflection\BetterReflectionSourceLocatorFactory; use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator; -/** - * @api used on phpstan config factory - */ final readonly class RectorBetterReflectionSourceLocatorFactory { public function __construct( diff --git a/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php b/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php index f5fc2e9dd12..cbb21205bdf 100644 --- a/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php +++ b/src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php @@ -11,9 +11,6 @@ use Rector\Contract\DependencyInjection\ResettableInterface; use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment; -/** - * @api phpstan external - */ final class DynamicSourceLocatorProvider implements ResettableInterface { /** @@ -82,9 +79,6 @@ public function arePathsEmpty(): bool return $this->filePaths === [] && $this->directories === []; } - /** - * @api to allow fast single-container tests - */ public function reset(): void { $this->filePaths = []; diff --git a/src/Parallel/Contract/SerializableInterface.php b/src/Parallel/Contract/SerializableInterface.php index a08a6a9e890..250986e4c66 100644 --- a/src/Parallel/Contract/SerializableInterface.php +++ b/src/Parallel/Contract/SerializableInterface.php @@ -9,7 +9,6 @@ interface SerializableInterface extends JsonSerializable { /** - * @api implemented by child classes * @param array $json */ public static function decode(array $json): self; diff --git a/src/Parallel/ValueObject/BridgeItem.php b/src/Parallel/ValueObject/BridgeItem.php index e743242e190..e4fd074840e 100644 --- a/src/Parallel/ValueObject/BridgeItem.php +++ b/src/Parallel/ValueObject/BridgeItem.php @@ -5,7 +5,6 @@ namespace Rector\Parallel\ValueObject; /** - * @api * Helpers constant for passing constant names around */ final class BridgeItem diff --git a/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php b/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php index 88e9a6c0367..7275966c732 100644 --- a/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php +++ b/src/PhpAttribute/NodeFactory/PhpAttributeGroupFactory.php @@ -59,7 +59,6 @@ public function createFromClass(string $attributeClass, ?string $value = null): } /** - * @api tests * @param mixed[] $items */ public function createFromClassWithItems(string $attributeClass, array $items): AttributeGroup @@ -101,8 +100,6 @@ public function create( } /** - * @api tests - * * @param ArrayItemNode[]|mixed[] $items * @param string $attributeClass @deprecated * @param string[] $classReferencedFields diff --git a/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php b/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php index 7e7e91ea15e..ea039bb4d29 100644 --- a/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php +++ b/src/PhpDocParser/NodeTraverser/SimpleCallableNodeTraverser.php @@ -8,16 +8,12 @@ use PhpParser\NodeTraverser; use Rector\PhpDocParser\NodeVisitor\CallableNodeVisitor; -/** - * @api - */ final class SimpleCallableNodeTraverser { /** * @param Node|Node[]|null $node * * @param callable(Node $node): (int|Node|null|Node[]) $callable - * @api shortcut helper */ public static function traverse(Node|array|null $node, callable $callable): void { diff --git a/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php b/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php index e668268c27b..c010e058392 100644 --- a/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php +++ b/src/PhpDocParser/PhpDocParser/PhpDocNodeTraverser.php @@ -10,8 +10,6 @@ use Rector\PhpDocParser\PhpDocParser\PhpDocNodeVisitor\CallablePhpDocNodeVisitor; /** - * @api - * * Mimics * https://github.com/nikic/PHP-Parser/blob/4abdcde5f16269959a834e4e58ea0ba0938ab133/lib/PhpParser/NodeTraverser.php * @@ -25,8 +23,6 @@ final class PhpDocNodeTraverser * * For subsequent visitors enterNode() will still be called on the current node and leaveNode() will also be invoked * for the current node. - * - * @api */ public const int DONT_TRAVERSE_CHILDREN = 1; @@ -34,8 +30,6 @@ final class PhpDocNodeTraverser * If NodeVisitor::enterNode() or NodeVisitor::leaveNode() returns STOP_TRAVERSAL, traversal is aborted. * * The afterTraverse() method will still be invoked. - * - * @api */ public const int STOP_TRAVERSAL = 2; @@ -44,8 +38,6 @@ final class PhpDocNodeTraverser * array. * * For subsequent visitors leaveNode() will still be invoked for the removed node. - * - * @api */ public const int NODE_REMOVE = 3; @@ -55,8 +47,6 @@ final class PhpDocNodeTraverser * * For subsequent visitors enterNode() will not be called as well. leaveNode() will be invoked for visitors that has * enterNode() method invoked. - * - * @api */ public const int DONT_TRAVERSE_CURRENT_AND_CHILDREN = 4; diff --git a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CloningPhpDocNodeVisitor.php b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CloningPhpDocNodeVisitor.php index e51e7e528ec..83a81697d96 100644 --- a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CloningPhpDocNodeVisitor.php +++ b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/CloningPhpDocNodeVisitor.php @@ -8,8 +8,6 @@ use Rector\PhpDocParser\PhpDocParser\ValueObject\PhpDocAttributeKey; /** - * @api - * * Mirrors * https://github.com/nikic/PHP-Parser/blob/d520bc9e1d6203c35a1ba20675b79a051c821a9e/lib/PhpParser/NodeVisitor/CloningVisitor.php */ diff --git a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php index b12645fba2b..377ad3a7ede 100644 --- a/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php +++ b/src/PhpDocParser/PhpDocParser/PhpDocNodeVisitor/ParentConnectingPhpDocNodeVisitor.php @@ -8,8 +8,6 @@ use Rector\PhpDocParser\PhpDocParser\ValueObject\PhpDocAttributeKey; /** - * @api - * * Mimics https://github.com/nikic/PHP-Parser/blob/master/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php * * @see \Rector\Tests\PhpDocParser\PhpDocParser\PhpDocNodeVisitor\ParentConnectingPhpDocNodeVisitorTest diff --git a/src/PhpDocParser/ValueObject/AttributeKey.php b/src/PhpDocParser/ValueObject/AttributeKey.php index 6525de98375..0a20140db16 100644 --- a/src/PhpDocParser/ValueObject/AttributeKey.php +++ b/src/PhpDocParser/ValueObject/AttributeKey.php @@ -4,9 +4,6 @@ namespace Rector\PhpDocParser\ValueObject; -/** - * @api - */ final class AttributeKey { /** diff --git a/src/PhpParser/AstResolver.php b/src/PhpParser/AstResolver.php index 00f8015d484..5c4cf0e4dab 100644 --- a/src/PhpParser/AstResolver.php +++ b/src/PhpParser/AstResolver.php @@ -57,9 +57,6 @@ public function __construct( ) { } - /** - * @api downgrade - */ public function resolveClassFromName(string $className): Class_|Trait_|Interface_|Enum_|null { if (! $this->reflectionProvider->hasClass($className)) { diff --git a/src/PhpParser/Comparing/NodeComparator.php b/src/PhpParser/Comparing/NodeComparator.php index 86fab84cf91..d6d5def80d6 100644 --- a/src/PhpParser/Comparing/NodeComparator.php +++ b/src/PhpParser/Comparing/NodeComparator.php @@ -42,7 +42,6 @@ public function areNodesEqual(Node|null $firstNode, Node|null $secondNode): bool } /** - * @api * @param Node[] $availableNodes */ public function isNodeEqual(Node $singleNode, array $availableNodes): bool diff --git a/src/PhpParser/Node/BetterNodeFinder.php b/src/PhpParser/Node/BetterNodeFinder.php index ffdfa22b7ef..6cbb76d6b44 100644 --- a/src/PhpParser/Node/BetterNodeFinder.php +++ b/src/PhpParser/Node/BetterNodeFinder.php @@ -76,7 +76,6 @@ public function findFirstInstanceOf(Node|array $nodes, string $type): ?Node } /** - * @api * @param Node|Node[] $nodes * @return Variable|null */ @@ -110,7 +109,6 @@ public function find(Node|array $nodes, callable $filter): array } /** - * @api symfony * @param Node[] $nodes * @return Class_|null */ @@ -195,8 +193,6 @@ function (Node $subNode) use (&$returns): ?int { } /** - * @api to be used - * * @template T of Node * @param Node[] $nodes * @param class-string|array> $types diff --git a/src/PhpParser/Node/NodeFactory.php b/src/PhpParser/Node/NodeFactory.php index 7066a6e736c..eb644975dbf 100644 --- a/src/PhpParser/Node/NodeFactory.php +++ b/src/PhpParser/Node/NodeFactory.php @@ -150,9 +150,6 @@ public function createPropertyAssignment(string $propertyName): Assign return $this->createPropertyAssignmentWithExpr($propertyName, $variable); } - /** - * @api - */ public function createPropertyAssignmentWithExpr(string $propertyName, Expr $expr): Assign { $propertyFetch = $this->createPropertyFetch(self::THIS, $propertyName); @@ -198,7 +195,6 @@ public function createPrivatePropertyFromNameAndType(string $name, ?Type $type): } /** - * @api symfony * @param mixed[] $arguments */ public function createLocalMethodCall(string $method, array $arguments = []): MethodCall @@ -208,7 +204,6 @@ public function createLocalMethodCall(string $method, array $arguments = []): Me } /** - * @api symfony, doctrine, phpunit * @param mixed[] $arguments */ public function createMethodCall(Expr|string $exprOrVariableName, string $method, array $arguments = []): MethodCall @@ -223,9 +218,6 @@ public function createPropertyFetch(string|Expr $variableNameOrExpr, string $pro return $this->builderFactory->propertyFetch($fetcherExpr, $property); } - /** - * @api doctrine - */ public function createPrivateProperty(string $name): Property { $propertyBuilder = new PropertyBuilder($name); @@ -327,7 +319,6 @@ public function createTrue(): ConstFetch } /** - * @api phpunit * @param string|ObjectReference::* $constantName */ public function createClassConstFetchFromName(Name $className, string $constantName): ClassConstFetch diff --git a/src/PhpParser/Node/Value/ValueResolver.php b/src/PhpParser/Node/Value/ValueResolver.php index 77a9b830dec..fb0aa944793 100644 --- a/src/PhpParser/Node/Value/ValueResolver.php +++ b/src/PhpParser/Node/Value/ValueResolver.php @@ -112,7 +112,6 @@ public function getValue(Arg|Expr|InterpolatedStringPart $expr, bool $resolvedCl } /** - * @api symfony * @param mixed[] $expectedValues */ public function isValues(Expr $expr, array $expectedValues): bool diff --git a/src/PhpParser/NodeFinder/PropertyFetchFinder.php b/src/PhpParser/NodeFinder/PropertyFetchFinder.php index a138dde4634..f26332c0e9b 100644 --- a/src/PhpParser/NodeFinder/PropertyFetchFinder.php +++ b/src/PhpParser/NodeFinder/PropertyFetchFinder.php @@ -72,7 +72,6 @@ public function findPrivatePropertyFetches( } /** - * @api used by other Rector packages * @return PropertyFetch[]|StaticPropertyFetch[]|NullsafePropertyFetch[] */ public function findLocalPropertyFetchesByName(Class_|ClassMethod $node, string $paramName): array diff --git a/src/PhpParser/NodeTransformer.php b/src/PhpParser/NodeTransformer.php index 278b65c1b28..c2b87738c73 100644 --- a/src/PhpParser/NodeTransformer.php +++ b/src/PhpParser/NodeTransformer.php @@ -19,9 +19,6 @@ use Rector\Util\StringUtils; use Rector\ValueObject\SprintfStringAndArgs; -/** - * @api used in phpunit - */ final class NodeTransformer { /** @@ -30,8 +27,6 @@ final class NodeTransformer private const string PERCENT_TEXT_REGEX = '#^%\w$#'; /** - * @api used in phpunit symfony - * * From: * - sprintf("Hi %s", $name); * @@ -88,9 +83,6 @@ public function transformArrayToYields(Array_ $array): array return $yields; } - /** - * @api symfony - */ public function transformConcatToStringArray(Concat $concat): Array_ { $arrayItems = $this->transformConcatToItems($concat); diff --git a/src/PhpParser/Parser/InlineCodeParser.php b/src/PhpParser/Parser/InlineCodeParser.php index ca64905f5e5..fea5eca842f 100644 --- a/src/PhpParser/Parser/InlineCodeParser.php +++ b/src/PhpParser/Parser/InlineCodeParser.php @@ -65,8 +65,6 @@ public function __construct( } /** - * @api downgrade - * * @return Stmt[] */ public function parseFile(string $fileName): array diff --git a/src/PhpParser/Parser/RectorParser.php b/src/PhpParser/Parser/RectorParser.php index 7bf6dbb162a..84d1626369e 100644 --- a/src/PhpParser/Parser/RectorParser.php +++ b/src/PhpParser/Parser/RectorParser.php @@ -24,8 +24,6 @@ public function __construct( } /** - * @api used by rector-symfony - * * @return Stmt[] */ public function parseFile(string $filePath): array diff --git a/src/PhpParser/Parser/SimplePhpParser.php b/src/PhpParser/Parser/SimplePhpParser.php index b1afa8cf229..524f06a4407 100644 --- a/src/PhpParser/Parser/SimplePhpParser.php +++ b/src/PhpParser/Parser/SimplePhpParser.php @@ -28,7 +28,6 @@ public function __construct() } /** - * @api tests * @return Node[] */ public function parseFile(string $filePath): array diff --git a/src/Reflection/ReflectionResolver.php b/src/Reflection/ReflectionResolver.php index 3e333f007bb..5b07f5b2fb4 100644 --- a/src/Reflection/ReflectionResolver.php +++ b/src/Reflection/ReflectionResolver.php @@ -47,9 +47,6 @@ public function __construct( ) { } - /** - * @api - */ public function resolveClassAndAnonymousClass(ClassLike $classLike): ClassReflection { if ($classLike instanceof Class_ && $this->classAnalyzer->isAnonymousClass($classLike)) { @@ -209,9 +206,6 @@ public function resolveFunctionLikeReflectionFromCall( return null; } - /** - * @api used in rector-laravel - */ public function resolveMethodReflectionFromClassMethod(ClassMethod $classMethod, Scope $scope): ?MethodReflection { $classReflection = $scope->getClassReflection(); diff --git a/src/RuleDoc/CodeSample/CodeSample.php b/src/RuleDoc/CodeSample/CodeSample.php index 6dab209721f..e6c85599e8d 100644 --- a/src/RuleDoc/CodeSample/CodeSample.php +++ b/src/RuleDoc/CodeSample/CodeSample.php @@ -6,9 +6,6 @@ use Rector\RuleDoc\AbstractCodeSample; -/** - * @api - */ final class CodeSample extends AbstractCodeSample { } diff --git a/src/RuleDoc/CodeSample/ConfiguredCodeSample.php b/src/RuleDoc/CodeSample/ConfiguredCodeSample.php index b6875889bd4..3e5a24a159a 100644 --- a/src/RuleDoc/CodeSample/ConfiguredCodeSample.php +++ b/src/RuleDoc/CodeSample/ConfiguredCodeSample.php @@ -8,9 +8,6 @@ use Rector\RuleDoc\Contract\CodeSampleInterface; use Rector\RuleDoc\Exception\ShouldNotHappenException; -/** - * @api - */ final class ConfiguredCodeSample extends AbstractCodeSample implements CodeSampleInterface { /** diff --git a/src/RuleDoc/CodeSample/ExtraFileCodeSample.php b/src/RuleDoc/CodeSample/ExtraFileCodeSample.php index f95e0a3b8bd..c7723853308 100644 --- a/src/RuleDoc/CodeSample/ExtraFileCodeSample.php +++ b/src/RuleDoc/CodeSample/ExtraFileCodeSample.php @@ -6,9 +6,6 @@ use Rector\RuleDoc\AbstractCodeSample; -/** - * @api - */ final class ExtraFileCodeSample extends AbstractCodeSample { public function __construct( diff --git a/src/RuleDoc/Contract/DocumentedRuleInterface.php b/src/RuleDoc/Contract/DocumentedRuleInterface.php index f781fbdeb63..153ad0d4cd7 100644 --- a/src/RuleDoc/Contract/DocumentedRuleInterface.php +++ b/src/RuleDoc/Contract/DocumentedRuleInterface.php @@ -6,9 +6,6 @@ use Rector\RuleDoc\RuleDefinition; -/** - * @api - */ interface DocumentedRuleInterface { public function getRuleDefinition(): RuleDefinition; diff --git a/src/RuleDoc/RuleDefinition.php b/src/RuleDoc/RuleDefinition.php index 073bfebf4ef..6cf247cb4a3 100644 --- a/src/RuleDoc/RuleDefinition.php +++ b/src/RuleDoc/RuleDefinition.php @@ -9,9 +9,6 @@ use Rector\RuleDoc\Exception\PoorDocumentationException; use Rector\RuleDoc\Exception\ShouldNotHappenException; -/** - * @api - */ final class RuleDefinition { private ?string $ruleFilePath = null; diff --git a/src/Set/ValueObject/LevelSetList.php b/src/Set/ValueObject/LevelSetList.php index 32c78c978cc..41c7cf8683d 100644 --- a/src/Set/ValueObject/LevelSetList.php +++ b/src/Set/ValueObject/LevelSetList.php @@ -4,9 +4,6 @@ namespace Rector\Set\ValueObject; -/** - * @api - */ final class LevelSetList { public const string UP_TO_PHP_86 = __DIR__ . '/../../../config/set/level/up-to-php86.php'; diff --git a/src/Set/ValueObject/Set.php b/src/Set/ValueObject/Set.php index 75b5834b1ef..dfdb5706c33 100644 --- a/src/Set/ValueObject/Set.php +++ b/src/Set/ValueObject/Set.php @@ -8,8 +8,6 @@ use Webmozart\Assert\Assert; /** - * @api used by extensions - * * @deprecated Bond the rules themselves instead, by implementing the ComposerPackageConstraintInterface. A set * described as an object only existed to be matched against the installed packages; a bonded rule states the exact * package version its target API is available from and applies from there upwards, so a plain set file is enough. diff --git a/src/Set/ValueObject/SetList.php b/src/Set/ValueObject/SetList.php index ae435ba8485..8300d60e959 100644 --- a/src/Set/ValueObject/SetList.php +++ b/src/Set/ValueObject/SetList.php @@ -4,9 +4,6 @@ namespace Rector\Set\ValueObject; -/** - * @api - */ final class SetList { /** diff --git a/src/Skipper/Skipper/Skipper.php b/src/Skipper/Skipper/Skipper.php index 62b621a18ff..10ace51e36f 100644 --- a/src/Skipper/Skipper/Skipper.php +++ b/src/Skipper/Skipper/Skipper.php @@ -13,7 +13,6 @@ use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment; /** - * @api * @see \Rector\Tests\Skipper\Skipper\SkipperTest */ final class Skipper diff --git a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php index 58e4cc547b8..f880e0c9d69 100644 --- a/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/AliasedObjectType.php @@ -11,9 +11,6 @@ use PHPStan\Type\Type; use Rector\StaticTypeMapper\Resolver\ClassNameFromObjectTypeResolver; -/** - * @api - */ final class AliasedObjectType extends ObjectType { public function __construct( diff --git a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php index d242e323f9d..88aaa413f1d 100644 --- a/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/FullyQualifiedObjectType.php @@ -12,9 +12,6 @@ use PHPStan\Type\Type; use Rector\NodeTypeResolver\Node\AttributeKey; -/** - * @api - */ final class FullyQualifiedObjectType extends ObjectType { public function getShortNameType(): ShortenedObjectType diff --git a/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php b/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php index 916ba0da943..7a969e8ca6d 100644 --- a/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php @@ -8,9 +8,6 @@ use PHPStan\Type\IsSuperTypeOfResult; use PHPStan\Type\Type; -/** - * @api - */ final class ShortenedGenericObjectType extends GenericObjectType { /** diff --git a/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php index a6c0738d2ee..78bef077860 100644 --- a/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php @@ -8,9 +8,6 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; -/** - * @api - */ final class ShortenedObjectType extends ObjectType { /** diff --git a/src/Testing/Fixture/FixtureFileFinder.php b/src/Testing/Fixture/FixtureFileFinder.php index 65c941b6db0..4808a380d9f 100644 --- a/src/Testing/Fixture/FixtureFileFinder.php +++ b/src/Testing/Fixture/FixtureFileFinder.php @@ -10,7 +10,6 @@ final class FixtureFileFinder { /** - * @api used in tests * @return Iterator> */ public static function yieldDirectory(string $directory, string $suffix = '*.php.inc'): Iterator diff --git a/src/Testing/Fixture/FixtureFileUpdater.php b/src/Testing/Fixture/FixtureFileUpdater.php index b14c4d2f09a..3c4c0184a86 100644 --- a/src/Testing/Fixture/FixtureFileUpdater.php +++ b/src/Testing/Fixture/FixtureFileUpdater.php @@ -9,7 +9,6 @@ final class FixtureFileUpdater { /** - * @api */ public static function updateFixtureContent( string $originalContent, diff --git a/src/Testing/Fixture/FixtureSplitter.php b/src/Testing/Fixture/FixtureSplitter.php index 3ac5bf02593..2cc269ff3e1 100644 --- a/src/Testing/Fixture/FixtureSplitter.php +++ b/src/Testing/Fixture/FixtureSplitter.php @@ -6,9 +6,6 @@ use Nette\Utils\FileSystem; -/** - * @api - */ final class FixtureSplitter { public static function containsSplit(string $fixtureFileContent): bool diff --git a/src/Testing/Fixture/FixtureTempFileDumper.php b/src/Testing/Fixture/FixtureTempFileDumper.php index f1de9f7eec0..880f2cf540b 100644 --- a/src/Testing/Fixture/FixtureTempFileDumper.php +++ b/src/Testing/Fixture/FixtureTempFileDumper.php @@ -6,9 +6,6 @@ use Nette\Utils\FileSystem; -/** - * @api used in tests - */ final class FixtureTempFileDumper { /** diff --git a/src/Testing/PHPUnit/AbstractLazyTestCase.php b/src/Testing/PHPUnit/AbstractLazyTestCase.php index a76b2441f07..053ccabc24d 100644 --- a/src/Testing/PHPUnit/AbstractLazyTestCase.php +++ b/src/Testing/PHPUnit/AbstractLazyTestCase.php @@ -21,7 +21,6 @@ protected function setUp(): void } /** - * @api * @param string[] $configFiles */ protected function bootFromConfigFiles(array $configFiles): void diff --git a/src/Testing/PHPUnit/AbstractRectorTestCase.php b/src/Testing/PHPUnit/AbstractRectorTestCase.php index 7036ee4a373..bfb62fc8108 100644 --- a/src/Testing/PHPUnit/AbstractRectorTestCase.php +++ b/src/Testing/PHPUnit/AbstractRectorTestCase.php @@ -28,9 +28,6 @@ use Rector\Testing\PHPUnit\ValueObject\RectorTestResult; use Rector\ValueObject\PhpVersion; -/** - * @api used by public - */ abstract class AbstractRectorTestCase extends AbstractLazyTestCase implements RectorTestInterface { private DynamicSourceLocatorProvider $dynamicSourceLocatorProvider; @@ -149,8 +146,6 @@ protected static function yieldFilesFromDirectory(string $directory, string $suf * Override to test a rule that implements @see \Rector\VersionBonding\Contract\ComposerPackageConstraintInterface * against a package that is not installed. The versions are read from the "require" and "require-dev" sections of * the provided "composer.json", instead of the installed packages. - * - * @api used by extensions */ protected function provideComposerJsonFilePath(): ?string { diff --git a/src/Testing/PHPUnit/ValueObject/RectorTestResult.php b/src/Testing/PHPUnit/ValueObject/RectorTestResult.php index 3b234b3b359..942ece039b3 100644 --- a/src/Testing/PHPUnit/ValueObject/RectorTestResult.php +++ b/src/Testing/PHPUnit/ValueObject/RectorTestResult.php @@ -8,9 +8,6 @@ use Rector\Util\RectorClassesSorter; use Rector\ValueObject\ProcessResult; -/** - * @api used in tests - */ final readonly class RectorTestResult { public function __construct( diff --git a/src/Testing/TestingParser/TestingParser.php b/src/Testing/TestingParser/TestingParser.php index 8ea448a32ba..f485f182d24 100644 --- a/src/Testing/TestingParser/TestingParser.php +++ b/src/Testing/TestingParser/TestingParser.php @@ -16,9 +16,6 @@ use Rector\PhpParser\Parser\RectorParser; use Rector\ValueObject\Application\File; -/** - * @api - */ final readonly class TestingParser { public function __construct( diff --git a/src/Util/Reflection/PrivatesAccessor.php b/src/Util/Reflection/PrivatesAccessor.php index 442810bd563..79b4c7aa39c 100644 --- a/src/Util/Reflection/PrivatesAccessor.php +++ b/src/Util/Reflection/PrivatesAccessor.php @@ -17,7 +17,6 @@ final class PrivatesAccessor /** * @param object|class-string $object * @param mixed[] $arguments - * @api */ public function callPrivateMethod(object|string $object, string $methodName, array $arguments): mixed { diff --git a/src/Validation/RectorAssert.php b/src/Validation/RectorAssert.php index 3cd55b4f17b..950f2ac702c 100644 --- a/src/Validation/RectorAssert.php +++ b/src/Validation/RectorAssert.php @@ -68,9 +68,6 @@ public static function functionName(string $name): void self::elementName($name, self::FUNCTION_NAME_REGEX, 'function'); } - /** - * @api - */ public static function elementName(string $name, string $regex, string $elementType): void { if (StringUtils::isMatch($name, $regex)) { diff --git a/src/ValueObject/MethodName.php b/src/ValueObject/MethodName.php index 7119ab7b8c2..8dafc67c45a 100644 --- a/src/ValueObject/MethodName.php +++ b/src/ValueObject/MethodName.php @@ -5,7 +5,6 @@ namespace Rector\ValueObject; /** - * @api * @enum */ final class MethodName diff --git a/src/ValueObject/PhpVersion.php b/src/ValueObject/PhpVersion.php index 566c15b8dc8..3272fb7a77d 100644 --- a/src/ValueObject/PhpVersion.php +++ b/src/ValueObject/PhpVersion.php @@ -4,9 +4,6 @@ namespace Rector\ValueObject; -/** - * @api - */ final class PhpVersion { public const int PHP_52 = 50200; diff --git a/src/ValueObject/PolyfillPackage.php b/src/ValueObject/PolyfillPackage.php index f2d7822b0cd..248a9092781 100644 --- a/src/ValueObject/PolyfillPackage.php +++ b/src/ValueObject/PolyfillPackage.php @@ -4,9 +4,6 @@ namespace Rector\ValueObject; -/** - * @api - */ final class PolyfillPackage { public const string PHP_85 = 'symfony/polyfill-php85'; diff --git a/src/VersionBonding/Contract/ComposerPackageConstraintInterface.php b/src/VersionBonding/Contract/ComposerPackageConstraintInterface.php index 887e16afcaa..b4c41ba32c5 100644 --- a/src/VersionBonding/Contract/ComposerPackageConstraintInterface.php +++ b/src/VersionBonding/Contract/ComposerPackageConstraintInterface.php @@ -10,8 +10,6 @@ * Can be implemented by @see \Rector\Contract\Rector\RectorInterface * * Rules that do not meet this composer package constraint will be skipped. - * - * @api used by extensions */ interface ComposerPackageConstraintInterface { diff --git a/src/VersionBonding/ValueObject/ComposerPackageConstraint.php b/src/VersionBonding/ValueObject/ComposerPackageConstraint.php index 152ace8c752..446468f1a0e 100644 --- a/src/VersionBonding/ValueObject/ComposerPackageConstraint.php +++ b/src/VersionBonding/ValueObject/ComposerPackageConstraint.php @@ -4,9 +4,6 @@ namespace Rector\VersionBonding\ValueObject; -/** - * @api used by extensions - */ final readonly class ComposerPackageConstraint { public function __construct( From 51bfc3fa9298868f518a6e785facf1e9382280af Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 23 Oct 2026 23:56:39 +0200 Subject: [PATCH 02/15] remove deprecated SetInterface and Set --- src/Set/Contract/SetInterface.php | 22 ---------------- src/Set/ValueObject/Set.php | 42 ------------------------------- 2 files changed, 64 deletions(-) delete mode 100644 src/Set/Contract/SetInterface.php delete mode 100644 src/Set/ValueObject/Set.php diff --git a/src/Set/Contract/SetInterface.php b/src/Set/Contract/SetInterface.php deleted file mode 100644 index f32334a6e36..00000000000 --- a/src/Set/Contract/SetInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -groupName; - } - - public function getName(): string - { - return $this->setName; - } - - public function getSetFilePath(): string - { - return $this->setFilePath; - } -} From ba29b02ae24eb0abbd8e0c378664f2e196825700 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 23 Oct 2026 23:57:40 +0200 Subject: [PATCH 03/15] remove unsued RectifiedAnalyzer --- phpstan-deprecated.neon | 6 ------ src/Set/ValueObject/SetList.php | 6 ------ 2 files changed, 12 deletions(-) diff --git a/phpstan-deprecated.neon b/phpstan-deprecated.neon index 829e6dd634d..639a2b6286c 100644 --- a/phpstan-deprecated.neon +++ b/phpstan-deprecated.neon @@ -1,12 +1,6 @@ # deprecated code kept temporarily, ignores to drop once the deprecated API is removed parameters: ignoreErrors: - # deprecated, to be removed - - - message: '#^Unused Rector\\Set\\Contract\\SetInterface\:\:(.*?)$#' - identifier: shipmonk.deadMethod - path: src/Set/Contract/SetInterface.php - - message: '#^Unused Rector\\Arguments\\ValueObject\\ReplaceArgumentDefaultValue\:\:(.*?)$#' identifier: shipmonk.deadMethod diff --git a/src/Set/ValueObject/SetList.php b/src/Set/ValueObject/SetList.php index 8300d60e959..df0c412a209 100644 --- a/src/Set/ValueObject/SetList.php +++ b/src/Set/ValueObject/SetList.php @@ -17,12 +17,6 @@ final class SetList public const string DEAD_CODE = __DIR__ . '/../../../config/set/dead-code.php'; - /** - * @deprecated Niche set for a rarely used extension, it is empty now and will be removed. - * Register RenameClassRector and RenameMethodRector with your own configuration instead. - */ - public const string GMAGICK_TO_IMAGICK = __DIR__ . '/../../../config/set/gmagick-to-imagick.php'; - /** * @deprecated Niche set for a rarely used extension, it is empty now and will be removed. */ From 2e6ce806522839aa81cfb11c6dd7d1170e102a12 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 23 Oct 2026 23:59:36 +0200 Subject: [PATCH 04/15] Remove unused constants --- src/Parallel/ValueObject/BridgeItem.php | 2 -- src/PhpDocParser/ValueObject/AttributeKey.php | 4 ---- 2 files changed, 6 deletions(-) diff --git a/src/Parallel/ValueObject/BridgeItem.php b/src/Parallel/ValueObject/BridgeItem.php index e4fd074840e..f0406a447ce 100644 --- a/src/Parallel/ValueObject/BridgeItem.php +++ b/src/Parallel/ValueObject/BridgeItem.php @@ -21,8 +21,6 @@ final class BridgeItem public const string DIFF_CONSOLE_FORMATTED = 'diff_console_formatted'; - public const string APPLIED_RECTORS = 'applied_rectors'; - public const string RECTOR_CLASS = 'rector_class'; public const string RECTORS_WITH_LINE_CHANGES = 'rectors_with_line_changes'; diff --git a/src/PhpDocParser/ValueObject/AttributeKey.php b/src/PhpDocParser/ValueObject/AttributeKey.php index 0a20140db16..263013fcca0 100644 --- a/src/PhpDocParser/ValueObject/AttributeKey.php +++ b/src/PhpDocParser/ValueObject/AttributeKey.php @@ -22,10 +22,6 @@ final class AttributeKey */ public const string PHPSTAN_CACHE_PRINTER = 'phpstan_cache_printer'; - public const string ASSIGNED_TO = 'assigned_to'; - - public const string NULLSAFE_CHECKED = 'nullsafe_checked'; - /** * PHPStan @api */ From d17ee55d742214ba2e1940ae6c61c0b11b2f2698 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 00:04:17 +0200 Subject: [PATCH 05/15] remove unsued findFirstNonAnonymousClass() --- src/PhpParser/Node/BetterNodeFinder.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/PhpParser/Node/BetterNodeFinder.php b/src/PhpParser/Node/BetterNodeFinder.php index 6cbb76d6b44..927be58d12a 100644 --- a/src/PhpParser/Node/BetterNodeFinder.php +++ b/src/PhpParser/Node/BetterNodeFinder.php @@ -108,19 +108,6 @@ public function find(Node|array $nodes, callable $filter): array return $this->nodeFinder->find($nodes, $filter); } - /** - * @param Node[] $nodes - * @return Class_|null - */ - public function findFirstNonAnonymousClass(array $nodes): ?Node - { - // skip anonymous classes - return $this->findFirst( - $nodes, - fn (Node $node): bool => $node instanceof Class_ && ! $this->classAnalyzer->isAnonymousClass($node) - ); - } - /** * @param Node|Node[] $nodes * @param callable(Node $filter): bool $filter From 5578c6763f391614dde40c0664c0204636ded697 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 00:05:03 +0200 Subject: [PATCH 06/15] remove unused GenericAnnotationToAttributeConverter --- src/PhpDocParser/ValueObject/AttributeKey.php | 10 ----- src/RuleDoc/RuleDefinition.php | 22 +++++++++++ src/Set/Contract/SetInterface.php | 17 +++++++++ src/Set/ValueObject/Set.php | 37 +++++++++++++++++++ 4 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 src/Set/Contract/SetInterface.php create mode 100644 src/Set/ValueObject/Set.php diff --git a/src/PhpDocParser/ValueObject/AttributeKey.php b/src/PhpDocParser/ValueObject/AttributeKey.php index 263013fcca0..f7c5bc3a117 100644 --- a/src/PhpDocParser/ValueObject/AttributeKey.php +++ b/src/PhpDocParser/ValueObject/AttributeKey.php @@ -6,16 +6,6 @@ final class AttributeKey { - /** - * Used in php-parser, do not change - */ - public const string KIND = 'kind'; - - /** - * Used by php-parser, do not change - */ - public const string COMMENTS = 'comments'; - /** * PHPStan @api Used in PHPStan for printed node content. Useful for printing error messages without need to reprint * it again. diff --git a/src/RuleDoc/RuleDefinition.php b/src/RuleDoc/RuleDefinition.php index 6cf247cb4a3..0d0c6d2f6a6 100644 --- a/src/RuleDoc/RuleDefinition.php +++ b/src/RuleDoc/RuleDefinition.php @@ -13,6 +13,8 @@ final class RuleDefinition { private ?string $ruleFilePath = null; + private ?string $ruleClass = null; + /** * @var CodeSampleInterface[] */ @@ -54,6 +56,26 @@ public function getRuleFilePath(): string return $this->ruleFilePath; } + /** + * @api used by getrector.com website + */ + public function setRuleClass(string $ruleClass): void + { + $this->ruleClass = $ruleClass; + } + + /** + * @api used by getrector.com website + */ + public function getRuleClass(): string + { + if ($this->ruleClass === null) { + throw new ShouldNotHappenException(); + } + + return $this->ruleClass; + } + /** * @return CodeSampleInterface[] */ diff --git a/src/Set/Contract/SetInterface.php b/src/Set/Contract/SetInterface.php new file mode 100644 index 00000000000..41ec68b0cc1 --- /dev/null +++ b/src/Set/Contract/SetInterface.php @@ -0,0 +1,17 @@ +groupName; + } + + public function getName(): string + { + return $this->setName; + } + + public function getSetFilePath(): string + { + return $this->setFilePath; + } +} From 52d3d4a9d9f6fe5c3e7d34913507369734803a26 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 00:05:25 +0200 Subject: [PATCH 07/15] remove unused createLocalMethodCall() --- src/PhpParser/Node/NodeFactory.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/PhpParser/Node/NodeFactory.php b/src/PhpParser/Node/NodeFactory.php index eb644975dbf..c6d7701d8d9 100644 --- a/src/PhpParser/Node/NodeFactory.php +++ b/src/PhpParser/Node/NodeFactory.php @@ -194,15 +194,6 @@ public function createPrivatePropertyFromNameAndType(string $name, ?Type $type): return $property; } - /** - * @param mixed[] $arguments - */ - public function createLocalMethodCall(string $method, array $arguments = []): MethodCall - { - $variable = new Variable('this'); - return $this->createMethodCall($variable, $method, $arguments); - } - /** * @param mixed[] $arguments */ From 60111eb72c1c99af39f2fbbbeccd424effec8fa6 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 00:10:35 +0200 Subject: [PATCH 08/15] restore original docblocks on website-used Set, SetInterface, RuleDefinition --- src/RuleDoc/RuleDefinition.php | 9 +++------ src/Set/Contract/SetInterface.php | 7 ++++++- src/Set/ValueObject/Set.php | 9 ++++++++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/RuleDoc/RuleDefinition.php b/src/RuleDoc/RuleDefinition.php index 0d0c6d2f6a6..6a435d6cd75 100644 --- a/src/RuleDoc/RuleDefinition.php +++ b/src/RuleDoc/RuleDefinition.php @@ -9,6 +9,9 @@ use Rector\RuleDoc\Exception\PoorDocumentationException; use Rector\RuleDoc\Exception\ShouldNotHappenException; +/** + * @api + */ final class RuleDefinition { private ?string $ruleFilePath = null; @@ -56,17 +59,11 @@ public function getRuleFilePath(): string return $this->ruleFilePath; } - /** - * @api used by getrector.com website - */ public function setRuleClass(string $ruleClass): void { $this->ruleClass = $ruleClass; } - /** - * @api used by getrector.com website - */ public function getRuleClass(): string { if ($this->ruleClass === null) { diff --git a/src/Set/Contract/SetInterface.php b/src/Set/Contract/SetInterface.php index 41ec68b0cc1..f32334a6e36 100644 --- a/src/Set/Contract/SetInterface.php +++ b/src/Set/Contract/SetInterface.php @@ -5,7 +5,12 @@ namespace Rector\Set\Contract; /** - * @api used by getrector.com website to build the set tree + * @deprecated Bond the rules themselves instead, by implementing the ComposerPackageConstraintInterface. A set + * described as an object only existed to be matched against the installed packages; a bonded rule states the exact + * package version its target API is available from and applies from there upwards, so a plain set file is enough. + * + * @see \Rector\VersionBonding\Contract\ComposerPackageConstraintInterface + * @see https://github.com/rectorphp/rector-src/pull/8296 */ interface SetInterface { diff --git a/src/Set/ValueObject/Set.php b/src/Set/ValueObject/Set.php index 1b1e2774cb5..75b5834b1ef 100644 --- a/src/Set/ValueObject/Set.php +++ b/src/Set/ValueObject/Set.php @@ -8,7 +8,14 @@ use Webmozart\Assert\Assert; /** - * @api used by getrector.com website to build the set tree + * @api used by extensions + * + * @deprecated Bond the rules themselves instead, by implementing the ComposerPackageConstraintInterface. A set + * described as an object only existed to be matched against the installed packages; a bonded rule states the exact + * package version its target API is available from and applies from there upwards, so a plain set file is enough. + * + * @see \Rector\VersionBonding\Contract\ComposerPackageConstraintInterface + * @see https://github.com/rectorphp/rector-src/pull/8296 */ final readonly class Set implements SetInterface { From 265a79b078ba3fc9779a9daf89a4994a0b8c40b0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 00:13:29 +0200 Subject: [PATCH 09/15] remove unsued ObjectMagicMethods --- .../ValueObject/ObjectMagicMethods.php | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 rules/CodingStyle/ValueObject/ObjectMagicMethods.php diff --git a/rules/CodingStyle/ValueObject/ObjectMagicMethods.php b/rules/CodingStyle/ValueObject/ObjectMagicMethods.php deleted file mode 100644 index b4b9a9cfa48..00000000000 --- a/rules/CodingStyle/ValueObject/ObjectMagicMethods.php +++ /dev/null @@ -1,33 +0,0 @@ - Date: Sat, 24 Oct 2026 00:15:24 +0200 Subject: [PATCH 10/15] remove AttributeKey --- .../ReplaceFuncCallArgumentDefaultValue.php | 3 ++ rules/Naming/Naming/VariableNaming.php | 6 +++ .../StrStartWithMatchAndRefactorInterface.php | 4 ++ .../NodeManipulator/VisibilityManipulator.php | 27 ++++++++++++ .../Contract/RenameAnnotationInterface.php | 3 ++ .../Renaming/ValueObject/RenameAnnotation.php | 3 ++ .../ValueObject/RenameAnnotationByType.php | 3 ++ .../ValueObject/RenameStaticMethod.php | 3 ++ .../ConstFetchToClassConstFetch.php | 3 ++ .../ValueObject/FuncCallToMethodCall.php | 3 ++ .../ValueObject/FuncCallToStaticCall.php | 3 ++ .../ValueObject/MethodCallToFuncCall.php | 3 ++ .../ValueObject/MethodCallToStaticCall.php | 3 ++ .../ValueObject/ScalarValueToConstFetch.php | 3 ++ .../ValueObject/StaticCallToMethodCall.php | 3 ++ .../ValueObject/StringToClassConstant.php | 3 ++ .../AddPropertyTypeDeclaration.php | 3 ++ .../ValueObject/AddReturnTypeDeclaration.php | 3 ++ src/Application/VersionResolver.php | 8 ++++ .../PhpDocNodeDecoratorInterface.php | 3 ++ .../PhpDocInfo/PhpDocInfo.php | 9 ++++ .../PhpDocManipulator/PhpDocTagRemover.php | 3 ++ .../AbstractValuesAwareNode.php | 3 ++ src/Composer/ValueObject/InstalledPackage.php | 3 ++ src/Config/RectorConfig.php | 3 ++ src/Configuration/RectorConfigBuilder.php | 3 ++ .../PHPStan/RichParserFactory.php | 3 ++ .../NodeAnalyzer/ClassChildAnalyzer.php | 8 ++++ src/NodeAnalyzer/DoctrineEntityAnalyzer.php | 3 ++ src/NodeManipulator/AssignManipulator.php | 1 + .../ClassDependencyManipulator.php | 5 +++ src/NodeManipulator/ClassManipulator.php | 3 ++ src/NodeManipulator/PropertyManipulator.php | 3 ++ .../PHPStanServicesFactory.php | 27 ++++++++++++ src/NodeTypeResolver/Node/AttributeKey.php | 2 + src/NodeTypeResolver/NodeTypeResolver.php | 1 + ...orBetterReflectionSourceLocatorFactory.php | 3 ++ .../Contract/SerializableInterface.php | 1 + src/PhpDocParser/ValueObject/AttributeKey.php | 19 -------- src/PhpParser/Node/NodeFactory.php | 5 +++ src/PhpParser/Node/Value/ValueResolver.php | 1 + src/PhpParser/NodeTransformer.php | 8 ++++ src/PhpParser/Parser/InlineCodeParser.php | 2 + src/Reflection/ReflectionResolver.php | 6 +++ .../CodeSample/ConfiguredCodeSample.php | 3 ++ .../CodeSample/ExtraFileCodeSample.php | 3 ++ src/Set/Contract/SetInterface.php | 22 ---------- src/Set/ValueObject/LevelSetList.php | 3 ++ src/Set/ValueObject/Set.php | 44 ------------------- .../Type/ShortenedGenericObjectType.php | 3 ++ .../ValueObject/Type/ShortenedObjectType.php | 3 ++ src/ValueObject/PolyfillPackage.php | 3 ++ 52 files changed, 217 insertions(+), 85 deletions(-) delete mode 100644 src/PhpDocParser/ValueObject/AttributeKey.php delete mode 100644 src/Set/Contract/SetInterface.php delete mode 100644 src/Set/ValueObject/Set.php diff --git a/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php b/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php index be0e99c3d7b..dcc0bbb92fd 100644 --- a/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php +++ b/rules/Arguments/ValueObject/ReplaceFuncCallArgumentDefaultValue.php @@ -4,6 +4,9 @@ namespace Rector\Arguments\ValueObject; +/** + * @api + */ final readonly class ReplaceFuncCallArgumentDefaultValue { public function __construct( diff --git a/rules/Naming/Naming/VariableNaming.php b/rules/Naming/Naming/VariableNaming.php index 38b607ac67b..81f7d1cb3e3 100644 --- a/rules/Naming/Naming/VariableNaming.php +++ b/rules/Naming/Naming/VariableNaming.php @@ -6,8 +6,14 @@ use PHPStan\Analyser\Scope; +/** + * @api used in downgrade + */ final class VariableNaming { + /** + * @api used in downgrade + */ public function createCountedValueName(string $valueName, ?Scope $scope): string { if (! $scope instanceof Scope) { diff --git a/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php b/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php index 5a9eadde45f..639de06ce29 100644 --- a/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php +++ b/rules/Php80/Contract/StrStartWithMatchAndRefactorInterface.php @@ -15,9 +15,13 @@ interface StrStartWithMatchAndRefactorInterface { + /** + * @api implemented by child classes + */ public function match(Identical|NotIdentical|Equal|NotEqual $binaryOp): ?StrStartsWith; /** + * @api implemented by child classes * @return FuncCall|BooleanNot|null */ public function refactorStrStartsWith(StrStartsWith $strStartsWith): ?Node; diff --git a/rules/Privatization/NodeManipulator/VisibilityManipulator.php b/rules/Privatization/NodeManipulator/VisibilityManipulator.php index 9a13b33a39a..85aab8be505 100644 --- a/rules/Privatization/NodeManipulator/VisibilityManipulator.php +++ b/rules/Privatization/NodeManipulator/VisibilityManipulator.php @@ -30,11 +30,17 @@ public function hasVisibility(Class_|ClassMethod|Property|ClassConst|Param $node return (bool) ($node->flags & $visibility); } + /** + * @api + */ public function makeStatic(ClassMethod|Property|ClassConst|Param $node): void { $this->addVisibilityFlag($node, Visibility::STATIC); } + /** + * @api + */ public function makeNonStatic(ClassMethod|Property $node): void { if (! $node->isStatic()) { @@ -44,6 +50,9 @@ public function makeNonStatic(ClassMethod|Property $node): void $node->flags -= Modifiers::STATIC; } + /** + * @api + */ public function makeNonAbstract(ClassMethod|Class_ $node): void { if (! $node->isAbstract()) { @@ -53,11 +62,17 @@ public function makeNonAbstract(ClassMethod|Class_ $node): void $node->flags -= Modifiers::ABSTRACT; } + /** + * @api + */ public function makeFinal(Class_|ClassMethod|Param|ClassConst $node): void { $this->addVisibilityFlag($node, Visibility::FINAL); } + /** + * @api + */ public function makeNonFinal(Class_|ClassMethod|Param $node): void { if (! $this->hasVisibility($node, Visibility::FINAL)) { @@ -86,6 +101,9 @@ public function makePublic(ClassMethod|Property|ClassConst|Param $node): void $this->replaceVisibilityFlag($node, Visibility::PUBLIC); } + /** + * @api + */ public function makeProtected(ClassMethod|Property|ClassConst $node): void { $this->replaceVisibilityFlag($node, Visibility::PROTECTED); @@ -103,6 +121,9 @@ public function makePrivate(ClassMethod|Property|ClassConst|Param $node): void $node->flags &= ~Modifiers::FINAL; } + /** + * @api + */ public function removeFinal(Class_|ClassConst $node): void { $node->flags -= Modifiers::FINAL; @@ -113,6 +134,9 @@ public function makeReadonly(Class_|Property|Param $node): void $this->addVisibilityFlag($node, Visibility::READONLY); } + /** + * @api + */ public function isReadonly(Class_|Property|Param $node): bool { return $this->hasVisibility($node, Visibility::READONLY); @@ -180,6 +204,9 @@ private function removeVisibility(ClassMethod|Property|ClassConst|Param $node): } } + /** + * @api + */ private function addVisibilityFlag(Class_|ClassMethod|Property|ClassConst|Param $node, int $visibility): void { $node->flags |= $visibility; diff --git a/rules/Renaming/Contract/RenameAnnotationInterface.php b/rules/Renaming/Contract/RenameAnnotationInterface.php index 326a70e1afa..14d8800e8e0 100644 --- a/rules/Renaming/Contract/RenameAnnotationInterface.php +++ b/rules/Renaming/Contract/RenameAnnotationInterface.php @@ -4,6 +4,9 @@ namespace Rector\Renaming\Contract; +/** + * @api used in deprecated RenameAnnotationRector configs + */ interface RenameAnnotationInterface { public function getOldAnnotation(): string; diff --git a/rules/Renaming/ValueObject/RenameAnnotation.php b/rules/Renaming/ValueObject/RenameAnnotation.php index f3b60df1b34..5fbee4ada93 100644 --- a/rules/Renaming/ValueObject/RenameAnnotation.php +++ b/rules/Renaming/ValueObject/RenameAnnotation.php @@ -6,6 +6,9 @@ use Rector\Renaming\Contract\RenameAnnotationInterface; +/** + * @api + */ final readonly class RenameAnnotation implements RenameAnnotationInterface { public function __construct( diff --git a/rules/Renaming/ValueObject/RenameAnnotationByType.php b/rules/Renaming/ValueObject/RenameAnnotationByType.php index 5cbcff35380..5832e73d5ee 100644 --- a/rules/Renaming/ValueObject/RenameAnnotationByType.php +++ b/rules/Renaming/ValueObject/RenameAnnotationByType.php @@ -8,6 +8,9 @@ use Rector\Renaming\Contract\RenameAnnotationInterface; use Rector\Validation\RectorAssert; +/** + * @api used in deprecated RenameAnnotationRector configs + */ final readonly class RenameAnnotationByType implements RenameAnnotationInterface { public function __construct( diff --git a/rules/Renaming/ValueObject/RenameStaticMethod.php b/rules/Renaming/ValueObject/RenameStaticMethod.php index 3df7fb0b12d..7cb3716e65e 100644 --- a/rules/Renaming/ValueObject/RenameStaticMethod.php +++ b/rules/Renaming/ValueObject/RenameStaticMethod.php @@ -7,6 +7,9 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; +/** + * @api used in deprecated RenameStaticMethodRector configs + */ final readonly class RenameStaticMethod { public function __construct( diff --git a/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php b/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php index dac185a81d5..c9079318c2f 100644 --- a/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php +++ b/rules/Transform/ValueObject/ConstFetchToClassConstFetch.php @@ -6,6 +6,9 @@ use Rector\Validation\RectorAssert; +/** + * @api kept for deprecated ConstFetchToClassConstFetchRector code sample + */ final readonly class ConstFetchToClassConstFetch { public function __construct( diff --git a/rules/Transform/ValueObject/FuncCallToMethodCall.php b/rules/Transform/ValueObject/FuncCallToMethodCall.php index 98b93b933b4..d7ff6ad76fb 100644 --- a/rules/Transform/ValueObject/FuncCallToMethodCall.php +++ b/rules/Transform/ValueObject/FuncCallToMethodCall.php @@ -7,6 +7,9 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; +/** + * @api used in deprecated FuncCallToMethodCallRector configs + */ final readonly class FuncCallToMethodCall { public function __construct( diff --git a/rules/Transform/ValueObject/FuncCallToStaticCall.php b/rules/Transform/ValueObject/FuncCallToStaticCall.php index 4be740252a2..a203517e4dc 100644 --- a/rules/Transform/ValueObject/FuncCallToStaticCall.php +++ b/rules/Transform/ValueObject/FuncCallToStaticCall.php @@ -6,6 +6,9 @@ use Rector\Validation\RectorAssert; +/** + * @api used in deprecated FuncCallToStaticCallRector configs + */ final readonly class FuncCallToStaticCall { public function __construct( diff --git a/rules/Transform/ValueObject/MethodCallToFuncCall.php b/rules/Transform/ValueObject/MethodCallToFuncCall.php index 953a73869ef..eb1582cccef 100644 --- a/rules/Transform/ValueObject/MethodCallToFuncCall.php +++ b/rules/Transform/ValueObject/MethodCallToFuncCall.php @@ -4,6 +4,9 @@ namespace Rector\Transform\ValueObject; +/** + * @api used in deprecated MethodCallToFuncCallRector configs + */ final readonly class MethodCallToFuncCall { public function __construct( diff --git a/rules/Transform/ValueObject/MethodCallToStaticCall.php b/rules/Transform/ValueObject/MethodCallToStaticCall.php index d91ee08ab6e..7996fc5e173 100644 --- a/rules/Transform/ValueObject/MethodCallToStaticCall.php +++ b/rules/Transform/ValueObject/MethodCallToStaticCall.php @@ -7,6 +7,9 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; +/** + * @api used in deprecated MethodCallToStaticCallRector configs + */ final readonly class MethodCallToStaticCall { public function __construct( diff --git a/rules/Transform/ValueObject/ScalarValueToConstFetch.php b/rules/Transform/ValueObject/ScalarValueToConstFetch.php index 91084ffd106..d669905e2aa 100644 --- a/rules/Transform/ValueObject/ScalarValueToConstFetch.php +++ b/rules/Transform/ValueObject/ScalarValueToConstFetch.php @@ -10,6 +10,9 @@ use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\String_; +/** + * @api used in deprecated ScalarValueToConstFetchRector configs + */ final readonly class ScalarValueToConstFetch { public function __construct( diff --git a/rules/Transform/ValueObject/StaticCallToMethodCall.php b/rules/Transform/ValueObject/StaticCallToMethodCall.php index e6cfd1b5300..693d3c27697 100644 --- a/rules/Transform/ValueObject/StaticCallToMethodCall.php +++ b/rules/Transform/ValueObject/StaticCallToMethodCall.php @@ -10,6 +10,9 @@ use PHPStan\Type\ObjectType; use Rector\Validation\RectorAssert; +/** + * @api used in deprecated StaticCallToMethodCallRector configs + */ final readonly class StaticCallToMethodCall { public function __construct( diff --git a/rules/Transform/ValueObject/StringToClassConstant.php b/rules/Transform/ValueObject/StringToClassConstant.php index 012d6855fb5..dc8de619ed1 100644 --- a/rules/Transform/ValueObject/StringToClassConstant.php +++ b/rules/Transform/ValueObject/StringToClassConstant.php @@ -6,6 +6,9 @@ use Rector\Validation\RectorAssert; +/** + * @api used in deprecated StringToClassConstantRector configs + */ final readonly class StringToClassConstant { public function __construct( diff --git a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php index 538f1ea9050..69d4310ac26 100644 --- a/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php @@ -7,6 +7,9 @@ use PHPStan\Type\Type; use Rector\Validation\RectorAssert; +/** + * @api used in deprecated AddPropertyTypeDeclarationRector configs + */ final readonly class AddPropertyTypeDeclaration { public function __construct( diff --git a/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php b/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php index a3e357f0c2d..67ee85f58ca 100644 --- a/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php +++ b/rules/TypeDeclaration/ValueObject/AddReturnTypeDeclaration.php @@ -8,6 +8,9 @@ use PHPStan\Type\Type; use Rector\Validation\RectorAssert; +/** + * @api + */ final readonly class AddReturnTypeDeclaration { public function __construct( diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 6bf990e2e67..dffbe0bb260 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -8,6 +8,8 @@ use Rector\Exception\VersionException; /** + * @api + * * Inspired by https://github.com/composer/composer/blob/master/src/Composer/Composer.php * See https://github.com/composer/composer/blob/6587715d0f8cae0cd39073b3bc5f018d0e6b84fe/src/Composer/Compiler.php#L208 * @@ -15,8 +17,14 @@ */ final class VersionResolver { + /** + * @api + */ public const string PACKAGE_VERSION = '@package_version@'; + /** + * @api + */ public const string RELEASE_DATE = '@release_date@'; private const int SUCCESS_CODE = 0; diff --git a/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php b/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php index 7d556956015..c95b4bc56b4 100644 --- a/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php +++ b/src/BetterPhpDocParser/Contract/PhpDocParser/PhpDocNodeDecoratorInterface.php @@ -9,5 +9,8 @@ interface PhpDocNodeDecoratorInterface { + /** + * @api implemented by child classes + */ public function decorate(PhpDocNode $phpDocNode, Node $phpNode): void; } diff --git a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php index 2e273b93093..5313f86c574 100644 --- a/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php +++ b/src/BetterPhpDocParser/PhpDocInfo/PhpDocInfo.php @@ -83,6 +83,9 @@ public function __construct( } } + /** + * @api + */ public function addPhpDocTagNode(PhpDocChildNode $phpDocChildNode): void { $this->phpDocNode->children[] = $phpDocChildNode; @@ -189,6 +192,9 @@ public function hasByName(string $name): bool return (bool) $this->getTagsByName($name); } + /** + * @api + */ public function getByName(string $name): ?Node { return $this->getTagsByName($name)[0] ?? null; @@ -207,6 +213,9 @@ public function getByAnnotationClasses(array $classes): ?DoctrineAnnotationTagVa return $doctrineAnnotationTagValueNodes[0] ?? null; } + /** + * @api doctrine/symfony + */ public function getByAnnotationClass(string $class): ?DoctrineAnnotationTagValueNode { $doctrineAnnotationTagValueNodes = $this->phpDocNodeByTypeFinder->findDoctrineAnnotationsByClass( diff --git a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php index d808b41ca95..52dd2f478f8 100644 --- a/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php +++ b/src/BetterPhpDocParser/PhpDocManipulator/PhpDocTagRemover.php @@ -12,6 +12,9 @@ final class PhpDocTagRemover { + /** + * @api phpunit + */ public function removeByName(PhpDocInfo $phpDocInfo, string $name): bool { $hasChanged = false; diff --git a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php index b5c387dfcb4..94d92f64a6b 100644 --- a/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php +++ b/src/BetterPhpDocParser/ValueObject/PhpDoc/DoctrineAnnotation/AbstractValuesAwareNode.php @@ -26,6 +26,9 @@ public function __construct( ) { } + /** + * @api + */ public function removeValue(string $desiredKey): void { foreach ($this->values as $key => $value) { diff --git a/src/Composer/ValueObject/InstalledPackage.php b/src/Composer/ValueObject/InstalledPackage.php index 0e19e21c1d1..291c7c389ab 100644 --- a/src/Composer/ValueObject/InstalledPackage.php +++ b/src/Composer/ValueObject/InstalledPackage.php @@ -4,6 +4,9 @@ namespace Rector\Composer\ValueObject; +/** + * @api + */ final readonly class InstalledPackage { public function __construct( diff --git a/src/Config/RectorConfig.php b/src/Config/RectorConfig.php index 7c9637c3ca6..deeb9ea9ff3 100644 --- a/src/Config/RectorConfig.php +++ b/src/Config/RectorConfig.php @@ -27,6 +27,7 @@ use Webmozart\Assert\Assert; /** + * @api * @see \Rector\Tests\Config\RectorConfigTest */ final class RectorConfig extends Container @@ -372,6 +373,7 @@ public function phpVersion(int $phpVersion): void /** * @internal * + * @api only for testing. It is parsed from composer.json "require" packages by default * @param array $polyfillPackages */ public function polyfillPackages(array $polyfillPackages): void @@ -482,6 +484,7 @@ public function indent(string $character, int $count): void /** * @internal + * @api used only in tests */ public function resetRuleConfigurations(): void { diff --git a/src/Configuration/RectorConfigBuilder.php b/src/Configuration/RectorConfigBuilder.php index 53d885f5888..23199b2f1b0 100644 --- a/src/Configuration/RectorConfigBuilder.php +++ b/src/Configuration/RectorConfigBuilder.php @@ -36,6 +36,9 @@ use Symfony\Component\Finder\Finder; use Webmozart\Assert\Assert; +/** + * @api + */ final class RectorConfigBuilder { private const int MAX_LEVEL_GAP = 10; diff --git a/src/DependencyInjection/PHPStan/RichParserFactory.php b/src/DependencyInjection/PHPStan/RichParserFactory.php index 3ac90de0eb2..8d32a5e65a3 100644 --- a/src/DependencyInjection/PHPStan/RichParserFactory.php +++ b/src/DependencyInjection/PHPStan/RichParserFactory.php @@ -31,6 +31,9 @@ public function __construct( ) { } + /** + * @api used by config/phpstan/parser.neon + */ public function create(): RichParser { return new RichParser( diff --git a/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php b/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php index ae068aaa8ad..cfd91937ce9 100644 --- a/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php +++ b/src/FamilyTree/NodeAnalyzer/ClassChildAnalyzer.php @@ -10,10 +10,15 @@ use PHPStan\Type\MixedType; use PHPStan\Type\Type; +/** + * @api + */ final readonly class ClassChildAnalyzer { /** * Look both parent class and interface, yes, all PHP interface methods are abstract + * + * @api rector-symfony */ public function hasAbstractParentClassMethod(ClassReflection $classReflection, string $methodName): bool { @@ -28,6 +33,9 @@ public function hasAbstractParentClassMethod(ClassReflection $classReflection, s ); } + /** + * @api downgrade + */ public function resolveParentClassMethodReturnType(ClassReflection $classReflection, string $methodName): Type { $parentClassMethods = $this->resolveParentClassMethods($classReflection, $methodName); diff --git a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php index 4508d76cd0a..e9dce6221a8 100644 --- a/src/NodeAnalyzer/DoctrineEntityAnalyzer.php +++ b/src/NodeAnalyzer/DoctrineEntityAnalyzer.php @@ -10,6 +10,9 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory; +/** + * @api used in doctrine + */ final readonly class DoctrineEntityAnalyzer { /** diff --git a/src/NodeManipulator/AssignManipulator.php b/src/NodeManipulator/AssignManipulator.php index 5c88d209f84..7240eb46b5e 100644 --- a/src/NodeManipulator/AssignManipulator.php +++ b/src/NodeManipulator/AssignManipulator.php @@ -63,6 +63,7 @@ public function matchListAndEach(Assign $assign): ?ListAndEach } /** + * @api doctrine * @return array */ public function resolveAssignsToLocalPropertyFetches(FunctionLike $functionLike): array diff --git a/src/NodeManipulator/ClassDependencyManipulator.php b/src/NodeManipulator/ClassDependencyManipulator.php index 7b252b08be7..e51993b8f55 100644 --- a/src/NodeManipulator/ClassDependencyManipulator.php +++ b/src/NodeManipulator/ClassDependencyManipulator.php @@ -33,6 +33,7 @@ use Rector\ValueObject\PhpVersionFeature; /** + * @api used by rector-symfony and rector-doctrine * @see \Rector\Tests\NodeManipulator\ClassDependencyManipulatorTest */ final readonly class ClassDependencyManipulator @@ -103,6 +104,9 @@ public function addConstructorDependency(Class_ $class, PropertyMetadata $proper ); } + /** + * @api doctrine + */ public function addConstructorDependencyWithCustomAssign( Class_ $class, string $name, @@ -156,6 +160,7 @@ public function addConstructorDependencyWithCustomAssign( } /** + * @api doctrine * @param Stmt[] $stmts */ public function addStmtsToConstructorIfNotThereYet(Class_ $class, array $stmts): void diff --git a/src/NodeManipulator/ClassManipulator.php b/src/NodeManipulator/ClassManipulator.php index bc6e7e85250..6c8f680975c 100644 --- a/src/NodeManipulator/ClassManipulator.php +++ b/src/NodeManipulator/ClassManipulator.php @@ -36,6 +36,9 @@ public function hasParentMethodOrInterface(ObjectType $objectType, string $oldMe return false; } + /** + * @api phpunit + */ public function hasTrait(Class_ $class, string $desiredTrait): bool { foreach ($class->getTraitUses() as $traitUse) { diff --git a/src/NodeManipulator/PropertyManipulator.php b/src/NodeManipulator/PropertyManipulator.php index 921c3a75278..6e081d6bcaf 100644 --- a/src/NodeManipulator/PropertyManipulator.php +++ b/src/NodeManipulator/PropertyManipulator.php @@ -113,6 +113,9 @@ public function isPropertyChangeableExceptConstructor( return false; } + /** + * @api Used in rector-symfony + */ public function resolveExistingClassPropertyNameByType(Class_ $class, ObjectType $objectType): ?string { foreach ($class->getProperties() as $property) { diff --git a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php index 100f3e21766..8755e439efa 100644 --- a/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php +++ b/src/NodeTypeResolver/DependencyInjection/PHPStanServicesFactory.php @@ -69,26 +69,41 @@ public function __construct() } } + /** + * @api + */ public function createReflectionProvider(): ReflectionProvider { return $this->container->getByType(ReflectionProvider::class); } + /** + * @api + */ public function createEmulativeLexer(): Lexer { return $this->container->getService('currentPhpVersionLexer'); } + /** + * @api + */ public function createPHPStanParser(): Parser { return $this->container->getService('currentPhpVersionRichParser'); } + /** + * @api + */ public function createNodeScopeResolver(): NodeScopeResolver { return $this->container->getByType(NodeScopeResolver::class); } + /** + * @api + */ public function createScopeFactory(): ScopeFactory { return $this->container->getByType(ScopeFactory::class); @@ -105,21 +120,33 @@ public function getByType(string $type): object return $this->container->getByType($type); } + /** + * @api + */ public function createFileHelper(): FileHelper { return $this->container->getByType(FileHelper::class); } + /** + * @api + */ public function createTypeNodeResolver(): TypeNodeResolver { return $this->container->getByType(TypeNodeResolver::class); } + /** + * @api + */ public function createDynamicSourceLocatorProvider(): DynamicSourceLocatorProvider { return $this->container->getByType(DynamicSourceLocatorProvider::class); } + /** + * @api + */ public function getContainer(): Container { return $this->container; diff --git a/src/NodeTypeResolver/Node/AttributeKey.php b/src/NodeTypeResolver/Node/AttributeKey.php index 6ab073d31ec..0539d4b4dce 100644 --- a/src/NodeTypeResolver/Node/AttributeKey.php +++ b/src/NodeTypeResolver/Node/AttributeKey.php @@ -46,6 +46,8 @@ final class AttributeKey public const string NAMESPACED_NAME = 'namespacedName'; /** + * @api + * * Internal php-parser name. * Do not change this even if you want! */ diff --git a/src/NodeTypeResolver/NodeTypeResolver.php b/src/NodeTypeResolver/NodeTypeResolver.php index 36c3ae4595b..a516fe7a2b9 100644 --- a/src/NodeTypeResolver/NodeTypeResolver.php +++ b/src/NodeTypeResolver/NodeTypeResolver.php @@ -93,6 +93,7 @@ public function __construct( } /** + * @api doctrine symfony * @param ObjectType[] $requiredTypes */ public function isObjectTypes(Node $node, array $requiredTypes): bool diff --git a/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php b/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php index dccfc25a3f3..0c74e8f7c5e 100644 --- a/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php +++ b/src/NodeTypeResolver/Reflection/BetterReflection/RectorBetterReflectionSourceLocatorFactory.php @@ -9,6 +9,9 @@ use PHPStan\Reflection\BetterReflection\BetterReflectionSourceLocatorFactory; use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator; +/** + * @api used on phpstan config factory + */ final readonly class RectorBetterReflectionSourceLocatorFactory { public function __construct( diff --git a/src/Parallel/Contract/SerializableInterface.php b/src/Parallel/Contract/SerializableInterface.php index 250986e4c66..a08a6a9e890 100644 --- a/src/Parallel/Contract/SerializableInterface.php +++ b/src/Parallel/Contract/SerializableInterface.php @@ -9,6 +9,7 @@ interface SerializableInterface extends JsonSerializable { /** + * @api implemented by child classes * @param array $json */ public static function decode(array $json): self; diff --git a/src/PhpDocParser/ValueObject/AttributeKey.php b/src/PhpDocParser/ValueObject/AttributeKey.php deleted file mode 100644 index f7c5bc3a117..00000000000 --- a/src/PhpDocParser/ValueObject/AttributeKey.php +++ /dev/null @@ -1,19 +0,0 @@ -builderFactory->propertyFetch($fetcherExpr, $property); } + /** + * @api + */ public function createPrivateProperty(string $name): Property { $propertyBuilder = new PropertyBuilder($name); diff --git a/src/PhpParser/Node/Value/ValueResolver.php b/src/PhpParser/Node/Value/ValueResolver.php index fb0aa944793..77a9b830dec 100644 --- a/src/PhpParser/Node/Value/ValueResolver.php +++ b/src/PhpParser/Node/Value/ValueResolver.php @@ -112,6 +112,7 @@ public function getValue(Arg|Expr|InterpolatedStringPart $expr, bool $resolvedCl } /** + * @api symfony * @param mixed[] $expectedValues */ public function isValues(Expr $expr, array $expectedValues): bool diff --git a/src/PhpParser/NodeTransformer.php b/src/PhpParser/NodeTransformer.php index c2b87738c73..278b65c1b28 100644 --- a/src/PhpParser/NodeTransformer.php +++ b/src/PhpParser/NodeTransformer.php @@ -19,6 +19,9 @@ use Rector\Util\StringUtils; use Rector\ValueObject\SprintfStringAndArgs; +/** + * @api used in phpunit + */ final class NodeTransformer { /** @@ -27,6 +30,8 @@ final class NodeTransformer private const string PERCENT_TEXT_REGEX = '#^%\w$#'; /** + * @api used in phpunit symfony + * * From: * - sprintf("Hi %s", $name); * @@ -83,6 +88,9 @@ public function transformArrayToYields(Array_ $array): array return $yields; } + /** + * @api symfony + */ public function transformConcatToStringArray(Concat $concat): Array_ { $arrayItems = $this->transformConcatToItems($concat); diff --git a/src/PhpParser/Parser/InlineCodeParser.php b/src/PhpParser/Parser/InlineCodeParser.php index fea5eca842f..ca64905f5e5 100644 --- a/src/PhpParser/Parser/InlineCodeParser.php +++ b/src/PhpParser/Parser/InlineCodeParser.php @@ -65,6 +65,8 @@ public function __construct( } /** + * @api downgrade + * * @return Stmt[] */ public function parseFile(string $fileName): array diff --git a/src/Reflection/ReflectionResolver.php b/src/Reflection/ReflectionResolver.php index 5b07f5b2fb4..3e333f007bb 100644 --- a/src/Reflection/ReflectionResolver.php +++ b/src/Reflection/ReflectionResolver.php @@ -47,6 +47,9 @@ public function __construct( ) { } + /** + * @api + */ public function resolveClassAndAnonymousClass(ClassLike $classLike): ClassReflection { if ($classLike instanceof Class_ && $this->classAnalyzer->isAnonymousClass($classLike)) { @@ -206,6 +209,9 @@ public function resolveFunctionLikeReflectionFromCall( return null; } + /** + * @api used in rector-laravel + */ public function resolveMethodReflectionFromClassMethod(ClassMethod $classMethod, Scope $scope): ?MethodReflection { $classReflection = $scope->getClassReflection(); diff --git a/src/RuleDoc/CodeSample/ConfiguredCodeSample.php b/src/RuleDoc/CodeSample/ConfiguredCodeSample.php index 3e5a24a159a..b6875889bd4 100644 --- a/src/RuleDoc/CodeSample/ConfiguredCodeSample.php +++ b/src/RuleDoc/CodeSample/ConfiguredCodeSample.php @@ -8,6 +8,9 @@ use Rector\RuleDoc\Contract\CodeSampleInterface; use Rector\RuleDoc\Exception\ShouldNotHappenException; +/** + * @api + */ final class ConfiguredCodeSample extends AbstractCodeSample implements CodeSampleInterface { /** diff --git a/src/RuleDoc/CodeSample/ExtraFileCodeSample.php b/src/RuleDoc/CodeSample/ExtraFileCodeSample.php index c7723853308..f95e0a3b8bd 100644 --- a/src/RuleDoc/CodeSample/ExtraFileCodeSample.php +++ b/src/RuleDoc/CodeSample/ExtraFileCodeSample.php @@ -6,6 +6,9 @@ use Rector\RuleDoc\AbstractCodeSample; +/** + * @api + */ final class ExtraFileCodeSample extends AbstractCodeSample { public function __construct( diff --git a/src/Set/Contract/SetInterface.php b/src/Set/Contract/SetInterface.php deleted file mode 100644 index f32334a6e36..00000000000 --- a/src/Set/Contract/SetInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -groupName; - } - - public function getName(): string - { - return $this->setName; - } - - public function getSetFilePath(): string - { - return $this->setFilePath; - } -} diff --git a/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php b/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php index 7a969e8ca6d..916ba0da943 100644 --- a/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/ShortenedGenericObjectType.php @@ -8,6 +8,9 @@ use PHPStan\Type\IsSuperTypeOfResult; use PHPStan\Type\Type; +/** + * @api + */ final class ShortenedGenericObjectType extends GenericObjectType { /** diff --git a/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php b/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php index 78bef077860..a6c0738d2ee 100644 --- a/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php +++ b/src/StaticTypeMapper/ValueObject/Type/ShortenedObjectType.php @@ -8,6 +8,9 @@ use PHPStan\Type\ObjectType; use PHPStan\Type\Type; +/** + * @api + */ final class ShortenedObjectType extends ObjectType { /** diff --git a/src/ValueObject/PolyfillPackage.php b/src/ValueObject/PolyfillPackage.php index 248a9092781..f2d7822b0cd 100644 --- a/src/ValueObject/PolyfillPackage.php +++ b/src/ValueObject/PolyfillPackage.php @@ -4,6 +4,9 @@ namespace Rector\ValueObject; +/** + * @api + */ final class PolyfillPackage { public const string PHP_85 = 'symfony/polyfill-php85'; From f763caf5bfd3434c0a5c36ae45a7859b2a6227bc Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 00:16:56 +0200 Subject: [PATCH 11/15] misc --- src/PhpParser/Node/BetterNodeFinder.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/PhpParser/Node/BetterNodeFinder.php b/src/PhpParser/Node/BetterNodeFinder.php index 927be58d12a..369b92a14f3 100644 --- a/src/PhpParser/Node/BetterNodeFinder.php +++ b/src/PhpParser/Node/BetterNodeFinder.php @@ -16,7 +16,6 @@ use PhpParser\Node\Stmt\Return_; use PhpParser\NodeFinder; use PhpParser\NodeVisitor; -use Rector\NodeAnalyzer\ClassAnalyzer; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Webmozart\Assert\Assert; @@ -29,7 +28,6 @@ public function __construct( private NodeFinder $nodeFinder, private NodeNameResolver $nodeNameResolver, - private ClassAnalyzer $classAnalyzer, private SimpleCallableNodeTraverser $simpleCallableNodeTraverser ) { } From 62be05b7e6c19eeceb7b0f7381526458b6dcc442 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 00:18:48 +0200 Subject: [PATCH 12/15] restore Set and SetInterface used by getrector.com website --- rules/Naming/Naming/VariableNaming.php | 38 ---------------------- src/Set/Contract/SetInterface.php | 24 ++++++++++++++ src/Set/ValueObject/Set.php | 44 ++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 38 deletions(-) delete mode 100644 rules/Naming/Naming/VariableNaming.php create mode 100644 src/Set/Contract/SetInterface.php create mode 100644 src/Set/ValueObject/Set.php diff --git a/rules/Naming/Naming/VariableNaming.php b/rules/Naming/Naming/VariableNaming.php deleted file mode 100644 index 81f7d1cb3e3..00000000000 --- a/rules/Naming/Naming/VariableNaming.php +++ /dev/null @@ -1,38 +0,0 @@ -hasVariableType($valueName)->yes()) { - return $valueName; - } - - // we need to add number suffix until the variable is unique - $i = 2; - $countedValueNamePart = $valueName; - while ($scope->hasVariableType($valueName)->yes()) { - $valueName = $countedValueNamePart . $i; - ++$i; - } - - return $valueName; - } -} diff --git a/src/Set/Contract/SetInterface.php b/src/Set/Contract/SetInterface.php new file mode 100644 index 00000000000..cebd5e891b5 --- /dev/null +++ b/src/Set/Contract/SetInterface.php @@ -0,0 +1,24 @@ +groupName; + } + + public function getName(): string + { + return $this->setName; + } + + public function getSetFilePath(): string + { + return $this->setFilePath; + } +} From 47aa76ac8eb7d4e3cc3339558d6f72816108118f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 09:58:38 +0200 Subject: [PATCH 13/15] mark test-only FixtureTempFileDumper and TestingParser as @api --- src/Testing/Fixture/FixtureTempFileDumper.php | 3 +++ src/Testing/TestingParser/TestingParser.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/Testing/Fixture/FixtureTempFileDumper.php b/src/Testing/Fixture/FixtureTempFileDumper.php index 880f2cf540b..f1de9f7eec0 100644 --- a/src/Testing/Fixture/FixtureTempFileDumper.php +++ b/src/Testing/Fixture/FixtureTempFileDumper.php @@ -6,6 +6,9 @@ use Nette\Utils\FileSystem; +/** + * @api used in tests + */ final class FixtureTempFileDumper { /** diff --git a/src/Testing/TestingParser/TestingParser.php b/src/Testing/TestingParser/TestingParser.php index f485f182d24..fa236b0e3d5 100644 --- a/src/Testing/TestingParser/TestingParser.php +++ b/src/Testing/TestingParser/TestingParser.php @@ -16,6 +16,9 @@ use Rector\PhpParser\Parser\RectorParser; use Rector\ValueObject\Application\File; +/** + * @api used in tests + */ final readonly class TestingParser { public function __construct( From 103f070421fdd67cddc4a555504ffcd2305a479f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 12:02:57 +0200 Subject: [PATCH 14/15] remove deprecated Set and SetInterface --- src/Set/Contract/SetInterface.php | 24 ----------------- src/Set/ValueObject/Set.php | 44 ------------------------------- 2 files changed, 68 deletions(-) delete mode 100644 src/Set/Contract/SetInterface.php delete mode 100644 src/Set/ValueObject/Set.php diff --git a/src/Set/Contract/SetInterface.php b/src/Set/Contract/SetInterface.php deleted file mode 100644 index cebd5e891b5..00000000000 --- a/src/Set/Contract/SetInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -groupName; - } - - public function getName(): string - { - return $this->setName; - } - - public function getSetFilePath(): string - { - return $this->setFilePath; - } -} From 7525e1c131e190a26e358f24b5ae6cab7a5f894b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 24 Oct 2026 12:05:44 +0200 Subject: [PATCH 15/15] remove unused setRuleClass/getRuleClass from RuleDefinition --- src/RuleDoc/RuleDefinition.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/RuleDoc/RuleDefinition.php b/src/RuleDoc/RuleDefinition.php index 6a435d6cd75..073bfebf4ef 100644 --- a/src/RuleDoc/RuleDefinition.php +++ b/src/RuleDoc/RuleDefinition.php @@ -16,8 +16,6 @@ final class RuleDefinition { private ?string $ruleFilePath = null; - private ?string $ruleClass = null; - /** * @var CodeSampleInterface[] */ @@ -59,20 +57,6 @@ public function getRuleFilePath(): string return $this->ruleFilePath; } - public function setRuleClass(string $ruleClass): void - { - $this->ruleClass = $ruleClass; - } - - public function getRuleClass(): string - { - if ($this->ruleClass === null) { - throw new ShouldNotHappenException(); - } - - return $this->ruleClass; - } - /** * @return CodeSampleInterface[] */