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

Why the move from no spaces to spaces in Blade directives? #56

Open
martinbean opened this issue Sep 20, 2016 · 3 comments
Open

Why the move from no spaces to spaces in Blade directives? #56

martinbean opened this issue Sep 20, 2016 · 3 comments
Labels
question Questions or comments about package.

Comments

@martinbean
Copy link

Previously, using this package to insert Blade directives added directives without any spaces (i.e. @foreach($foo as $bar), @if($foo) etc. Now, directives contain spaces between the directive name and the opening parenthesis, i.e. @foreach ($foo as $bar), @if ($foo) etc. This means I know have code that is non-uniform.

What was the reason for this change? I preferred the non-space version for consistency, as you write @section('section.name') not @section ('section.name') and @include('path.to.include') not @include ('path.to.include').

@Ingramz
Copy link
Collaborator

Ingramz commented Sep 20, 2016

The uniformity is dependant on the way you look at it. My main argument is going to be that it's the way how it is depicted in Laravel documentation. As a secondary, if you write your PHP adhering to PSR-2, then all control structures have a space between the directive name and opening parenthesis. Rest of directives can be viewed as functions with exceptions such as @section.

I would have no problems with it being configurable in package settings where you can just tick a checkbox to toggle the style you like. I am not sure however if snippets package allows one to do this programmatically.

@martinbean
Copy link
Author

@Ingramz Understandable. But my argument re: PSR-2 is that Blade directives aren’t really PHP, so doesn’t really need to adhere to that standard.

I’d definitely be interested in a configuration option. I think some packages allow configuring of HTML- or XHTML-style tags, so would imagine it is possible. I have no idea how it would be achieved off the top of my head, though 😄

@Ingramz
Copy link
Collaborator

Ingramz commented Sep 20, 2016

I think some packages allow configuring of HTML- or XHTML-style tags, so would imagine it is possible.

If you know specific packages that can do that, could you mention them by name/link them so I could look into how they work.

@Ingramz Ingramz added the question Questions or comments about package. label Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions or comments about package.
Projects
None yet
Development

No branches or pull requests

2 participants