CARVIEW |
Select Language
HTTP/2 200
date: Wed, 23 Jul 2025 14:05:26 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"37b2e36c4f1a83e473c9d8521094ec36"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=My4o2uKnb294DIP94adPMmZYxFnt753nKiXrPcCV1QoHAMjiUArBgqDOY8PRAPXfFoLSyBF7m5h0XMgTN6nKBmVgROdoYlm38gj4V8wQWnCW2Eayb4i3y725UPV%2FdKr3h4VivjnSF2HWOfs6sMHzHQMFBD8syK4QOwnYZdNB0fSUXh710ZJuRzf2eumXHfJxmI%2BCYOtLSaFHHJ994GUxniuhU2EDpFVkZqwVRAZGOFgvopHQpKO3iwP6KtI%2FY%2FfJ1NDDSb6FAeh1wmBW%2BvXJWw%3D%3D--qfS8pVVCF17ptmgL--%2BqVDH6m4LTw%2FbGXSN6Q50A%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.855828610.1753279525; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 14:05:25 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Thu, 23 Jul 2026 14:05:25 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: D548:271430:CE0F88:F4169D:6880EC25
Releases · PHPCSStandards/PHPCSUtils · GitHub
12 Jun 04:40
Read more
Loading
20 May 13:47
Loading
24 Apr 11:53
Loading
17 Mar 23:55
Loading
08 Dec 14:54
Loading
16 Jul 21:45
Loading
10 Jul 14:03
Loading
27 May 14:02
Loading
15 Apr 09:01
Loading
Skip to content
Navigation Menu
{{ message }}
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Releases: PHPCSStandards/PHPCSUtils
Releases · PHPCSStandards/PHPCSUtils
1.1.0 - 2025-06-12
6535567
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Compare
Added
Compatibility with the new PHP_CodeSniffer 4.x
branch in anticipation of the PHP_CodeSniffer 4.0 release. #674, #679
PHPCSUtils should now be fully compatible with PHP_CodeSniffer 4.0 (again). If you still find an issue, please report it.
PHPCS BackCompat
BCFile::findExtendedClassName()
: sync with PHPCS 4.0.0 - support for namespace relative names when used as the extended parent class name. #674BCFile::findImplementedInterfaceNames()
: sync with PHPCS 4.0.0 - support for namespace relative names when used in implemented interface names. #674BCFile::getMemberProperties()
: sync with PHPCS 3.12.0 - support for PHP 8.4 final properties. Thanks @DanielEScherzer! #646BCFile::getMemberProperties()
: sync with PHPCS 3.13.1 - support for PHP 8.4 asymmetric visibility. #677BCFile::getMemberProperties()
: sync with PHPCS 4.0.0. #674- Add support for PHP 8.4 properties in interfaces.
- Removed parse error warning.
BCFile::getMethodParameters()
: sync with PHPCS 3.13.1 - support for PHP 8.4 asymmetric visibility. #677BCFile::findStartOfStatement()
: sync with PHPCS 3.12.1 - support forgoto
as aswitch
-case
terminating statement. #661BCTokens::nameTokens()
as introduced in PHPCS 4.0.0. #674
The same token array previously already existed in PHPCSUtils asCollections::nameTokens()
.BCTokens::functionNameTokens()
: sync with PHPCS 4.0.0 - added theT_ANON_CLASS
token. #674BCTokens::parenthesisOpeners()
: sync with PHPCS 4.0.0 - added theT_USE
,T_ISSET
,T_UNSET
,T_EMPTY
,T_EVAL
andT_EXIT
tokens. #674
Note: WhileT_USE
,T_ISSET
,T_UNSET
,T_EMPTY
,T_EVAL
andT_EXIT
will be included in the return value for this method,
the associated parentheses will not have the'parenthesis_owner'
index set unless PHPCS 4.0.0 is used.
Use theParentheses::getOwner()
or theParentheses::hasOwner()
methods if you need to check
whether any of these tokens are a parentheses owner. The methods in theParentheses
class are PHPCS cross-version compatible.
TestUtils
- New
PHPCSUtils\TestUtils\ConfigDouble
class as a lightweight and more stable alternative to directly using the PHPCS nativeConfig
class in tests. #550, #612
Props to @fredden for helping me find and fix a bug in this feature before it was released. - New
PHPCSUtils\TestUtils\RulesetDouble
class which allows for creating aRuleset
object without registering any sniffs. #674
This allows for thePHPCSUtils\TestUtils\UtilityMethodTestCase
class to be cross-version compatible with both PHP_CodeSniffer 3.x as well as 4.x. - New
PHPCSUtils\TestUtils\UtilityMethodTestCase::parseFile()
method to allow for on-demand tokenizing of a (secondary) test case file. #591, #610
This method is intended for tests which need to use multiple test case files, like, for example, tests which need to verify that a utility resets a$fileName
property on seeing another file. - New
PHPCSUtils\TestUtils\UtilityMethodTestCase::testTestMarkersAreUnique()
andPHPCSUtils\TestUtils\UtilityMethodTestCase::assertTestMarkersAreUnique()
methods which automatically check that code sample files used with thisTestCase
do not contain duplicate test case markers. #642
If needs be, the test method can be disabled by overloading it (discouraged). If a test uses multiple test case/code sample files, the assertion method can be called directly.
Tokens
- New
Collections::constantTypeTokens()
method to support PHP 8.3 typed class constants. #562 - New
Collections::ternaryOperators()
method. #549 T_EXIT
to theCollections::functionCallTokens()
andCollections::parameterPassingTokens()
in light of the PHP 8.4 "exit as function" change. #618- The PHP 8.4 asymmetric visibility tokens have been added to the
Collections::propertyModifierKeywords()
method. #653 T_INTERFACE
has been added to theCollections::ooPropertyScopes()
method for PHP 8.4 interface properties support. #674
Utils
- New
PHPCSUtils\Utils\Constants
class: Utility functions to examine (class) constants. #562
Initially available method:getProperties()
to retrieve an array of information about an OO constant declaration. - New
PHPCSUtils\Utils\FileInfo
class: Utility functions to check characteristics of the file under scan. #572
Initial set of available methods:hasByteOrderMark()
andhasSheBang()
. - New
PHPCSUtils\Utils\FilePath
class: Utility functions for handling and comparing file paths. #593
Initial set of available methods:getName()
to retrieve the normalized path for the current file,isStdin()
,normalizeAbsolutePath()
,normalizeDirectorySeparators()
,trailingSlashIt()
andstartsWith()
. - New
PHPCSUtils\Utils\TypeString
class: Utility functions for analysing typestrings as retrieved via the various availablegetParameters()
/getProperties()
methods. #588
Initial set of available methods:getKeywordTypes()
,isKeyword()
,normalizeCase()
,isSingular()
,isNullable()
,isUnion()
,isIntersection()
,isDNF()
,toArray()
,toArrayUnique()
,filterKeywordTypes()
andfilterOOTypes()
.
Note: Theis*()
methods will not check if the type string provided is valid, as doing so would inhibit what sniffs can flag. Theis*()
methods will only look at the form of the type string to determine if it could be valid for a certain type. - New
PHPCSUtils\Utils\ObjectDeclarations::getDeclaredConstants()
,PHPCSUtils\Utils\ObjectDeclarations::getDeclaredEnumCases()
,PHPCSUtils\Utils\ObjectDeclarations::getDeclaredProperties()
andPHPCSUtils\Utils\ObjectDeclarations::getDeclaredMethods()
utility methods. #592
These methods will each return an array with the name of the constant/case/property/method as the key and the typical stack pointer needed for further processing.
The retrieval of this information is highly optimized for performance. If a sniff needs to search for a named constant/enum case/property/method in an OO structure, in most cases, these methods should be the recommended way for finding the declaration, instead of the sniff attempting to do this itself.
Mind: the return value of thegetDeclaredProperties()
method includes constructor promoted properties. Passing the stack pointer of constructor promoted properties onto a call to theVariables::getMemberProperties()
method, however, is currently not supported. FunctionDeclarations::getParameters()
: support for PHP 8.4 asymmetric visibility. #677Variables::getMemberProperties()
: support for PHP 8.4 final properties. Thanks @DanielEScherzer! #646Variables::getMemberProperties()
: support for PHP 8.4 asymmetric visibility. #677
Changed
- The exceptions thrown by PHPCSUtils native utilities have been made more modular and more specific. #598, #599, #600
- Passing a parameter of the wrong type will now result in a
PHPCSUtils\Exceptions\TypeError
being thrown. - Passing a parameter of the correct type, but with an invalid value, like an empty string when only non-empty strings are expected/accepted, will now result in a
PHPCSUtils\Exceptions\ValueError
being thrown. - Passing a (positive) integer stack pointer, which doesn't exist in the token stack of the current file, will now result in a
PHPCSUtils\Exceptions\OutOfBoundsStackPtr
being thrown. - Passing a stack pointer to a token which is not within the range of token types which is accepted by the method, will now result in a
PHPCSUtils\Exceptions\UnexpectedTokenType
being thrown. - Logic errors will now result in a
PHPCSUtils\Exceptions\LogicException
being thrown.
This can occur, for instance, when a method takes a$start
and$end
parameter and the$end
pointer is before the$start
pointer. - Missing, conditionally required, parameters, will now result in a
PHPCSUtils\Exceptions\MissingArgumentError
being thrown. - Generic errors will now result in a
PHPCSUtils\Exceptions\RuntimeException
being thrown. - Previously the PHPCS native
PHP_CodeSniffer\Exceptions\RuntimeException
was used for all these exceptions.
Catching the PHPCS nativeRuntimeException
will still catch the new exceptions, but it is strongly recommended to be more selective when catching exceptions to prevent accidentally hiding errors in sniffs. - Also note that the PHPCSUtils native utilities now include more and stricter type checking to help surface bugs in sniffs.
- Passing a parameter of the wrong type will now result in a
Abstract Sniffs
- The
AbstractArrayDeclarationSniff::process()
method will no longer hide exceptions about a non-integer or non-existent stack pointer being passed. #600 - The
AbstractArrayDeclarationSniff::processArray()
method will no longer hide exceptions about non-integer or non-existent stack pointers being passed. #600
PHPCS BackCompat
*...
Assets 2
2 people reacted
1.0.12 - 2024-05-20
87b233b
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Compare
Added
PHPCS BackCompat
BCFile::getMemberProperties()
: sync with PHPCS 3.10.0 - support for PHP 8.2 DNF types. #604BCFile::getMethodProperties()
: sync with PHPCS 3.10.0 - support for PHP 8.2 DNF types. #604BCFile::getMethodParameters()
: sync with PHPCS 3.10.0 - support for PHP 8.2 DNF types. #604
Utils
FunctionDeclarations::getParameters()
: support for PHP 8.2 DNF types. #604FunctionDeclarations::getProperties()
: support for PHP 8.2 DNF types. #604Variables::getMemberProperties()
: support for PHP 8.2 DNF types. #604
Changed
Tokens
Collections::parameterTypeTokens()
,Collections::propertyTypeTokens()
andCollections::returnTypeTokens()
: now include the newT_TYPE_OPEN_PARENTHESIS
andT_TYPE_CLOSE_PARENTHESIS
tokens for PHP 8.2 DNF type support. #604
Utils
ControlStructures::getCaughtExceptions()
: will now silently ignore parse errors in the code under scan which prevent the method from analyzing acatch
statement. #594
The method will now return an empty array instead of throwing aPHP_CodeSniffer\Exceptions\RuntimeException
.
Other
- Dropped support for PHP_CodeSniffer < 3.10.0. #603
Please ensure you runcomposer update phpcsstandards/phpcsutils --with-dependencies
to benefit from this. - Various housekeeping and documentation improvements.
Fixed
Utils
UseStatements::splitImportUseStatement()
: the values in the return array will now never include a leading backslash. #590
Previously the behaviour around importuse
statements declared with a leading backslash was undefined and the backslash would be included in the return value.
Assets 2
1 person reacted
1.0.11 - 2024-04-24
c457da9
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Compare
Changed
Other
- Various housekeeping and documentation improvements. Includes a contribution from @fredden.
Fixed
PHPCS BackCompat
BCFile::getMethodProperties()
: small performance improvement & more defensive coding, in line with same fix in PHPCS 3.9.2. #573
Utils
FunctionDeclarations::getProperties()
: small performance improvement & more defensive coding, in line with same fix in PHPCS 3.9.2. #573
Assets 2
1.0.10 - 2024-03-18
51609a5
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Compare
Changed
Other
- Dropped support for PHP_CodeSniffer < 3.9.0. #561
Please ensure you runcomposer update phpcsstandards/phpcsutils --with-dependencies
to benefit from this. - Various housekeeping and documentation improvements.
Deprecated
Utils
Fixed
PHPCS BackCompat
Assets 2
1.0.9 - 2023-12-08
908247b
This commit was created on GitHub.com and signed with GitHub’s verified signature.
The key has expired.
Compare
Added
PHPCS BackCompat
BCFile::getMemberProperties()
: sync with PHPCS 3.8.0 - support for PHP 8.2true
type. #524BCFile::getMethodProperties()
: sync with PHPCS 3.8.0 - support for PHP 8.2true
type. #524BCFile::getMethodParameters()
: sync with PHPCS 3.8.0 - support for PHP 8.2true
type. #524
Changed
TestUtils
- Significant performance improvement for the
UtilityMethodTestCase
. #525
Other
- Dropped support for PHP_CodeSniffer < 3.8.0. #523
Please ensure you runcomposer update phpcsstandards/phpcsutils --with-dependencies
to benefit from this. - Small improvements to the documentation website generation. Includes a contribution from @fredden.
- Various housekeeping and documentation improvements. Includes a contribution from @fredden.
Assets 2
1.0.8 - 2023-07-17
69465ca
This commit was created on GitHub.com and signed with GitHub’s verified signature.
The key has expired.
Compare
Changed
PHPCS BackCompat
BCFile::getDeclarationName()
: sync with PHPCS 3.8.0 - support for functions calledself
,parent
orstatic
which return by reference. #494
Other
- Various housekeeping and minor documentation improvements.
Fixed
Fixers
- The
SpacesFixer
will no longer throw an (incorrect) exception when the second pointer passed is a comment token and this comment token is the last content in a file. #493
Assets 2
1 person reacted
1.0.7 - 2023-07-10
886a728
This commit was created on GitHub.com and signed with GitHub’s verified signature.
The key has expired.
Compare
Changed
Other
- Various housekeeping and maintenance updates, including making the test suite compatible with PHPUnit 10.
Fixed
Utils
- The
Arrays::getDoubleArrowPtr()
method could previously get confused over a double arrow in a keyed list used as an array value. #485
Assets 2
1.0.6 - 2023-05-27
ba259ea
This commit was created on GitHub.com and signed with GitHub’s verified signature.
The key has expired.
Compare
Changed
PHPCS BackCompat
BCFile::getClassProperties()
: sync with PHPCS 3.8.0 - support for PHP 8.2readonly
classes. #470BCFile::getMethodParameters()
: sync with PHPCS 3.8.0 - support for constructor property promotion withreadonly
properties without explicit visibility. #472
Utils
- The results of the following methods will now (also) be cached for improved performance when multiple sniffs call these functions for the same token during a PHPCS run. #464, #466
FunctionDeclarations::getProperties()
Variables::getMemberProperties()
- Additionally, the results of the
UseStatements::splitImportUseStatement()
method will be cached more often and the cache checked earlier. #467 - The return value of the
ControlStructures::getCaughtExceptions()
method will no longer contain "empty" entries for catch statements without a named exception. It will return an empty array instead. #474
Other
- Various small housekeeping and maintenance updates.
Fixed
Abstract Sniffs
Assets 2
1 person reacted
1.0.5 - 2023-04-17
1.0.4 - 2023-04-15
6b0c204
This commit was created on GitHub.com and signed with GitHub’s verified signature.
The key has expired.
Compare
Changed
Other
- Minor documentation improvements.
Fixed
Utils
- The
FunctionDeclarations::getParameters()
method will now correctly handle constructor promoted properties withreadonly
, but without explicit visibility set. #456
Assets 2
Previous Next
You can’t perform that action at this time.