- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25
Description
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:
- Create a branch 🌴
- Update your composer.json to "phpstan/phpstan": "^1.0", add"minimum-stability": "dev"and"prefer-stable": trueif necessary.
- Update your code with the BC breaks below in mind. 🔧
- Fix the code so that it passes PHPStan's analysis 🤓
- 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
- Level maxis now level 9. Feel free to updatemaxto8if your code isn't ready.
- Description of some types was updated to match the syntax in PHPDocs. This includes numeric-string(it was previously described asstring&numeric), and also array shapes.
- Removed baselineNeonerror formatter, use--generate-baselineCLI option instead (phpstan/phpstan-src@492cfbc)
- Removed polluteCatchScopeWithTryAssignmentsconfig parameter (phpstan/phpstan-src@8933c7e)
- Removed deprecated autoload_filesparameter - use Discovering Symbols instead (phpstan/phpstan-src@7a21246)
- Removed deprecated autoload_directoriesparameter - use Discovering Symbols instead (phpstan/phpstan-src@f67b48a)
- Removed bootstrapparameter - usebootstrapFilesinstead (phpstan/phpstan-src@1baa294)
- Moved implicitThrowsconfiguration parameter toexceptions.implicitThrows(phpstan/phpstan-src@96b7c48)
- Removed --paths-fileCLI option (phpstan/phpstan-src@5670cf2)
- Removed dump-depscommand (phpstan/phpstan-src@9c7017c)
- Deprecated excludes_analyseoption, useexcludePathsinstead (phpstan/phpstan-src@d25c5e5)
The following are interesting only if you create a custom ruleset in your configuration file:
- Removed DeadCatchRule, replaced byCatchWithUnthrownExceptionRule(phpstan/phpstan-src@4dba60b)
- Removed VariableCertaintyInIssetRule, replaced byIssetRule(phpstan/phpstan-src@2e858de)
- Removed MissingClosureNativeReturnTypehintRule, no longer needed thanks to type inference (phpstan/phpstan-src@1c34d8d)
- Rename rules with typos (phpstan/phpstan-src@003ab1a)
BC breaks for extension developers
- Extensions are checked with rules for correct usage of PHPStan internals according to backward compatibility promise.
- Removed CompoundTypeHelper(phpstan/phpstan-src@145c4e3)
- Removed CommentHelper(phpstan/phpstan-src@ebad6f6)
- Removed DependencyDumper(phpstan/phpstan-src@9c7017c)
- Removed PHPStan\Reflection\Generic\ResolvedFunctionVariant, replaced byPHPStan\Reflection\ResolvedFunctionVariant(phpstan/phpstan-src@1cc6c81)
- Removed ClassReflection::getNativeMethods(), usegetNativeReflection()instead (phpstan/phpstan-src@d2c1446)
- Removed PhpPropertyReflection::hasPhpDoc(), replaced byhasPhpDocType()(phpstan/phpstan-src@bedd5be)
- NodeDependenciesno longer iterable (phpstan/phpstan-src@f76875a)
- Renamed TestCasetoPHPStanTestCase(#634), thanks @frankdejonge!
- StaticTypeand- ThisType- require- ClassReflectionin constructor (phpstan/phpstan-src@7aabc84)
- PHPStanTestCase- extensions can no longer be provided by overriding methods from- PHPStanTestCase. Use- getAdditionalConfigFiles()instead. (phpstan/phpstan-src@65efd93, phpstan/phpstan-src@239291a)
- Removed some unused internal helper methods from Broker (phpstan/phpstan-src@d578151)
- Changed return types of various methods that had |falseto|null(phpstan/phpstan-src@629ccf6)
- Type generalization precision is now a required argument (phpstan/phpstan-src@6568103)
- Some constructor parameters are now required (phpstan/phpstan-src@1f4062f)
- Deprecated BrokerAwareExtension(phpstan/phpstan-src@db2f7fb)
- Deprecated PHPStanTestCase::createBroker(). UsecreateReflectionProvider()instead. (phpstan/phpstan-src@1e5cf58)
- Deprecated PHPStan\Broker\Broker. UsePHPStan\Reflection\ReflectionProviderinstead. (phpstan/phpstan-src@c775594)
- Deprecated PHPStan\Broker\Broker::getInstance(). UsePHPStan\Reflection\ReflectionProviderStaticAccessorinstead. (phpstan/phpstan-src@4e7d60d)