brandembassy / phpstan-forbidden-method-calls-rule
Rule for PHPStan that enables you to forbid some methods from being called.
Installs: 23 056
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-12-22 06:21:22 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().
------ -----------------------------------------------------------------