Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 982 Bytes

allow-ignore-errors.md

File metadata and controls

18 lines (15 loc) · 982 Bytes

Allow some previously disallowed calls or attributes

Sometimes, the method, the function, or the constant needs to be called or used once in your code, for example in a custom wrapper. You can use PHPStan's ignoreErrors feature to ignore that one call:

ignoreErrors:
    -
        message: '#^Calling Redis::connect\(\) is forbidden, use our own Redis instead#'  # Needed for the constructor
        path: application/libraries/Redis/Redis.php
    -
        message: '#^Calling print_r\(\) is forbidden, use logger instead#'  # Used with $return = true
        paths:
            - application/libraries/Tls/Certificate.php
            - application/libraries/Tls/CertificateSigningRequest.php
            - application/libraries/Tls/PublicKey.php

The extension's configuration using custom rules is flexible enough to allow a call with specified attributes only for example.