 [ ← blog / drupal ](/) May 12, 2021  ·  \#drupal  ·  3 min read 

# 🥳 phpstan-drupal 0.12.10 out! 



I just released [phpstan-drupal 0.12.10](https://github.com/mglaman/phpstan-drupal/releases/tag/0.12.10), which includes a major bug fix and major feature.

 [Release 0.12.10 · mglaman/phpstan-drupal

🐞 Bug fixes:  
  
\#175: Fixes crashes on GlobalDrupalDependencyInjectionRule and autoloading when PHPUnit does not exist. Note: PHPStan still warns about autoloading and symbol discovery, still, but no...

https://github.com/mglaman/phpstan-drupal/releases/tag/0.12.10

 

 ![Release 0.12.10 · mglaman/phpstan-drupal](https://opengraph.githubassets.com/619a752697488a1ea1c6a3f97a8e92f29e38cb38a13b23a5b0ffefeba5ba4548/mglaman/phpstan-drupal) 

 

 

 ](https://github.com/mglaman/phpstan-drupal/releases/tag/0.12.10) 

## Thank you, sponsors.

Before diving into the changes, I would like to thank my [GitHub Sponsors](https://github.com/sponsors/mglaman) and contributors on [Open Collective](https://opencollective.com/phpstan-drupal) who help fund my open source development time for projects like phpstan-drupal. Especially a big thanks to [undpaul](https://www.undpaul.de/) and [intracto](https://www.intracto.com/) for being organization-level sponsors of my work.

Through my GitHub Sponsors and Open Collective, I'm able to cover roughly three hours of development a month.

## What's new?

### Better compatibility when drupal/core-dev is not installed

Turns out a rule in phpstan-drupal was causing analysis to crash if PHPUnit was not installed. This was due to an interface check via reflection. If the interface could not be autoloaded the script would crash. 😱. So a little change was made:

```php
// Before
$classReflection->implementsInterface($item)

// After
$implemented_interfaces = $classReflection->getInterfaceNames();
foreach ($allowed_list as $item) {
  if (in_array($item, $implemented_interfaces, true)) {
```

The interface doesn't need to be available for autoloading this way.

I have added a new GitHub Actions workflow for testing without the `drupal/core-dev` package, which installs PHPUnit and other testing dependencies.

### Dynamic loading of included files from module\_load\_include

This is a big deal! It's not as common in Drupal 8 or 9 as in Drupal 7, but often times modules would provide extra include files like `mymodule.extra.inc`.  Most of these were switched to the `loadIncludes` method of the module handler, but the module\_load\_include function still persists. The main difference is that `module_load_includes` allows loading files from uninstalled modules. The main point is this: **PHPStan had no idea how to load functions from those files, so any call to those functions were reported as undefined function calls.**

Now, this is fixed! When it comes to Drupal core, the main problem would have occurred when analyzing the `locale.module` file.

I have added that as test coverage.

## Helping continue development

I would love to continue building on phpstan-drupal. I would *really* like to start adding rules which help folks write better code. If you'd like to see a more expansive phpstan-drupal project, considering funding my time via [GitHub Sponsors](https://github.com/sponsors/mglaman) or the project's [Open Collective](https://opencollective.com/phpstan-drupal).

Alternatively, I am also considering making a private package called phpstan-drupal-rules that would be available via a license. This package would help fund maintenance and allow me to codify my Drupal code review knowledge into rules that could be added to your projects. I would love to hear your thoughts on this idea.

 

  ![](/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

Hack and Play – a new weekly live stream session

 ](/blog/hack-and-play-new-weekly-live-stream-session) [Newer →

Funding open source development with Profit First methodology

 ](/blog/funding-open-source-development-profit-first-methodology)