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

PHPCSStandards / PHPCSUtils / 178
97%
develop: 99%

Build:
LAST BUILD BRANCH: feature/ghactions-various-tweaks
DEFAULT BRANCH: develop
Ran 22 Jan 2020 11:18PM UTC
Jobs 4
Files 16
Run time 2min
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: 97.187%. First build
178

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

76 of 77 new or added lines in 1 file covered. (98.7%)

1520 of 1564 relevant lines covered (97.19%)

69.07 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
85.39
PHPCSUtils/Utils/PassedParameters.php
Jobs
ID Job ID Ran Files Coverage
29 178.29 (LINT=1 PHPCS_VERSION="dev-master" COVERALLS_VERSION="^2.0") 22 Jan 2020 11:18PM UTC 16
94.76
Travis Job 178.29
30 178.30 (PHPCS_VERSION="2.9.2" COVERALLS_VERSION="^2.0") 22 Jan 2020 11:18PM UTC 16
95.33
Travis Job 178.30
31 178.31 (LINT=1 PHPCS_VERSION="dev-master" COVERALLS_VERSION="^1.0") 22 Jan 2020 11:19PM UTC 16
93.82
Travis Job 178.31
32 178.32 (PHPCS_VERSION="2.6.0" COVERALLS_VERSION="^1.0") 22 Jan 2020 11:20PM UTC 16
94.2
Travis Job 178.32
Source Files on build 178
  • Tree
  • List 16
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Travis Build #178
  • Pull Request #48
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