Skip to content

Commit 54262b5

Browse files
committed
Leverage str_ends_with
added the php80 polyfill to requirements when necessary
1 parent d5a2222 commit 54262b5

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Exception/ParseException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function updateRepr()
114114
$this->message = $this->rawMessage;
115115

116116
$dot = false;
117-
if ('.' === substr($this->message, -1)) {
117+
if (str_ends_with($this->message, '.')) {
118118
$this->message = substr($this->message, 0, -1);
119119
$dot = true;
120120
}

Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private function doParse(string $value, int $flags)
463463
$value .= ' ';
464464
}
465465

466-
if ('' !== trim($line) && '\\' === substr($line, -1)) {
466+
if ('' !== trim($line) && str_ends_with($line, '\\')) {
467467
$value .= ltrim(substr($line, 0, -1));
468468
} elseif ('' !== trim($line)) {
469469
$value .= trim($line);
@@ -472,7 +472,7 @@ private function doParse(string $value, int $flags)
472472
if ('' === trim($line)) {
473473
$previousLineWasNewline = true;
474474
$previousLineWasTerminatedWithBackslash = false;
475-
} elseif ('\\' === substr($line, -1)) {
475+
} elseif (str_ends_with($line, '\\')) {
476476
$previousLineWasNewline = false;
477477
$previousLineWasTerminatedWithBackslash = true;
478478
} else {

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
],
1818
"require": {
1919
"php": ">=7.1.3",
20-
"symfony/polyfill-ctype": "~1.8"
20+
"symfony/polyfill-ctype": "~1.8",
21+
"symfony/polyfill-php80": "^1.16"
2122
},
2223
"require-dev": {
2324
"symfony/console": "^3.4|^4.0|^5.0"

0 commit comments

Comments
 (0)