Skip to content

Commit 886a728

Browse files
authored
Merge pull request #487 from PHPCSStandards/develop
Release 1.0.7
2 parents ba259ea + 004a3cf commit 886a728

File tree

120 files changed

+687
-420
lines changed

Some content is hidden

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

120 files changed

+687
-420
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ phpcs.xml.dist export-ignore
1616
phpdoc.dist.xml export-ignore
1717
phpdoc.xml.dist export-ignore
1818
phpunit.xml.dist export-ignore
19+
phpunit10.xml.dist export-ignore
1920
/.github/ export-ignore
2021
/docs/ export-ignore
2122
/Tests/ export-ignore

.github/workflows/quicktest.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,32 @@ jobs:
8080
if: matrix.phpcs_version == 'dev-master'
8181
run: composer lint-lt72
8282

83+
- name: Grab PHPUnit version
84+
id: phpunit_version
85+
# yamllint disable-line rule:line-length
86+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
87+
88+
- name: Determine PHPUnit config file to use
89+
id: phpunit_config
90+
run: |
91+
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
92+
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
93+
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
94+
else
95+
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
96+
echo 'EXTRA_ARGS= --repeat 2' >> $GITHUB_OUTPUT
97+
fi
98+
8399
- name: Run the unit tests without caching
84-
run: vendor/bin/phpunit --no-coverage
100+
run: vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }} --no-coverage
85101
env:
86102
PHPCS_VERSION: ${{ matrix.phpcs_version }}
87103
PHPCSUTILS_USE_CACHE: false
88104

89105
- name: Run the unit tests with caching
90-
run: vendor/bin/phpunit --testsuite PHPCSUtils --no-coverage --repeat 2
106+
run: >
107+
vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }}
108+
--testsuite PHPCSUtils --no-coverage ${{ steps.phpunit_config.outputs.EXTRA_ARGS }}
91109
env:
92110
PHPCS_VERSION: ${{ matrix.phpcs_version }}
93111
PHPCSUTILS_USE_CACHE: true

.github/workflows/test.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,34 @@ jobs:
201201
if: ${{ matrix.phpcs_version == 'lowest' }}
202202
run: composer update squizlabs/php_codesniffer --prefer-lowest --no-scripts --no-interaction
203203

204+
- name: Grab PHPUnit version
205+
id: phpunit_version
206+
# yamllint disable-line rule:line-length
207+
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
208+
209+
- name: Determine PHPUnit config file to use
210+
id: phpunit_config
211+
run: |
212+
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
213+
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
214+
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
215+
else
216+
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
217+
echo 'EXTRA_ARGS= --repeat 2' >> $GITHUB_OUTPUT
218+
fi
219+
204220
- name: Run the unit tests without caching (non-risky)
205221
if: ${{ matrix.risky == false }}
206-
run: vendor/bin/phpunit --no-coverage
222+
run: vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }} --no-coverage
207223
env:
208224
PHPCS_VERSION: ${{ matrix.phpcs_version == '4.0.x-dev' && '4.0.0' || matrix.phpcs_version }}
209225
PHPCSUTILS_USE_CACHE: false
210226

211227
- name: Run the unit tests with caching (non-risky)
212228
if: ${{ matrix.risky == false }}
213-
run: vendor/bin/phpunit --testsuite PHPCSUtils --no-coverage --repeat 2
229+
run: >
230+
vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }}
231+
--testsuite PHPCSUtils --no-coverage ${{ steps.phpunit_config.outputs.EXTRA_ARGS }}
214232
env:
215233
PHPCS_VERSION: ${{ matrix.phpcs_version == '4.0.x-dev' && '4.0.0' || matrix.phpcs_version }}
216234
PHPCSUTILS_USE_CACHE: true
@@ -220,15 +238,15 @@ jobs:
220238
- name: Run the unit tests (risky, comparewithPHPCS)
221239
if: ${{ matrix.risky && matrix.phpcs_version == 'dev-master' }}
222240
# "nothing" is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
223-
run: vendor/bin/phpunit --no-coverage --group compareWithPHPCS --exclude-group nothing
241+
run: vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }} --no-coverage --group compareWithPHPCS --exclude-group nothing
224242
env:
225243
PHPCS_VERSION: ${{ matrix.phpcs_version == '4.0.x-dev' && '4.0.0' || matrix.phpcs_version }}
226244

227245
# Run the "xtra" group against high and low PHPCS as these are tests safeguarding PHPCS itself.
228246
- name: Run the unit tests (risky, xtra)
229247
if: ${{ matrix.risky }}
230248
# "nothing" is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
231-
run: vendor/bin/phpunit --no-coverage --group xtra --exclude-group nothing
249+
run: vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }} --no-coverage --group xtra --exclude-group nothing
232250
env:
233251
PHPCS_VERSION: ${{ matrix.phpcs_version == '4.0.x-dev' && '4.0.0' || matrix.phpcs_version }}
234252

@@ -312,20 +330,21 @@ jobs:
312330
# As of PHPUnit 9.3.4, a cache warming option is available.
313331
# Using that option prevents issues with PHP-Parser backfilling PHP tokens when PHPCS does not (yet),
314332
# which would otherwise cause tests to fail on tokens being available when they shouldn't be.
333+
# As coverage is only run on high/low PHP, the high PHP version will use PHPUnit 10, so just check for that.
315334
- name: "Warm the PHPUnit cache (PHPUnit 9.3+)"
316-
if: ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
317-
run: vendor/bin/phpunit --coverage-cache ./build/phpunit-cache --warm-coverage-cache
335+
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
336+
run: vendor/bin/phpunit -c phpunit10.xml.dist --coverage-cache ./build/phpunit-cache --warm-coverage-cache
318337

319-
- name: "Run the unit tests without caching with code coverage (PHPUnit < 9.3)"
320-
if: ${{ steps.phpunit_version.outputs.VERSION < '9.3' }}
338+
- name: "Run the unit tests without caching with code coverage (PHPUnit < 10)"
339+
if: ${{ ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
321340
run: vendor/bin/phpunit
322341
env:
323342
PHPCS_VERSION: ${{ matrix.phpcs_version }}
324343
PHPCSUTILS_USE_CACHE: false
325344

326-
- name: "Run the unit tests without caching with code coverage (PHPUnit 9.3+)"
327-
if: ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
328-
run: vendor/bin/phpunit --coverage-cache ./build/phpunit-cache
345+
- name: "Run the unit tests without caching with code coverage (PHPUnit 10+)"
346+
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
347+
run: vendor/bin/phpunit -c phpunit10.xml.dist --coverage-cache ./build/phpunit-cache
329348
env:
330349
PHPCS_VERSION: ${{ matrix.phpcs_version }}
331350
PHPCSUTILS_USE_CACHE: false

.remarkrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
["remark-lint-linebreak-style", "unix"],
99
["remark-lint-link-title-style", "\""],
1010
["remark-lint-ordered-list-marker-style", "."],
11-
"remark-lint-no-dead-urls",
11+
[
12+
"remark-lint-no-dead-urls",
13+
{
14+
"skipUrlPatterns": [
15+
"^https?://github\\.com/PHPCSStandards/PHPCSUtils/compare/[0-9\\.]+?\\.{3}[0-9\\.]+"
16+
]
17+
}
18+
],
1219
"remark-lint-no-duplicate-defined-urls",
1320
"remark-lint-no-duplicate-definitions",
1421
"remark-lint-no-empty-url",

CHANGELOG.md

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

1212

13+
## [1.0.7] - 2023-07-10
14+
15+
### Changed
16+
17+
#### Other
18+
19+
* Various housekeeping and maintenance updates, including making the test suite compatible with PHPUnit 10.
20+
21+
### Fixed
22+
23+
#### Utils
24+
25+
* The `Arrays::getDoubleArrowPtr()` method could previously get confused over a double arrow in a keyed lists used as an array value. [#485]
26+
27+
[#485]: https://github.com/PHPCSStandards/PHPCSUtils/pull/485
28+
29+
1330
## [1.0.6] - 2023-05-27
1431

1532
### Changed
@@ -889,6 +906,7 @@ This initial alpha release contains the following utility classes:
889906

890907

891908
[Unreleased]: https://github.com/PHPCSStandards/PHPCSUtils/compare/stable...HEAD
909+
[1.0.7]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.6...1.0.7
892910
[1.0.6]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.5...1.0.6
893911
[1.0.5]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.4...1.0.5
894912
[1.0.4]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.3...1.0.4

PHPCSUtils/Utils/Arrays.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ final class Arrays
3939
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,
4040

4141
// Inline function, control structures and other things to skip over.
42+
\T_LIST => \T_LIST,
4243
\T_FN => \T_FN,
4344
\T_MATCH => \T_MATCH,
4445
\T_ATTRIBUTE => \T_ATTRIBUTE,
@@ -208,6 +209,14 @@ public static function getDoubleArrowPtr(File $phpcsFile, $start, $end)
208209
continue;
209210
}
210211

212+
// Skip over potentially keyed long lists.
213+
if ($tokens[$doubleArrow]['code'] === \T_LIST
214+
&& isset($tokens[$doubleArrow]['parenthesis_closer'])
215+
) {
216+
$doubleArrow = $tokens[$doubleArrow]['parenthesis_closer'];
217+
continue;
218+
}
219+
211220
// Start of nested long/short array.
212221
break;
213222
} while ($doubleArrow < $end);

0 commit comments

Comments
 (0)