struggle-for-php/angry-regex
Composer 安装命令:
composer require struggle-for-php/angry-regex
包简介
PHPStan Rule to detect Unfavorable Regex
README 文档
README
PHPStan Rule to detect Unfavorable Regex.
and add more checking than PHPStan's Regex check.
Based on Tokumaru's statement
正規表現によるバリデーションでは ^ と $ ではなく \A と \z を使おう
Example
$ ../vendor/bin/phpstan analyse --level=1 src/ Note: Using configuration file /tmp/angry-regex/demo/phpstan.neon. 2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% ------ ------------------------------------------------------------- Line Demo.php ------ ------------------------------------------------------------- 17 Regex pattern is invalid: Unfavorable `^` or `$` /^[0-9]+$/ ------ ------------------------------------------------------------- [ERROR] Found 1 error
Installation
composer require --dev struggle-for-php/angry-regex
Configuration
In your phpstan.neon configuration, add following section:
includes: - vendor/struggle-for-php/angry-regex/rules.neon
Also see.
- Validator\Ip should not allow newlines in any case. - zendframework/zendframework#6104
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-01