Skip to content

Various sniffs: start using new PHPCSUtils 1.1.0 TypeString utility#1837

Merged
wimg merged 7 commits intodevelopfrom
PHPCSUtils-1.1.0/use-new-typestrings-class
Aug 13, 2025
Merged

Various sniffs: start using new PHPCSUtils 1.1.0 TypeString utility#1837
wimg merged 7 commits intodevelopfrom
PHPCSUtils-1.1.0/use-new-typestrings-class

Conversation

@jrfnl
Copy link
Copy Markdown
Member

@jrfnl jrfnl commented Aug 6, 2025

PHPCSUtils introduces a new PHPCSUtils\Utils\TypeString utility class, which allows for consistent analysis of type strings.


FunctionDeclarations/NewParamTypeDeclarations: start using new PHPCSUtils 1.1.0 TypeString utility

This commit starts using this new utility in the NewParamTypeDeclarations sniff.

Includes minor adjustments to the tests:

  • One test will no longer be flagged as it is not a valid type in PHP. In my opinion, this is fine as PHPCompatibility is not about detecting invalid code.
    Note: this test has not been added to the dataNewDNFTypesNoFalsePositives() data provider, as the type includes null and that's flagged on PHP < 8.2 for other reasons and that aspect of the test is still valid.
  • One test has been updated to safeguard that nullable "long form" types will still be flagged correctly.

FunctionDeclarations/NewReturnTypeDeclarations: start using new PHPCSUtils 1.1.0 TypeString utility

This commit starts using this new utility in the NewReturnTypeDeclarations sniff.

Includes minor adjustments to the tests:

  • One test will no longer be flagged as it is not a valid type in PHP. In my opinion, this is fine as PHPCompatibility is not about detecting invalid code.
    This test will now be checked via the "no false positives for DNF types" test.

Classes/NewTypedProperties: start using new PHPCSUtils 1.1.0 TypeString utility

This commit starts using this new utility in the NewTypedProperties sniff.

Includes minor adjustments to the tests:

  • One test will no longer be flagged as it is not a valid type in PHP. In my opinion, this is fine as PHPCompatibility is not about detecting invalid code.
    This test will now be checked via the "no false positives for DNF types" test.
  • One test has been updated to safeguard that nullable "long form" types will still be flagged correctly.

Classes/NewClasses: start using new PHPCSUtils 1.1.0 TypeString utility

This commit starts using this new utility in the NewClasses sniff.

Includes minor improvements to the tests related to this.

Classes/RemovedClasses: start using new PHPCSUtils 1.1.0 TypeString utility

This commit starts using this new utility in the RemovedClasses sniff.

Includes minor improvements to the tests related to this.

Interfaces/NewInterfaces: start using new PHPCSUtils 1.1.0 TypeString utility

This commit starts using this new utility in the NewInterfaces sniff.

FunctionDeclarations/RemovedImplicitlyNullableParam: minor simplification

... by using the PHPCSUtils 1.1.0 TypeString::isNullable()` method.

jrfnl added 7 commits August 6, 2025 23:05
…tils 1.1.0 TypeString utility

PHPCSUtils introduces a new `PHPCSUtils\Utils\TypeString` utility class, which allows for consistent analysis of type strings.

This commit starts using this new utility in the `NewParamTypeDeclarations` sniff.

Includes minor adjustments to the tests:
* One test will no longer be flagged as it is not a valid type in PHP. In my opinion, this is fine as PHPCompatibility is not about detecting invalid code.
    Note: this test has not been added to the `dataNewDNFTypesNoFalsePositives()` data provider, as the type includes `null` and that's flagged on PHP < 8.2 for other reasons and that aspect of the test is still valid.
* One test has been updated to safeguard that nullable "long form" types will still be flagged correctly.
…Utils 1.1.0 TypeString utility

PHPCSUtils introduces a new `PHPCSUtils\Utils\TypeString` utility class, which allows for consistent analysis of type strings.

This commit starts using this new utility in the `NewReturnTypeDeclarations` sniff.

Includes minor adjustments to the tests:
* One test will no longer be flagged as it is not a valid type in PHP. In my opinion, this is fine as PHPCompatibility is not about detecting invalid code.
    This test will now be checked via the "no false positives for DNF types" test.
…ng utility

PHPCSUtils introduces a new `PHPCSUtils\Utils\TypeString` utility class, which allows for consistent analysis of type strings.

This commit starts using this new utility in the `NewTypedProperties` sniff.

Includes minor adjustments to the tests:
* One test will no longer be flagged as it is not a valid type in PHP. In my opinion, this is fine as PHPCompatibility is not about detecting invalid code.
    This test will now be checked via the "no false positives for DNF types" test.
* One test has been updated to safeguard that nullable "long form" types will still be flagged correctly.
PHPCSUtils introduces a new `PHPCSUtils\Utils\TypeString` utility class, which allows for consistent analysis of type strings.

This commit starts using this new utility in the `NewClasses` sniff.

Includes minor improvements to the tests related to this.
…tility

PHPCSUtils introduces a new `PHPCSUtils\Utils\TypeString` utility class, which allows for consistent analysis of type strings.

This commit starts using this new utility in the `RemovedClasses` sniff.

Includes minor improvements to the tests related to this.
… utility

PHPCSUtils introduces a new `PHPCSUtils\Utils\TypeString` utility class, which allows for consistent analysis of type strings.

This commit starts using this new utility in the `NewInterfaces` sniff.
…tion

... by using the PHPCSUtils 1.1.0 TypeString::isNullable()` method.
@jrfnl jrfnl added this to the 10.0.0 milestone Aug 6, 2025
@jrfnl jrfnl requested a review from wimg August 6, 2025 21:16
@jrfnl jrfnl added Type: chores/QA PR: quick merge PR only contains relatively simple changes PR: ready for review labels Aug 6, 2025
@wimg wimg merged commit 66f0bec into develop Aug 13, 2025
49 checks passed
@wimg wimg deleted the PHPCSUtils-1.1.0/use-new-typestrings-class branch August 13, 2025 19:08
@github-actions github-actions bot removed PR: ready for review PR: quick merge PR only contains relatively simple changes labels Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants