schranz-php-recipes / symfony-recipes-yaml-to-php-converter

A wrapper around symplify/config-transformer used to update recipes and using easy coding standard for generating readable config files.
MIT License
5 stars 0 forks source link

Enum error in YamlLoader #11

Open alexander-schranz opened 10 months ago

alexander-schranz commented 10 months ago

Currently we have the following error:

  datana-gmbh/logz-io-handler/1.7/config .............................. FAILED  
    The command "'/usr/bin/php8.1' '/home/runner/work/symfony-recipes-php-contrib/symfony-recipes-php-contrib/vendor/bin/config-transformer' 'switch-format' '/home/runner/work/symfony-recipes-php-contrib/symfony-recipes-php-contrib/datana-gmbh/logz-io-handler/1.7/config'" failed.
Exit Code: 1
(General error) Working directory: /home/runner/work/symfony-recipes-php-contrib/symfony-recipes-php-contrib Output: ================ Error

Output: ================ In YamlFileLoader.php line 596: The file "/home/runner/work/symfony-recipes-php-contrib/symfony-recipes-php -contrib/datana-gmbh/logz-io-handler/1.7/config/packages/datana_logz_io_han dler.yaml" does not contain valid YAML:

The enum "Inpsyde\LogzIoMonolog\Enum\Host::EuCentral1" is not defined at line 8 (near "$host: !php/enum Inpsyde\LogzIoMonolog\Enum\Host::EuCentral1"). In Inline.php line 578: The enum "Inpsyde\LogzIoMonolog\Enum\Host::EuCentral1" i

We are converting without installing here things If I remember correctly but not sure. I don't know yet how we can fix that as the error is in the YamlFileLoader not able to ignore the Enum.

@TomasVotruba do you maybe have an idea?

TomasVotruba commented 10 months ago

Hi, this might be related to new symfony/yaml release, as I've tagged new package. Not sure what exactly.

alexander-schranz commented 10 months ago

@TomasVotruba I will do some testing with the newer config-transformer and symfony/yaml version I locked the versions as I not accidently wanted to get breaking changes. I will let you know if it disappears on newer version. But you do not remember any changes in the config-transformer itself fixing such problem with the YamlFileLoader.

If it does not work I maybe thinking about creating "Fake" enums by extract them via regex before transforming would that be something which make sense to contribute back to simplify/config-transformer package? Else I can keep it inside this package.

TomasVotruba commented 10 months ago

Tests were passing for config-transformer :+1: but I'm not sure if enums were working even before. I only use it config-transformer on legacy projects, where it's mostly PHP 5.6-7.4 :)