Skip to content

Do not report at attribute line #161

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

Open
wants to merge 1 commit into
base: 2.0.x
Choose a base branch
from

Conversation

janedbal
Copy link
Contributor

I believe it is misleading to report at the first attribute line. Most visible when you inline ignore it. One real world example from our codebase:

#[Get('/api/v1/foo')] // @phpstan-ignore return.deprecatedClass
#[OwnedBy(Team::D2C)]
public function someAction(): DeprecatedClass
{

This is minor BC, but I think moving few inline ignores is not that big deal. If you feel otherwise, we can use bleedingEdge.

@@ -51,7 +52,7 @@ public function processNode(Node $node, Scope $scope): array
strtolower($deprecatedClass->getClassTypeDescription()),
$deprecatedClass->getName(),
$this->deprecatedClassHelper->getClassDeprecationDescription($deprecatedClass),
))->identifier(sprintf('parameter.deprecated%s', $deprecatedClass->getClassTypeDescription()))->build();
))->identifier(sprintf('parameter.deprecated%s', $deprecatedClass->getClassTypeDescription()))->line($line)->build();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally, this should report at the parameter line, but that would be much bigger BC.

@ondrejmirtes
Copy link
Member

This would much better addressed in phpstan-src for rules executed on all nodes that can have attributes. And also on virtual nodes related to those nodes.

And only for bleeding edge because it's a BC break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants