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

Sign up
Appearance settings

Multiple container XML paths #237

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

Closed
ckuran wants to merge 1 commit into phpstan:1.2.x from ckuran:container-xml-paths

Conversation

Copy link

@ckuran ckuran commented Jan 19, 2022
edited
Loading

Provides the option to define multiple container paths. For most of us, it will resolve the issue of missing container file in CI, because if the container is not found in dev environment, PHPStan can look to other defined paths like test.

Workaround to #105 because the best solution would be locating the container automatically without any configuration.

Requires phpstan-src#932

wyster and raziel057 reacted with thumbs up emoji meyerbaptiste reacted with heart emoji
Copy link
Collaborator

In my CI pipelines I just run php bin/console --env=dev > /dev/null before phpstan analyse with whatever --env I need. Works like a charm.

I have tentative plans to implement "smart" automatic container detection (with features like choosing the test one when analysing tests). But I can't promise anything at the moment.

Copy link
Author

ckuran commented Jan 19, 2022
edited
Loading

In my CI pipelines I just run php bin/console --env=dev > /dev/null before phpstan analyse with whatever --env I need. Works like a charm.

Current PHPStan's configuration leaves you with the requirement of making hacks on CI or locally. If you leave the dev env in phpstan.neon.dist then you need to make hacks on CI (to run it in test env). If you put the test env in phpstan.neon.dist then you need to make hacks to run it locally (to run it in dev env). The easiest way is creating a phpstan.neon file with the config that works, but the fun comes when you use a multi-environment setup - not only the standard dev and test, but for example qa because you have a local copy of your QA's database because he asked you to debug something. Then PHPStan is crying about the missing container if you forget to switch it back to the original env and you removed all cached ones. With this fix our devs wouldn't have to configure anything and the ones that have multi-env setup could define their possible locations for containers.

I have tentative plans to implement "smart" automatic container detection (with features like choosing the test one when analysing tests). But I can't promise anything at the moment.

I know this isn't ideal, but this solution is just a workaround to the problem that I've managed to do in a short amount of time.

Copy link
Member

Hi, I don't think this complexity is needed, I think phpstan-symfony as it is works for all Symfony apps, albeit you need to dump the right container before running PHPStan. It's totally fine. Thanks for understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /