-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Adds support of internal child class instantiation #61
Adds support of internal child class instantiation #61
Conversation
tests/DoctrineTest/InstantiatorTestAsset/SerializableFinalInternalChildAssset.php
Outdated
Show resolved
Hide resolved
Wait, don't merge yet, there's something odd going on |
Allright, that's better now. Cloning ArrayIterator results in the original array being referenced in cloned objects, which will probably lead to unwanted side effects. Here's an example: <?php
require __DIR__ . '/vendor/autoload.php';
final class MyIterator extends \ArrayIterator
{
}
$instantiator = new \Doctrine\Instantiator\Instantiator();
$o1 = $instantiator->instantiate(\MyIterator::class);
$o2 = $instantiator->instantiate(\MyIterator::class);
$o3 = $instantiator->instantiate(\MyIterator::class);
$o3->append('foo');
die(var_dump($o1, $o2, $o3)); Which outputs:
|
Let me know if you'd rather have one commit in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @gquemener! |
Related to #39
This is my attempt to resolve a long on-going issue on the phpspec repository, taking inspiration on the SF VarExporter component.
I do not see any other missing testcases, however feel free to let me know if you think about some, I will happily add them.
/cc @ciaranmcnulty @Ocramius @mikeSimonson