You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more a question or a start of a discusion around the fact that currently a space is required before a colon in phtml files when using the alternative syntax for control structures.
So currently Magento code standards expects us to use this format in phtml files:
<?phpif ($something) : ?>
<!-- do something -->
<?phpelse : ?>
<!-- do something else -->
<?phpendif; ?>
I'm wondering why this is required at this moment? Was there a reason for requiring it like this? Or did it just happen because it is the default setting of the PHP_CodeSniffer project?
Because it looks very ugly (personal opinion), other php projects don't enforce this syntax, a lot of php tutorials/samples don't use it, and it's also not part of any php coding standard as far as I'm aware?
I would rather see this format:
<?phpif ($something): ?>
<!-- do something -->
<?phpelse: ?>
<!-- do something else -->
<?phpendif; ?>
I'm seeing a lot of files being changed recently in the 2.3-develop branch whereas in Magento 2.3.2 this syntax wasn't being enforced yet. So it feels like somebody made this decision to enforce this but I can't find the reasoning behind it.
Not sure if this would make a chance to get changed?
No big deal if not, just wanted to bring this up 🙂
Thanks!
The text was updated successfully, but these errors were encountered:
If this gets approved, it best happens before Magento 2.3.3 gets released, otherwise a lot of files will get changed to the other format and then again in 2.3.4 to this new proposal (if approved). It would be nice if all changes could happen in a single Magento release if possible.
This makes figuring out what changed in between releases easier as fewer files will have been updated.
Description
Hi
This is more a question or a start of a discusion around the fact that currently a space is required before a colon in phtml files when using the alternative syntax for control structures.
So currently Magento code standards expects us to use this format in phtml files:
I'm wondering why this is required at this moment? Was there a reason for requiring it like this? Or did it just happen because it is the default setting of the PHP_CodeSniffer project?
Because it looks very ugly (personal opinion), other php projects don't enforce this syntax, a lot of php tutorials/samples don't use it, and it's also not part of any php coding standard as far as I'm aware?
I would rather see this format:
This could be changed with this option:
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties#squizcontrolstructurescontrolsignature
I'm seeing a lot of files being changed recently in the
2.3-develop
branch whereas in Magento 2.3.2 this syntax wasn't being enforced yet. So it feels like somebody made this decision to enforce this but I can't find the reasoning behind it.Not sure if this would make a chance to get changed?
No big deal if not, just wanted to bring this up 🙂
Thanks!
The text was updated successfully, but these errors were encountered: