Skip to content

Commit 7628348

Browse files
committed
Allow php-cs-fixer to Handle Implicit Backslashes
1 parent 8f4c541 commit 7628348

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+115
-110
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
205205
'strict_comparison' => false, // No, too dangerous to change that
206206
'strict_param' => false, // No, too dangerous to change that
207-
'string_implicit_backslashes' => false, // was escape_implicit_backslashes, too confusing
207+
'string_implicit_backslashes' => ['single_quoted' => 'unescape', 'double_quoted' => 'escape', 'heredoc' => 'escape'], // was escape_implicit_backslashes
208208
'string_line_ending' => true,
209209
'switch_case_semicolon_to_colon' => true,
210210
'switch_case_space' => true,

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org).
77

88
# TBD - 1.29.11
99

10+
### Changed
11+
12+
- Allow php-cs-fixer to Handle Implicit Backslashes.
13+
1014
### Fixed
1115

1216
- TEXT and TIMEVALUE functions. [Issue #4249](https://github.com/PHPOffice/PhpSpreadsheet/issues/4249) [PR #4352](https://github.com/PHPOffice/PhpSpreadsheet/pull/4352)

bin/findpolyfill.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ function findPolyfill(string $directory): int
66
// See issue #4215 - code which should have erred in unit test
77
// succeeded because a dev package required polyfills.
88
$retCode = 0;
9-
$polyfill80 = 'FILTER_VALIDATE_BOOL\\b'
9+
$polyfill80 = 'FILTER_VALIDATE_BOOL\b'
1010
. '|fdiv[(]'
1111
. '|preg_last_error_msg[(]'
1212
. '|str_contains[(]'
1313
. '|str_starts_with[(]'
1414
. '|str_ends_with[(]'
1515
. '|get_debug_type[(]'
1616
. '|get_resource_id[(]';
17-
$polyfill81 = 'MYSQLI_REFRESH_REPLICA\\b'
17+
$polyfill81 = 'MYSQLI_REFRESH_REPLICA\b'
1818
. '|fdiv[(]'
1919
. '|array_is_list[(]'
2020
. '|enum_exists[(]';
21-
$polyfill = '/\\b(?:'
21+
$polyfill = '/\b(?:'
2222
. $polyfill80
2323
. '|'
2424
. $polyfill81

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"spreadsheet"
1313
],
1414
"config": {
15+
"process-timeout": 600,
1516
"sort-packages": true,
1617
"allow-plugins": {
1718
"dealerdirect/phpcodesniffer-composer-installer": true

phpstan-conditional.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,28 @@
4949
//];
5050
// Erroneous analysis by Phpstan before PHP8 - mb_strlen does not return false
5151
$config['parameters']['ignoreErrors'][] = [
52-
'message' => '#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\StringHelper\\:\\:countCharacters\\(\\) should return int but returns int(<0, max>)?\\|false\\.$#',
52+
'message' => '#^Method PhpOffice\\\PhpSpreadsheet\\\Shared\\\StringHelper\:\:countCharacters\(\) should return int but returns int(<0, max>)?\|false\.$#',
5353
'path' => __DIR__ . '/src/PhpSpreadsheet/Shared/StringHelper.php',
5454
'count' => 1,
5555
];
5656
// New with Phpstan 1.9.2 for Php7 only
5757
$config['parameters']['ignoreErrors'][] = [
58-
'message' => '#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array<int, mixed>\\|false given.$#',
58+
'message' => '#^Parameter \#2 \.\.\.\$args of function array_merge expects array, array<int, mixed>\|false given.$#',
5959
'path' => __DIR__ . '/src/PhpSpreadsheet/Calculation/LookupRef/Sort.php',
6060
'count' => 1,
6161
];
6262
$config['parameters']['ignoreErrors'][] = [
63-
'message' => '#^Parameter \\#1 \\$input of function array_chunk expects array, array<int, float\\|int>\\|false given.$#',
63+
'message' => '#^Parameter \#1 \$input of function array_chunk expects array, array<int, float\|int>\|false given.$#',
6464
'path' => __DIR__ . '/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php',
6565
'count' => 1,
6666
];
6767
$config['parameters']['ignoreErrors'][] = [
68-
'message' => '#^Parameter \\#2 \\$array of function array_map expects array, array<int, float|int>\\|false given.$#',
68+
'message' => '#^Parameter \#2 \$array of function array_map expects array, array<int, float|int>\|false given.$#',
6969
'path' => __DIR__ . '/src/PhpSpreadsheet/Calculation/MathTrig/Random.php',
7070
'count' => 1,
7171
];
7272
$config['parameters']['ignoreErrors'][] = [
73-
'message' => '#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array<int, mixed>\\|false given.$#',
73+
'message' => '#^Parameter \#2 \.\.\.\$args of function array_merge expects array, array<int, mixed>\|false given.$#',
7474
'path' => __DIR__ . '/src/PhpSpreadsheet/Calculation/TextData/Text.php',
7575
'count' => 1,
7676
];

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Calculation
4646
// Defined Names: Named Range of cells, or Named Formulae
4747
const CALCULATION_REGEXP_DEFINEDNAME = '((([^\s,!&%^\/\*\+<>=-]*)|(\'(?:[^\']|\'[^!])+?\')|(\"(?:[^\"]|\"[^!])+?\"))!)?([_\p{L}][_\p{L}\p{N}\.]*)';
4848
// Structured Reference (Fully Qualified and Unqualified)
49-
const CALCULATION_REGEXP_STRUCTURED_REFERENCE = '([\p{L}_\\\\][\p{L}\p{N}\._]+)?(\[(?:[^\d\]+-])?)';
49+
const CALCULATION_REGEXP_STRUCTURED_REFERENCE = '([\p{L}_\\\][\p{L}\p{N}\._]+)?(\[(?:[^\d\]+-])?)';
5050
// Error
5151
const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?';
5252

src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function fromString($dateValue)
4646
}
4747

4848
// try to parse as date iff there is at least one digit
49-
if (is_string($dateValue) && preg_match('/\\d/', $dateValue) !== 1) {
49+
if (is_string($dateValue) && preg_match('/\d/', $dateValue) !== 1) {
5050
return ExcelError::VALUE();
5151
}
5252

src/PhpSpreadsheet/Calculation/DateTimeExcel/TimeValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function fromString($timeValue)
5757
}
5858

5959
// try to parse as time iff there is at least one digit
60-
if (is_string($timeValue) && preg_match('/\\d/', $timeValue) !== 1) {
60+
if (is_string($timeValue) && preg_match('/\d/', $timeValue) !== 1) {
6161
return ExcelError::VALUE();
6262
}
6363

src/PhpSpreadsheet/Calculation/Engine/Operands/StructuredReference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class StructuredReference implements Operand
2828
self::ITEM_SPECIFIER_TOTALS,
2929
];
3030

31-
private const TABLE_REFERENCE = '/([\p{L}_\\\\][\p{L}\p{N}\._]+)?(\[(?:[^\]\[]+|(?R))*+\])/miu';
31+
private const TABLE_REFERENCE = '/([\p{L}_\\\][\p{L}\p{N}\._]+)?(\[(?:[^\]\[]+|(?R))*+\])/miu';
3232

3333
private string $value;
3434

src/PhpSpreadsheet/Calculation/FormulaParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private function parseToTokens(): void
219219
// scientific notation check
220220
if (strpos(self::OPERATORS_SN, $this->formula[$index]) !== false) {
221221
if (strlen($value) > 1) {
222-
if (preg_match('/^[1-9]{1}(\\.\\d+)?E{1}$/', $this->formula[$index]) != 0) {
222+
if (preg_match('/^[1-9]{1}(\.\d+)?E{1}$/', $this->formula[$index]) != 0) {
223223
$value .= $this->formula[$index];
224224
++$index;
225225

0 commit comments

Comments
 (0)