mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-31 04:28:51 +00:00
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!
This commit is contained in:
@@ -173,7 +173,7 @@ jobs:
|
|||||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
- name: Code Version Compatibility check with PHP_CodeSniffer
|
- name: Code Version Compatibility check with PHP_CodeSniffer
|
||||||
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.1-
|
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.1- --exclude=PHPCompatibility.Variables.ForbiddenThisUseContexts
|
||||||
|
|
||||||
phpstan:
|
phpstan:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -4,17 +4,11 @@ namespace PhpOffice\PhpSpreadsheet\Style\NumberFormat\Wizard;
|
|||||||
|
|
||||||
enum CurrencyNegative
|
enum CurrencyNegative
|
||||||
{
|
{
|
||||||
// PHPCompatibility (versions check) has an error which
|
|
||||||
// causes it to flag the use of $this below as erroneous.
|
|
||||||
// They fixed it in their development branch in October 2022.
|
|
||||||
// But they haven't had a release since 2019!
|
|
||||||
// Hence the phpcs disable statment below.
|
|
||||||
case minus;
|
case minus;
|
||||||
case redMinus;
|
case redMinus;
|
||||||
case parentheses;
|
case parentheses;
|
||||||
case redParentheses;
|
case redParentheses;
|
||||||
|
|
||||||
// phpcs:disable PHPCompatibility.Variables.ForbiddenThisUseContexts
|
|
||||||
public function start(): string
|
public function start(): string
|
||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
@@ -38,5 +32,4 @@ enum CurrencyNegative
|
|||||||
self::parentheses, self::minus => '',
|
self::parentheses, self::minus => '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// phpcs:enable
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user