nepada/phpstan-nette-tester
最新稳定版本:v2.0.1
Composer 安装命令:
composer require nepada/phpstan-nette-tester
包简介
PHPStan nette/tester extension
README 文档
README
This extension was heavily inspired by phpstan/phpstan/phpstan-webmozart-assert developed by Ondřej Mirtes.
It was originally developed and published under damejidlo organization.
Description
The main scope of this extension is to help phpstan to detect the type of object after the Tester\Assert validation.
<?php declare(strict_types = 1); use Tester\Assert; function runTest(?int $a) { // ... Assert::notNull($a); // phpstan is now aware that $a can no longer be `null` at this point return ($a === 10); }
This extension specifies types of values passed to:
Assert::null()Assert::notNull()Assert::true()Assert::false()Assert::truthy()Assert::falsey()Assert::nan()Assert::same()Assert::notSame()Assert::type()Assert::count()
Installation
To use this extension, require it in Composer:
composer require --dev nepada/phpstan-nette-tester
If you also install phpstan/extension-installer then you're all set!
If you have enabled checkAlwaysTrueCheckTypeFunctionCall: true, you will need to add some ignored errors:
parameters:
ignoreErrors:
- '~Call to static method Tester\\Assert::(type|count|same|notSame)\(\) with .* and .* will always evaluate to true\.~'
- '~Call to static method Tester\\Assert::(null|notNull|true|false|truthy|falsey|nan)\(\) with .* will always evaluate to true\.~'
Manual installation
If you don't want to use phpstan/extension-installer, include extension.neon in your project's PHPStan config:
includes:
- vendor/nepada/phpstan-nette-tester/extension.neon
统计信息
- 总下载量: 363.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 27
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-01-15