-
Notifications
You must be signed in to change notification settings - Fork 61
#67 stub out dependencies that cannot be located by using empty classes #74
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
#67 stub out dependencies that cannot be located by using empty classes #74
Conversation
Btw, thanks @michaelcullum for the idea! |
Shipping/releasing here, as I won't have time to do it later today or tomorrow, and it is indeed a blocker... |
Thanks. I'll have a look later! Can't right now sorry.
…On Sun, 27 May 2018, 15:57 Marco Pivetta, ***@***.***> wrote:
Shipping/releasing here, as I won't have time to do it later today or
tomorrow, and it is indeed a blocker...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAmK8LbpfpaMeDo5NFLT4pY40w4M3BwIks5t2r7HgaJpZM4UPTDm>
.
|
After this PR i'm receiving this running on API platform.
reproduction:
|
This usually happens when a constant cannot be located. If you have a reference to a non-existing class and then attempt to retrieve a constant from it, it will:
I just reproduced this in |
@bendavies see Roave/BetterReflection#425 - that should at least lead to better exception messages for these scenarios. Not something the tool can fix though :-\ |
Also reported #77, since stubbing drags in some more issues, and is also incomplete (can't stub |
This effectively reverts #74 without introducing a BC break: the class is now deprecated, but still exists in the codebase. The idea of the `StubClassSourceLocator` was that it should be possible to analyse code even if dependency holes are present, but that is now solved by skipping BC break checks for any reflection-based exception. This massively simplifies things, as any missing dependency will simply lead to a skipped error and a non-zero exit code, much like it happens in `maglnet/composer-require-checker` (https://github.com/maglnet/ComposerRequireChecker). This also fixes weird scenarios where a pre-existing class is being looked up in a new codebase that doesn't contain it. Assuming that following was deleted across two breaking versions: ```php namespace Foo; interface Bar {} ``` Before this change, this breakage would not be located, because the `StubClassSourceLocator` would create an implicit `Foo\Bar` stub, which would therefore be considered as "not a change".
is now deprecated, but still exists in the codebase. The idea of the `StubClassSourceLocator` was that it should be possible to analyse code even if dependency holes are present, but that is now solved by skipping BC break checks for any reflection-based exception. This massively simplifies things, as any missing dependency will simply lead to a skipped error and a non-zero exit code, much like it happens in `maglnet/composer-require-checker` (https://github.com/maglnet/ComposerRequireChecker). This also fixes weird scenarios where a pre-existing class is being looked up in a new codebase that doesn't contain it. Assuming that following was deleted across two breaking versions: ```php namespace Foo; interface Bar {} ``` Before this change, this breakage would not be located, because the `StubClassSourceLocator` would create an implicit `Foo\Bar` stub, which would therefore be considered as "not a change".
Fixes #67
@bendavies can I ask for a review here please, as well as checking if this allows you to integrate this tool with your project?