Download Latest Version 2.2.2 source code.tar.gz (4.0 MB)
Email in envelope

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

Home / 2.2.2
Name Modified Size InfoDownloads / Week
Parent folder
phpstan.phar 2026-06-05 27.1 MB
phpstan.phar.asc 2026-06-05 833 Bytes
2.2.2 source code.tar.gz 2026-06-05 4.0 MB
2.2.2 source code.zip 2026-06-05 4.0 MB
README.md 2026-06-05 4.5 kB
Totals: 5 Items   35.1 MB 1

Improvements 🔧

  • Narrow preg_match/preg_match_all subject string type when match is truthy (#5777), [#14710], thanks @staabm and @VincentLanglet!
  • Resolve per-element callback return types in array_map for closure and arrow function callbacks (#5716), [#14649], [#11656], thanks @VincentLanglet and @staabm!
  • Support union types in str_repeat() (#5784), thanks @staabm!
  • Report impossible class_exists/interface_exists/trait_exists/enum_exists (#5754), [#14683], thanks @janedbal!
  • Narrow variadic parameter array key integer type to int<0, max> (#5791), [#14744], thanks @staabm and @VincentLanglet!
  • Build an (unsealed) array shape in ArrayType::intersectKeyArray() when the other operand has known sealedness (#5792), [#14747]
  • Resolve WithoutImpurePoints purity transitively through calls to other effect-free callables (#5798), [#14759]
  • ctype_digit() narrows to decimal-int-string (#5311), thanks @staabm!
  • Infer decimal-int-string/non-decimal-int-string for regex capturing groups matching (non-)digits (#5793), [#14750], thanks @staabm, @VincentLanglet and @mvorisek!
  • Infer decimal-int-string when casting int/int<a, b> to string (#5794), [#14753], thanks @staabm and @VincentLanglet!

Bugfixes 🐛

  • Create cross-kind conditional expression holders in BooleanAnd/BooleanOr type specifier with truthy fallback for isset() (#5760), [#10644], [#11918], [#3385], [#6202], [#14455], thanks @VincentLanglet and @staabm!
  • Fix file path of trait errors reported directly in the trait (#5780), [#14718], thanks @janedbal!
  • PHPStan should not crash on startup when projects' composer.json is invalid (#5779), [#14724], thanks @staabm!
  • Narrow array key type when removing HasOffsetType via ArrayType::tryRemove (#5756), [#9461], thanks @VincentLanglet and @staabm!
  • Narrow value type instead of unsetting key in ConstantArrayType::tryRemove for HasOffsetValueType (#5776), [#14711], thanks @VincentLanglet and @staabm!
  • Allow reinitialization of a readonly property in __clone since PHP8.3 (#5731), [#11495], thanks @grizzm0!
  • Omit key type from unsealed ConstantArrayType description when the unsealed extra type is array-key (https://github.com/phpstan/phpstan-src/commit/49074ec999435f8676e21ba8fb2511e8b0180a64), [#14732]
  • Revert "Return list<mixed> from PDOStatement::fetchAll() (#5643)" (#5795), thanks @staabm!
  • Treat declarations with a non-void @throws as not effect-free in the CallTo*StatementWithoutImpurePointsRule family (#5802), [#14767]

Function signature fixes 🤖

  • Correct xdebug filename/trace function return types in functionMap to include false/null (#5788), [#14736]

Internals 🔍

Source: README.md, updated 2026-06-05