typisttech / imposter

Wrapping all composer vendor packages inside your own namespace. Intended for WordPress plugins
https://www.typist.tech/projects/imposter
MIT License
108 stars 16 forks source link

Feature Request: support class_alias #277

Open eteubert opened 4 years ago

eteubert commented 4 years ago

Currently class_alias is not supported.

I need this because I would like to use imposter for Twig, but they make use of class_alias, for example here: https://github.com/twigphp/Twig/blob/2.x/src/Environment.php#L995

I think the prefix should be applied to both the alias $origin and $alias.

# from the PHP docs:
class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) : bool
eteubert commented 4 years ago

Just want to let you know that I moved to PHP Scoper.

I tried looking at your code but couldn't wrap my head around the regexes 😅 And even support for class_alias wouldn't be enough to scope Twig. I need the flexibility of what PHP Scoper calls "patcher" to make it work -- unfortunately.

Still want to leave a thumbs up 👍 here for your efforts. Especially with your imposter-plugin the usage is really pleasant. I'm just unfortunate, I guess, in that the only dependency I need to wrap makes scoping really hard. Feel free to close the issue.