Download Latest Version 2.3.6 source code.zip (31.2 MB)
Home / 2.3.5
Name Modified Size InfoDownloads / Week
Parent folder
phpstan.phar 2026-11-03 30.5 MB
phpstan.phar.asc 2026-11-03 833 Bytes
2.3.5 source code.tar.gz 2026-11-03 30.0 MB
2.3.5 source code.zip 2026-11-03 30.0 MB
README.md 2026-11-03 9.9 kB
Totals: 5 Items   90.6 MB 5

Huge release!

Auto-fixable rules with --fix. They show up in the on-line playground too:

image (1)

Stale ignoreErrors entries and @phpstan-ignore comments can be removed with --fix too:

Screenshot 2026-11-03 at 11 14 38

Extensions can be registered with attributes instead of .neon file:

:::php
use PHPStan\DependencyInjection\AutowiredService;

#[AutowiredService]
class MyExtension implements DynamicMethodReturnTypeExtension

Services be migrated automatically with migrate:neon2attributes.

Major new features πŸš€

  • Support for auto-fixable custom rules
  • analyse command now supports --fix and even --fix-ignored (looks at your ignored auto-fixable errors and fixes them too)
  • Auto-fixable errors are marked with πŸ”§ in the default table output
  • Rules can change AST with RuleErrorBuilder::fixNode() and removeNode(). Learn more
  • After first round of fixes, PHPStan reanalyses the whole codebase again (which is fast thanks to the result cache) and looks if the first round of fixes produced more errors to fix. It ends after 10 rounds in case the fixes cannot agree about the final state of the code.
  • This is a good fit for "coding standard rules", for example if you want to enforce final classes, named arguments etc.
  • It's not a good fit for errors that have multiple possible fixes (most of PHPStan errors do), like type-related errors. PHPStan cannot know whether the accepting or accepted side should correct its type.
  • Selected errors reported by PHPStan are now autofixable
  • All unmatched ignoreErrors entries in the config file and baseline can now be removed by running PHPStan with --fix (#6906, #6907, #6909)
  • Works for unmatched @phpstan-ignore comments too
  • backtick.deprecated (phpstan.org)
  • cast.useless (phpstan.org)
  • method.missingOverride (phpstan.org)
  • method.override (phpstan.org)
  • property.missingOverride (phpstan.org)
  • property.override (phpstan.org)
  • phpunit.assertCount (phpstan.org)
  • phpunit.assertEmpty (phpstan.org)
  • phpunit.assertEquals (phpstan.org)
  • phpunit.assertFalse (phpstan.org)
  • phpunit.assertNull (phpstan.org)
  • phpunit.assertTrue (phpstan.org)
  • phpunit.dataProviderStatic (phpstan.org)
  • Extensions can be registered with attributes on PHP 8.0+ (#6918), [#15114]
  • Instead of registering services in neon file, you can now use PHP attributes above classes to register them
  • #[AutowiredService], #[NonAutowiredService], #[AutowiredParameter], #[RegisteredRule], #[RegisteredCollector], #[Conditional], #[GenerateFactory], #[ExtensionInterface]
  • Learn more
  • PHPStan comes with a migration command that will do the grunt work for you: migrate:neon2attributes (#6920)

Improvements πŸ”§

  • Extensions can register their own interface <-> service tag mapping to have it validated and automatically registered with #[AutowiredService]. Learn more
  • Make --fix fast and complete: linear patching, multi-node fixes, fix rounds (#6902)
  • Improve return type of base64_decode() (#4492), thanks @jlherren!
  • Support template types as object shape keys (#6905), [#12756], thanks @canvural!
  • Make named arguments passed to @no-named-arguments callables fixable (#6910)
  • Report PHPStan attributes not covered by backward compatibility promise (#6916)
  • Write class names added by fixes relative to namespace and uses (#6924)

Bugfixes πŸ›

  • Run a rule on CollectedDataNode every time when it does not call get() (#6881), thanks @SanderMuller!
  • Run every rule on CollectedDataNode with -vvv (#6881), thanks @SanderMuller!
  • Do not analyse stub files with errors when the result cache is restored (#6891)
  • Update RangeFunctionReturnTypeExtension to include known integer ranges (#4251), thanks @PrinsFrank!
  • Allow valid built-in constants in function parameters (#6579), [#15308], thanks @midhunmonachan!
  • Fix SimpleRelativePathHelper stripping first character when working directory is slash (#6646), thanks @liamduckett!
  • Preserve source types during destructuring assignments (#6760), [#15091], thanks @Gabrieljr42!
  • Do not treat method templates resolved to their bound as unresolved (#6823), thanks @GromNaN!
  • Re-analyse files with errors of rules on collected data when a symbol appears (#6896), [#15162]
  • Accept closures matching the parameter closure type extension in argument checks (#6897), [#12585]
  • [PHP 8.6] Do not use deprecated SORT_LOCALE_STRING constant at runtime (#6904)
  • Keep the creation-time fixpoint for closures re-invoked from nested closures (#6911)
  • Keep the creation-time fixpoint for closures assigned to their own by-ref variable (#6912), [#15442]

Performance 🏎️

  • Skip conditional type search on types without late-resolvable types (#6672), thanks @Kocal!
  • Skip the generic object type search on types without classes (#6673), thanks @Kocal!
  • Narrow associative array comparison casts by key (#6578), [#15261], thanks @midhunmonachan!
  • Memoize recursive type queries on ConstantArrayType (#6671), thanks @Kocal!
  • Read the cached collected data only when the rules on CollectedDataNode run (#6373), thanks @janedbal!

Internals πŸ”

  • Build the pie extensions from the core's profile and cache the musl PHP builds (#6880)
  • Test generated subclass scopes in closure-this extensions (#6884), thanks @MrPunyapal!
  • Resume backward compatibility check (https://github.com/phpstan/phpstan-src/commit/7bca2c628e88b990c1342a32f7ba451cffc00755)
  • Isolate intersection test toggle state (#6255), thanks @simPod!
  • Let the ubuntu static analysis jobs fork their workers on PHP 8.2+ (#6595), thanks @SanderMuller!
  • Proper handling of unknown paths (#6302), thanks @AJenbo!
  • Correct calling mergeWith() on the wrong scope (#6301), thanks @AJenbo!
  • Be explicit about handled types rather then assuming implementations (#6303), thanks @AJenbo!
  • Make ResultCacheManagerCollectedDataTest independent of the second boundary (#6898)
  • Lint auto-fixing test-files (#6895), thanks @staabm!
  • Register services conditionally with #[Conditional] attribute (#6914)
  • SkipTestsWithRequiresPhpAttributeRule: do not report methods that already have #[RequiresPhp] (#6922)
Source: README.md, updated 2026-11-03