Skip to content

BrandEmbassy/phpstan-forbidden-method-calls-rule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPStan Forbidden Method Calls Rule

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().                                                                                                                 
 ------ -----------------------------------------------------------------