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

[Bug] Type error when trying to convert config/services.yaml #42

Closed
COil opened this issue Dec 3, 2024 · 4 comments
Closed

[Bug] Type error when trying to convert config/services.yaml #42

COil opened this issue Dec 3, 2024 · 4 comments

Comments

@COil
Copy link

COil commented Dec 3, 2024

Stack

  • PHP 8.2
  • Symfony 7.2.0

Bug

Hello, I used simplify/config-transformer on MicroSymfony (PR), it worked well except for the config/services.yaml file, I had to convert manually. I have the following error :

   ~/Sites/microsymfony  $ feat/use-php-config !14 ?12 $ vendor/bin/config-transformer switch-format config/services.yaml                                                                                                                                               ✔   8.4.1  17:47:04
PHP Fatal error:  Uncaught TypeError: Symplify\PhpConfigPrinter\NodeFactory\Service\AutoBindNodeFactory::createBindMethodCall(): Argument #2 ($bindValues) must be of type array, null given, called in /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/Service/AutoBindNodeFactory.php on line 48 and defined in /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/Service/AutoBindNodeFactory.php:59
Stack trace:
#0 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/Service/AutoBindNodeFactory.php(48): Symplify\PhpConfigPrinter\NodeFactory\Service\AutoBindNodeFactory->createBindMethodCall(Object(ConfigTransformerPrefix202401\PhpParser\Node\Expr\MethodCall), NULL)
#1 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/CaseConverter/ServicesDefaultsCaseConverter.php(33): Symplify\PhpConfigPrinter\NodeFactory\Service\AutoBindNodeFactory->createAutoBindCalls(Array, Object(ConfigTransformerPrefix202401\PhpParser\Node\Expr\MethodCall))
#2 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php(192): Symplify\PhpConfigPrinter\CaseConverter\ServicesDefaultsCaseConverter->convertToMethodCallStmt('_defaults', Array)
#3 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php(90): Symplify\PhpConfigPrinter\NodeFactory\ContainerConfiguratorReturnClosureFactory->resolveStmt('services', '_defaults', Array)
#4 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php(69): Symplify\PhpConfigPrinter\NodeFactory\ContainerConfiguratorReturnClosureFactory->createStmtsFromCaseConverters(Array)
#5 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/ContainerConfiguratorReturnClosureFactory.php(58): Symplify\PhpConfigPrinter\NodeFactory\ContainerConfiguratorReturnClosureFactory->createClosureStmts(Array)
#6 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/src/Converter/YamlToPhpConverter.php(76): Symplify\PhpConfigPrinter\NodeFactory\ContainerConfiguratorReturnClosureFactory->createFromYamlArray(Array)
#7 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/src/Converter/YamlToPhpConverter.php(65): Symplify\ConfigTransformer\Converter\YamlToPhpConverter->convertYamlArray(Array, '/Users/coil/Sit...')
#8 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/src/Converter/ConfigFormatConverter.php(40): Symplify\ConfigTransformer\Converter\YamlToPhpConverter->convert('# This file is ...', '/Users/coil/Sit...')
#9 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/src/Console/Command/SwitchFormatCommand.php(74): Symplify\ConfigTransformer\Converter\ConfigFormatConverter->convert(Object(ConfigTransformerPrefix202401\Symfony\Component\Finder\SplFileInfo))
#10 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symfony/console/Command/Command.php(327): Symplify\ConfigTransformer\Console\Command\SwitchFormatCommand->execute(Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Input\ArgvInput), Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Output\ConsoleOutput))
#11 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symfony/console/Application.php(960): ConfigTransformerPrefix202401\Symfony\Component\Console\Command\Command->run(Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Input\ArgvInput), Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Output\ConsoleOutput))
#12 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symfony/console/Application.php(333): ConfigTransformerPrefix202401\Symfony\Component\Console\Application->doRunCommand(Object(Symplify\ConfigTransformer\Console\Command\SwitchFormatCommand), Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Input\ArgvInput), Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Output\ConsoleOutput))
#13 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symfony/console/Application.php(216): ConfigTransformerPrefix202401\Symfony\Component\Console\Application->doRun(Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Input\ArgvInput), Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Output\ConsoleOutput))
#14 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/bin/config-transformer.php(34): ConfigTransformerPrefix202401\Symfony\Component\Console\Application->run(Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Input\ArgvInput), Object(ConfigTransformerPrefix202401\Symfony\Component\Console\Output\ConsoleOutput))
#15 /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/bin/config-transformer(5): require('/Users/coil/Sit...')
#16 /Users/coil/Sites/microsymfony/vendor/bin/config-transformer(119): include('/Users/coil/Sit...')
#17 {main}
  thrown in /Users/coil/Sites/microsymfony/vendor/symplify/config-transformer/vendor/symplify/php-config-printer/src/NodeFactory/Service/AutoBindNodeFactory.php on line 59

Reproducer

It can be reproduced on the main branch of MicroSymfony.

Thanks. See you. COil

@COil COil changed the title [Bug] Cannot [Bug] Type error when trying to convert config/services.yaml Dec 3, 2024
@TomasVotruba
Copy link
Member

Thanks for sharing.
What was the minimal line causing this?

@COil
Copy link
Author

COil commented Dec 4, 2024

I just retried and it works now! Thanks.

@COil COil closed this as completed Dec 4, 2024
@COil
Copy link
Author

COil commented Dec 4, 2024

I have made a PR a MicroSymfony, does that seems O to you @TomasVotruba? See you.

@COil
Copy link
Author

COil commented Dec 4, 2024

I have also added a link in the README to your blog post (https://tomasvotruba.com/blog/2020/07/27/how-to-switch-from-yaml-xml-configs-to-php-today-with-migrify/). See you, and thanks for this library. :)

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

No branches or pull requests

2 participants