eboreum / immutable-interface-phpstan-checker
Check your project's code for adherence to immutability (class implementing Eboreum\ImmutableInterface\ImmutableInterface) using PHPStan (https://phpstan.org/).
Package info
gitlab.com/eboreum/immutable-interface-phpstan-checker
pkg:composer/eboreum/immutable-interface-phpstan-checker
Requires
- php: ^8.5
- eboreum/immutable-interface: ^1.0
- phpstan/phpstan: ^2.0
Requires (Dev)
- overtrue/phplint: ^9.7
- phpunit/phpunit: ^13.0
- slevomat/coding-standard: ^8.27
- squizlabs/php_codesniffer: ^4.0
Suggests
- phpstan/extension-installer: Automatically registers this PHPStan extension.
This package is auto-updated.
Last update: 2026-06-24 16:27:36 UTC
README

A PHPStan rule, which checks all classes implementing (or interfaces extending) Eboreum\ImmutableInterface\ImmutableInterface (available in the eboreum/immutable-interface package) for adherence to immutability.
This library respects the paths defined in your custom code base's phpstan.neon file.
An alternative
If you do not like the inheritance pattern or if you have specific cases where you do not want inheritance to apply, you may instead use these libraries in combination:
- php-static-analysis/attributes: Defines the
@immutableannotation. - php-static-analysis/phpstan-extension: A
--devpackage, which reacts to the annotations defined in php-static-analysis/attributes (bullet 1).
Requirements
"php": "^8.5",
"eboreum/immutable-interface": "^1.0",
"phpstan/phpstan": "^2.0"
Installation
Via Composer (https://packagist.org/packages/eboreum/immutable-interface-phpstan-checker):
composer require --dev eboreum/immutable-interface-phpstan-checker
Update your local phpstan.neon to load this package as a PHPStan extension:
includes:
- vendor/eboreum/immutable-interface-phpstan-checker/phpstan.neon
Via GitLab:
git clone git@gitlab.com:eboreum/immutable-interface-phpstan-checker.git
License & Disclaimer
See LICENSE file. Basically: Use this library at your own risk.
Acknowledgements
ChatGPT and GitHub Copilot were used to implement parts of this code base. However, this project is not entirely vibe coded. Everything has been inspected and sometimes rewritten by human eyes and brains.
Contributing
We prefer that you create an issue and or a merge request at https://gitlab.com/eboreum/immutable-interface-phpstan-checker, and have a discussion about a feature or bug here.
Credits
Authors
- Kasper Søfren (kafoso)
E-mail: soefritz@gmail.com
Homepage: https://gitlab.com/kafoso / https://github.com/kafoso
AI Disclaimer
Parts of this code base has been made using AI, namely GPT-5.5! Although, there was an adult in the room during this process.