Skip to content

Commit b22b59e

Browse files
authored
Merge pull request #709 from PHPCSStandards/develop
Release 1.1.2
2 parents f7eb16f + 577c808 commit b22b59e

34 files changed

+600
-58
lines changed

.github/release-checklist.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ PR for tracking changes for the x.x.x release. Target release date: **DOW MONTH
2626

2727
### Publicize
2828

29+
- [ ] Post on Mastodon about the release.
2930
- [ ] Tweet about the release.
3031
- [ ] Inform the primary dependants of this repo (PHPCSExtra, WordPressCS, PHPCompatibility and VariableAnalysis) about the release.

.github/workflows/basics.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Checkout code
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v5
3030

3131
- name: Install PHP
3232
uses: shivammathur/setup-php@v2

.github/workflows/quicktest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
steps:
4848
- name: Checkout code
49-
uses: actions/checkout@v4
49+
uses: actions/checkout@v5
5050

5151
# On stable PHPCS versions, allow for PHP deprecation notices.
5252
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525

2626
jobs:
2727
lint:
28-
if: ${{ github.ref != 'refs/heads/develop' }}
28+
if: ${{ github.ref != 'refs/heads/develop' || github.event_name != 'pull_request' }}
2929
runs-on: ubuntu-latest
3030

3131
strategy:
@@ -38,7 +38,7 @@ jobs:
3838

3939
steps:
4040
- name: Checkout code
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@v5
4242

4343
- name: Install PHP
4444
uses: shivammathur/setup-php@v2
@@ -67,7 +67,7 @@ jobs:
6767

6868
#### TEST STAGE ####
6969
test:
70-
if: ${{ github.ref != 'refs/heads/develop' }}
70+
if: ${{ github.ref != 'refs/heads/develop' || github.event_name != 'pull_request' }}
7171
needs: lint
7272
runs-on: ubuntu-latest
7373

@@ -161,7 +161,7 @@ jobs:
161161

162162
steps:
163163
- name: Checkout code
164-
uses: actions/checkout@v4
164+
uses: actions/checkout@v5
165165

166166
# On stable PHPCS versions, allow for PHP deprecation notices.
167167
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
@@ -294,7 +294,7 @@ jobs:
294294

295295
steps:
296296
- name: Checkout code
297-
uses: actions/checkout@v4
297+
uses: actions/checkout@v5
298298

299299
# On stable PHPCS versions, allow for PHP deprecation notices.
300300
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.

.github/workflows/update-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
fi
5959
6060
- name: Checkout code
61-
uses: actions/checkout@v4
61+
uses: actions/checkout@v5
6262
with:
6363
ref: ${{ steps.base_branch.outputs.BRANCH }}
6464
# fetch-depth is needed to allow for retrieving the last tag for a non-tag workflow run.
@@ -129,7 +129,7 @@ jobs:
129129
destination: ./docs/_site
130130

131131
- name: Upload GH Pages artifact
132-
uses: actions/upload-pages-artifact@v3
132+
uses: actions/upload-pages-artifact@v4
133133
with:
134134
path: ./docs/_site
135135

.github/workflows/update-phpcs-versionnr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
echo "PR_BRANCH=feature/getversiontest-update-phpcs-version" >> "$GITHUB_OUTPUT"
5353
5454
- name: Checkout code
55-
uses: actions/checkout@v4
55+
uses: actions/checkout@v5
5656
with:
5757
ref: ${{ steps.branches.outputs.BASE }}
5858

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,43 @@ This projects adheres to [Keep a CHANGELOG](https://keepachangelog.com/) and use
1010
_Nothing yet._
1111

1212

13+
## [1.1.2] - 2025-09-05
14+
15+
### Added
16+
17+
#### PHPCS BackCompat
18+
19+
* `BCFile::getMemberProperties()`: sync with PHPCS 3.13.3 - support for PHP 8.4 abstract properties. [#698]
20+
21+
#### Utils
22+
23+
* `Variables::getMemberProperties()`: support for PHP 8.4 abstract properties. [#698]
24+
25+
### Changed
26+
27+
#### Utils
28+
29+
* `TypeString::normalizeCase()` will now also normalize a fully qualified `true`, `false` or `null` type to unqualified. [#702]
30+
31+
#### Other
32+
33+
* Dropped support for [PHP_CodeSniffer] < 3.13.3. [#698]
34+
Please ensure you run `composer update phpcsstandards/phpcsutils --with-dependencies` to benefit from this.
35+
* Various housekeeping.
36+
37+
### Fixed
38+
39+
#### Utils
40+
41+
* `TypeString::isNullable()`: a type string with a fully qualified `null` was not recognized as nullable. [#702]
42+
* `TypeString::isKeyword()`: a fully qualified `true`, `false` or `null` type was not recognized as a keyword type. [#702]
43+
44+
_Note: using fully qualified `true`, `false` or `null` in a typestring is not allowed by PHP. Even so, the `TypeString` utility will now handle this in a parse error tolerant manner._
45+
46+
[#698]: https://github.com/PHPCSStandards/PHPCSUtils/pull/698
47+
[#702]: https://github.com/PHPCSStandards/PHPCSUtils/pull/702
48+
49+
1350
## [1.1.1] - 2025-08-10
1451

1552
### Changed
@@ -1239,6 +1276,7 @@ This initial alpha release contains the following utility classes:
12391276

12401277

12411278
[Unreleased]: https://github.com/PHPCSStandards/PHPCSUtils/compare/stable...HEAD
1279+
[1.1.2]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.1...1.1.2
12421280
[1.1.1]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.0...1.1.1
12431281
[1.1.0]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.12...1.1.0
12441282
[1.0.12]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.11...1.0.12

PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -478,31 +478,15 @@ public function getActualArrayKey(File $phpcsFile, $startPtr, $endPtr)
478478
continue;
479479
}
480480

481-
// Handle FQN true/false/null.
482-
if ($this->tokens[$i]['code'] === \T_NAME_FULLY_QUALIFIED) {
483-
$compareReadyKeyword = \strtolower($this->tokens[$i]['content']);
484-
if ($compareReadyKeyword === '\true'
485-
|| $compareReadyKeyword === '\false'
486-
|| $compareReadyKeyword === '\null'
487-
) {
488-
// FQN true/false/null on PHPCS 4.x. This can be handled.
489-
$content .= $this->tokens[$i]['content'];
490-
continue;
491-
}
492-
} elseif ($this->tokens[$i]['code'] === \T_NS_SEPARATOR) {
493-
// PHPCS 3.x.
481+
// Handle FQN true/false/null for PHPCS 3.x.
482+
if ($this->tokens[$i]['code'] === \T_NS_SEPARATOR) {
494483
$nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true);
495484
$nextNonEmptyLC = \strtolower($this->tokens[$nextNonEmpty]['content']);
496485
if ($nextNonEmpty !== false
497-
// PHPCS 3.x with PHP < 8.0.
498486
&& ($this->tokens[$nextNonEmpty]['code'] === \T_TRUE
499487
|| $this->tokens[$nextNonEmpty]['code'] === \T_FALSE
500-
|| $this->tokens[$nextNonEmpty]['code'] === \T_NULL
501-
// PHPCS 3.x with PHP >= 8.0 where the namespaced name tokenization has been undone.
502-
|| ($this->tokens[$nextNonEmpty]['code'] === \T_STRING
503-
&& ($nextNonEmptyLC === 'true' || $nextNonEmptyLC === 'false' || $nextNonEmptyLC === 'null')))
488+
|| $this->tokens[$nextNonEmpty]['code'] === \T_NULL)
504489
) {
505-
// FQN true/false/null on PHPCS 3.x. This can be handled.
506490
$content .= $this->tokens[$nextNonEmpty]['content'];
507491
$i = $nextNonEmpty;
508492
continue;

PHPCSUtils/BackCompat/BCFile.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ public static function getMethodParameters(File $phpcsFile, $stackPtr)
524524
*
525525
* Changelog for the PHPCS native function:
526526
* - Introduced in PHPCS 0.0.5.
527-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
527+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
528528
*
529529
* @see \PHP_CodeSniffer\Files\File::getMethodProperties() Original source.
530530
* @see \PHPCSUtils\Utils\FunctionDeclarations::getProperties() PHPCSUtils native improved version.
@@ -559,6 +559,7 @@ public static function getMethodProperties(File $phpcsFile, $stackPtr)
559559
* 'is_static' => boolean, // TRUE if the static keyword was found.
560560
* 'is_readonly' => boolean, // TRUE if the readonly keyword was found.
561561
* 'is_final' => boolean, // TRUE if the final keyword was found.
562+
* 'is_abstract' => boolean, // TRUE if the abstract keyword was found.
562563
* 'type' => string, // The type of the var (empty if no type specified).
563564
* 'type_token' => integer|false, // The stack pointer to the start of the type
564565
* // or FALSE if there is no type.
@@ -573,13 +574,16 @@ public static function getMethodProperties(File $phpcsFile, $stackPtr)
573574
*
574575
* Changelog for the PHPCS native function:
575576
* - Introduced in PHPCS 0.0.5.
577+
* - PHPCS 3.13.3: support for PHP 8.4 abstract properties.
576578
* - PHPCS 4.0: properties in interfaces (PHP 8.4+) are accepted.
577579
* - PHPCS 4.0: will no longer throw a parse error warning.
578580
*
579581
* @see \PHP_CodeSniffer\Files\File::getMemberProperties() Original source.
580582
* @see \PHPCSUtils\Utils\Variables::getMemberProperties() PHPCSUtils native improved version.
581583
*
582584
* @since 1.0.0
585+
* @since 1.1.0 Sync with PHPCS 4.0.0, remove parse error warning and support PHP 8.4 properties in interfaces. PHPCS(new)#991
586+
* @since 1.1.2 Sync with PHPCS 3.13.3, support for abstract properties. PHPCS(new)#xxx
583587
*
584588
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
585589
* @param int $stackPtr The position in the stack of the `T_VARIABLE` token to
@@ -626,6 +630,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr)
626630
T_VAR => T_VAR,
627631
T_READONLY => T_READONLY,
628632
T_FINAL => T_FINAL,
633+
T_ABSTRACT => T_ABSTRACT,
629634
];
630635

631636
$valid += Tokens::$scopeModifiers;
@@ -637,6 +642,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr)
637642
$isStatic = false;
638643
$isReadonly = false;
639644
$isFinal = false;
645+
$isAbstract = false;
640646

641647
$startOfStatement = $phpcsFile->findPrevious(
642648
[
@@ -684,6 +690,9 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr)
684690
case T_FINAL:
685691
$isFinal = true;
686692
break;
693+
case T_ABSTRACT:
694+
$isAbstract = true;
695+
break;
687696
}
688697
}
689698

@@ -728,6 +737,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr)
728737
'is_static' => $isStatic,
729738
'is_readonly' => $isReadonly,
730739
'is_final' => $isFinal,
740+
'is_abstract' => $isAbstract,
731741
'type' => $type,
732742
'type_token' => $typeToken,
733743
'type_end_token' => $typeEndToken,
@@ -751,7 +761,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr)
751761
*
752762
* Changelog for the PHPCS native function:
753763
* - Introduced in PHPCS 1.3.0.
754-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
764+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
755765
*
756766
* @see \PHP_CodeSniffer\Files\File::getClassProperties() Original source.
757767
* @see \PHPCSUtils\Utils\ObjectDeclarations::getClassProperties() PHPCSUtils native improved version.
@@ -779,7 +789,7 @@ public static function getClassProperties(File $phpcsFile, $stackPtr)
779789
*
780790
* Changelog for the PHPCS native function:
781791
* - Introduced in PHPCS 0.0.5.
782-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
792+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
783793
*
784794
* @see \PHP_CodeSniffer\Files\File::isReference() Original source.
785795
* @see \PHPCSUtils\Utils\Operators::isReference() PHPCSUtils native improved version.
@@ -805,7 +815,7 @@ public static function isReference(File $phpcsFile, $stackPtr)
805815
*
806816
* Changelog for the PHPCS native function:
807817
* - Introduced in PHPCS 0.0.5.
808-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
818+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
809819
*
810820
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Original source.
811821
* @see \PHPCSUtils\Utils\GetTokensAsString Related set of functions.
@@ -834,7 +844,7 @@ public static function getTokensAsString(File $phpcsFile, $start, $length, $orig
834844
*
835845
* Changelog for the PHPCS native function:
836846
* - Introduced in PHPCS 2.1.0.
837-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
847+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
838848
*
839849
* @see \PHP_CodeSniffer\Files\File::findStartOfStatement() Original source.
840850
*
@@ -858,7 +868,7 @@ public static function findStartOfStatement(File $phpcsFile, $start, $ignore = n
858868
*
859869
* Changelog for the PHPCS native function:
860870
* - Introduced in PHPCS 2.1.0.
861-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
871+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
862872
*
863873
* @see \PHP_CodeSniffer\Files\File::findEndOfStatement() Original source.
864874
*
@@ -882,7 +892,7 @@ public static function findEndOfStatement(File $phpcsFile, $start, $ignore = nul
882892
*
883893
* Changelog for the PHPCS native function:
884894
* - Introduced in PHPCS 0.0.5.
885-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
895+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
886896
*
887897
* @see \PHP_CodeSniffer\Files\File::hasCondition() Original source.
888898
* @see \PHPCSUtils\Utils\Conditions::hasCondition() PHPCSUtils native alternative.
@@ -907,7 +917,7 @@ public static function hasCondition(File $phpcsFile, $stackPtr, $types)
907917
*
908918
* Changelog for the PHPCS native function:
909919
* - Introduced in PHPCS 1.3.0.
910-
* - The upstream method has received no significant updates since PHPCS 3.13.0.
920+
* - The upstream method has received no significant updates since PHPCS 3.13.3.
911921
*
912922
* @see \PHP_CodeSniffer\Files\File::getCondition() Original source.
913923
* @see \PHPCSUtils\Utils\Conditions::getCondition() More versatile alternative.

PHPCSUtils/BackCompat/BCTokens.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ final class BCTokens
7272

7373
/**
7474
* Handle calls to (undeclared) methods for token arrays which haven't received any
75-
* changes since PHPCS 3.13.0.
75+
* changes since PHPCS 3.13.3.
7676
*
7777
* @since 1.0.0
7878
*

0 commit comments

Comments
 (0)