Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHPCSStandards / PHPCSUtils / 178 / 31
97%
develop: 99%

Build:
LAST BUILD BRANCH: feature/ghactions-remark-ignore-release-links
DEFAULT BRANCH: develop
Ran 22 Jan 2020 11:20PM UTC
Files 16
Run time 1s
Badge
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

22 Jan 2020 - 22:47 coverage: 93.824%. First build
LINT=1 PHPCS_VERSION="dev-master" COVERALLS_VERSION="^1.0"

Pull #48

travis-ci-com

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
:sparkles: New Utils\PassedParameters class

This introduces four new methods to PHPCSUtils.

These methods are intended for use with:
* `T_STRING` and `T_VARIABLE` tokens for function calls;
* `T_SELF` and `T_STATIC` token for function calls in the form of `new self()`;
* `T_ARRAY` and `T_OPEN_SHORT_ARRAY` tokens for array declarations;
* `T_ISSET` and `T_UNSET` tokens for calls to these language constructs.

Methods:
* `hasParameters()` - to check if parameters have been passed. Returns true/false.
* `getParameters()` - to retrieve details of the passed parameters. Returns an array with `start` (token position), `end` (token position), `raw` (string content) and `clean` (string content without comments) information for each parameter.
* `getParameter()` - to retrieve the details of a specific parameter. Index for the parameters is 1-based. Returns an array with the details for the specified parameter or `false` if the parameter does not exist.
* `getParameterCount()` - to get the a count of the number of parameters. Returns integer.

These methods have been battle-tested in the past year or two in the PHPCompatibility and the WordPressCS standards.

Includes dedicated unit tests.

N.B.: In the class as pulled to PHPCS originally, these methods also handled (short/long) list constructs, however, as lists can have empty entries - `list(,,)` - prior to PHP 7 and can skip items - `list($a,, $b)` - in cross-version PHP, parsing lists with the functions in this class will break on those type of list definitions.
So, I've decided that this is better served with a dedicated utility function focussing just on list constructs.
Pull Request #48: New Utils\PassedParameters class

1732 of 1846 relevant lines covered (93.82%)

16.79 hits per line

Source Files on job 178.31 (LINT=1 PHPCS_VERSION="dev-master" COVERALLS_VERSION="^1.0")
  • Tree
  • List 16
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 65
  • Travis Job 178.31
  • 9337b6d0 on github
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2023 Coveralls, Inc