Skip to content

Conversation

NickSdot
Copy link

@NickSdot NickSdot commented Oct 7, 2025

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

$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) : '')),
Copy link
Member

Choose a reason for hiding this comment

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

  1. I don't want the error message to contain phpstan-ignore, just the identifier
  2. 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?

Copy link
Author

@NickSdot NickSdot Oct 7, 2025

Choose a reason for hiding this comment

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

  1. 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.
image
  1. 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

Copy link
Member

@ondrejmirtes ondrejmirtes Oct 7, 2025

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.

Copy link
Author

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? 🚀

Copy link
Member

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 🪄

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Author

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

@NickSdot NickSdot closed this Oct 7, 2025
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.

4 participants