1.12.0
版本发布时间: 2024-08-27 17:22:43
phpstan/phpstan最新发布版本:1.12.6(2024-10-06 23:06:59)
Read all about PHPStan 1.12 on phpstan.org »
Major new features 🚀
- Precise type for
$matches
frompreg_match
generally available, out of bleeding edge (https://github.com/phpstan/phpstan-src/commit/bd2cec118592f7c66dff5a7ae28882654daf6468) - PHP 8.4 runtime support
- PHPStan runs on PHP 8.4 without emitting deprecation notices
- Full support for PHP 8.4 including new syntax and rules is coming later, after PHPStan 2.0 release
Bleeding edge 🔪
- More precise types for bcmath function parameters (#2217), thanks @Warxcell!
- Enforce
@no-named-arguments
(https://github.com/phpstan/phpstan-src/commit/74ba8c23696948f2647d880df72f375346f41010), #5968 - Check too wide private property type (https://github.com/phpstan/phpstan-src/commit/7453f4f75fae3d635063589467842aae29d88b54)
- Consider implicit throw points when the only explicit one is Throw_ (https://github.com/phpstan/phpstan-src/commit/22eef6d5ab9a4afafb2305258fea273be6cc06e4)
- Check existing classes in
@param-out
(https://github.com/phpstan/phpstan-src/commit/30c4b9e80f51af8b5f166ba3aae93d8409c9c0ea), #10260 - Check existing classes in
@param-closure-this
(https://github.com/phpstan/phpstan-src/commit/2fa539a39e06bcc3155b109fd8d246703ceb176d), #10933 - Check invalid
@param-closure-this
(https://github.com/phpstan/phpstan-src/commit/95c0a5806c65c975201b9d3a464873f75a04c8b8), #10932 - Check
@param-immediately-invoked-callable
and@param-later-invoked-callable
(https://github.com/phpstan/phpstan-src/commit/580a6add422f4e34191df9e7a77ba1655e914bda), #10932 - Check existing classes in
@phpstan-self-out
(https://github.com/phpstan/phpstan-src/commit/6838669976bf20232abde36ecdd52b1770fa50c9) - Check missing types in
@phpstan-self-out
(https://github.com/phpstan/phpstan-src/commit/892b319f25f04bc1b55c3d0063b607909612fe6d) - Check missing types in local type aliases (https://github.com/phpstan/phpstan-src/commit/ce7ffaf02d624a7fb9d38f8e5dffc9739f1233fc)
- Check nonexistent classes in local type aliases (https://github.com/phpstan/phpstan-src/commit/2485b2e9c129e789ec3b2d7db81ca30f87c63911)
- Check unresolvable types in local type aliases (https://github.com/phpstan/phpstan-src/commit/5f7d12b2fb2809525ab0e96eeae95093204ea4d3)
- Check generics in local type aliases (https://github.com/phpstan/phpstan-src/commit/5a2d4416d94ab77a2a2e7e1bfaba4c5ed2a13c25)
- Check missing types in
@mixin
(https://github.com/phpstan/phpstan-src/commit/3175c81f26fd5bcb4a161b24e774921870ed2533) - Check types in
@property
tags (https://github.com/phpstan/phpstan-src/commit/55ea2ae516df22a071ab873fdd6f748a3af0520e), #10752, #9356 - Check types in
@method
tags (https://github.com/phpstan/phpstan-src/commit/5b7e474680eaf33874b7ed6a227677adcbed9ca5) - Check
@extends
,@implements
,@use
for unresolvable types (https://github.com/phpstan/phpstan-src/commit/2bb528233edb75312614166e282776f279cf2018), #11552
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
Improvements 🔧
- Internal classes made
final
,@api
classes made@final
(#3264, https://github.com/phpstan/phpstan-src/commit/5baa146510b56c9571b3d85eba71c02d86f683bb) - Repair
PhpParser\Node\Stmt\Class_::isAnonymous()
(#3343), thanks @tscni! - Improve
curl_init()
return type analysis (#3346), thanks @tscni! - StubValidator - added missing rules (https://github.com/phpstan/phpstan-src/commit/7fc5ab8dfb3be8cc0c1daff7c17b6c6d98d8ca7a)
- Do not allow
@phpstan-self-out
above static method (https://github.com/phpstan/phpstan-src/commit/0dfd8217699fc1c4796bcafbf2f6e04137938365) - Check unresolvable types in
@phpstan-self-out
(https://github.com/phpstan/phpstan-src/commit/e182c0662df24e57c81b1d49e22963cad5ff5d13) - Check generics in
@phpstan-self-out
(https://github.com/phpstan/phpstan-src/commit/9ebc315589ba2086279dd4c404ef77a33f8b43a7) - ConstExprNodeResolver - support ConstFetchNode for class constants (https://github.com/phpstan/phpstan-src/commit/3e51899dd7ed0e2785846f8ec820b4cd8214b993) - allowed in default parameter values in
@method
Bugfixes 🐛
- PHPStanDiagnoseExtension - skip showing config files in "Included configs from Composer packages" if already present in the "Extension installer" section (https://github.com/phpstan/phpstan-src/commit/6c4477c9fcc2d62579cb1e353ca902b4b9ebb888)
- Support multiple anonymous class definitions on the same line (#3328), #5597, #11511, thanks @tscni!
- Fix ConstantArrayType not accepting NeverType (#3327), #11517, thanks @tscni!
- Narrow to non-falsy-string from
strlen()
on integer range (#3337), thanks @staabm! - Narrow arrays in union based on
count()
with integer range (#3335), thanks @staabm! - Fix description escaping in UsedTraitsRule (https://github.com/phpstan/phpstan-src/commit/4ffbb3b126d3c98fad4ad0906c76d24febdb89ed)
Internals 🔍
- Cleanup TypeSpecifier (#3340), thanks @staabm!
- Refactor ReplaceFunctionsDynamicReturnTypeExtension (#3339), thanks @staabm!
- BetterReflectionSourceLocator - playground mode (https://github.com/phpstan/phpstan-src/commit/7d1bde44afc0c0f7e3b29f2d75a7c33d5e6a56ec)
- Internal PHPStan rule - class must be abstract or final (https://github.com/phpstan/phpstan-src/commit/d631120bea6af099cdcc85e3e12dc9f26bf6f1f5)
- Downgrade PHP files in build/PHPStan (https://github.com/phpstan/phpstan-src/commit/fe503cad77b684f845a932644007c50684161b8d)
- ExtendedPropertyReflection (https://github.com/phpstan/phpstan-src/commit/d65138a11f0654b710a27b4b563bff2ccf0b2c1b)
- Replace
highlight_string()
stub with a return type extension (#3350) - Issue bot - test PHP 8.4 (#3358)
1、 phpstan.phar 22.37MB
2、 phpstan.phar.asc 833B