Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add documentation how to ignore container service checks for tests directory #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 1.2.x
Choose a base branch
Loading
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions 14 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ parameters:
- var/cache/dev/Symfony/Config
```

## Ignore container service checks for tests

Inside tests maybe inlined or private container services are accessed. To disable the ruleset for `tests` directory following can be added to the `phpstan.neon` file:

```neon
parameters:
# ...
ignoreErrors:
- path: "tests/"
message: '#Service "(.*)" is not registered in the container.#'
- path: "tests/"
message: '#Service "(.*)" is private.#'
```

## Constant hassers

Sometimes, when you are dealing with optional dependencies, the `::has()` methods can cause problems. For example, the following construct would complain that the condition is always either on or off, depending on whether you have the dependency for `service` installed:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.