-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] : Fix bad generation of proxy class when use overriden getter on class with constructor #21508
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
Conversation
@@ -344,6 +344,27 @@ public function testDumpOverridenGetters() | |||
$this->assertSame('baz', $r->invoke($baz)); | |||
} | |||
|
|||
public function testDumpOverridenGettersWithConstructor() | |||
{ | |||
$container = include self::$fixturesPath.'/containers/container34.php'; |
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.
please give it a non numeric name (new policy for added test cases :) )
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.
maybe can you merge this test case with the existing one on the topic?
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.
Ok, should I do this in a new commit or modify my existing commit?
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.
we will squash anyway, so same commit is ok
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.
Resolved
$dump = $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Overriden_Getters_With_Constructor')); | ||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services34.php', $dump); | ||
$res = $container->getResources(); | ||
$this->assertSame(realpath(self::$fixturesPath.'/containers/container34.php'), array_pop($res)->getResource()); |
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.
this looks wrong to me, as we can have other resources, and the on added for this file may not be the first one
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.
You suggest that I should only check the presence of this resource in the array instead of what I'm doing here?
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.
I followed your advice
Resolved
04ae996
to
baad4b6
Compare
|
||
$dump = $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Overriden_Getters_With_Constructor')); | ||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_dump_overriden_getters_with_constructor.php', $dump); | ||
$resources = array_map( |
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.
array_map('strval', $resources)
would be better I think, because getResource is not part of ResourceInterface
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.
Ok, thanks for your return and the tip you gave me
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.
@nicolas-grekas we actually need to check for a file resource, as you did in #21505
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.
the string version of a resource is supposed to uniquely identify it, so that's not strictly required to me
… class with constructor - [X] Add test fail - [X] Fix bug - [X] Run test pass
baad4b6
to
2440b0f
Compare
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.
👍
Thank you @jean-pasqualini. |
…n getter on class with constructor (jean-pasqualini) This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] : Fix bad generation of proxy class when use overriden getter on class with constructor [DI] : Fix bad generation of proxy class when use overriden getter on class with constructor | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21507 | License | MIT - [X] Add test fail - [X] Fix bug - [X] Run test pass Commits ------- 2440b0f [DI] : Fix bad generation of proxy class when use overriden getter on class with constructor
[DI] : Fix bad generation of proxy class when use overriden getter on class with constructor