eboreum/immutable-interface-phpstan-checker

Check your project's code for adherence to immutability (class implementing Eboreum\ImmutableInterface\ImmutableInterface) using PHPStan (https://phpstan.org/).

Maintainers

Package info

gitlab.com/eboreum/immutable-interface-phpstan-checker

Issues

pkg:composer/eboreum/immutable-interface-phpstan-checker

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

dev-main 2026-06-24 18:25 UTC

This package is auto-updated.

Last update: 2026-06-24 16:27:36 UTC


README

license pipeline status coverage report PHPStan Level

immutable-interface-phpstan-checker-logo

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:

  1. php-static-analysis/attributes: Defines the @immutable annotation.
  2. php-static-analysis/phpstan-extension: A --dev package, 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

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.