![]() ![]() This overwrites global reportUnmatchedIgnoredErrors setting. You can turn on/off reporting unused ignores explicitly for each entry in ignoredErrors. You can turn off this behaviour by setting reportUnmatchedIgnoredErrors to false in the configuration: parameters : reportUnmatchedIgnoredErrors : false If some of the ignored errors (both from configuration and PHPDocs) do not occur in the result anymore, PHPStan will let you know and you will have to remove the pattern from the configuration. If you want to ignore all the current errors and only focus on new and changed code from now on, go and learn about the baseline feature. It deals with the complexity of writing a matching regular expression from a plain string and encoding that regular expression into the neon format.Īn error occurred. Using the fields below, you can generate an entry that you can put in the parameters.ignoreErrors section of your configuration file. So if your phpstan.neon is in the root directory of the project, and you want to ignore an error in src/Foo/Bar.php, your path key can simply be src/Foo/Bar.php. ![]() Relative paths in the path and paths keys are resolved based on the directory of the config file is in. message : '#Call to an undefined method +::doFoo\(\)#' path : other/dir/DifferentFile.phpĬount : 2 # optional - '#Other error to ignore everywhere#' messages : - '#Call to an undefined method +::doFooFoo\(\)#' - '#Call to an undefined method +::doFooBar\(\)#' paths : - some/foo/dir/* messages : - '#Call to an undefined method +::doFooFoo\(\)#' - '#Call to an undefined method +::doFooBar\(\)#' path : other/dir/AnotherFile.php message : '#Call to an undefined method +::doBar\(\)#' paths : - some/dir/* parameters : ignoreErrors : - message : '#Access to an undefined property +::\$foo#' path : some/dir/SomeFile.php ![]() You can specify how many times the error is expected by using count (optional, applies only to message not messages and path, not paths). Wildcard patterns compatible with the PHP fnmatch() are also supported. To ignore errors by a regular expression only in a specific file, add an entry with message or messages and path or paths keys. To ignore an error by a regular expression in the whole project, add a string entry: parameters : ignoreErrors : - '#Call to an undefined method +::doFoo\(\)#' - '#Call to an undefined method +::doBar\(\)#'
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |