Skip to content
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

PHPStan: Add support for multiline messages #3686

Merged
merged 1 commit into from
Jul 9, 2021

Conversation

greg0ire
Copy link
Contributor

@greg0ire greg0ire commented Apr 10, 2021

When using PHPStan, you might get multiline messages in some cases:

/home/greg/dev/doctrine-migrations/tests/Doctrine/Migrations/Tests/Metadata/Storage/ExistingTableMetadataStorageTest.php:83:Fetching class constant class of deprecated class Doctrine\DBAL\Connections\MasterSlaveConnection:
Use PrimaryReadReplicaConnection instead
/home/greg/dev/doctrine-migrations/tests/Doctrine/Migrations/Tests/Metadata/Storage/TableMetadataStorageTest.php:200:Instantiation of deprecated class Doctrine\DBAL\Driver\PDOSqlite\Driver:
Use {@link PDO\SQLite\Driver} instead.
/home/greg/dev/doctrine-migrations/tests/Doctrine/Migrations/Tests/Tools/Console/Command/StatusCommandTest.php:77:Call to method compare() of deprecated class Doctrine\DBAL\Version:
Refrain from checking the DBAL version at runtime.

Without this patch, the messages get truncated and you only get the first line, so just Instantiation of deprecated class Doctrine\DBAL\Driver\PDOSqlite\Driver:

With it, you can get the whole message. (Instantiation of deprecated class Doctrine\DBAL\Driver\PDOSqlite\Driver: Use {@link PDO\SQLite\Driver} instead.)

This is achieved by switching to JSON, which makes it much easier to
avoid confusion between an error message and the next one. It also
spares us from having to deal with regular expressions, and eliminates
some edge cases that no longer need to be tested.

@greg0ire greg0ire changed the title Add support for multiline messages PHPStan: Add support for multiline messages Apr 10, 2021
@greg0ire greg0ire force-pushed the phpstan-multiline-support branch 9 times, most recently from 40a8730 to ec4477c Compare April 10, 2021 18:58
@greg0ire greg0ire marked this pull request as ready for review April 10, 2021 19:10
This is achieved by switching to JSON, which makes it much easier to
avoid confusion between an error message and the next one. It also
spares us from having to deal with regular expressions, and eliminates
some edge cases that no longer need to be tested.
@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 4, 2021

ping @w0rp I've been using this for almost 2 months now, no issues 🙂

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Looks good to me and json output seems to have been supported for long time.

@hsanson hsanson merged commit 2a5a7ba into dense-analysis:master Jul 9, 2021
@greg0ire greg0ire deleted the phpstan-multiline-support branch July 9, 2021 18:38
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.

None yet

2 participants