Releases: symplify/phpstan-rules
Released 14.1
- upgraded to PHPStan 2.0
- upgraded to PHP Parser 5.3
New Rules π₯³
- #152 - Added
NoValueObjectInServiceConstructorRule
to improve service architecture - #153 - Added many new rules
General
- Added
NoConstructorOverrideRule
Symfony
- Added
NoAbstractControllerConstructorRule
- Added
NoRequiredOutsideClassRule
- Added
SingleArgEventDispatchRule
- Added
NoListenerWithoutContractRule
- Added
NoStringInGetSubscribedEventsRule
Doctrine
- Added
NoGetRepositoryOutsideServiceRule
- Added
NoParentRepositoryRule
- Added
NoRepositoryCallInDataFixtureRule
PHPUnit
- Added
PublicStaticDataProviderRule
- Added
NoMockOnlyTestRule
- Added
NoDocumentMockingRule
- Added
NoEntityMockingRule
Removed rules π
Following rules were quite complex and niche to use in the wild. Instead, developers should decide based on context.
- #156 - Removed
NoSingleInterfaceImplementerRule
- #154 - Removed
NoReturnArrayVariableListRule
- #150 - Removed
CheckClassNamespaceFollowPsr4Rule
, use https://github.com/shipmonk-rnd/composer-dependency-analyser that does the same job better - #151 - Removed
RegexSuffixInRegexConstantRule
,NoInlineStringRegexRule
,AnnotateRegexClassConstWithRegexLinkRule
to ease working with regular expressions
13.0.0
- Move type-declaration-related rules to type-perfect package by @TomasVotruba in #128
- See https://github.com/rectorphp/type-perfect/ and https://getrector.com/blog/introducing-type-perfect-for-extra-safety
Added Rules π₯³
- Add ForbiddenStaticClassConstFetchRule by @TomasVotruba in #131
- Add no global const rule, entity in its namespace and no single implementer by @TomasVotruba in #132
What's Changed π¨
-
Allow d in short names by @TomasVotruba in #116
-
Skip attributes on setter rule by @TomasVotruba in #120
-
Allow abstract classes to be implemented in NoSingleInterfaceImplementerRule by @TomasVotruba in #135
-
Improve no single interface by @TomasVotruba in #136
Removed π
Few rules seemed like too pedantic in practice, I always ignored them in most projects. Time to let go to make this set more practical:
- Remove NoMissingDirPathRule, as often not clear if target file or required file path by @TomasVotruba in #129
- Remove NoAbstractMethodRule as way too opinionated by @TomasVotruba in #121
- Remove ForbiddenSameNamedNewInstanceRule as rarely a buggy spot by @TomasVotruba in #123
- Remove NoVoidGetterMethodRule as not that practical by @TomasVotruba in #125
- Remove NoEmptyClassRule, as rarely true and already coverd by class-leak by @TomasVotruba in #124
- Remove NoShortNameRule, as devs are educated and not a thing anymore by @TomasVotruba in #127
- Remove NoRelativeFilePathRule as more exceptoins by @TomasVotruba in #118
- Remove RequireEnumDocBlockOnConstantListPassRule as reports many false positive, better shift to native enums by @TomasVotruba in #119
- Remove NoDuplicatedShortClassNameRule as overly detailed by @TomasVotruba in #133
- Remove NoNullableArrayPropertyRule as depends on use-case, cached etc by @TomasVotruba in #134
- Remove BoolishClassMethodPrefixRule as very limited and often ignored by @TomasVotruba in #114
- Remove NoProtectedClassElementRule as overly strict by @TomasVotruba in #115
Full Changelog: 12.5.0...13.0.0
Released PHPStan Rules 11.1 with PHP 7.2 support
This release is using downgrade-package approach, so instead of PHP 8.0, you can be as low as PHP 7.2 and make use of 100+ PHPStan rules there are.
Decoupling from Astral package π₯³
This allowed the downgrade, as we needed the /src
to be fully downgradable, without any external PHP 8.0 dependency
- deprecated-packages/symplify#4318 - [PHPStanRules] Avoid using value resolver, make use of PHPStan scope type instead
- deprecated-packages/symplify#4319 - [PHPConfigPrinter] Move value resolver to scope->getType()
- deprecated-packages/symplify#4320 - [PHPStanRules] Various cleanups of Astral
- deprecated-packages/symplify#4315 - [PHPStanRules] Add SeePhpDocTagNodesFinder
- deprecated-packages/symplify#4314 - [PHPStanExtensions] Remove useless deps on Astral
- deprecated-packages/symplify#4312 - [PHPStanRules] Remove dependency on TypeChecker
- deprecated-packages/symplify#4313 - [PHPStanRules] Move ContainsTypeAnalyser here
Removed Rules π
While at it, we did cleaning of rules that were mostly designed for single spot in code-review once time in history. These rules were not practical and only cluttered the whole rule overview. Also we found few duplicates. Now the ruleset is more concise and eaiser to search through π
- deprecated-packages/symplify#4321 - [PHPStanRules] Remove dependency on symplify/package-builder, remove couple of very specific not practical rules - NoMagicClosureRule, NoBinaryOpCallCompareRule, NoGetRepositoryOutsideConstructorRule, RequireConstantInAttributeArgumentRule, RequireStringArgumentInConstructorRule, ValueObjectDestructRule