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

[5.5] Fix class name in generated class file #20961

Merged
merged 2 commits into from
Sep 4, 2017
Merged

[5.5] Fix class name in generated class file #20961

merged 2 commits into from
Sep 4, 2017

Conversation

jrl05k
Copy link
Contributor

@jrl05k jrl05k commented Sep 4, 2017

This fixes the class name in a generated class file if the class name begins with a slash.

If a class name used in a make command starts with a slash the generated file will have the slash in the class name creating a syntax error in class file. For example, "php artisan make:model \Foo" will generate a file with the class name \Foo (i.e. namespace App; .... class \Foo { ..... } ).

Although a user would see the invalid class name in the generated file when they edit it to add their content, it seems more appropriate for the generator to create syntactically correct files.

Removing the beginning slash in the GeneratorCommand::qualifyClass() method generates a file with a valid class name.

jrl05k and others added 2 commits September 4, 2017 01:51
If a class name used in a make commands starts with a slash the generated file will have the slash in the class name creating syntax error in class file. For example, artisan make modeld command (i.e. php artisan make:model \Foo) will generate file with the class name \Foo (i.e. class \Foo { ..... } ).  Removing the beginning slash in the GeneratorCommand::qualifyClass() method will generate file will a valid class name.
@taylorotwell taylorotwell merged commit d44c435 into laravel:5.5 Sep 4, 2017
@GrahamCampbell GrahamCampbell changed the title Fix class name in generated class file. [5.5] Fix class name in generated class file Sep 5, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants