phpstan beberlei assert
2.0.0
该扩展程序的主要范围是帮助PHPSTAN在AssertAssertion验证后检测对象的类型。
<?php declare (strict_types = 1 );
use Assert Assertion ;
function demo (? int $ a ) {
// ...
Assertion:: integer ( $ a );
// PHPStan is now aware that $a can no longer be `null` at this point
return ( $ a === 10 );
}要使用此扩展名,请在作曲家中需要它:
composer require --dev phpstan/phpstan-beberlei-assert
如果您还安装了phpstan/Extension-installer,那么您将全部设置!
如果您不想使用phpstan/extension-installer ,请在项目的PHPSTAN配置中包含Extension.Neon:
includes:
- vendor/phpstan/phpstan-beberlei-assert/extension.neon