BackwardCompatibilityCheck icon indicating copy to clipboard operation
BackwardCompatibilityCheck copied to clipboard

Interface could not be found in the located source

Open VincentLanglet opened this issue 4 years ago • 3 comments

When trying to add this library to SonataAdmin (https://github.com/sonata-project/SonataAdminBundle/pull/6802) we get an error: https://github.com/vladyslavstartsev/SonataAdminBundle/runs/1755213208?check_suite_focus=true

In IdentifierNotFound.php line 30:
                                                                               
  Roave\BetterReflection\Reflection\ReflectionClass "Sonata\AdminBundle\Objec  
  t\InternalMetadataInterface" could not be found in the located source

But the InternalMetadataInterface is defined here: https://github.com/sonata-project/SonataAdminBundle/blob/137ffd9f6053fa0b734c2e1dd7db86d6c3b94aed/src/Object/MetadataInterface.php#L19-L27

Is it a bug from this library or are we doing something wrong ?

Thanks.

VincentLanglet avatar Feb 15 '21 21:02 VincentLanglet

Fairly sure that since it's in a conditional, it does not get scanned at all by roave/better-reflection: potentially to be tested with a StringSourceLocator (https://github.com/Roave/BetterReflection/blob/4eabb04831a249dc43d2f3aeb8b9d6bbc57c5916/src/SourceLocator/Type/StringSourceLocator.php)

Ocramius avatar Feb 16 '21 11:02 Ocramius

Fairly sure that since it's in a conditional, it does not get scanned at all by roave/better-reflection: potentially to be tested with a StringSourceLocator

I know nothing about the better-reflection library but that was my hypothesis. I'm not sure it's possible to avoid this conditional ; do you think it's something that can be improved in better-reflection ? Should the issue be moved to this library then ?

VincentLanglet avatar Feb 16 '21 11:02 VincentLanglet

do you think it's something that can be improved in better-reflection?

Difficult to say: the definition of InternalMetadataInterface is conditionally declared, and it is not currently possible to evaluate the condition statically there.

Ocramius avatar Feb 16 '21 11:02 Ocramius