1. Go to this page and download the library: Download ebln/phpstan-factory-rule library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ebln / phpstan-factory-rule example snippets
// […]
#[\Ebln\Attrib\ForceFactory(GoodFactory::class, BetterFactory::class)]
class OnlyViaFactory
{
}
// […]
class FailingFactory
{
public function create(): OnlyViaFactory
{
return new OnlyViaFactory();
}
}
// […]
use Ebln\PHPStan\EnforceFactory\ForceFactoryInterface;
class OnlyViaFactory implements ForceFactoryInterface
{
// […]
public static function getFactories(): array
{ // Return a list of classes that are allowed to
// create new OnlyViaFactory instances…
return [TheOnlyTrueFactory::class];
}
}
// […]
class FailingFactory
{
public function create(): OnlyViaFactory
{
return new OnlyViaFactory();
}
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.