php-scoper icon indicating copy to clipboard operation
php-scoper copied to clipboard

Scoping Interfaces implemented by Enums

Open danielmaier42 opened this issue 10 months ago • 3 comments

Bug report

Question Answer
PHP-Scoper version 0.18.17
PHP version 8.3.16
Platform with version macOS Sequoia 15.3.1

We have some Enums which do implement our own Interfaces. When bundling wich php scoper those Enums are not handled correctly.

Original File:

Image

File after Scoped with "dcAGBundleMigration":

Image

I would expect it to look like this (have a look at the changes in line 8):

Image

danielmaier42 avatar Mar 07 '25 14:03 danielmaier42

Hmm the FQCN is not ideal but it should cause a problem either, does it?

theofidry avatar Mar 07 '25 18:03 theofidry

Well, the FQCN in the actual output (Screenshot 2) is technically correct, but not as a scoped result as the file which could be loaded with that exact namespace (\General\Lib\Collection\Interface\CollectionItemInterface) does no longer exist in the places where this phar bundle (yes, we are bundling after scoping) is used. So it should just look like my expected output (Screenshot 3) where the use statement is still there (again - scoped correctly) as well as it is used in the implements section on line 8.

danielmaier42 avatar Mar 10 '25 12:03 danielmaier42

@theofidry any news so far?

danielmaier42 avatar May 05 '25 19:05 danielmaier42