Resource icon

Static analysis for XenForo addons with PHPStan

Sim

Well-known member
Licensed customer
Sim submitted a new resource:

Static analysis for XenForo addons with PHPStan - How to use PHPStan to perform static analysis on XenForo addons to complement unit testing

A tutorial on how to use static analysis to find bugs or potential problems with your addon code - and how to set up hampel/xenforo-phpstan, an open-source composer package that helps a developer analyse XenForo addons. By the end you should have a clean run at level 2 on an add-on of your own and know what the next levels will ask of you.

What static analysis is​


Static analysis reads your code without running it, and reports what cannot be right....

Read more about this resource...
 
Sim updated Static analysis for XenForo addons with PHPStan with a new update entry:

v0.10.7

Thanks to @DragonByte Tech for the suggestion and bug report!

0.10.7 (2026-11-09)​

  • generate compared a set from an earlier minute as changed and rewrote it, because the date was stripped from the header before comparing but not from the exported 'generated' entry in classes.php; 0.10.6's "writes nothing when current" held only within the minute it was written. Reported by a reader the same day...

Read the rest of this update entry...
 
Sim updated Static analysis for XenForo addons with PHPStan with a new update entry:

v0.11.12 - lots of updates, rapid iterating by implementing against our own addon code

0.11.12 (2026-11-30)​

  • An array read of an entity, $entity['column'], is typed as get() has been since 0.11.11: offsetGet() is the same call
  • $entity->getValue('column') is typed from the entity's @property line: the underscored one XenForo writes for the stored value of a column that has a getter, the plain one otherwise

0.11.11 (2026-11-29)​

  • ...

Read the rest of this update entry...
 
Sim updated Static analysis for XenForo addons with PHPStan with a new update entry:

v1.3.2

1.3.2 (2026-12-01)​

  • On Windows generate wrote an alias stub with no aliases, from 0.11.1, so every legacy class name was undefined in every add-on analysed against that forum. The rule that skips a path naming no class accepted only / between segments, and PHP joins them with \ there. Reported as issue #3
  • On Windows a shortcut did not return the analysing add-on's own class extension: the file was matched against...

Read the rest of this update entry...
 
Back
Top Bottom