gacela-project / phpstan-extension
PHPStan rule for projects using Gacela
Package info
github.com/gacela-project/phpstan-extension
Type:phpstan-extension
pkg:composer/gacela-project/phpstan-extension
Fund package maintenance!
Requires
- php: >=8.0
- gacela-project/gacela: >=0.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.62
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^9.6
- psalm/plugin-phpunit: ^0.18
- symfony/var-dumper: ^5.4
- vimeo/psalm: ^5.25
Suggests
- gacela-project/gacela: Gacela helps you build modular PHP applications. It helps normalizing the entry point of a module, without interfering with your domain-business logic.
README
This package is abandoned. Use
gacela-project/gacelainstead.Everything this extension did is built into the framework, and more. It is also incompatible with PHPStan 2: it builds errors without the identifiers PHPStan 2 requires, so it cannot load against the PHPStan version Gacela itself needs.
composer remove --dev gacela-project/phpstan-extension
The rules now ship with Gacela, for PHPStan and Psalm alike, sharing one implementation so the two analysers cannot disagree about what counts as a violation. See docs/static-analysis.md.
Migrating
Replace the include:
# before includes: - vendor/gacela-project/phpstan-extension/extension.neon # after includes: - vendor/gacela-project/gacela/phpstan-gacela.neon
That include turns on the pillar rules — a *Facade must extend AbstractFacade,
a facade method may only delegate, a factory may not reach for a Facade, a facade
interface must stay in sync — plus real return types for the pillar accessors and
for getProvidedDependency(Foo::class). None of that existed here.
The module-boundary check stays opt-in, because nothing in a class name says where a boundary falls. Its two parameters are renamed:
phpstan-extension |
Gacela |
|---|---|
parameters.gacela.modulesNamespace |
rootNamespace |
parameters.gacela.excludedNamespaces |
sharedNamespaces |
services: - class: Gacela\PHPStan\Rules\CrossModuleViaFacadeRule tags: [phpstan.rules.rule] arguments: rootNamespace: App\Modules sharedNamespaces: - App\Shared - class: Gacela\PHPStan\Rules\CrossModuleMethodCallRule tags: [phpstan.rules.rule] arguments: rootNamespace: App\Modules sharedNamespaces: - App\Shared
EnforceModuleBoundariesForMethodCallRule — the one rule this package had — is
CrossModuleMethodCallRule there. The check now has a second half,
CrossModuleViaFacadeRule, which reports the crossings a source writes by name
(new, static calls, class constants). This package never covered those.
Why it moved
The rules describe Gacela's architecture and name AbstractFacade,
AbstractFactory and the rest. Kept in their own package they fell behind the
framework they check — which is what happened here. Shipped with it, they move in
lockstep and run against Gacela's own source on every build.