-
-
Notifications
You must be signed in to change notification settings - Fork 932
-
Ondrej, I am wondering if we should change in PHPStan what Jetbrains couldn't get fixed for over 14 months on their end?
@staabm just opened
https://youtrack.jetbrains.com/issue/WI-82781/PHPStan-integration-show-error-identifiers
And there are also:
https://youtrack.jetbrains.com/issue/WI-81974/PHPStan-Show-error-identifiers
https://youtrack.jetbrains.com/issue/WI-78524/PHPStan-Make-it-possible-to-use-more-detailed-error-reporting-formats
I got it working for myself and I can PR:
https://gist.github.com/NickSdot/58d27003b5c76c662bb1bfac550f3517#file-checkstyleerrorformatter-php-L45-L53
It's a minimal change that moves the error identifier into the message of the CheckstyleErrorFormatter.php instead appending it via source. It's as simple as:
$output->writeRaw(sprintf( ' <error line="%d" column="1" severity="error" message="%s"%s />', $this->escape((string) $error->getLine()), $this->escape($error->getMessage()), $error->getIdentifier() !== null ? sprintf(' source="%s"', $this->escape($error->getIdentifier())) : '', )); $output->writeLineFormatted('');
to:
$identifier = null !== $error->getIdentifier() ? " // @phpstan-ignore {$error->getIdentifier()}" : ''; $output->writeRaw(sprintf( '<error line="%d" column="1" severity="error" message="%s" />', $this->escape((string) $error->getLine()), $this->escape($error->getMessage() . $identifier), ));
Keen to merge this if I PR it?
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
Replies: 2 comments
-
I like the idea. lets see what ondrej says about it.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Sent the PR: phpstan/phpstan-src#4416
Beta Was this translation helpful? Give feedback.