brandembassy / phpstan-forbidden-method-calls-rule
Rule for PHPStan that enables you to forbid some methods from being called.
Installs: 23 055
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 9
Forks: 1
Open Issues: 3
Requires
- php: ~7.2
Requires (Dev)
- phpstan/phpstan: >=0.10
This package is not auto-updated.
Last update: 2024-10-27 05:41:43 UTC
README
This PHPStan rule was created by Petr Morávek (https://github.com/xificurk).
Usage
composer require --dev brandembassy/phpstan-forbidden-method-calls-rule
And then in your phpstan.neon
register service:
services:
-
class: BrandEmbasssy\ForbiddenMethodCallsRule\ForbiddenMethodCallsRule
setup:
- addForbiddenMethod(Psr\Http\Message\StreamInterface, getContents)
tags:
- phpstan.rules.rule
Example
------ -----------------------------------------------------------------
Line foo/Bar/Baz.php (in context of class Foo\Bar\Baz)
------ -----------------------------------------------------------------
95 Calling forbidden method
Psr\Http\Message\StreamInterface:getContents().
------ -----------------------------------------------------------------