ekino/phpstan-banned-code
Composer 安装命令:
composer require --dev ekino/phpstan-banned-code
包简介
Detected banned code using PHPStan
README 文档
README
This library is based on PHPStan to detect calls to specific functions you don't want in your project. For instance, you can add it in your CI process to make sure there is no debug/non standard code (like var_dump, exit, ...).
Basic usage
To use this extension, require it using Composer:
composer require --dev ekino/phpstan-banned-code
When you use https://github.com/phpstan/extension-installer you are done.
If not, include extension.neon in your project's PHPStan config:
includes:
- vendor/ekino/phpstan-banned-code/extension.neon
Advanced usage
You can configure this library with parameters:
parameters:
banned_code:
nodes:
# enable detection of echo
-
type: Stmt_Echo
functions: null
# enable detection of eval
-
type: Expr_Eval
functions: null
# enable detection of die/exit
-
type: Expr_Exit
functions: null
# enable detection of a set of functions
-
type: Expr_FuncCall
functions:
- dd
- debug_backtrace
- dump
- exec
- passthru
- phpinfo
- print_r
- proc_open
- shell_exec
- system
- var_dump
# enable detection of print statements
-
type: Expr_Print
functions: null
# enable detection of shell execution by backticks
-
type: Expr_ShellExec
functions: null
# enable detection of `use Tests\Foo\Bar` in a non-test file
use_from_tests: true
# errors emitted by the extension are non-ignorable by default, so they cannot accidentally be put into the baseline.
non_ignorable: false # default is true
type is the returned value of a node, see the method getType().
ekino/phpstan-banned-code 适用场景与选型建议
ekino/phpstan-banned-code 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.22M 次下载、GitHub Stars 达 299, 最近一次更新时间为 2019 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「static analysis」 「code quality」 「PHPStan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ekino/phpstan-banned-code 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ekino/phpstan-banned-code 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ekino/phpstan-banned-code 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Bookdown.io With Bootswatch Styles And Prism Syntax Highlighting
TwigStan is a static analyzer for Twig templates powered by PHPStan
Sentiment analysis library for PHP.
Database Standardization and Analysis Tool for Laravel
Enforce architecture by defining modules with allowed dependencies. Detects forbidden, uncovered, missing and unused module dependencies in PHP projects.
统计信息
- 总下载量: 6.22M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 301
- 点击次数: 22
- 依赖项目数: 96
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-02