From 0808642660cd45a369b6a7daa5bc9a119258bacd Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Thu, 9 Dec 2021 22:33:04 +0100 Subject: [PATCH 1/8] enh(php) Switch highlighter to partially case-insensitive --- src/languages/php.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/languages/php.js b/src/languages/php.js index b0736a2014..4656a8ef79 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -56,11 +56,11 @@ export default function(hljs) { const NUMBER = { className: 'number', variants: [ - { begin: `\\b0b[01]+(?:_[01]+)*\\b` }, // Binary w/ underscore support - { begin: `\\b0o[0-7]+(?:_[0-7]+)*\\b` }, // Octals w/ underscore support - { begin: `\\b0x[\\da-f]+(?:_[\\da-f]+)*\\b` }, // Hex w/ underscore support + { begin: `\\b0[bB][01]+(?:_[01]+)*\\b` }, // Binary w/ underscore support + { begin: `\\b0[oO][0-7]+(?:_[0-7]+)*\\b` }, // Octals w/ underscore support + { begin: `\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b` }, // Hex w/ underscore support // Decimals w/ underscore support, with optional fragments and scientific exponent (e) suffix. - { begin: `(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:e[+-]?\\d+)?` } + { begin: `(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?` } ], relevance: 0 }; @@ -269,7 +269,7 @@ export default function(hljs) { built_in: BUILT_INS }; return { - case_insensitive: true, + case_insensitive: false, keywords: KEYWORDS, contains: [ hljs.HASH_COMMENT_MODE, From f7ef5741ebd4582bc21a8ebc6d614059ba02a8ec Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Fri, 10 Dec 2021 13:33:37 -0500 Subject: [PATCH 2/8] chore(php) support dual-cased literals --- src/languages/php.js | 23 ++++++++++++++++++++++- test/markup/php/case.expect.txt | 8 ++++++++ test/markup/php/case.txt | 8 ++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/markup/php/case.expect.txt create mode 100644 test/markup/php/case.txt diff --git a/src/languages/php.js b/src/languages/php.js index 4656a8ef79..9d38213f8f 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -263,9 +263,30 @@ export default function(hljs) { "stdClass" ]; + /** Dual-case keywords + * + * ["then","FILE"] => + * ["then", "THEN", "FILE", "file"] + * + * @param {string[]} items */ + const dualCase = (items) => { + /** @type string[] */ + const result = []; + items.forEach(item => { + if (item.toLowerCase() === item) { + result.push(item); + result.push(item.toUpperCase()); + } else { + result.push(item); + result.push(item.toLowerCase()); + } + }); + return result; + }; + const KEYWORDS = { keyword: KWS, - literal: LITERALS, + literal: dualCase(LITERALS), built_in: BUILT_INS }; return { diff --git a/test/markup/php/case.expect.txt b/test/markup/php/case.expect.txt new file mode 100644 index 0000000000..e75606fd72 --- /dev/null +++ b/test/markup/php/case.expect.txt @@ -0,0 +1,8 @@ +$test = true +$test = TRUE + +$a = false +$a = FALSE + +$b = null +$b = NULL diff --git a/test/markup/php/case.txt b/test/markup/php/case.txt new file mode 100644 index 0000000000..079112129e --- /dev/null +++ b/test/markup/php/case.txt @@ -0,0 +1,8 @@ +$test = true +$test = TRUE + +$a = false +$a = FALSE + +$b = null +$b = NULL From 79e7a46e60ee347ce0b4b74ce9eb85b33a5dad61 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Sat, 11 Dec 2021 22:59:35 +0100 Subject: [PATCH 3/8] enh(php) support function invoke --- src/languages/php.js | 33 +++++++++++++++++++++------- test/markup/php/functions.expect.txt | 10 +++++++++ test/markup/php/functions.txt | 10 +++++++++ test/markup/php/strings.expect.txt | 4 ++-- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/languages/php.js b/src/languages/php.js index 9d38213f8f..baf64f5d9f 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -11,6 +11,7 @@ Category: common * @returns {LanguageDetail} * */ export default function(hljs) { + const regex = hljs.regex; const VARIABLE = { className: 'variable', begin: '\\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' + @@ -145,7 +146,6 @@ export default function(hljs) { "isset", "iterable", "list", - "match|0", "mixed", "new", "object", @@ -172,7 +172,6 @@ export default function(hljs) { const BUILT_INS = [ // Standard PHP library: // - "Error|0", "AppendIterator", "ArgumentCountError", "ArithmeticError", @@ -273,11 +272,10 @@ export default function(hljs) { /** @type string[] */ const result = []; items.forEach(item => { + result.push(item); if (item.toLowerCase() === item) { - result.push(item); result.push(item.toUpperCase()); } else { - result.push(item); result.push(item.toLowerCase()); } }); @@ -285,9 +283,23 @@ export default function(hljs) { }; const KEYWORDS = { - keyword: KWS, + keyword: KWS.concat([ "match|0" ]), literal: dualCase(LITERALS), - built_in: BUILT_INS + built_in: BUILT_INS.concat([ "Error|0" ]), + }; + + const FUNCTION_INVOKE = { + relevance: 0, + match: [ + /(?:->|::|\s|\(|\\)/, + regex.concat("(?!fn\\b|function\\b|match\\b|", KWS.join("\\b|"), "|", BUILT_INS.join("\\b|"), "\\b)"), + /\w+/, + /\s*/, + regex.lookahead(/(?=\()/) + ], + scope: { + 3: "function.title.invoke", + } }; return { case_insensitive: false, @@ -328,9 +340,14 @@ export default function(hljs) { begin: /\$this\b/ }, VARIABLE, + FUNCTION_INVOKE, { // swallow composed identifiers to avoid parsing them as keywords - begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ + begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?!\()/ + }, + { + // swallow create object + begin: /new\s\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\s?\(/ }, { className: 'function', @@ -378,7 +395,7 @@ export default function(hljs) { }, // both use and namespace still use "old style" rules (vs multi-match) // because the namespace name can include `\` and we still want each - // element to be treated as it's own *individual* title + // element to be treated as its own *individual* title { beginKeywords: 'namespace', relevance: 0, diff --git a/test/markup/php/functions.expect.txt b/test/markup/php/functions.expect.txt index d161e753f4..ba14faad0b 100644 --- a/test/markup/php/functions.expect.txt +++ b/test/markup/php/functions.expect.txt @@ -6,3 +6,13 @@ $fn2 = function ($x) use ($y) { return $x + $y; }; + +/** + * Function invoke + */ +$date = new DateTimeImmutable (); +$date->format('Y-m-d'); + +DateTimeImmutable::createFromMutable(new \DateTime()); + +str_contains (\strtoupper(substr('abcdef', -2), 'f')); diff --git a/test/markup/php/functions.txt b/test/markup/php/functions.txt index 2eec171beb..525442d0bf 100644 --- a/test/markup/php/functions.txt +++ b/test/markup/php/functions.txt @@ -6,3 +6,13 @@ $fn1 = fn($x) => $x + $y; $fn2 = function ($x) use ($y) { return $x + $y; }; + +/** + * Function invoke + */ +$date = new DateTimeImmutable (); +$date->format('Y-m-d'); + +DateTimeImmutable::createFromMutable(new \DateTime()); + +str_contains (\strtoupper(substr('abcdef', -2), 'f')); diff --git a/test/markup/php/strings.expect.txt b/test/markup/php/strings.expect.txt index a547757933..56f3428e3b 100644 --- a/test/markup/php/strings.expect.txt +++ b/test/markup/php/strings.expect.txt @@ -12,12 +12,12 @@ MSG); // heredoc syntax -var_dump(<<<SQL +var_dump(<<<SQL SELECT * FROM table SQL); -var_dump(<<<SQL +var_dump(<<<SQL SELECT * FROM table SQL); From 7acf6f7ef834457234e135b720ab484f53b829a1 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Sun, 12 Dec 2021 19:11:43 +0100 Subject: [PATCH 4/8] enh(php) support class constructor call --- CHANGES.md | 3 +++ src/languages/php.js | 30 ++++++++++++++++++++++------ test/markup/php/functions.expect.txt | 23 +++++++++++++++++++-- test/markup/php/functions.txt | 21 ++++++++++++++++++- 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a15582a946..c0e510146f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,9 @@ These changes should be for the better and should not be super noticeable but if Grammars: +- enh(php) support class constructor call (#3427) [Wojciech Kania][] +- enh(php) support function invoke (#3427) [Wojciech Kania][] +- enh(php) Switch highlighter to partially case-insensitive (#3427) [Wojciech Kania][] - enh(php) improve `namespace` and `use` highlighting (#3427) [Josh Goebel][] - enh(php) `$this` is a `variable.language` now (#3427) [Josh Goebel][] - enh(php) add `__COMPILER_HALT_OFFSET__` (#3427) [Josh Goebel][] diff --git a/src/languages/php.js b/src/languages/php.js index baf64f5d9f..d37403ff99 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -288,11 +288,31 @@ export default function(hljs) { built_in: BUILT_INS.concat([ "Error|0" ]), }; + const CONSTRUCTOR_CALL = { + variants: [ + { + match: [ + /new/, + /\s+/, + // to prevent built ins from being confused as the class constructor call + regex.concat("(?!", BUILT_INS.join("\\b|"), "\\b)"), + /\\?\w+/, + /\s*\(/, + ], + scope: { + 1: "keyword", + 4: "title.class", + }, + } + ] + }; + const FUNCTION_INVOKE = { relevance: 0, match: [ /(?:->|::|\s|\(|\\)/, - regex.concat("(?!fn\\b|function\\b|match\\b|", KWS.join("\\b|"), "|", BUILT_INS.join("\\b|"), "\\b)"), + // to prevent keywords from being confused as the function title + regex.concat("(?!fn\\b|function\\b|match\\b|Error\\b|", KWS.join("\\b|"), "|", BUILT_INS.join("\\b|"), "\\b)"), /\w+/, /\s*/, regex.lookahead(/(?=\()/) @@ -301,6 +321,7 @@ export default function(hljs) { 3: "function.title.invoke", } }; + return { case_insensitive: false, keywords: KEYWORDS, @@ -343,12 +364,9 @@ export default function(hljs) { FUNCTION_INVOKE, { // swallow composed identifiers to avoid parsing them as keywords - begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?!\()/ - }, - { - // swallow create object - begin: /new\s\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\s?\(/ + begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ }, + CONSTRUCTOR_CALL, { className: 'function', relevance: 0, diff --git a/test/markup/php/functions.expect.txt b/test/markup/php/functions.expect.txt index ba14faad0b..2302fa6297 100644 --- a/test/markup/php/functions.expect.txt +++ b/test/markup/php/functions.expect.txt @@ -10,9 +10,28 @@ /** * Function invoke */ -$date = new DateTimeImmutable (); +$date = new DateTimeImmutable (); $date->format('Y-m-d'); -DateTimeImmutable::createFromMutable(new \DateTime()); +DateTimeImmutable::createFromMutable(new \DateTime('now')); str_contains (\strtoupper(substr('abcdef', -2), 'f')); + +/** + * Function declaration + */ +function testMe(string|int $name): int +{ + if (empty($name)) { + return 0; + } elseif ($name === 1) { + return (int) $name; + } + + switch($name) { + case '2': + return 2; + default: + throw new \Exception('error'); + } +} diff --git a/test/markup/php/functions.txt b/test/markup/php/functions.txt index 525442d0bf..077283afeb 100644 --- a/test/markup/php/functions.txt +++ b/test/markup/php/functions.txt @@ -13,6 +13,25 @@ $fn2 = function ($x) use ($y) { $date = new DateTimeImmutable (); $date->format('Y-m-d'); -DateTimeImmutable::createFromMutable(new \DateTime()); +DateTimeImmutable::createFromMutable(new \DateTime('now')); str_contains (\strtoupper(substr('abcdef', -2), 'f')); + +/** + * Function declaration + */ +function testMe(string|int $name): int +{ + if (empty($name)) { + return 0; + } elseif ($name === 1) { + return (int) $name; + } + + switch($name) { + case '2': + return 2; + default: + throw new \Exception('error'); + } +} From 6a3220f26d9ca65da006c66fad19795d6b9ecbfb Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Mon, 13 Dec 2021 20:24:40 +0100 Subject: [PATCH 5/8] chore(php) normalize keywords --- src/languages/php.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/languages/php.js b/src/languages/php.js index d37403ff99..e5339e0eb1 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -146,6 +146,7 @@ export default function(hljs) { "isset", "iterable", "list", + "match|0", "mixed", "new", "object", @@ -172,6 +173,7 @@ export default function(hljs) { const BUILT_INS = [ // Standard PHP library: // + "Error|0", "AppendIterator", "ArgumentCountError", "ArithmeticError", @@ -283,9 +285,17 @@ export default function(hljs) { }; const KEYWORDS = { - keyword: KWS.concat([ "match|0" ]), + keyword: KWS, literal: dualCase(LITERALS), - built_in: BUILT_INS.concat([ "Error|0" ]), + built_in: BUILT_INS, + }; + + /** + * @param {string[]} items */ + const normalizeKeywords = (items) => { + return items.map(item => { + return item.replace(/\|\d+$/, ""); + }); }; const CONSTRUCTOR_CALL = { @@ -295,7 +305,7 @@ export default function(hljs) { /new/, /\s+/, // to prevent built ins from being confused as the class constructor call - regex.concat("(?!", BUILT_INS.join("\\b|"), "\\b)"), + regex.concat("(?!", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"), /\\?\w+/, /\s*\(/, ], @@ -312,7 +322,7 @@ export default function(hljs) { match: [ /(?:->|::|\s|\(|\\)/, // to prevent keywords from being confused as the function title - regex.concat("(?!fn\\b|function\\b|match\\b|Error\\b|", KWS.join("\\b|"), "|", BUILT_INS.join("\\b|"), "\\b)"), + regex.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"), /\w+/, /\s*/, regex.lookahead(/(?=\()/) From 7603452247164df66f29d194affc6cedbf9b8330 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Tue, 14 Dec 2021 18:26:17 +0100 Subject: [PATCH 6/8] enh(php) support First-class Callable Syntax --- CHANGES.md | 2 ++ src/languages/php.js | 11 ++++++----- test/markup/php/functions.expect.txt | 6 ++++++ test/markup/php/functions.txt | 6 ++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c0e510146f..05034fcaea 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ These changes should be for the better and should not be super noticeable but if Grammars: +- enh(php) support First-class Callable Syntax (#3427) [Wojciech Kania][] - enh(php) support class constructor call (#3427) [Wojciech Kania][] - enh(php) support function invoke (#3427) [Wojciech Kania][] - enh(php) Switch highlighter to partially case-insensitive (#3427) [Wojciech Kania][] @@ -49,6 +50,7 @@ Themes: - Modified background color in css for Gradient Light and Gradient Dark themes [Samia Ali][] +[Wojciech Kania]: https://github.com/wkania [Jeylani B]: https://github.com/jeyllani [Richard Gibson]: https://github.com/gibson042 [Bradley Mackey]: https://github.com/bradleymackey diff --git a/src/languages/php.js b/src/languages/php.js index e5339e0eb1..f88609e1b0 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -303,11 +303,11 @@ export default function(hljs) { { match: [ /new/, - /\s+/, + / +/, // to prevent built ins from being confused as the class constructor call regex.concat("(?!", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"), /\\?\w+/, - /\s*\(/, + / *\(/, ], scope: { 1: "keyword", @@ -320,11 +320,11 @@ export default function(hljs) { const FUNCTION_INVOKE = { relevance: 0, match: [ - /(?:->|::|\s|\(|\\)/, + /\b/, // to prevent keywords from being confused as the function title regex.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"), /\w+/, - /\s*/, + / */, regex.lookahead(/(?=\()/) ], scope: { @@ -374,7 +374,8 @@ export default function(hljs) { FUNCTION_INVOKE, { // swallow composed identifiers to avoid parsing them as keywords - begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/ + begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?! *\()(?![a-zA-Z0-9_\x7f-\xff])/, + // scope:"wrong" }, CONSTRUCTOR_CALL, { diff --git a/test/markup/php/functions.expect.txt b/test/markup/php/functions.expect.txt index 2302fa6297..946c41bd67 100644 --- a/test/markup/php/functions.expect.txt +++ b/test/markup/php/functions.expect.txt @@ -35,3 +35,9 @@ DateTimeImmutable::createFromMutable throw new \Exception('error'); } } + +/** + * First-class Callable Syntax + */ +$fun = mb_strlen(); +$fun(); diff --git a/test/markup/php/functions.txt b/test/markup/php/functions.txt index 077283afeb..86f7fd48a4 100644 --- a/test/markup/php/functions.txt +++ b/test/markup/php/functions.txt @@ -35,3 +35,9 @@ function testMe(string|int $name): int throw new \Exception('error'); } } + +/** + * First-class Callable Syntax + */ +$fun = mb_strlen(); +$fun(); From d6e220e20400d944aa20fe8490f0fd40fa1f0c83 Mon Sep 17 00:00:00 2001 From: Wojciech Kania Date: Wed, 15 Dec 2021 22:38:14 +0100 Subject: [PATCH 7/8] chore(php) add list of valid whitespaces --- src/languages/php.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/languages/php.js b/src/languages/php.js index f88609e1b0..4832f88d71 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -46,6 +46,8 @@ export default function(hljs) { end: /[ \t]*(\w+)\b/, contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST), }); + // list of valid whitespaces because non-breaking space might be part of a name + const WHITESPACE = '[ \t\n]'; const STRING = { className: 'string', variants: [ @@ -303,11 +305,11 @@ export default function(hljs) { { match: [ /new/, - / +/, + regex.concat(WHITESPACE, "+"), // to prevent built ins from being confused as the class constructor call regex.concat("(?!", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"), /\\?\w+/, - / *\(/, + regex.concat(WHITESPACE, "*\\("), ], scope: { 1: "keyword", @@ -324,7 +326,7 @@ export default function(hljs) { // to prevent keywords from being confused as the function title regex.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS).join("\\b|"), "\\b)"), /\w+/, - / */, + regex.concat(WHITESPACE, "*"), regex.lookahead(/(?=\()/) ], scope: { @@ -374,7 +376,11 @@ export default function(hljs) { FUNCTION_INVOKE, { // swallow composed identifiers to avoid parsing them as keywords - begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?! *\()(?![a-zA-Z0-9_\x7f-\xff])/, + match: regex.concat( + /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/, + regex.concat("(?!", WHITESPACE, "*\\()"), + /(?![a-zA-Z0-9_\x7f-\xff])/ + ), // scope:"wrong" }, CONSTRUCTOR_CALL, From 9c711ed9a30481abd7bd7dde527fc2f73de6297d Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Wed, 15 Dec 2021 17:43:39 -0500 Subject: [PATCH 8/8] fix: correct parent scope is `title` - also add `title.function.invoke` to the official list (Rust was already using) --- docs/css-classes-reference.rst | 2 ++ src/languages/php.js | 2 +- test/markup/php/functions.expect.txt | 8 ++++---- test/markup/php/strings.expect.txt | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/css-classes-reference.rst b/docs/css-classes-reference.rst index 70d45e4dc4..9cea743642 100644 --- a/docs/css-classes-reference.rst +++ b/docs/css-classes-reference.rst @@ -70,6 +70,8 @@ in mind so a better choice (for best theme support) might possibly be ``string`` +--------------------------+-------------------------------------------------------------+ | title.function | name of a function | +--------------------------+-------------------------------------------------------------+ +| title.function.invoke | name of a function (when being invoked) | ++--------------------------+-------------------------------------------------------------+ | params | block of function arguments (parameters) at the | | | place of declaration | +--------------------------+-------------------------------------------------------------+ diff --git a/src/languages/php.js b/src/languages/php.js index 4832f88d71..371ef2ae78 100644 --- a/src/languages/php.js +++ b/src/languages/php.js @@ -330,7 +330,7 @@ export default function(hljs) { regex.lookahead(/(?=\()/) ], scope: { - 3: "function.title.invoke", + 3: "title.function.invoke", } }; diff --git a/test/markup/php/functions.expect.txt b/test/markup/php/functions.expect.txt index 946c41bd67..f6bc43f49a 100644 --- a/test/markup/php/functions.expect.txt +++ b/test/markup/php/functions.expect.txt @@ -11,11 +11,11 @@ * Function invoke */ $date = new DateTimeImmutable (); -$date->format('Y-m-d'); +$date->format('Y-m-d'); -DateTimeImmutable::createFromMutable(new \DateTime('now')); +DateTimeImmutable::createFromMutable(new \DateTime('now')); -str_contains (\strtoupper(substr('abcdef', -2), 'f')); +str_contains (\strtoupper(substr('abcdef', -2), 'f')); /** * Function declaration @@ -39,5 +39,5 @@ DateTimeImmutable::createFromMutable /** * First-class Callable Syntax */ -$fun = mb_strlen(); +$fun = mb_strlen(); $fun(); diff --git a/test/markup/php/strings.expect.txt b/test/markup/php/strings.expect.txt index 56f3428e3b..8a9c4dd8f5 100644 --- a/test/markup/php/strings.expect.txt +++ b/test/markup/php/strings.expect.txt @@ -12,12 +12,12 @@ MSG); // heredoc syntax -var_dump(<<<SQL +var_dump(<<<SQL SELECT * FROM table SQL); -var_dump(<<<SQL +var_dump(<<<SQL SELECT * FROM table SQL);