-
Notifications
You must be signed in to change notification settings - Fork 506
Implement FinalPrivateConstantRule #3838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8e07dbc
to
1311fdd
Compare
{ | ||
$this->analyse([__DIR__ . '/data/final-private-const.php'], [ | ||
[ | ||
'Private constant FinalPrivateConstants\User::FINAL_PRIVATE() cannot be final as it is not visible to other classes.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used the error message from https://3v4l.org/oBYII
$errors = []; | ||
foreach ($node->consts as $classConstNode) { | ||
$errors[] = RuleErrorBuilder::message(sprintf( | ||
'Private constant %s::%s() cannot be final as it is not visible to other classes.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the method wording: Private method HelloWorld::sayHello() cannot be final as it is never overridden by other classes.
'Private constant %s::%s() cannot be final as it is never overridden by other classes.', | ||
$classReflection->getDisplayName(), | ||
$classConstNode->name->name, | ||
))->identifier('classConstant.finalPrivate')->build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be non-ignorable
f711356
to
c650a3c
Compare
Thank you! |
as requested in #3830 (review)