Repository navigation
Conversation
Address the exact PHP 8.5.7 deprecations reported by CI, with behaviour-identical changes: - Reader/Xlsx/ColumnAndRowAttributes.php: replace the `++` increments on the Excel column-letter strings with Coordinate::stringFromColumnIndex(columnIndexFromString(...) + 1), fixing "Increment on non-numeric string is deprecated". - Worksheet/Worksheet.php (rangeToArray): same column-string `++` replacement using the Coordinate helper. - Calculation/Calculation.php (renameCalculationCacheForWorksheet): coerce the array offset to '' ($fromWorksheetName ?? '') to fix "Using null as an array offset is deprecated". The Coordinate helper is used (rather than str_increment) because it keeps the library working on the full supported PHP range (^7.2||^8.0) and matches the surrounding code which already uses Coordinate::stringFromColumnIndex.
PHP 8.4 rewrote round() and removed its internal pre-rounding step. For a value whose IEEE-754 representation sits just below a .5 boundary due to accumulated float error (e.g. 366.49999999999977, intended as 366.5), pre-8.4 round() snapped it up to 367 while 8.4+ rounds down to 366. That silently drifted insurer pricing/tax output by a cent (e.g. Visana content_insurance_discount_on_tax). Reimplement Kasko::ROUND to reproduce the pre-8.4 _php_math_round algorithm (pre-round to absorb representation error, then round half away from zero) so Excel ROUND output stays backward-compatible / insurer-signed-off and independent of the PHP version. Deliberately ROUND-only; no other function is touched.
Reverts 59fa646. Decision (migration §2.1, option 1): accept PHP 8.4+ native round() output as the correct values rather than carrying a non-standard pre-8.4 rounding port in the fork. Excel ROUND now maps to Kasko::ROUND -> native round(); the roundPre84/roundHelperPre84 port is removed. Insurer pricing snapshots are regenerated to the corrected figures in the consuming services. PHP 8.5 deprecation fixes on this branch (incl. the (int) $precision cast) are unaffected.
sukonovs
marked this pull request as ready for review
July 10, 2026 06:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://github.com/kasko/v2-quote-svc/pull/771 PHP 8.3 tests.
https://github.com/kasko/v2-quote-svc/pull/764 PHP 8.5 tests.
In php 8.5 tests there are updates of snapshots it is related to php rounding function changes not lib changes.
PHP 8.5 compatibility — what each error was, the fix, and why it's not breaking
This PR resolves the two PHP 8.5 deprecations CI flagged. Both are new in PHP 8.5 — they do not occur on PHP 8.3/8.4 — and every fix is behaviour-preserving on all supported versions. Verified locally: the 3 changed files lint clean on PHP 8.3, and each replacement produces byte-identical output to the original.
1.
Increment on non-numeric string is deprecated, use str_increment() insteadWhere:
Worksheet::rangeToArray()andReader\Xlsx\ColumnAndRowAttributes::readColumnAttributes().Cause: columns were advanced by incrementing the column letter as a string —
++$colturning"A" → "B","Z" → "AA", etc. (PHP's legacy "alphanumeric string increment"). PHP 8.5 deprecates++/--on non-numeric strings.Fix: perform the increment numerically via PhpSpreadsheet's own column helpers, then convert back to the letter:
Why it's not breaking: the string
++and the index round-trip are the same bijective base-26 mapping. Verified identical for every boundary case, including the last Excel column:2.
Using null as an array offset is deprecated, use an empty string insteadWhere:
Calculation::renameCalculationCacheForWorksheet().Cause:
$fromWorksheetNamemay benull, soisset($this->calculationCache[$fromWorksheetName])usesnullas an array key. PHP 8.5 deprecates usingnullas an array offset (previously it was silently coerced to the empty-string key"").Fix: coerce explicitly to the exact value PHP used implicitly:
Why it's not breaking: a
nullarray key has always resolved to the""key;?? ''just makes that explicit. For any non-null worksheet name the expression is unchanged.PHP 8.3 / 8.4 compatibility
Fully compatible — nothing observable changes on older versions:
"Z"++→"AA",isset($arr[null])→false).?? ''null-coalescing operator and theCoordinate::columnIndexFromString()/stringFromColumnIndex()helpers — has existed since long before 8.3.