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/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/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 deleted file mode 100644 index 1b334ce9bec..00000000000 --- a/rules/CodingStyle/ValueObject/ObjectMagicMethods.php +++ /dev/null @@ -1,36 +0,0 @@ -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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/ValueObject/BridgeItem.php b/src/Parallel/ValueObject/BridgeItem.php index e743242e190..f0406a447ce 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 @@ -22,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/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 deleted file mode 100644 index 6525de98375..00000000000 --- a/src/PhpDocParser/ValueObject/AttributeKey.php +++ /dev/null @@ -1,36 +0,0 @@ -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..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 ) { } @@ -76,7 +74,6 @@ public function findFirstInstanceOf(Node|array $nodes, string $type): ?Node } /** - * @api * @param Node|Node[] $nodes * @return Variable|null */ @@ -109,20 +106,6 @@ public function find(Node|array $nodes, callable $filter): array return $this->nodeFinder->find($nodes, $filter); } - /** - * @api symfony - * @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 @@ -195,8 +178,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..e67c1f4aed3 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,17 +195,8 @@ public function createPrivatePropertyFromNameAndType(string $name, ?Type $type): } /** - * @api symfony - * @param mixed[] $arguments - */ - public function createLocalMethodCall(string $method, array $arguments = []): MethodCall - { - $variable = new Variable('this'); - return $this->createMethodCall($variable, $method, $arguments); - } - - /** - * @api symfony, doctrine, phpunit + * @api + * * @param mixed[] $arguments */ public function createMethodCall(Expr|string $exprOrVariableName, string $method, array $arguments = []): MethodCall @@ -224,7 +212,7 @@ public function createPropertyFetch(string|Expr $variableNameOrExpr, string $pro } /** - * @api doctrine + * @api */ public function createPrivateProperty(string $name): Property { @@ -327,7 +315,6 @@ public function createTrue(): ConstFetch } /** - * @api phpunit * @param string|ObjectReference::* $constantName */ public function createClassConstFetchFromName(Name $className, string $constantName): ClassConstFetch 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/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/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/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/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/Set/ValueObject/SetList.php b/src/Set/ValueObject/SetList.php index ae435ba8485..df0c412a209 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 { /** @@ -20,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. */ 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/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/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..fa236b0e3d5 100644 --- a/src/Testing/TestingParser/TestingParser.php +++ b/src/Testing/TestingParser/TestingParser.php @@ -17,7 +17,7 @@ use Rector\ValueObject\Application\File; /** - * @api + * @api used in tests */ final readonly class TestingParser { 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/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(