Skip to content
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

Constrainer is not able to handle class_alias() #29

Open
jkreller opened this issue Aug 22, 2023 · 1 comment
Open

Constrainer is not able to handle class_alias() #29

jkreller opened this issue Aug 22, 2023 · 1 comment

Comments

@jkreller
Copy link

jkreller commented Aug 22, 2023

I got a quite specific use case within my code, where I create an anonymous class extending another class dynamically.
Our pipelines fail since Spryker's composer-constrainer cannot handle this.

class_alias($class, '\AnyClass'); // value of $class is only known at runtime
$extendedClass = new class () extends \AnyClass { // ...

Executing constrainer throws the following exception:

ReflectionException - Exception: Class "AnyClass@anonymous" does not exist 
in /builds/aci/spryker/spryker-b2c/vendor/spryker-sdk/composer-constrainer/src/SprykerSdk/Zed/ComposerConstrainer/Business/Finder/ExtendedModuleFinder/ExtendedModuleFinder.php (129)

Support for class_alias() should be added.

@jkreller
Copy link
Author

I created a pull request to ignore anonymous classes at this point, which seems reasonable to me: #30.
Would resolve the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant