diff --git a/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php b/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php index 5ec3ca266..197402fa4 100644 --- a/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php +++ b/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTreeTokenizer.php @@ -48,7 +48,7 @@ final class FunctionTreeTokenizer public function tokenize(string $value): array { $value = preg_replace( - '/(.*?)<((?:.*?:)?(?:\p{L}|[0-9])+?)\((.*?)/', + '/(.*?)<((?:.*?:)?(?:\p{L}|_|[0-9])+?)\((.*?)/', sprintf('$1%1$sFUNCTION_START__$2__%1$s$3', self::DELIMITER), $value ); diff --git a/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php b/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php index 78067672c..8a98eae83 100644 --- a/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php +++ b/src/FixtureBuilder/ExpressionLanguage/Lexer/SubPatternsLexer.php @@ -46,7 +46,7 @@ final class SubPatternsLexer implements LexerInterface '/^(<\(.+\)>)/' => TokenType::IDENTITY_TYPE, '/^(<\S+\(.*\)>)/' => TokenType::FUNCTION_TYPE, '/^(<\S+>)/' => null, - '/^(\[[^\[\]]+\])/' => TokenType::STRING_ARRAY_TYPE, + '/^(\[[^\[\]]*\])/' => TokenType::STRING_ARRAY_TYPE, '/^(@[^\ @\{\<]+\(.*\))/' => self::REFERENCE_LEXER, // Function with text '/^(@[^\ @\<]+\{.*\}->\S+\(.*\))/' => self::REFERENCE_LEXER, // Range or list with function '/^(@[^\ @\<]+\{.*\}->[^\(\)\ \{]+)/' => self::REFERENCE_LEXER, // Range or list with property diff --git a/tests/Loader/LoaderIntegrationTest.php b/tests/Loader/LoaderIntegrationTest.php index 2a0c9ceb0..05c8a0415 100644 --- a/tests/Loader/LoaderIntegrationTest.php +++ b/tests/Loader/LoaderIntegrationTest.php @@ -2832,5 +2832,23 @@ public function provideFixturesToGenerate() ], ], ]; + + yield '[function] call nested PHP native function' => [ + [ + \stdClass::class => [ + 'dummy' => [ + 'foo' => '', + ], + ], + ], + [ + 'parameters' => [], + 'objects' => [ + 'dummy' => StdClassFactory::create([ + 'foo' => '[]', + ]), + ], + ], + ]; } }