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-instholer ، فأنت جميعًا قد تم تعيينه!
إذا كنت لا ترغب في استخدام phpstan/extension-installer ، قم بتضمين extension.neon في تكوين Phpstan لمشروعك:
includes:
- vendor/phpstan/phpstan-beberlei-assert/extension.neon