-
Notifications
You must be signed in to change notification settings - Fork 132
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
Problems with native class ArrayAccess as Interface #1447
Comments
How do you set up BetterReflection? |
Cannot show you everything, but it was like this: public const string OLD_NAMESPACE = 'DocuSign\eSign\Model';
public const string NEW_NAMESPACE = 'DocusignEsignatureClient\Structs';
$finder
->in(__DIR__ . '/../../vendor/docusign/esign-client/src/Model')
->files()
->name('*.php')
->notName('*Interface.php')
->sortByName(true);
$iterator = $finder->getIterator();
$iterator->rewind();
foreach ($iterator as $modelFile) {
$classLoader = require __DIR__ . '/../../vendor/autoload.php';
$astLocator = (new BetterReflection())->astLocator();
$reflector = new DefaultReflector(new ComposerSourceLocator($classLoader, $astLocator));
$class = $reflector->reflectClass(self::OLD_NAMESPACE . '\\' . $modelFile->getFilenameWithoutExtension());
/** @var ReflectionProperty $swaggerTypeProperty */
$swaggerTypeProperty = $class->getProperty('swaggerTypes');
$swaggerTypes = $swaggerTypeProperty->getDefaultValue();
$class = new ClassType($modelFile->getFilenameWithoutExtension());
$namespace = new PhpNamespace(self::NEW_NAMESPACE);
$namespace->add($class);
$namespace->addUse(SerializedName::class);
} |
I think the composer source locator is not sufficient there: needs to be composed together with an internal classes source locator. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I try to reflect a class with arrayaccess interface it does not work:
https://github.com/docusign/docusign-esign-php-client/blob/master/src/Model/AccessCodeFormat.php
Roave\BetterReflection\Reflection\ReflectionClass "ArrayAccess" could not be found in the located source
The text was updated successfully, but these errors were encountered: