mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-20 23:10:44 +00:00
40f7cd00db
We have identical constants defined in several places, and use literals in others. We aren't consistent in checking limits. This PR makes the use of the constants in Cell/AddressRange the "official" source, deprecates all other constants, and substitutes the constants wherever literals are used. A number of different edge case tests are added. During testing, I discovered that `columnIndexFromString` correctly throws an exception for 4-character string, but allows `XFE` through `ZZZ`, all of which are also invalid. There are similar inconsistencies with related routines, and this PR attempts to make them operate consistently. One suprise is that throwing for `row=0` causes serious regression problems, so it continues to be permitted (but the high row limit is enforced). Further, Reference Helper sometimes dips into negative numbers, resulting in totally unexpected results (-1 affects column Z, -2 column Y, etc.). It is changed to ignore rows and columns outside the limits.
59 lines
707 B
PHP
59 lines
707 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
return [
|
|
[
|
|
'A',
|
|
1,
|
|
],
|
|
[
|
|
'Z',
|
|
26,
|
|
],
|
|
[
|
|
'AA',
|
|
27,
|
|
],
|
|
[
|
|
'AB',
|
|
28,
|
|
],
|
|
[
|
|
'AZ',
|
|
52,
|
|
],
|
|
[
|
|
'BA',
|
|
53,
|
|
],
|
|
[
|
|
'BZ',
|
|
78,
|
|
],
|
|
[
|
|
'CA',
|
|
79,
|
|
],
|
|
[
|
|
'IV',
|
|
256,
|
|
],
|
|
[
|
|
'ZZ',
|
|
702,
|
|
],
|
|
[
|
|
'AAA',
|
|
703,
|
|
],
|
|
[
|
|
'BAA',
|
|
1379,
|
|
],
|
|
'zero not allowed' => ['exception', 0],
|
|
'negative not allowed' => ['exception', -1],
|
|
'maximum possible' => ['XFD', 16384],
|
|
'beyond maximum possible' => ['exception', 16385],
|
|
];
|