Skip to content

Commit

Permalink
Merge pull request #487 from PHPCSStandards/develop
Browse files Browse the repository at this point in the history
Release 1.0.7
  • Loading branch information
jrfnl authored Jul 10, 2023
2 parents ba259ea + 004a3cf commit 886a728
Show file tree
Hide file tree
Showing 120 changed files with 687 additions and 420 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ phpcs.xml.dist export-ignore
phpdoc.dist.xml export-ignore
phpdoc.xml.dist export-ignore
phpunit.xml.dist export-ignore
phpunit10.xml.dist export-ignore
/.github/ export-ignore
/docs/ export-ignore
/Tests/ export-ignore
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,32 @@ jobs:
if: matrix.phpcs_version == 'dev-master'
run: composer lint-lt72

- name: Grab PHPUnit version
id: phpunit_version
# yamllint disable-line rule:line-length
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT

- name: Determine PHPUnit config file to use
id: phpunit_config
run: |
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
else
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS= --repeat 2' >> $GITHUB_OUTPUT
fi
- name: Run the unit tests without caching
run: vendor/bin/phpunit --no-coverage
run: vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }} --no-coverage
env:
PHPCS_VERSION: ${{ matrix.phpcs_version }}
PHPCSUTILS_USE_CACHE: false

- name: Run the unit tests with caching
run: vendor/bin/phpunit --testsuite PHPCSUtils --no-coverage --repeat 2
run: >
vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }}
--testsuite PHPCSUtils --no-coverage ${{ steps.phpunit_config.outputs.EXTRA_ARGS }}
env:
PHPCS_VERSION: ${{ matrix.phpcs_version }}
PHPCSUTILS_USE_CACHE: true
41 changes: 30 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,34 @@ jobs:
if: ${{ matrix.phpcs_version == 'lowest' }}
run: composer update squizlabs/php_codesniffer --prefer-lowest --no-scripts --no-interaction

- name: Grab PHPUnit version
id: phpunit_version
# yamllint disable-line rule:line-length
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT

- name: Determine PHPUnit config file to use
id: phpunit_config
run: |
if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}" == "true" ]; then
echo 'FILE=phpunit10.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS=' >> $GITHUB_OUTPUT
else
echo 'FILE=phpunit.xml.dist' >> $GITHUB_OUTPUT
echo 'EXTRA_ARGS= --repeat 2' >> $GITHUB_OUTPUT
fi
- name: Run the unit tests without caching (non-risky)
if: ${{ matrix.risky == false }}
run: vendor/bin/phpunit --no-coverage
run: vendor/bin/phpunit -c ${{ steps.phpunit_config.outputs.FILE }} --no-coverage
env:
PHPCS_VERSION: ${{ matrix.phpcs_version == '4.0.x-dev' && '4.0.0' || matrix.phpcs_version }}
PHPCSUTILS_USE_CACHE: false

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

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

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

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

- name: "Run the unit tests without caching with code coverage (PHPUnit 9.3+)"
if: ${{ steps.phpunit_version.outputs.VERSION >= '9.3' }}
run: vendor/bin/phpunit --coverage-cache ./build/phpunit-cache
- name: "Run the unit tests without caching with code coverage (PHPUnit 10+)"
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: vendor/bin/phpunit -c phpunit10.xml.dist --coverage-cache ./build/phpunit-cache
env:
PHPCS_VERSION: ${{ matrix.phpcs_version }}
PHPCSUTILS_USE_CACHE: false
Expand Down
9 changes: 8 additions & 1 deletion .remarkrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
["remark-lint-linebreak-style", "unix"],
["remark-lint-link-title-style", "\""],
["remark-lint-ordered-list-marker-style", "."],
"remark-lint-no-dead-urls",
[
"remark-lint-no-dead-urls",
{
"skipUrlPatterns": [
"^https?://github\\.com/PHPCSStandards/PHPCSUtils/compare/[0-9\\.]+?\\.{3}[0-9\\.]+"
]
}
],
"remark-lint-no-duplicate-defined-urls",
"remark-lint-no-duplicate-definitions",
"remark-lint-no-empty-url",
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ This projects adheres to [Keep a CHANGELOG](https://keepachangelog.com/) and use
_Nothing yet._


## [1.0.7] - 2023-07-10

### 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 lists used as an array value. [#485]

[#485]: https://github.com/PHPCSStandards/PHPCSUtils/pull/485


## [1.0.6] - 2023-05-27

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


[Unreleased]: https://github.com/PHPCSStandards/PHPCSUtils/compare/stable...HEAD
[1.0.7]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.6...1.0.7
[1.0.6]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.5...1.0.6
[1.0.5]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.4...1.0.5
[1.0.4]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.3...1.0.4
Expand Down
9 changes: 9 additions & 0 deletions PHPCSUtils/Utils/Arrays.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ final class Arrays
\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY,

// Inline function, control structures and other things to skip over.
\T_LIST => \T_LIST,
\T_FN => \T_FN,
\T_MATCH => \T_MATCH,
\T_ATTRIBUTE => \T_ATTRIBUTE,
Expand Down Expand Up @@ -208,6 +209,14 @@ public static function getDoubleArrowPtr(File $phpcsFile, $start, $end)
continue;
}

// Skip over potentially keyed long lists.
if ($tokens[$doubleArrow]['code'] === \T_LIST
&& isset($tokens[$doubleArrow]['parenthesis_closer'])
) {
$doubleArrow = $tokens[$doubleArrow]['parenthesis_closer'];
continue;
}

// Start of nested long/short array.
break;
} while ($doubleArrow < $end);
Expand Down
Loading

0 comments on commit 886a728

Please sign in to comment.