Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brandembassy/phpstan-forbidden-method-calls-rule


https://github.com/brandembassy/phpstan-forbidden-method-calls-rule

phpstan phpstan-rules

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# PHPStan Forbidden Method Calls Rule

> This PHPStan rule was created by Petr Morávek (https://github.com/xificurk).

## Usage

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