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
Error in TypeInferenceTestCase when missing namespace #2148
Conversation
1c047e8
to
40cb59d
Compare
|
b333809
to
0728646
Compare
0728646
to
10a4ee2
Compare
The idea looks great to me! Is it possible to detect duplicate namespaces? |
I think we could implement a phpstan collector to check for duplicate namespaces across all test files. What I don't like with this PR is that it does not cover files e.g. included from Rule*Tests. |
something like https://github.com/slevomat/coding-standard/blob/master/doc/namespaces.md#slevomatcodingstandardnamespacesrequireonenamespaceinfile configured to run only in all |
good idea. what I like about this PR is, that it only enforces a namespace when you have named symbols contained. some tests might not have a namespace and adding one might imply changing a lot of test expectations (e.g. reported line numbers) |
10a4ee2
to
487b464
Compare
487b464
to
3427331
Compare
I don't think this is the right approach. We need something more general because:
What would make more sense to me is a new workflow with a separate PHPStan config that would run PHPStan only on
Since that implementation is not going to have anything common with this PR, I'm closing it. |
(If you want to send fixes for the discovered problems, sure, send a separate PR with no other changes :)) |
inspired by #2147 added a error condition when test files contain named classes or functions but do not declare a namespace
catched the following error on first run (and even more on subsequent runs):