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

[Feature request] Sniff for alternative opening tags ? #1063

Closed
jrfnl opened this issue Jul 10, 2016 · 0 comments · Fixed by #1084
Closed

[Feature request] Sniff for alternative opening tags ? #1063

jrfnl opened this issue Jul 10, 2016 · 0 comments · Fixed by #1084

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Jul 10, 2016

The Generic.PHP.DisallowShortOpenTag sniff checks for PHP short open tags, however there are also some alternative syntaxes which have been removed in PHP7:

<% echo 'content'; %>
<%= 'content'; %>
<script language="php">
echo 'content';
</script>

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

Would there be interest in a sniff for this ?

And if so - should this be added to the Generic.PHP.DisallowShortOpenTag sniff or should a separate sniff be created ?

jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 11, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 11, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 11, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 11, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 11, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 11, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 12, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 13, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 14, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 17, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/WordPress-Coding-Standards that referenced this issue Jul 21, 2016
Fixes WordPress#580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this issue Jul 21, 2016
This sniff checks  for the alternative PHP syntaxes - ASP tags and script tags - which have been removed in PHP7:
```php
<% echo 'content'; %>
<%= 'content'; %>
<script language="php">
echo 'content';
</script>
```
Ref: http://php.net/manual/en/language.basic-syntax.phptags.php

If PHPCS is run on PHP < 7, the script tags will be fixable.
If PHPCS is run on PHP < 7 + asp_tags is on, the ASP tags will be fixable.

Fixes squizlabs#1063

Similar to squizlabs#1069, the myconfig.ini file and the adjustment to the travis script are needed for the fixer unit tests to pass as when asp_tags is set to off, the fixer won't fix it correctly and the tests will fail ;-)

The travis and myconfig.ini changes will conflict with squizlabs#1069, but depending on whichever PR will get merged first - if any get merged at all -, I will adjust the other one to remove the conflict.
jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this issue Jul 28, 2016
This sniff checks  for the alternative PHP syntaxes - ASP tags and script tags - which have been removed in PHP7:
```php
<% echo 'content'; %>
<%= 'content'; %>
<script language="php">
echo 'content';
</script>
```
Ref: http://php.net/manual/en/language.basic-syntax.phptags.php

If PHPCS is run on PHP < 7, the script tags will be fixable.
If PHPCS is run on PHP < 7 + asp_tags is on, the ASP tags will be fixable.

Fixes squizlabs#1063

Similar to squizlabs#1069, the myconfig.ini file and the adjustment to the travis script are needed for the fixer unit tests to pass as when asp_tags is set to off, the fixer won't fix it correctly and the tests will fail ;-)

The travis and myconfig.ini changes will conflict with squizlabs#1069, but depending on whichever PR will get merged first - if any get merged at all -, I will adjust the other one to remove the conflict.
jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this issue Jul 28, 2016
This sniff checks  for the alternative PHP syntaxes - ASP tags and script tags - which have been removed in PHP7:
```php
<% echo 'content'; %>
<%= 'content'; %>
<script language="php">
echo 'content';
</script>
```
Ref: http://php.net/manual/en/language.basic-syntax.phptags.php

If PHPCS is run on PHP < 7, the script tags will be fixable.
If PHPCS is run on PHP < 7 + asp_tags is on, the ASP tags will be fixable.

Fixes squizlabs#1063

Similar to squizlabs#1069, the myconfig.ini file and the adjustment to the travis script are needed for the fixer unit tests to pass as when asp_tags is set to off, the fixer won't fix it correctly and the tests will fail ;-)

The travis and myconfig.ini changes will conflict with squizlabs#1069, but depending on whichever PR will get merged first - if any get merged at all -, I will adjust the other one to remove the conflict.
jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this issue Jul 28, 2016
This sniff checks  for the alternative PHP syntaxes - ASP tags and script tags - which have been removed in PHP7:
```php
<% echo 'content'; %>
<%= 'content'; %>
<script language="php">
echo 'content';
</script>
```
Ref: http://php.net/manual/en/language.basic-syntax.phptags.php

If PHPCS is run on PHP < 7, the script tags will be fixable, provided they are correct.
If PHPCS is run on PHP < 7 + asp_tags is on, the ASP tags will be fixable.

Fixes squizlabs#1063

Similar to squizlabs#1069, the `myconfig5.ini` and `myconfig57.ini` files and the adjustment to the travis script are needed for the fixer unit tests to pass as when asp_tags is set to off, the fixer won't fix it correctly and the tests will fail ;-)
grappler pushed a commit to WPTT/WPThemeReview that referenced this issue Sep 25, 2016
Fixes #580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
JDGrimes pushed a commit to WordPress/WordPress-Coding-Standards that referenced this issue Oct 8, 2016
Fixes #580

This should be removed again if the upstream issue squizlabs/PHP_CodeSniffer#1063 would get traction and the associated PR would be merged *and* the minimum PHPCS version for WPCS would become higher than the version in which the PR is merged ;-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants