Skip to content

Conversation

@phanan
Copy link
Contributor

@phanan phanan commented Mar 11, 2015

I've made some refactoring for the whole View package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crynobone PHP5.4+ has <?= short tag enabled by default. And Laravel requires 5.4+, so why not?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And everyone is forced to have short_open_tag as on?

I still don't see it really add any benefit, unless this changes gain some huge performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're wrong. <?= is not even considered as a short tag anymore, and is not affected by short_open_tag. See http://svn.php.net/viewvc?view=revision&revision=311260, from Rasmus Lerdorf himself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't see it really add any benefit, unless this changes gain some huge performance.

Well, just as [] is not of any more benefits than array(). But Laravel has always been a modern framework, it should adapt the latest techniques whenever it can. I see quite a portion of L5 switched to [] instead of array(), ?: instead of ? $var : $val, so again, why not?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the use of non-conventional tags.

@kirkbushell
Copy link
Contributor

The problems with <? is one of convention and good practise - it's a sharp conflict with XML, which is why it is generally frowned upon to be used as a language opening tag.

I cannot see this being supported by @taylorotwell or anyone in the PHP community in general.

@phanan
Copy link
Contributor Author

phanan commented Mar 11, 2015

First, I wouldn't speak for the whole PHP community, which I'm pretty much sure I'm a part of.

Then, would appreciate if you could enlighten me regarding this statement:

The problems with <? is one of convention and good practise - it's a sharp conflict with XML, which is why it is generally frowned upon to be used as a language opening tag.

And last, it's perfectly OK if Taylor or any contributor rejects this PR. I still strongly believe that Laravel has much for refactoring.

@kirkbushell
Copy link
Contributor

That's why i said "in general" - aka, a generalisation. Aka, the majority.

Have a look at the tags xml uses. Tell me if this looks familiar:

    <?xml version="1.0" encoding="UTF-8"?>

In your code, if someone is using the View package to generate XML - it will fail. Their XML documents won't be correctly constructed AND any opening XML tag will be incorrectly parsed as PHP.

@phanan
Copy link
Contributor Author

phanan commented Mar 11, 2015

"Generalization" is a good fallacy name.

Not sure what you mean by comparing <?xml and <?php. If you're implying a possible conflict between the short tag <? and <?xml, then no, we're talking about <?=, which is not a short tag anymore.

Oh, and for that, I believe Rasmus is in a better position to represent the "PHP community."

@kirkbushell
Copy link
Contributor

Please read: http://php.net/manual/en/language.basic-syntax.phptags.php

"PHP also allows for short open tag <? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option)."

If you support short tags, then XML tags also get factored in.

If you're going to support short tags, and allow for <?= then you also have to support <? which creates problems, as I mentioned above - with XML.

If short tags are actually discouraged on the OFFICIAL documentation - then we shouldn't be supporting them.

@phanan
Copy link
Contributor Author

phanan commented Mar 11, 2015

@kirkbushell, I strongly suggest you read from the beginning of this discussion.

@kirkbushell
Copy link
Contributor

No it's okay, I'm done.

@GrahamCampbell
Copy link
Collaborator

This add no benefit. All you're done is changed the syntax. We don't accept pulls for short array syntax, and there's no point in chaining the tags to a style that might not even work on all systems.

@phanan
Copy link
Contributor Author

phanan commented Mar 12, 2015

@GrahamCampbell While I totally respect your decision, the PR had more than just array syntax. Even if it was only array syntax, I wouldn't say an effort to make the code cleaner is of "no benefit."

Please remove the use of non-conventional tags.

a style that might not even work on all systems.

Again, how does <?= not work on any system that Laravel supports, if it's always supported by PHP5.4+? And what convention are we looking at? Here is the first rule from PSR-1 standards, which Laravel claims to follow:

Files MUST use only <?php and <?= tags.

Maybe @taylorotwell could clarify this? No hard feelings, only wanted to learn things.

@GrahamCampbell
Copy link
Collaborator

Again, how does <?= not work on any system that Laravel supports

Just because it's "enabled by default", it doesn't mean it's always enabled. Also, those tags might be removed in php 7 are far as I know.

@kirkbushell
Copy link
Contributor

+1 @GrahamCampbell

@JoostK
Copy link
Contributor

JoostK commented Mar 12, 2015

@GrahamCampbell Stop spreading nonsense. @phanan has already given proof that short_open_tag is not used anymore and that the tags are always present, and cannot be disabled. In PHP 7 the ASP style tags are being removed, but <?= is not.

@kirkbushell
Copy link
Contributor

Just read up on PHP 5.4, absolutely correct - my bad.

They are enabled - and you cannot disable them.

@phanan
Copy link
Contributor Author

phanan commented Mar 13, 2015

@GrahamCampbell As some guys here have pointed out as well, <?= support is not even optional since 5.4. I'd expect a more responsible answer from you as a well-respected, core collaborator of Laravel than just "as far as I know" - even a PHP noob like me can say so, too. Btw are you ignoring the fact about PSR-1?

@ghost
Copy link

ghost commented Mar 13, 2015

Yes, please reopen this.

PSR-1:

Files MUST use only <?php and <?= tags.

and

PHP code MUST use the long <?php ?> tags or the short-echo <?= ?> tags

It's completely valid and follows PSR-1.

@kirkbushell
Copy link
Contributor

@phanan your passive-aggressive responses need to stop - they're unnecessary.

@phanan
Copy link
Contributor Author

phanan commented Mar 13, 2015

@kirkbushell Sorry, didn't realize I was being passive-aggressive. And sorry for bad English. 😃

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.

5 participants