brandembassy / phpstan-forbidden-method-calls-rule
PHPStan规则,允许您禁止调用某些方法。
1.0.1
2018-08-21 08:29 UTC
Requires
- php: ~7.2
Requires (Dev)
- phpstan/phpstan: >=0.10
This package is not auto-updated.
Last update: 2024-09-15 05:12:38 UTC
README
此PHPStan规则由Petr Morávek创建(https://github.com/xificurk)。
用法
composer require --dev brandembassy/phpstan-forbidden-method-calls-rule
然后在您的phpstan.neon
注册服务
services:
-
class: BrandEmbasssy\ForbiddenMethodCallsRule\ForbiddenMethodCallsRule
setup:
- addForbiddenMethod(Psr\Http\Message\StreamInterface, getContents)
tags:
- phpstan.rules.rule
示例
------ -----------------------------------------------------------------
Line foo/Bar/Baz.php (in context of class Foo\Bar\Baz)
------ -----------------------------------------------------------------
95 Calling forbidden method
Psr\Http\Message\StreamInterface:getContents().
------ -----------------------------------------------------------------