Download the PHP package phpstan/phpstan-beberlei-assert without Composer
On this page you can find all versions of the php package phpstan/phpstan-beberlei-assert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpstan/phpstan-beberlei-assert
More information about phpstan/phpstan-beberlei-assert
Files in phpstan/phpstan-beberlei-assert
Package phpstan-beberlei-assert
Short Description PHPStan beberlei/assert extension
License MIT
Informations about the package phpstan-beberlei-assert
PHPStan beberlei/assert extension
Description
The main scope of this extension is to help PHPStan to detect the type of object after the Assert\Assertion validation.
Supported Assertions
This extension understands the following Assertion static methods and narrows types accordingly:
integer, string, float, numeric, boolean, scalar, objectOrClass, isResource, isCallable, isArray, isInstanceOf, notIsInstanceOf, true, false, null, notNull, same, notSame, subclassOf, integerish, keyExists, keyNotExists, propertyExists, methodExists, classExists, interfaceExists, notBlank, isJsonString
nullOr* Prefix
Every supported assertion can be prefixed with nullOr to accept null in addition to the asserted type:
all* Prefix
Every supported assertion can be prefixed with all to narrow the item type of arrays and iterables:
The allNot* prefix is also supported for allNotNull, allNotIsInstanceOf, allNotSame, and allNotBlank.
Fluent Chain API
The extension supports Assert::that() chains including ->nullOr() and ->all() modifiers:
The function-style API (Assert\that(), Assert\thatNullOr(), Assert\thatAll()) is also supported.
Installation
To use this extension, require it in Composer:
If you also install phpstan/extension-installer then you're all set!