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

Prepare for PHPStan 1.0 #379

Closed
ondrejmirtes opened this issue Oct 14, 2021 · 6 comments · Fixed by #381
Closed

Prepare for PHPStan 1.0 #379

ondrejmirtes opened this issue Oct 14, 2021 · 6 comments · Fixed by #381
Assignees

Comments

@ondrejmirtes
Copy link

Hello everyone 👋

I announced today that PHPStan 1.0 is going to be released on November 1st 2021.

I'm approaching you as one of the most popular PHPStan extensions. I'd love if you could prepare your code for PHPStan 1.0 in advance so that it's ready to release on the same day.

Here's a brief guide how to approach the upgrade:

  1. Create a branch 🌴
  2. Update your composer.json to "phpstan/phpstan": "^1.0", add "minimum-stability": "dev" and "prefer-stable": true if necessary.
  3. Update your code with the BC breaks below in mind. 🔧
  4. Fix the code so that it passes PHPStan's analysis 🤓
  5. Wait for PHPStan 1.0 release on November 1st, merge your branch and tag the next major version 👍

Thank you!


Here are the BC breaks. The list is huge but most of those have very little impact.

There are new rules around using PHPStan internals in regard to backward compatibility promise: https://phpstan.org/developing-extensions/backward-compatibility-promise

It's possible that not everything you use is covered by it - so I'm here to help you to transition to correct usage, or add some @api annotations in PHPStan itself so that more is covered by the promise. Let me know!

BC breaks for end-users

The following are interesting only if you create a custom ruleset in your configuration file:

BC breaks for extension developers

@localheinz localheinz self-assigned this Oct 14, 2021
@localheinz
Copy link
Member

Thank you, @ondrejmirtes, for reaching out with detailed explanations for upgrading - I will update as soon as possible!

@rpkamp
Copy link
Contributor

rpkamp commented Nov 1, 2021

@localheinz is there a timeline for this and/or is there anything I can do to help out?

@localheinz
Copy link
Member

@rpkamp

Haven't had the time to take care of this yet, but if you can spare some time and submit a pull request, I would appreciate it!

@InvisibleSmiley
Copy link

extensions can no longer be provided by overriding methods from PHPStanTestCase. Use getAdditionalConfigFiles() instead.

This affects RuleTestCase as well. My test failed because getStaticMethodTypeSpecifyingExtensions was removed.

@rpkamp
Copy link
Contributor

rpkamp commented Nov 24, 2021

@InvisibleSmiley that sounds like a problem with PHPStan itself, not this extension. Or am I missing something?

@InvisibleSmiley
Copy link

@InvisibleSmiley that sounds like a problem with PHPStan itself, not this extension. Or am I missing something?

Oh sorry, I think I had previously visited this page and quickly glanced at the title and list of changes without checking the URL.
Commented on the PHPStan 1.0 release discussion thread now.

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

Successfully merging a pull request may close this issue.

4 participants