phpstan / phpstan-webmozart-assert
PHPStan webmozart/assert extension
Installs: 16 214 549
Dependents: 816
Suggesters: 0
Security: 0
Stars: 167
Watchers: 7
Forks: 28
Open Issues: 7
Type:phpstan-extension
Requires
- php: ^7.4 || ^8.0
- phpstan/phpstan: ^2.0
Requires (Dev)
- nikic/php-parser: ^5.1
- php-parallel-lint/php-parallel-lint: ^1.2
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^9.6
- webmozart/assert: ^1.11.0
- 2.0.x-dev
- 2.0.0
- 1.2.x-dev
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.12.16
- 0.12.15
- 0.12.14
- 0.12.13
- 0.12.12
- 0.12.11
- 0.12.10
- 0.12.9
- 0.12.8
- 0.12.7
- 0.12.6
- 0.12.5
- 0.12.4
- 0.12.3
- 0.12.2
- 0.12.1
- 0.12.0
- 0.11.3
- 0.11.2
- 0.11.1
- 0.11
- 0.10
- dev-renovate/major-root-composer
- dev-renovate/major-github-actions
This package is auto-updated.
Last update: 2024-12-11 07:45:49 UTC
README
Description
The main scope of this extension is to help PHPStan to detect the type of object after the Webmozart\Assert\Assert
validation.
<?php declare(strict_types = 1); use Webmozart\Assert\Assert; function demo(?int $a) { // ... Assert::integer($a); // PHPStan is now aware that $a can no longer be `null` at this point return ($a === 10); }
Installation
To use this extension, require it in Composer:
composer require --dev phpstan/phpstan-webmozart-assert
If you also install phpstan/extension-installer then you're all set!
Manual installation
If you don't want to use phpstan/extension-installer
, include extension.neon in your project's PHPStan config:
includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon