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

Namespaces with escaped backslashes in strings are not replaced #129

Open
deviationist opened this issue Apr 15, 2021 · 0 comments
Open

Comments

@deviationist
Copy link

deviationist commented Apr 15, 2021

Hello Coen! First of all, great work and thanks for making this tool. Helped me a lot, super easy to use!

I learned something when implementing it in my project. Not sure if I should call it a bug, but I wanted to share it with you regardless. When namespaces are specified in strings then it seems like Mozart is only able to prefix namespaces where the backslash is not escaped. See the example below.

Before namespace prefixing:

$baseNamespace = "\Example\Sdk\Endpoints";
$baseNamespace = "Example\\Sdk\\Endpoints";
$baseNamespace = "Example\Sdk\Endpoints";

$baseNamespace = '\\Example\\Sdk\\Endpoints';
$baseNamespace = '\Example\Sdk\Endpoints';
$baseNamespace = 'Example\\Sdk\\Endpoints';
$baseNamespace = 'Example\Sdk\Endpoints';

After namespace prefixing:

$baseNamespace = "\My\Dependencies\Example\Sdk\Endpoints";
$baseNamespace = "Example\\Sdk\\Endpoints";
baseNamespace = "My\Dependencies\Example\Sdk\Endpoints";

$baseNamespace = '\\Example\\Sdk\\Endpoints';
$baseNamespace = '\My\Dependencies\Example\Sdk\Endpoints';
$baseNamespace = 'Example\\Sdk\\Endpoints';
$baseNamespace = 'My\Dependencies\Example\Sdk\Endpoints';

Initially I thought this was related to the use of single- or double-quotes, but it only seems to be an issue when using escaped backslashes in the namespace string. Probably not the biggest issue, but it would probably be nice to also support escaped backslashes IMO.

Kind regards,
Robert Sæther

@deviationist deviationist changed the title Namespaces surrounded by single-quotes are not replaced Namespaces with escaped backslashes in strings are not replaced Apr 15, 2021
BrianHenryIE added a commit to BrianHenryIE/strauss that referenced this issue May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant