diff --git a/composer.lock b/composer.lock index e2e3341b20..a3d742130f 100644 --- a/composer.lock +++ b/composer.lock @@ -1358,12 +1358,12 @@ "source": { "type": "git", "url": "https://github.com/PHPCSStandards/composer-installer.git", - "reference": "b49fdb59dd34284bd347435a959f2093894d1ac8" + "reference": "eda4086d152f545894f94018cb208f38dc251172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/b49fdb59dd34284bd347435a959f2093894d1ac8", - "reference": "b49fdb59dd34284bd347435a959f2093894d1ac8", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/eda4086d152f545894f94018cb208f38dc251172", + "reference": "eda4086d152f545894f94018cb208f38dc251172", "shasum": "" }, "require": { @@ -1428,7 +1428,7 @@ "issues": "https://github.com/PHPCSStandards/composer-installer/issues", "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2023-09-22T07:48:18+00:00" + "time": "2023-11-26T02:51:26+00:00" }, { "name": "doctrine/instantiator", @@ -1564,50 +1564,50 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.37.1", + "version": "v3.40.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "c3fe76976081ab871aa654e872da588077e19679" + "reference": "27d2b3265b5d550ec411b4319967ae7cfddfb2e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/c3fe76976081ab871aa654e872da588077e19679", - "reference": "c3fe76976081ab871aa654e872da588077e19679", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/27d2b3265b5d550ec411b4319967ae7cfddfb2e0", + "reference": "27d2b3265b5d550ec411b4319967ae7cfddfb2e0", "shasum": "" }, "require": { - "composer/semver": "^3.3", + "composer/semver": "^3.4", "composer/xdebug-handler": "^3.0.3", "ext-json": "*", "ext-tokenizer": "*", "php": "^7.4 || ^8.0", "sebastian/diff": "^4.0 || ^5.0", - "symfony/console": "^5.4 || ^6.0", - "symfony/event-dispatcher": "^5.4 || ^6.0", - "symfony/filesystem": "^5.4 || ^6.0", - "symfony/finder": "^5.4 || ^6.0", - "symfony/options-resolver": "^5.4 || ^6.0", - "symfony/polyfill-mbstring": "^1.27", - "symfony/polyfill-php80": "^1.27", - "symfony/polyfill-php81": "^1.27", - "symfony/process": "^5.4 || ^6.0", - "symfony/stopwatch": "^5.4 || ^6.0" + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", - "keradus/cli-executor": "^2.0", + "keradus/cli-executor": "^2.1", "mikey179/vfsstream": "^1.6.11", - "php-coveralls/php-coveralls": "^2.5.3", + "php-coveralls/php-coveralls": "^2.7", "php-cs-fixer/accessible-object": "^1.1", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", - "phpspec/prophecy": "^1.16", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", + "phpspec/prophecy": "^1.17", "phpspec/prophecy-phpunit": "^2.0", - "phpunit/phpunit": "^9.5", - "symfony/phpunit-bridge": "^6.2.3", - "symfony/yaml": "^5.4 || ^6.0" + "phpunit/phpunit": "^9.6", + "symfony/phpunit-bridge": "^6.3.8 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -1645,7 +1645,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.37.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.40.0" }, "funding": [ { @@ -1653,7 +1653,7 @@ "type": "github" } ], - "time": "2023-10-29T20:51:23+00:00" + "time": "2023-11-26T09:25:53+00:00" }, { "name": "masterminds/html5", @@ -1770,16 +1770,16 @@ }, { "name": "mpdf/mpdf", - "version": "v8.2.0", + "version": "v8.2.2", "source": { "type": "git", "url": "https://github.com/mpdf/mpdf.git", - "reference": "170a236a588d177c2aa7447ce490a030ca68e6f4" + "reference": "596a87b876d7793be7be060a8ac13424de120dd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mpdf/mpdf/zipball/170a236a588d177c2aa7447ce490a030ca68e6f4", - "reference": "170a236a588d177c2aa7447ce490a030ca68e6f4", + "url": "https://api.github.com/repos/mpdf/mpdf/zipball/596a87b876d7793be7be060a8ac13424de120dd5", + "reference": "596a87b876d7793be7be060a8ac13424de120dd5", "shasum": "" }, "require": { @@ -1789,7 +1789,7 @@ "mpdf/psr-log-aware-trait": "^2.0 || ^3.0", "myclabs/deep-copy": "^1.7", "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "psr/http-message": "^1.0 || ^2.0", "psr/log": "^1.0 || ^2.0 || ^3.0", "setasign/fpdi": "^2.1" @@ -1847,7 +1847,7 @@ "type": "custom" } ], - "time": "2023-09-01T11:44:52+00:00" + "time": "2023-11-07T13:52:14+00:00" }, { "name": "mpdf/psr-http-message-shim", @@ -2371,16 +2371,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.40", + "version": "1.10.46", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "93c84b5bf7669920d823631e39904d69b9c7dc5d" + "reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/93c84b5bf7669920d823631e39904d69b9c7dc5d", - "reference": "93c84b5bf7669920d823631e39904d69b9c7dc5d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", + "reference": "90d3d25c5b98b8068916bbf08ce42d5cb6c54e70", "shasum": "" }, "require": { @@ -2429,7 +2429,7 @@ "type": "tidelift" } ], - "time": "2023-10-30T14:48:31+00:00" + "time": "2023-11-28T14:57:26+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -5327,16 +5327,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -5365,7 +5365,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -5373,7 +5373,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c7cbf42ca9..c9762340b2 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,31 +1,6 @@ parameters: ignoreErrors: - - - message: "#^Cannot call method getTokenSubType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" - count: 4 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php - - - - message: "#^Cannot call method getTokenType\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\FormulaToken\\|null\\.$#" - count: 8 - path: src/PhpSpreadsheet/Calculation/FormulaParser.php - - message: "#^Binary operation \"/\" between float and array\\|float\\|int\\|string results in an error\\.$#" count: 1 path: src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php - - - - message: "#^Offset 2 does not exist on array\\{int, int, int, int\\}\\|array\\{int, int\\}\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Validations.php - - - - message: "#^Offset 3 does not exist on array\\{int, int, int, int\\}\\|array\\{int, int\\}\\.$#" - count: 1 - path: src/PhpSpreadsheet/Worksheet/Validations.php - - - - message: "#^Parameter \\#2 \\$value of function ini_set expects string, int given\\.$#" - count: 1 - path: tests/bootstrap.php diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index d8d0557399..34062a5319 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -4715,7 +4715,7 @@ private function processTokenStack(mixed $tokens, $cellID = null, ?Cell $cell = if (($operand2Data = $stack->pop()) === null) { return $this->raiseFormulaError('Internal error - Operand value missing from stack'); } - if (($operand1Data = $stack->pop()) === null) { + if (($operand1Data = $stack->pop()) === null) { // @phpstan-ignore-line return $this->raiseFormulaError('Internal error - Operand value missing from stack'); } diff --git a/src/PhpSpreadsheet/Calculation/FormulaParser.php b/src/PhpSpreadsheet/Calculation/FormulaParser.php index cffce179c6..0be1ca8ac9 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaParser.php +++ b/src/PhpSpreadsheet/Calculation/FormulaParser.php @@ -530,12 +530,12 @@ private function parseToTokens(): void if ($i == 0) { $token->setTokenType(FormulaToken::TOKEN_TYPE_OPERATORPREFIX); } elseif ( - (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) - && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) - || (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) - && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) - || ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) - || ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) + (($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) + && ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) + || (($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) + && ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) + || ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) + || ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) ) { $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH); } else { @@ -551,12 +551,12 @@ private function parseToTokens(): void if ($i == 0) { continue; } elseif ( - (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) - && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) - || (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) - && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) - || ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) - || ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) + (($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) + && ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) + || (($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) + && ($previousToken?->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) + || ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) + || ($previousToken?->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) ) { $token->setTokenSubType(FormulaToken::TOKEN_SUBTYPE_MATH); } else { diff --git a/src/PhpSpreadsheet/Worksheet/Validations.php b/src/PhpSpreadsheet/Worksheet/Validations.php index d6e5582809..9ce7652690 100644 --- a/src/PhpSpreadsheet/Worksheet/Validations.php +++ b/src/PhpSpreadsheet/Worksheet/Validations.php @@ -81,14 +81,14 @@ public static function validateCellRange(AddressRange|array|string $cellRange): if (is_array($cellRange)) { switch (count($cellRange)) { - case 2: + case 4: $from = [$cellRange[0], $cellRange[1]]; - $to = [$cellRange[0], $cellRange[1]]; + $to = [$cellRange[2], $cellRange[3]]; break; - case 4: + case 2: $from = [$cellRange[0], $cellRange[1]]; - $to = [$cellRange[2], $cellRange[3]]; + $to = [$cellRange[0], $cellRange[1]]; break; default: diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4cd23357de..5b48e70f9b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -32,6 +32,6 @@ function phpunit10ErrorHandler(int $errno, string $errstr, string $filename, int } if (!method_exists(\PHPUnit\Framework\TestCase::class, 'setOutputCallback')) { - ini_set('error_reporting', E_ALL); + ini_set('error_reporting', (string) E_ALL); set_error_handler('phpunit10ErrorHandler'); }