Skip to content

Commit 99f5c18

Browse files
committed
Allow php-cs-fixer to Handle Implicit Backslashes
1 parent 12c2e79 commit 99f5c18

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

+110
-105
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
224224
'strict_comparison' => false, // No, too dangerous to change that
225225
'strict_param' => false, // No, too dangerous to change that
226-
'string_implicit_backslashes' => false, // was escape_implicit_backslashes, too confusing
226+
'string_implicit_backslashes' => ['single_quoted' => 'unescape', 'double_quoted' => 'escape', 'heredoc' => 'escape'], // was escape_implicit_backslashes
227227
'string_length_to_empty' => true,
228228
'string_line_ending' => true,
229229
'switch_case_semicolon_to_colon' => 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 - 2.1.10
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 #4353](https://github.com/PHPOffice/PhpSpreadsheet/pull/4353)

bin/findpolyfill.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ 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-
$polyfill81 = 'MYSQLI_REFRESH_REPLICA\\b'
9+
$polyfill81 = 'MYSQLI_REFRESH_REPLICA\b'
1010
. '|fdiv[(]'
1111
. '|array_is_list[(]'
1212
. '|enum_exists[(]';
13-
$polyfill = '/\\b(?:'
13+
$polyfill = '/\b(?:'
1414
. $polyfill81
1515
. ')/';
1616

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"platform": {
1616
"php" : "8.0.99"
1717
},
18+
"process-timeout": 600,
1819
"sort-packages": true,
1920
"allow-plugins": {
2021
"dealerdirect/phpcodesniffer-composer-installer": true

src/PhpSpreadsheet/Calculation/Calculation.php

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

src/PhpSpreadsheet/Calculation/DateTimeExcel/DateValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function fromString(null|array|string|int|bool|float $dateValue):
4747
}
4848

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

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

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

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

3434
private string $value;
3535

src/PhpSpreadsheet/Calculation/FormulaParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private function parseToTokens(): void
213213
// scientific notation check
214214
if (str_contains(self::OPERATORS_SN, $this->formula[$index])) {
215215
if (strlen($value) > 1) {
216-
if (preg_match('/^[1-9]{1}(\\.\\d+)?E{1}$/', $this->formula[$index]) != 0) {
216+
if (preg_match('/^[1-9]{1}(\.\d+)?E{1}$/', $this->formula[$index]) != 0) {
217217
$value .= $this->formula[$index];
218218
++$index;
219219

src/PhpSpreadsheet/Calculation/Functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public static function expandDefinedName(string $coordinate, Cell $cell): string
308308

309309
public static function trimTrailingRange(string $coordinate): string
310310
{
311-
return (string) preg_replace('/:[\\w\$]+$/', '', $coordinate);
311+
return (string) preg_replace('/:[\w\$]+$/', '', $coordinate);
312312
}
313313

314314
public static function trimSheetFromCellReference(string $coordinate): string

src/PhpSpreadsheet/Calculation/Internal/WildcardMatch.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ class WildcardMatch
66
{
77
private const SEARCH_SET = [
88
'~~', // convert double tilde to unprintable value
9-
'~\\*', // convert tilde backslash asterisk to [*] (matches literal asterisk in regexp)
10-
'\\*', // convert backslash asterisk to .* (matches string of any length in regexp)
11-
'~\\?', // convert tilde backslash question to [?] (matches literal question mark in regexp)
12-
'\\?', // convert backslash question to . (matches one character in regexp)
9+
'~\*', // convert tilde backslash asterisk to [*] (matches literal asterisk in regexp)
10+
'\*', // convert backslash asterisk to .* (matches string of any length in regexp)
11+
'~\?', // convert tilde backslash question to [?] (matches literal question mark in regexp)
12+
'\?', // convert backslash question to . (matches one character in regexp)
1313
"\x1c", // convert original double tilde to single tilde
1414
];
1515

0 commit comments

Comments
 (0)