Skip to content

Commit fa82d14

Browse files
authored
Merge pull request #731 from PHPCSStandards/develop
Release 1.2.0
2 parents 8b8e176 + 7912daf commit fa82d14

File tree

71 files changed

+3872
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+3872
-68
lines changed

.github/GHPages/UpdateWebsite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private function replace(string $search, string $replace, string $subject, int $
268268
private function getContents(string $source): string
269269
{
270270
$contents = \file_get_contents($source);
271-
if (!$contents) {
271+
if (\is_string($contents) === false) {
272272
throw new RuntimeException(\sprintf('Failed to read doc file: %s', $source));
273273
}
274274

.github/GHPages/update-docgen-config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
echo 'This is your own responsibility!' . \PHP_EOL, \PHP_EOL;
4545

4646
$config = \file_get_contents($projectRoot . '/' . $destination);
47-
if (!$config) {
47+
if (\is_string($config) === false) {
4848
echo "ERROR: Failed to read phpDocumentor $destination configuration file.", \PHP_EOL;
4949
exit(1);
5050
}
@@ -59,7 +59,7 @@
5959
);
6060
} else {
6161
$config = \file_get_contents($projectRoot . '/' . $source);
62-
if (!$config) {
62+
if (\is_string($config) === false) {
6363
echo "ERROR: Failed to read phpDocumentor $source configuration template file.", \PHP_EOL;
6464
exit(1);
6565
}

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "composer"
9-
directory: "/"
10-
schedule:
11-
interval: "weekly"
12-
open-pull-requests-limit: 5 # Set to 0 to (temporarily) disable.
13-
versioning-strategy: widen
14-
commit-message:
15-
prefix: "Composer:"
16-
include: "scope"
17-
labels:
18-
- "Type: chores/QA"
19-
208
- package-ecosystem: "github-actions"
219
directory: "/"
2210
schedule:

.github/workflows/basics.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
steps:
2828
- name: Checkout code
2929
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
with:
31+
persist-credentials: false
3032

3133
- name: Install PHP
3234
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
@@ -44,9 +46,8 @@ jobs:
4446
run: |
4547
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
4648
composer remove --no-update --dev phpunit/phpunit --no-scripts
47-
# Using PHPCS `3.x` as an early detection system for bugs upstream.
48-
# This should be changed to 4.x, but we'll need to wait for PHPCSDevCS to be compatible with 4.x.
49-
composer require --no-update squizlabs/php_codesniffer:"3.x-dev"
49+
# Using PHPCS `4.x` as an early detection system for bugs upstream.
50+
composer require --no-update squizlabs/php_codesniffer:"4.x-dev"
5051
5152
# Install dependencies and handle caching in one go.
5253
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer

.github/workflows/quicktest.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838

3939
include:
4040
- php: '7.2'
41-
phpcs_version: '4.0.0'
41+
phpcs_version: '4.0.1'
4242
- php: '7.2'
4343
phpcs_version: '4.x-dev'
4444
- php: 'latest'
45-
phpcs_version: '4.0.0'
45+
phpcs_version: '4.0.1'
4646
- php: 'latest'
4747
phpcs_version: '4.x-dev'
4848

@@ -51,6 +51,8 @@ jobs:
5151
steps:
5252
- name: Checkout code
5353
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
54+
with:
55+
persist-credentials: false
5456

5557
# On stable PHPCS versions, allow for PHP deprecation notices.
5658
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
@@ -70,7 +72,7 @@ jobs:
7072
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
7173
coverage: none
7274

73-
# Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS 4.x.
75+
# Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS "lowest".
7476
- name: 'Composer: remove PHPCSDevCS'
7577
run: composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-interaction
7678

.github/workflows/test.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
steps:
4040
- name: Checkout code
4141
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
42+
with:
43+
persist-credentials: false
4244

4345
- name: Install PHP
4446
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
@@ -85,30 +87,30 @@ jobs:
8587
#
8688
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
8789
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
88-
phpcs_version: ['lowest', '3.x-dev', '4.0.0', '4.x-dev']
90+
phpcs_version: ['lowest', '3.x-dev', '4.0.1', '4.x-dev']
8991
risky: [false]
9092
experimental: [false]
9193

9294
exclude:
9395
- php: '5.5'
94-
phpcs_version: '4.0.0'
96+
phpcs_version: '4.0.1'
9597
- php: '5.5'
9698
phpcs_version: '4.x-dev'
9799
- php: '5.6'
98-
phpcs_version: '4.0.0'
100+
phpcs_version: '4.0.1'
99101
- php: '5.6'
100102
phpcs_version: '4.x-dev'
101103
- php: '7.0'
102-
phpcs_version: '4.0.0'
104+
phpcs_version: '4.0.1'
103105
- php: '7.0'
104106
phpcs_version: '4.x-dev'
105107
- php: '7.1'
106-
phpcs_version: '4.0.0'
108+
phpcs_version: '4.0.1'
107109
- php: '7.1'
108110
phpcs_version: '4.x-dev'
109111
# Also exclude the 7.2 builds as those are run in code coverage, no need to duplicate.
110112
- php: '7.2'
111-
phpcs_version: '4.0.0'
113+
phpcs_version: '4.0.1'
112114
- php: '7.2'
113115
phpcs_version: '4.x-dev'
114116

@@ -161,7 +163,7 @@ jobs:
161163
experimental: true
162164

163165
- php: '8.4'
164-
phpcs_version: '4.0.0'
166+
phpcs_version: '4.0.1'
165167
risky: true
166168
experimental: true
167169

@@ -177,6 +179,8 @@ jobs:
177179
steps:
178180
- name: Checkout code
179181
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
182+
with:
183+
persist-credentials: false
180184

181185
# On stable PHPCS versions, allow for PHP deprecation notices.
182186
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
@@ -197,7 +201,7 @@ jobs:
197201
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
198202
coverage: none
199203

200-
# Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS 4.x.
204+
# Remove PHPCSDevCS as it would (for now) prevent the tests from being able to run against PHPCS "lowest".
201205
- name: 'Composer: remove PHPCSDevCS'
202206
run: composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-interaction
203207

@@ -295,15 +299,15 @@ jobs:
295299
phpcs_version: '4.x-dev'
296300
extensions: ':iconv' # Run one build with iconv disabled.
297301
- php: '8.4'
298-
phpcs_version: '4.0.0'
302+
phpcs_version: '4.0.1'
299303
- php: '8.4'
300304
phpcs_version: '3.x-dev'
301305
- php: '8.4'
302306
phpcs_version: 'lowest'
303307
- php: '7.2'
304308
phpcs_version: '4.x-dev'
305309
- php: '7.2'
306-
phpcs_version: '4.0.0'
310+
phpcs_version: '4.0.1'
307311
- php: '5.4'
308312
phpcs_version: '3.x-dev'
309313
- php: '5.4'
@@ -314,6 +318,8 @@ jobs:
314318
steps:
315319
- name: Checkout code
316320
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
321+
with:
322+
persist-credentials: false
317323

318324
# On stable PHPCS versions, allow for PHP deprecation notices.
319325
# 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
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.
6565
fetch-depth: 0
66+
persist-credentials: false
6667

6768
- name: Install PHP
6869
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
@@ -112,7 +113,7 @@ jobs:
112113
# Retention is normally 90 days, but this artifact is only for reviewing
113114
# and debugging the generated files for the website.
114115
- name: Upload the generated files
115-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
116+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
116117
with:
117118
name: generated-files
118119
path: ./docs/

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5656
with:
5757
ref: ${{ steps.branches.outputs.BASE }}
58+
persist-credentials: false
5859

5960
- name: Update the version constant in the test file (PHPCS 3)
6061
if: ${{ startsWith( steps.version.outputs.TAG, '3.' ) }}

CHANGELOG.md

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

1212

13+
## [1.2.0] - 2025-11-11
14+
15+
### Added
16+
17+
#### Utils
18+
19+
* New [`PHPCSUtils\Utils\AttributeBlock`][`AttributeBlock`] class: Utility functions to examine attribute blocks. [#720], [#729]
20+
For the purposes of these utilities, an "attribute block" is defined as being an attribute opener, an attribute closer and everything between. I.e. `#[MyAttribute(1, 2), AnotherAttribute]` is one attribute block.
21+
Initial set of available methods:
22+
- `getAttributes()` to retrieve information about each attribute being instantiated within a particular attribute block.
23+
- `countAttributes()` to retrieve a count of the number of attribute instantiations with a particular attribute block.
24+
- `appliesTo()` to find the stack pointer to the language construct an attribute block applies to.
25+
* New `PHPCSUtils\Utils\Constants::getAttributeOpeners()`, `PHPCSUtils\Utils\FunctionDeclarations::getAttributeOpeners()`, `PHPCSUtils\Utils\ObjectDeclarations::getAttributeOpeners()` and `PHPCSUtils\Utils\Variables::getAttributeOpeners()` utility methods. [#719]
26+
These methods will each return an array with the stack pointers to the attribute openers for applicable attribute blocks.
27+
This may be an empty array if no attributes apply to the constant/function/OO structure/property.
28+
29+
### Changed
30+
31+
#### Other
32+
33+
* Dropped support for [PHP_CodeSniffer] < 3.13.5/<4.00. [#729]
34+
Please ensure you run `composer update phpcsstandards/phpcsutils --with-dependencies` to benefit from this.
35+
* Various housekeeping.
36+
37+
[#719]: https://github.com/PHPCSStandards/PHPCSUtils/pull/719
38+
[#720]: https://github.com/PHPCSStandards/PHPCSUtils/pull/720
39+
[#729]: https://github.com/PHPCSStandards/PHPCSUtils/pull/729
40+
41+
1342
## [1.1.3] - 2025-10-16
1443

1544
### Changed
@@ -1293,6 +1322,7 @@ This initial alpha release contains the following utility classes:
12931322

12941323

12951324
[Unreleased]: https://github.com/PHPCSStandards/PHPCSUtils/compare/stable...HEAD
1325+
[1.2.0]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.3...1.2.0
12961326
[1.1.3]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.2...1.1.3
12971327
[1.1.2]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.1...1.1.2
12981328
[1.1.1]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.0...1.1.1
@@ -1329,6 +1359,7 @@ This initial alpha release contains the following utility classes:
13291359
[`Collections`]: https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Tokens-Collections.html
13301360
[`TokenHelper`]: https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Tokens-TokenHelper.html
13311361
[`Arrays`]: https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-Arrays.html
1362+
[`AttributeBlock`]: https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-AttributeBlock.html
13321363
[`Conditions`]: https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-Conditions.html
13331364
[`Constants`]: https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-Constants.html
13341365
[`Context`]: https://phpcsutils.com/phpdoc/classes/PHPCSUtils-Utils-Context.html

PHPCSUtils/BackCompat/BCFile.php

Lines changed: 8 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.3.
527+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
528528
*
529529
* @see \PHP_CodeSniffer\Files\File::getMethodProperties() Original source.
530530
* @see \PHPCSUtils\Utils\FunctionDeclarations::getProperties() PHPCSUtils native improved version.
@@ -765,7 +765,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr)
765765
*
766766
* Changelog for the PHPCS native function:
767767
* - Introduced in PHPCS 1.3.0.
768-
* - The upstream method has received no significant updates since PHPCS 3.13.3.
768+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
769769
*
770770
* @see \PHP_CodeSniffer\Files\File::getClassProperties() Original source.
771771
* @see \PHPCSUtils\Utils\ObjectDeclarations::getClassProperties() PHPCSUtils native improved version.
@@ -793,7 +793,7 @@ public static function getClassProperties(File $phpcsFile, $stackPtr)
793793
*
794794
* Changelog for the PHPCS native function:
795795
* - Introduced in PHPCS 0.0.5.
796-
* - The upstream method has received no significant updates since PHPCS 3.13.3.
796+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
797797
*
798798
* @see \PHP_CodeSniffer\Files\File::isReference() Original source.
799799
* @see \PHPCSUtils\Utils\Operators::isReference() PHPCSUtils native improved version.
@@ -819,7 +819,7 @@ public static function isReference(File $phpcsFile, $stackPtr)
819819
*
820820
* Changelog for the PHPCS native function:
821821
* - Introduced in PHPCS 0.0.5.
822-
* - The upstream method has received no significant updates since PHPCS 3.13.3.
822+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
823823
*
824824
* @see \PHP_CodeSniffer\Files\File::getTokensAsString() Original source.
825825
* @see \PHPCSUtils\Utils\GetTokensAsString Related set of functions.
@@ -848,7 +848,7 @@ public static function getTokensAsString(File $phpcsFile, $start, $length, $orig
848848
*
849849
* Changelog for the PHPCS native function:
850850
* - Introduced in PHPCS 2.1.0.
851-
* - The upstream method has received no significant updates since PHPCS 3.13.3.
851+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
852852
*
853853
* @see \PHP_CodeSniffer\Files\File::findStartOfStatement() Original source.
854854
*
@@ -872,7 +872,7 @@ public static function findStartOfStatement(File $phpcsFile, $start, $ignore = n
872872
*
873873
* Changelog for the PHPCS native function:
874874
* - Introduced in PHPCS 2.1.0.
875-
* - The upstream method has received no significant updates since PHPCS 3.13.3.
875+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
876876
*
877877
* @see \PHP_CodeSniffer\Files\File::findEndOfStatement() Original source.
878878
*
@@ -896,7 +896,7 @@ public static function findEndOfStatement(File $phpcsFile, $start, $ignore = nul
896896
*
897897
* Changelog for the PHPCS native function:
898898
* - Introduced in PHPCS 0.0.5.
899-
* - The upstream method has received no significant updates since PHPCS 3.13.3.
899+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
900900
*
901901
* @see \PHP_CodeSniffer\Files\File::hasCondition() Original source.
902902
* @see \PHPCSUtils\Utils\Conditions::hasCondition() PHPCSUtils native alternative.
@@ -921,7 +921,7 @@ public static function hasCondition(File $phpcsFile, $stackPtr, $types)
921921
*
922922
* Changelog for the PHPCS native function:
923923
* - Introduced in PHPCS 1.3.0.
924-
* - The upstream method has received no significant updates since PHPCS 3.13.3.
924+
* - The upstream method has received no significant updates since PHPCS 3.13.5.
925925
*
926926
* @see \PHP_CodeSniffer\Files\File::getCondition() Original source.
927927
* @see \PHPCSUtils\Utils\Conditions::getCondition() More versatile alternative.

0 commit comments

Comments
 (0)