Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested functions errors #1144

Open
ZhukV opened this issue Oct 11, 2023 · 5 comments
Open

Nested functions errors #1144

ZhukV opened this issue Oct 11, 2023 · 5 comments

Comments

@ZhukV
Copy link

ZhukV commented Oct 11, 2023

I try to use nested functions in my fixtures and receive error.

Fixture:

data: '<calculateFeeActionData("ababab", "acacac", <money("USD", "100.02")>)>'

Error:

Nelmio\Alice\Throwable\Exception\FixtureBuilder\ExpressionLanguage\MalformedFunctionException: The value "<money(__ARG_TOKEN__3518f8944d42212dd37daffe097d216e" contains an unclosed function.

The functions calculateFeeActionData and money presented by faker provider.

Full stack trace:

Nelmio\Alice\Throwable\Exception\FixtureBuilder\ExpressionLanguage\MalformedFunctionException: The value "<money(__ARG_TOKEN__3518f8944d42212dd37daffe097d216e" contains an unclosed function.

/code/vendor/nelmio/alice/src/Throwable/Exception/FixtureBuilder/ExpressionLanguage/ExpressionLanguageExceptionFactory.php:60
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTokenizer.php:116
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionTokenizer.php:43
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/FunctionLexer.php:52
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/GlobalPatternsLexer.php:61
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/ReferenceEscaperLexer.php:47
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Lexer/EmptyValueLexer.php:41
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/SimpleParser.php:55
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FunctionTokenParser.php:166
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FunctionTokenParser.php:130
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/FunctionTokenParser.php:98
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/IdentityTokenParser.php:74
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/Chainable/TolerantFunctionTokenParser.php:81
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/TokenParser/TokenParserRegistry.php:65
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/SimpleParser.php:88
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/SimpleParser.php:58
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/StringMergerParser.php:45
/code/vendor/nelmio/alice/src/FixtureBuilder/ExpressionLanguage/Parser/FunctionFixtureReferenceParser.php:48
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/SimpleValueDenormalizer.php:64
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/SimpleValueDenormalizer.php:43
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Value/UniqueValueDenormalizer.php:48
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/Property/SimplePropertyDenormalizer.php:39
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/SimpleSpecificationsDenormalizer.php:144
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SpecificationBagDenormalizer/SimpleSpecificationsDenormalizer.php:102
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/Chainable/SimpleDenormalizer.php:74
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/FixtureDenormalizerRegistry.php:59
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/TolerantFixtureDenormalizer.php:42
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/Fixture/SimpleFixtureBagDenormalizer.php:79
/code/vendor/nelmio/alice/src/FixtureBuilder/Denormalizer/SimpleDenormalizer.php:45
/code/vendor/nelmio/alice/src/FixtureBuilder/SimpleBuilder.php:38
/code/vendor/nelmio/alice/src/Loader/SimpleDataLoader.php:44
/code/vendor/nelmio/alice/src/Loader/SimpleFileLoader.php:46

Note: if I use function with one argument, all ok correctly.

@theofidry
Copy link
Member

Until a fix (see #998) I would suggest a custom faker provider (see https://github.com/nelmio/alice/blob/master/doc/customizing-data-generation.md#custom-faker-data-providers)

@d0niek
Copy link

d0niek commented Sep 13, 2024

Hi @theofidry!

Any progress on it?

@theofidry
Copy link
Member

No, and since there is a acceptable workaround it's far from being a priority to me atm.

@d0niek
Copy link

d0niek commented Sep 13, 2024

Oh.. please can you point me this "workaround"?

@theofidry
Copy link
Member

#1144 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants