Skip to content

Configuration

Yohan Laborda edited this page Jun 26, 2021 · 5 revisions

Manual

You need to add the extension.neon in your PHPStan file settings.

includes:
    - vendor/yohanlaborda/behaviour/extension.neon

Parameters

The rule can be configured with various parameters.

parameters:
    behaviour:
        expressions: ["/^.+(Service)$/", "/^.+(Stage)$/"]
        extensions: ["feature", "features"]
        maximumIfAllowed: 3
        maximumLinesInMethod: 10
        maximumLinesInClass: 100

Expressions

You can use the regular expression you want to parse the files. By default the files ending in NameService.php and NameStage.php are searched.

parameters:
    behaviour:
        expressions: ["/^.+(Service)$/", "/^.+(Stage)$/"]

Extensions

To change the extension you must configure the extensions parameter, indicating the desired extensions.

parameters:
    behaviour:
        extensions: ["feature", "features"]

Maximum if allowed

Number of ifs allowed in a method of a class.

parameters:
    behaviour:
        maximumIfAllowed: 3

Maximum lines in method

Indicates the number of lines allowed in a method of a class.

parameters:
    behaviour:
        maximumLinesInMethod: 10

Maximum lines in class

Indicates the number of lines allowed in a class.

parameters:
    behaviour:
        maximumLinesInClass: 100