-
Notifications
You must be signed in to change notification settings - Fork 535
Quality of life improvement, PHPStorm error identifiers #4416
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
$this->escape((string) $error->getLine()), | ||
$this->escape($error->getMessage()), | ||
$error->getIdentifier() !== null ? sprintf(' source="%s"', $this->escape($error->getIdentifier())) : '', | ||
$this->escape($error->getMessage() . ($identifier !== null ? sprintf(' // @phpstan-ignore %s', $identifier) : '')), |
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.
- I don't want the error message to contain phpstan-ignore, just the identifier
- I don't want the error message to change for everyone, that's creating unnecessary noise. Can we detect we're running inside the PhpStorm plugin?
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.
- Sure, I can do that. Allow me to add that it is super convinient to be able to just copy&paste the full comment. Your call.

- Not really. I was thinking about that. There is no PHPStorm native env var available. One hacky way to achieve an opt-in like behaviour is the following:
- create phpstorm.php somewhere with content
<?php
putenv('PHPSTAN_IDE=PHP_STORM');
- load it as bootstrap file
parameters:
bootstrapFiles:
- ./Foo/phpstorm.php
Then I have it available in the CheckstyleErrorFormatter.
But honestly, this feels too hacky. At this point it is probably better to just introduce CheckstyleErrorFormatterPhpStorm
and then people can opt-in the usual way?
errorFormatter.checkstyle:
class: Foo\CheckstyleErrorFormatterPhpStorm
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.
Honestly I'm not too keen on fixing problems of a different commercial product on my side because they're not giving priority to work on their plugin, creating more work for me.
I'd rather have my own plugin that offers the best experience for PhpStorm users, probably offered as part of PHPStan Pro subscription.
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.
Yes, I am with you. Totally understandable. Also quite disappointing that @JetBrains leaves small issues like this open for such long time. Maybe @pronskiy or @brendt can get something rolling on their end.
Closing here. When official plugin? 🚀
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.
Maybe I'll vibecode it 🪄
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.
Phpstorm can be detected, see https://github.com/phpstan/phpstan-src/pull/4369/files
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.
Thanks @staabm but that apparenly doesn't work in the inspection; terminal only. Tried, not available.
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.
Isn't that only for the integrated terminal? PHPStan in PHPStorm works as a plugin.
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.
I wrapped it up as a composer package real quick composer require nicksdot/phpstan-phpstorm-error-identifiers
ref: phpstan/phpstan#13646
I left the actual source attribute untouched in case someone is using it for any other tools. If Jetbrains ever gets this sorted on their end we can revert the change without affecting anything else.
Edit: failures seem unrelated