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

DX: PHPStan improvements #6868

Merged
merged 12 commits into from May 6, 2023

Conversation

Wirone
Copy link
Member

@Wirone Wirone commented Mar 27, 2023

Details in commits' messages, but let's summarise:

  • Allow customising PHPStan experience with phpstan.neon (default config moved to phpstan.dist.neon)
  • Bump PHPStan and extensions to newest version
  • Report unmatched errors (enforce clean baseline)
  • Fix some currently ignored errors, in terms of "no value type specified in iterable type" I introduced example type aliases to discuss it before working on other missing array shapes
  • Use actual baseline file instead of count-based error rule

Plan for the future (in separate PRs):

@coveralls
Copy link

coveralls commented Mar 27, 2023

Pull Request Test Coverage Report for Build 4600881262

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.004%

Totals Coverage Status
Change from base Build 4600797305: 0.0%
Covered Lines: 22734
Relevant Lines: 24444

💛 - Coveralls

dev-tools/composer.lock Outdated Show resolved Hide resolved
phpstan.dist.neon Outdated Show resolved Hide resolved
Copy link
Member

@keradus keradus left a comment

Choose a reason for hiding this comment

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

great story reading over commit logs!
i left some commits

@Wirone Wirone force-pushed the codito/phpstan-improvement branch from e77719c to 085407c Compare April 3, 2023 14:59
@Wirone
Copy link
Member Author

Wirone commented Apr 3, 2023

@keradus sorry for the force push - I wanted to rebase branch to be up-to-date with master and then push only what was provided before + new commits in separate push (so Github could display compare view only for new commits), but I forgot and pushed everything at once 😩. I hope you used "Viewed" checkboxes and Github handle it properly for files that were not changed within rebase (Gitlab can do it, so I have such habit).

@Wirone Wirone force-pushed the codito/phpstan-improvement branch 2 times, most recently from 9f1de92 to 744fda5 Compare April 3, 2023 15:15
@Wirone Wirone force-pushed the codito/phpstan-improvement branch from 744fda5 to 7de2ba5 Compare April 3, 2023 20:08
@Wirone Wirone force-pushed the codito/phpstan-improvement branch 2 times, most recently from 716ff79 to 480ff3b Compare April 26, 2023 15:26
@Wirone Wirone force-pushed the codito/phpstan-improvement branch 3 times, most recently from 911b9c8 to 35f6b49 Compare May 5, 2023 21:51
Copy link
Contributor

@kubawerlos kubawerlos left a comment

Choose a reason for hiding this comment

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

@Wirone one last thing, can you update .gitattributes?

Wirone added 4 commits May 6, 2023 09:54
Make `phpstan.neon` ignored by Git and allow people override default config (helpful especially for `editorUrl` and `parallel`).

https://phpstan.org/config-reference#config-file
This will allow us to keep track of `ignoreErrors` and do not let outdated ignore rules be kept there.
Wirone and others added 8 commits May 6, 2023 09:54
Introduce PHPStan type aliases to re-use array shape within single file.
With explicit baseline file we know exactly where errors are it's easier to fix them. Also, with previous approach it was possible to fix N issue and introduce N other issues at the same time and PHPStan wouldn't complain. Now, it will report unmatched (fixed) errors and newly introduced ones.
Let's do not pretend there's some kind of more sophisticated type, use array shape in all places. In the future it should be replaced with some kind of DTO.
Reuse path stored in variable instead concatenating the same values again.

Co-authored-by: Dariusz Rumiński <dariusz.ruminski@gmail.com>
@Wirone Wirone force-pushed the codito/phpstan-improvement branch from 35f6b49 to 17f5f70 Compare May 6, 2023 07:57
@kubawerlos kubawerlos merged commit 3a8e460 into PHP-CS-Fixer:master May 6, 2023
14 checks passed
@kubawerlos
Copy link
Contributor

Thank you @Wirone

@Wirone Wirone deleted the codito/phpstan-improvement branch May 6, 2023 09:09
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

5 participants