Skip to content

Commit 5e248cf

Browse files
committed
Better Workaround for Versions "Error"
PHPCompatibility (versions check) erroneously flags the use of $this in enumerations. They fixed it in their development branch in October 2022. But they haven't had a release since 2019!
1 parent 56ecfa2 commit 5e248cf

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jobs:
173173
run: composer install --no-progress --prefer-dist --optimize-autoloader
174174

175175
- name: Code Version Compatibility check with PHP_CodeSniffer
176-
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.1-
176+
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.1- --exclude=PHPCompatibility.Variables.ForbiddenThisUseContexts
177177

178178
phpstan:
179179
runs-on: ubuntu-latest

src/PhpSpreadsheet/Style/NumberFormat/Wizard/CurrencyNegative.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44

55
enum CurrencyNegative
66
{
7-
// PHPCompatibility (versions check) has an error which
8-
// causes it to flag the use of $this below as erroneous.
9-
// They fixed it in their development branch in October 2022.
10-
// But they haven't had a release since 2019!
11-
// Hence the phpcs disable statment below.
127
case minus;
138
case redMinus;
149
case parentheses;
1510
case redParentheses;
1611

17-
// phpcs:disable PHPCompatibility.Variables.ForbiddenThisUseContexts
1812
public function start(): string
1913
{
2014
return match ($this) {
@@ -38,5 +32,4 @@ public function color(): string
3832
self::parentheses, self::minus => '',
3933
};
4034
}
41-
// phpcs:enable
4235
}

0 commit comments

Comments
 (0)