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

PHPCSStandards / PHPCSUtils / 253
97%
develop: 100%

Build:
Build:
LAST BUILD BRANCH: dependabot/github_actions/action-runners-c4b2a15d30
DEFAULT BRANCH: develop
Ran 30 Jan 2020 06:11PM UTC
Jobs 4
Files 24
Run time 2min
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

pending completion
253

Pull #70

travis-ci-com

web-flow
:sparkles: New Utils\ControlStructures class

This adds three new utility methods:
* `hasBody()` - to check whether a control structure has a body and optionally whether that body is non-empty. Returns boolean.
    This is a helper function to distinguish between structures like `while (++$i < 10);` and `while (++$i < 10) { /* do something */ }`.
* `isElseIf()` - to check whether an `T_IF` or `T_ELSE` token is part of an `else if`. Returns boolean.
* `getDeclareScopeOpenClose()` - to retrieve the scope open/close pointers for `declare` statements. Returns an array with the stack pointers or false if a file based statement or if the scope open/close pointers could not be determined.
    Declare statements come in three flavours:
    - file based, without body: `declare(ticks=1);`;
    - scoped using curly braces;
    - scoped using the alternative control structure syntax.
    In that last case, PHPCS does not assign the scope open/close indexes in the `$tokens` array. A [PR is open to fix this](https://github.com/squizlabs/PHP_CodeSniffer/pull/2843), but for any sniff which needs to support versions of PHPCS prior to the version in which that PR will be merged, this helper method can retrieve the scope open/close indexes.

This commit also adds two convenience token arrays for working with control structures to the `PHPCSUtils\Tokens\Collections` class.
* `$alternativeControlStructureSyntaxTokens` - tokens which can use the alternative syntax for control structures.
* `$controlStructureTokens` - control structure tokens.

Includes extensive dedicated unit tests.
Pull Request #70: New Utils\ControlStructures class

110 of 110 new or added lines in 1 file covered. (100.0%)

2127 of 2196 relevant lines covered (96.86%)

65.65 hits per line

Jobs
ID Job ID Ran Files Coverage
29 253.29 (PHPCS_VERSION="dev-master" LINT=1 COVERALLS_VERSION="^2.0") 30 Jan 2020 06:11PM UTC 0
92.11
Travis Job 253.29
30 253.30 (PHPCS_VERSION="2.9.2" COVERALLS_VERSION="^2.0") 30 Jan 2020 06:11PM UTC 0
95.43
Travis Job 253.30
31 253.31 (PHPCS_VERSION="dev-master" LINT=1 COVERALLS_VERSION="^1.0") 30 Jan 2020 06:11PM UTC 0
91.28
Travis Job 253.31
32 253.32 (PHPCS_VERSION="2.6.0" COVERALLS_VERSION="^1.0") 30 Jan 2020 06:13PM UTC 0
94.95
Travis Job 253.32
Source Files on build 253
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #253
  • Pull Request #70
  • PR Base - develop (#250)
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