 [ ← blog / drupal ](/) Dec 12, 2024  ·  \#drupal  ·  2 min read 

# phpstan-drupal now supports PHPStan 2.0



PHPStan 2.0 was released a month ago, a massive milestone for the project. To learn about all the changes, I recommend reading the [release announcement](https://phpstan.org/blog/phpstan-2-0-released-level-10-elephpants). `phpstan-drupal` now has a PHPStan 2.0 compatible release: <https://github.com/mglaman/phpstan-drupal/releases/tag/2.0.0>. The `1.x` branch will be maintained as long as a version of Drupal Core uses it, at least until [Drupal 10's end-of-life](https://www.drupal.org/about/core/policies/core-release-cycles/schedule#s-drupal-10-end-of-life) near the end of 2026. If applicable, I will backport bug fixes and features to `1.x`.

## What's new in phpstan-drupal 2.0.0?

At the moment, nothing much. Support for Drupal 9 has been removed, [removing 1,000+ lines of code](https://github.com/mglaman/phpstan-drupal/pull/807) and making phpstan-drupal much easier to maintain. Agan thanks to [Spokje](https://www.drupal.org/u/spokje).

## Does Drupal core use PHPStan 2.0?

Not yet! Drupal Core still uses PHPStan 1.0. Getting a compatible release of `phpstan-drupal` was a blocker. I owe so many thanks to [Spokje](https://www.drupal.org/u/spokje), who performed the `phpstan-drupal` upgrade to PHPStan 2.0. I wouldn't say it was hard work; it was just [a lot of tedious work](https://github.com/mglaman/phpstan-drupal/pull/805).

You can follow this issue for the upgrade of Drupal Core to PHPStan 2.0: <https://www.drupal.org/project/drupal/issues/3486713>. If it is updated before 11.2.0, then phpstan-drupal `1.x` will be supported until 11.1.x loses security coverage, unless that comes before 10.x's end-of-life.

## Can we move more of phpstan-drupal into Drupal Core?

Yes! We can. However, part of that will involve making features of `phpstan-drupal` toggleable. See <https://github.com/mglaman/phpstan-drupal/issues/810> as an example. If we can turn off some of the dynamic return type extensions, we can improve the in-code PHPDocs to replace them.

 

  ![](/themes/custom/mglaman/images/headshot.webp)Thanks for reading

I write about Drupal, PHP, and the quiet infrastructure behind large sites — caching, config, and testing. New posts land every week or two.

 [Subscribe via RSS →](/rss.xml) [About me →](/about-me) 

 



 

  [← Older

The Web APIs powering the Drupal CMS trial experience

 ](/blog/web-apis-powering-drupal-cms-trial-experience) [Newer →

Drupal is delivering innovation beyond major versions

 ](/blog/drupal-delivering-innovation-beyond-major-versions)