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

Squiz/EmbeddedPhp doesn't examine code using short open echo tag #3705

Closed
jrfnl opened this issue Nov 2, 2022 · 2 comments
Closed

Squiz/EmbeddedPhp doesn't examine code using short open echo tag #3705

jrfnl opened this issue Nov 2, 2022 · 2 comments

Comments

@jrfnl
Copy link
Contributor

jrfnl commented Nov 2, 2022

Given this code:

<?php   echo $var   ?>

Running the Squiz.PHP.EmbeddedPhp sniff over it results in:

-------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] Expected 1 space after opening PHP tag; 3 found
   |       |     (Squiz.PHP.EmbeddedPhp.SpacingAfterOpen)
 1 | ERROR | [x] Inline PHP statement must end with a semicolon (Squiz.PHP.EmbeddedPhp.NoSemicolon)
 1 | ERROR | [x] Expected 1 space before closing PHP tag; 3 found
   |       |     (Squiz.PHP.EmbeddedPhp.SpacingBeforeClose)
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------

... while running the same sniff over the below code doesn't yield any errors:

<?=   $var   ?>

Questions

  1. Should the T_OPEN_TAG_WITH_ECHO token be added to the sniff ?
  2. If so and as the sniff would now start acting on more files, should the error codes for issues found in embedded PHP statements using short open echo tags be different ?
@jrfnl
Copy link
Contributor Author

jrfnl commented Dec 2, 2023

Closing as replaced by PHPCSStandards/PHP_CodeSniffer#27

@jrfnl jrfnl closed this as not planned Won't fix, can't repro, duplicate, stale Dec 2, 2023
@jrfnl
Copy link
Contributor Author

jrfnl commented Feb 16, 2024

FYI: a fix for this issue is included in today's PHP_CodeSniffer 3.9.0 release.

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

No branches or pull requests

1 participant