Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

[EasyCodingStandardPrefixed] Failures with get_debug_type polyfill in prefixed phar package #2973

Closed
pdelre opened this issue Feb 19, 2021 · 3 comments

Comments

@pdelre
Copy link
Contributor

pdelre commented Feb 19, 2021

In 9.1.*, an Call to undefined function get_debug_type Fatal occurs in the symplify/easy-coding-standard-prefixed package. This error does not occur in symplify/easy-coding-standard-prefixed:9.0.* nor in symplify/easy-coding-standard:9.1.*.

🔴 symplify/easy-coding-standard-prefixed:9.1.*

# in a empty directory
$ composer require --dev 'symplify/easy-coding-standard-prefixed:9.1.*'
$ vendor/bin/ecs init
$ sed -i 's|// SetList::PSR_12|SetList::PSR_12|' ecs.php
$ vendor/bin/ecs check .

PHP Fatal error:  Uncaught Error: Call to undefined function get_debug_type() in /Users/pdelre/ecs-polyfill-issue/vendor/symplify/easy-coding-standard-prefixed/vendor/symfony/options-resolver/OptionsResolver.php:974
Stack trace:
#0 /Users/pdelre/ecs-polyfill-issue/vendor/symplify/easy-coding-standard-prefixed/vendor/symfony/options-resolver/OptionsResolver.php(863): _PhpScoper89c09b8e7101\Symfony\Component\OptionsResolver\OptionsResolver->verifyTypes('array', NULL, Array)
#1 /Users/pdelre/ecs-polyfill-issue/vendor/symplify/easy-coding-standard-prefixed/vendor/symfony/options-resolver/OptionsResolver.php(774): _PhpScoper89c09b8e7101\Symfony\Component\OptionsResolver\OptionsResolver->offsetGet('imports_order')
#2 /Users/pdelre/ecs-polyfill-issue/vendor/symplify/easy-coding-standard-prefixed/vendor/friendsofphp/php-cs-fixer/src/FixerConfiguration/FixerConfigurationResolver.php(89): _PhpScoper89c09b8e7101\Symfony\Component\OptionsResolver\OptionsResolv in /Users/pdelre/ecs-polyfill-issue/vendor/symplify/easy-coding-standard-prefixed/vendor/symfony/options-resolver/OptionsResolver.php on line 974

Fatal error: Uncaught Error: Call to undefined function get_debug_type() in /Users/pdelre/ecs-polyfill-issue/vendor/symplify/easy-coding-standard-prefixed/vendor/symfony/options-resolver/OptionsResolver.php on line 974

🟢 symplify/easy-coding-standard-prefixed:9.0.*

# in a empty directory
$ composer require --dev 'symplify/easy-coding-standard-prefixed:9.0.*'
$ vendor/bin/ecs init
$ sed -i 's|// SetList::PSR_12|SetList::PSR_12|' ecs.php
$ vendor/bin/ecs check .

 [OK] No errors found. Great job - your code is shiny in style!

🟢 symplify/easy-coding-standard:9.1.*

# in a empty directory
$ composer require --dev 'symplify/easy-coding-standard:9.1.*'
$ vendor/bin/ecs init
$ sed -i 's|// SetList::PSR_12|SetList::PSR_12|' ecs.php
$ vendor/bin/ecs check .

 [OK] No errors found. Great job - your code is shiny in style!
@TomasVotruba
Copy link
Member

TomasVotruba commented Feb 19, 2021

Hi, thanks for report. This must be fixed in php-scoper, see rectorphp/rector#5617

@pdelre
Copy link
Contributor Author

pdelre commented Feb 19, 2021

@TomasVotruba Is there any interest in adding the symfony polyfills to scoper.inc.php's files-whitelist (workaround mentioned in humbug/php-scoper#440)? I would draft a PR doing so, but how to test with the symplify repo structure is a little confusing for me.

This appears to have been done for symfony/deprecation-contracts in the past, so there's some precedence of hardcoding files in vendor/. Alternatively, infection/infection took dynamic approach to add the various symfony/polyfill-* bootstrap files.

@TomasVotruba
Copy link
Member

I would draft a PR doing so, but how to test with the symplify repo structure is a little confusing for me.

Definitely, go for it 👍

There are currently no tests for split ECS prefixed, but they're welcomed too.
Adding scoped version is happening here in this workflow:
https://github.com/symplify/symplify/blob/016d2cbd4a1a112266f7e3146bd2c62e06a24db3/.github/workflows/build_scoped_packages.yaml#L51

@deprecated-packages deprecated-packages locked as resolved and limited conversation to collaborators May 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants