PHPackages                             ebln/phpstan-factory-rule - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ebln/phpstan-factory-rule

ActivePhpstan-extension

ebln/phpstan-factory-rule
=========================

PHPStan rule to enforce instanciation by factories

v2.0.0(1y ago)319.2k↓22.2%[1 issues](https://github.com/ebln/phpstan-factory-rule/issues)MITPHPPHP 7.4 - 8.4CI passing

Since Nov 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ebln/phpstan-factory-rule)[ Packagist](https://packagist.org/packages/ebln/phpstan-factory-rule)[ RSS](/packages/ebln-phpstan-factory-rule/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

ebln/phpstan-factory-rule
=========================

[](#eblnphpstan-factory-rule)

Enforce that your classes get only instantiated by the factories you define!

Usage with support for attributes
---------------------------------

[](#usage-with-support-for-attributes)

Require this package: `composer require --dev ebln/phpstan-factory-rule`

Add the `ForceFactory` attribute to your class, and supply all class names as arguments, which shall be allowed to instanciate your object.

```
