• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHPCSStandards / PHP_CodeSniffer / 10375015156 / 2
78%
master: 79%

Build:
Build:
LAST BUILD BRANCH: dependabot/github_actions/3.x/action-runners-06f19cc200
DEFAULT BRANCH: master
Ran 13 Aug 2024 06:22PM UTC
Files 260
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Aug 2024 06:14PM UTC coverage: 72.43% (+0.004%) from 72.426%
10375015156.2

push

github

jrfnl
Squiz/EmbeddedPhp: fix false positive when handling short open tags

The content of a PHP long open tag token is `<?php ` (note
the space after the tag). The content of a PHP short open tag is
`<?` (no space after the tag). The sniff did not account correctly for
this difference when checking the expected number of spaces after a
short open tag, resulting in false positives and incorrect fixes.

For example, the code below:

```
<? echo 'one space after short open tag'; ?>
```

Resulted in the error (there is just one space after the opening tag and
not two, as stated in the error):

```
Expected 1 space after opening PHP tag; 2 found (Squiz.PHP.EmbeddedPhp.SpacingAfterOpen)
```

And the incorrect fix:

```
<?echo 'without space after short open tag'; ?>
```

This commit fixes this problem by changing the sniff code to consider
that only long open tags contain a space after the tag in the `content`
key of the token array.

17528 of 24200 relevant lines covered (72.43%)

23.95 hits per line

Source Files on job php-8.1-custom-ini-true - 10375015156.2
  • Tree
  • List 0
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 10375015156
  • 0f69726d on github
  • Prev Job for on 4.0 (#10322894362.3)
  • Next Job for on 4.0 (#10375273139.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc