镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[DeadCode] Skip abstract method on RemoveUnusedPublicMethodParameterRector - #7002

Merged
samsonasik merged 6 commits into
mainfrom
skip-abstract
Jun 19, 2025
Merged

samsonasik merged 6 commits into
mainfrom
skip-abstract

Conversation

@samsonasik

Copy link
Copy Markdown
Member

It happen when ->withTreatClassesAsFinal(); is used, which non-final class can have abstract method to be implemented by child.


namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUnusedPublicMethodParameterRector\FixtureTreatClassesAsFinal;

abstract class SkipAbstractMethod

@samsonasik samsonasik Jun 19, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomasVotruba abstract method only exists in abstract class, this means in other rules, the check $class->isAbstract() is needed as well, since abstract never be "final".

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create separate PR for add is abstract check on "treat final class" since abstract never be "final"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created separate PR for always verify class is abstract before FeatureFlags::treatClassesAsFinal() check at PR:

Comment on lines -20 to -23
public static function reset(): void
{
SimpleParameterProvider::setParameter(Option::TREAT_CLASSES_AS_FINAL, false);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved this reset functionality to AbstractRectorTestCase::tearDownAfterClass

@samsonasik

Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant