phpstan / phpstan-webmozart-assert
PHPStan webmozart/assert 扩展
1.2.11
2024-09-11 15:48 UTC
Requires
- php: ^7.2 || ^8.0
- phpstan/phpstan: ^1.12
Requires (Dev)
- nikic/php-parser: ^4.13.0
- php-parallel-lint/php-parallel-lint: ^1.2
- phpstan/phpstan-deprecation-rules: ^1.2
- phpstan/phpstan-phpunit: ^1.4
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^9.5
- webmozart/assert: ^1.11.0
- 2.0.x-dev
- 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-09-22 10:58:24 UTC
README
描述
此扩展的主要作用是帮助 PHPStan 在 Webmozart\Assert\Assert
验证后检测对象的类型。
<?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); }
安装
要使用此扩展,请在 Composer 中引入它
composer require --dev phpstan/phpstan-webmozart-assert
如果您还安装了 phpstan/extension-installer,则一切准备就绪!
手动安装
如果您不想使用 phpstan/extension-installer
,请将 extension.neon 包含到您的项目 PHPStan 配置中
includes:
- vendor/phpstan/phpstan-webmozart-assert/extension.neon