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

Check for use of deprecated API with Psalm #8691

Merged
merged 1 commit into from
May 15, 2021

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented May 15, 2021

Follow-up to #8689.

This enables checks for usage of deprecated API in the psalm configuration and also updates the baseline to not report any errors. Deprecations will be fixed gradually.

@alcaeus alcaeus added the CI label May 15, 2021
@alcaeus alcaeus added this to the 2.9.0 milestone May 15, 2021
@alcaeus alcaeus requested a review from ostrolucky May 15, 2021 14:47
@alcaeus alcaeus self-assigned this May 15, 2021
@ostrolucky
Copy link
Member

DeprecatedMethod was just an example I gave. There are a lot more deprecated* issue handlers in Psalm https://github.com/vimeo/psalm/blob/master/docs/running_psalm/error_levels.md:

DeprecatedClass
DeprecatedConstant
DeprecatedFunction
DeprecatedInterface
DeprecatedMethod
DeprecatedProperty
DeprecatedTrait

Maybe would be easier to bump psalm to level 3?

@alcaeus
Copy link
Member Author

alcaeus commented May 15, 2021

We'd have to bump to level 2, as the Deprecated* class of issues are treated as errors only from level 2 and lower. I'm ok with updating the baseline and require new code to be stricter, but then would definitely defer this change until 2.10. WDYT?

@alcaeus
Copy link
Member Author

alcaeus commented May 15, 2021

As a follow-up, here's the output when moving to level 2:

No errors found!
------------------------------
5995 other issues found.

And just for shits and giggles, here's what happens when we include tests:

No errors found!
------------------------------
18562 other issues found.

@ostrolucky
Copy link
Member

ostrolucky commented May 15, 2021

Ok. What about other Deprecated* issue handlers? Do you want to include them in this PR, or you think DeprecatedMethod will do?

@alcaeus
Copy link
Member Author

alcaeus commented May 15, 2021

I'd add all others, but as you said: it might be easier to go to level 2. This puts more restrictions on new codes with existing issues being safely ignored through the baseline.

This converts more issues to errors, most notably around deprecations. This can be used to later remove deprecated API.
@greg0ire
Copy link
Member

here's what happens when we include tests:

About that, @beberlei proposed to have some kind of sample calling code instead. That's looks a lot like what Marco did on the DBAL recently: doctrine/dbal#4638

@alcaeus
Copy link
Member Author

alcaeus commented May 15, 2021

Then let's not add tests. I've pushed a change to check level 2.

Copy link
Member

@greg0ire greg0ire 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! Is there a Psalm command that allows to only see the deprecations?

@greg0ire greg0ire merged commit b85403d into doctrine:2.9.x May 15, 2021
@greg0ire
Copy link
Member

Thanks @alcaeus !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants