else if => elseif #1520

Merged
merged 1 commit into from Oct 3, 2012

Conversation

Projects
None yet
6 participants
@creocoder
Contributor

creocoder commented Oct 3, 2012

How about make code consistent?

If not, maybe then make PR where elseif => else if?

Also i think its good idea to add rule about elseif or else if in Code Style Guide.

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 3, 2012

Member

I think it's better to use else if.

Member

samdark commented Oct 3, 2012

I think it's better to use else if.

@mdomba

This comment has been minimized.

Show comment
Hide comment
@mdomba

mdomba Oct 3, 2012

Member

same here :)

Member

mdomba commented Oct 3, 2012

same here :)

@cebe

This comment has been minimized.

Show comment
Hide comment
@cebe

cebe Oct 3, 2012

Member

Have no preference here. Does it matter in any way?

Member

cebe commented Oct 3, 2012

Have no preference here. Does it matter in any way?

@creocoder

This comment has been minimized.

Show comment
Hide comment
@creocoder

creocoder Oct 3, 2012

Contributor

I also have no preference, but only elseif works in <?php elseif: ?>, and elseif 1 byte less :)

Contributor

creocoder commented Oct 3, 2012

I also have no preference, but only elseif works in <?php elseif: ?>, and elseif 1 byte less :)

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 3, 2012

Member

Not really but it's better to be consistent :)

Member

samdark commented Oct 3, 2012

Not really but it's better to be consistent :)

@creocoder

This comment has been minimized.

Show comment
Hide comment
@creocoder

creocoder Oct 3, 2012

Contributor

Ok, ill make new PR with elseif => else if for files where it used, exclude vendors and views.

Contributor

creocoder commented Oct 3, 2012

Ok, ill make new PR with elseif => else if for files where it used, exclude vendors and views.

@Ragazzo

This comment has been minimized.

Show comment
Hide comment
@Ragazzo

Ragazzo Oct 3, 2012

Hm, i think maybe it's good to mention that code-blocks breaks must be started each from new line? I, mean there are some examples in guide here in wiki, they are like

{
//code here
}

but nowhere in wiki is mentioned that breacks must be from new line, think its important, because some people use style like

if(){
}

this is not Yii way as i know, am i right?

Ragazzo commented Oct 3, 2012

Hm, i think maybe it's good to mention that code-blocks breaks must be started each from new line? I, mean there are some examples in guide here in wiki, they are like

{
//code here
}

but nowhere in wiki is mentioned that breacks must be from new line, think its important, because some people use style like

if(){
}

this is not Yii way as i know, am i right?

@creocoder

This comment has been minimized.

Show comment
Hide comment
@creocoder

creocoder Oct 3, 2012

Contributor

This PR about else if => elseif problem and only in core. Yii does not enforce any coding style in end applications.

Contributor

creocoder commented Oct 3, 2012

This PR about else if => elseif problem and only in core. Yii does not enforce any coding style in end applications.

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 3, 2012

Member

@creocoder why elseif and not else if?

Member

samdark commented Oct 3, 2012

@creocoder why elseif and not else if?

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 3, 2012

Member

Actually there are two pros when using elseif:

  1. It works a bit faster.
  2. It works like that
if($x):
  echo '1';
elseif:
  echo '2';
endif;

while else if doesn't. Important for views. I'm for elseif now :)

Member

samdark commented Oct 3, 2012

Actually there are two pros when using elseif:

  1. It works a bit faster.
  2. It works like that
if($x):
  echo '1';
elseif:
  echo '2';
endif;

while else if doesn't. Important for views. I'm for elseif now :)

@ghost ghost assigned samdark Oct 3, 2012

samdark added a commit that referenced this pull request Oct 3, 2012

@samdark samdark merged commit 99e90d8 into yiisoft:master Oct 3, 2012

@qiangxue

This comment has been minimized.

Show comment
Hide comment
@qiangxue

qiangxue Oct 3, 2012

Member

elseif is better which is being used in yii2 codebase.

However, in future I think we should avoid such massive commits unless very necessary.

Member

qiangxue commented Oct 3, 2012

elseif is better which is being used in yii2 codebase.

However, in future I think we should avoid such massive commits unless very necessary.

@samdark

This comment has been minimized.

Show comment
Hide comment
@samdark

samdark Oct 3, 2012

Member

What's the issue with it? It's just search-replace + I've checked diff.

Member

samdark commented Oct 3, 2012

What's the issue with it? It's just search-replace + I've checked diff.

@qiangxue

This comment has been minimized.

Show comment
Hide comment
@qiangxue

qiangxue Oct 3, 2012

Member

We were using else if consistently previously. Even though elseif is better, the advantage over else if (which we were using consistently) is very marginal. By doing such massive commits, we may bring trouble to ourselves. Now every file has one additional commit history. If there are any outstanding branches, future merge may cause conflicts.

Member

qiangxue commented Oct 3, 2012

We were using else if consistently previously. Even though elseif is better, the advantage over else if (which we were using consistently) is very marginal. By doing such massive commits, we may bring trouble to ourselves. Now every file has one additional commit history. If there are any outstanding branches, future merge may cause conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment