Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PHPStorm: Show error identifiers #13646

NickSdot started this conversation in General
Discussion options

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?

You must be logged in to vote

Replies: 2 comments

Comment options

I like the idea. lets see what ondrej says about it.

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /