Download Latest Version 2.1.18 source code.tar.gz (3.8 MB)
Email in envelope

Get an email when there's a new version of PHPStan

Home / 2.1.18
Name Modified Size InfoDownloads / Week
Parent folder
phpstan.phar 2025-07-17 25.1 MB
phpstan.phar.asc 2025-07-17 833 Bytes
2.1.18 source code.tar.gz 2025-07-17 3.8 MB
2.1.18 source code.zip 2025-07-17 3.8 MB
README.md 2025-07-17 10.6 kB
Totals: 5 Items   32.8 MB 0

Bleeding edge 🔪

  • Name string expr check in ClassConstantRule (#3910), thanks @zonuexe!
  • Name string expr check in AccessPropertiesCheck (#4094), thanks @zonuexe!

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 🔧

  • Add @phpstan-sealed support (#4095), thanks @VincentLanglet!
  • This release includes improvements and bugfixes from PHPStan 1.12.28
  • Validate registered services tags against implemented interface (https://github.com/phpstan/phpstan-src/commit/f375a814c453ee4220322e238d5d1ace59810f45)
  • Only change exit code with --fail-without-result-cache when the error formatter returns 0 (https://github.com/phpstan/phpstan-src/commit/df9fa6e04b636bbcd16d49ec213f13fbb45026a6)
  • Normalize arguments before calling into TypeSpecifyingExtensions (#4034), [#13088], thanks @staabm!
  • Use count() return type in ObjectType::getArraySize() (#4072, #4078), thanks @vojtech-dobes!
  • Add method to get ObjectType from ClassReflection and EnumCaseReflection (#4099), thanks @calebdw!
  • Playground & Issue bot: PhpdocCommentRule (#4074), thanks @staabm!
  • Describe array shape key in quotes unless valid identifier (#4071), thanks @vojtech-dobes!
  • Improve TrimDynamicReturnType for constant strings (#4028), thanks @VincentLanglet!
  • Introduce ArrayPadDynamicReturnTypeExtension (#4017), [#12305], thanks @VincentLanglet!
  • Introduce PDO::connect dynamic method return type extension (#4015), [#12359], thanks @VincentLanglet!
  • Add PhpVersion::__construct to BC promise (#4022), [#8582], thanks @VincentLanglet!
  • Support switch on ::class (#4011), [#13069], thanks @VincentLanglet!
  • More precise array_keys return type (#3590), [#11928], thanks @staabm!

Bugfixes 🐛

  • Fix ClosureType::equals() for pure/impure closures (https://github.com/phpstan/phpstan-src/commit/02066c7350e4a60a5cdcabacc613bd62ae0bf907), [#13067]
  • Fix for benevolent union (#4039), [#13098], thanks @VincentLanglet!
  • Fix resolving generics from phpstorm-stubs (https://github.com/phpstan/phpstan-src/commit/c0f2e9e9235db973784d88b107bc8c14ecb647d0), [#13171]
  • Correctly retrieve hasSideEffects metadata for inherited methods (#4079), [#13201], thanks @zonuexe!
  • ObjectType: fix hasConstant behaviour (#4089), thanks @janedbal!
  • Explicitly use StreamSelectLoop for PHPStan Pro download (#4077), thanks @calebdw!
  • stream_get_contents() does not return FALSE unless an invalid position is provided (#4092), [#3396], thanks @staabm!
  • Revert "non-falsy-string cannot be converted to 0" (#3997), thanks @VincentLanglet!
  • Improve return type of array map by invoking dynamic function return type extensions for the callback (#4068), [#11180], [#3156], thanks @VincentLanglet!
  • Avoid false positive in_array() always true (#4073), [#13151], [#8818], [#12755], [#12412], thanks @VincentLanglet!
  • Fix always-true detection in in_array with union type haystack (#3888), [#12755], thanks @sayuprc!
  • Fix NAN inferences (#4040), [#13097], thanks @VincentLanglet!
  • Fix MixedType->equals(ErrorType) (#3934), thanks @staabm!
  • Handle class without namespace for internal rule (#3998), [#13041], thanks @VincentLanglet!
  • Resolve substr based on configured PHP version instead of runtime PHP version (#4061), [#13129], thanks @VincentLanglet!
  • Keep list on unset() with nested dim fetch (#3964), [#12927], [#12330], [#11171], [#8282], [#12754], thanks @staabm!

Function signature fixes 🤖

Internals 🔍

Source: README.md, updated 2025-07-17