-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fatal error: Uncaught Error: Interface 'Stringable' not found in #1010
Comments
It you're using the latest tagged version it is a known issue, if you're using the master branch however it should be fixed. You notice you have a class alias statement added: \class_alias('ReinosMapsScoped\\Stringable', 'Stringable', \false); You should also have a corresponding If you still have the problem on master please provide a reproducer so that I can look into it |
Hi @theofidry, thanks for your reply! So I did some digging and I found the issue. The file
Indeed, By moving
Any idea how we can fix this? |
I see, that's an annoying one... We could fix it for this specific case for now. Fixing this more generally looks a bit tricky, doable but tricky. |
@theofidry , do you know of a workaround we could use until this can be fixed? I can confirm that it works if I reorder my exposed classes to this order: humbug_phpscoper_expose_class( 'Stringable', 'CodeZone\Bible\Stringable' ); |
@theofidry , what about a setting to allow for setting a priority of exposed classes? 'exposed-class-priority' => [
'Stringable' => 0,
'PhpToken' => 1
] Just an idea. I'm sure there is a more elegant solution. |
I'm working on a PoC for it. In terms of effort having another setting is not exactly trivial either, so might as well try to fix it the proper way. I don't think it is that hard in the end, but I was on holiday so didn't get that much time to look into it, I hope to fix this within the week or next week though. |
🙏 Thank you @theofidry! |
Ok I'll need some help here... Could you guys provide a super minimal reproducer? I identified the source code changes that I need to do, it's not a crazy amount but for the tests it's another story. So I've been trying to implement an e2e test instead to validate my idea first before fixing all the other tests... And I can't make it work. I did my changes in #1035. There is some source code changes but they actually have no impact yet (I'm tracking the dependencies of the class when aliasing a class, but I do nothing with them for now). The end to end test is in the I've tried various things, but I cannot reproduce the issue you describe. I've even added a polyfill-80 structure like to try to reproduce it without having to run an old PHP version but this does not do the trick: for me the I also notice that |
Hi @theofidry Its been a while. Sorry for taking sooo long. However, I have no idea how to send you a minimal reproducer. Ideas? I can send you my project that is causing the issue though. Perhaps that is helpful? let me know. |
No worries, if you can't publish the project maybe you can send a zip with the steps to reproduce it? |
How can I send you the zip file? Can we get in contact with each other? |
You can send them either here at theo.fidry @ gmail.com (and write here when you sent it, as it will likely end up in spam) |
I send you the project, I hope you can find what the cause of the issue is in this case 🤞🏻 Keep me posted! |
Thanks, received |
Cool, let me know if you have any questions. |
Hi @theofidry Any luck on reproducing/fixing this issue? |
Sorry couldnt take a look, got a bit busy with my moving. I saved the project you sent me by email, I hope to be able to take a look at it this week |
Bug report
After running php-scoper it seems that some interfaces are no scoped.
See the source of file /vendor/symfony/polyfill-php80/PhpToken.php
and file vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php
are scoped like
The issue seems that
class PhpToken implements \Stringable
is not scoped toclass PhpToken implements \ ReinosMapsScoped\Stringable
Now it throws an PHP error
Fatal error: Uncaught Error: Interface 'Stringable' not found in.....
and with adding manually the scoped namespace it fixed the error.Is this a bug in PHPscoper or a configuration issue? 🤔
The text was updated successfully, but these errors were encountered: