-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[ProxyManagerBridge] Fixed support of private services #27593
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
0931007
to
c016761
Compare
); | ||
} | ||
|
||
public function getPrivatePublicDefinitions() |
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.
make static?
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.
what for? it's phpunit dataprovider
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.
avoids needing to create instance of test case to invoke
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.
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.
https://github.com/sebastianbergmann/phpunit/blob/master/src/Util/Test.php#L840
using $this inside the data provider can be confusing if it's not static too, use of Prophecy for example isn't managed etc... it was just a minor suggestion.
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.
But nowhere in the Symfony tests data proiders are made static. Why must this one be?
|
||
$code = $this->dumper->getProxyFactoryCode($definition, 'foo', '$this->getFoo2Service(false)'); | ||
|
||
$this->assertStringMatchesFormat( |
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.
Should be one line to be consistent with the code base.
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.
Fixed
/** | ||
* @dataProvider getPrivatePublicDefinitions | ||
*/ | ||
public function testCorrectPublicPrivateInstantiation(Definition $definition, string $access) |
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 hate to be picky, but what doesn it mean "correct" in this context?
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.
Changed name
c016761
to
a4ba66f
Compare
The issue is not the method name. It is the |
And this needs to be fixed in 3.4, to account for ProxyManagerBridge and DependencyInjection being installed at different versions. |
@nicolas-grekas can you confirm my diagnosis ? |
Ok, so probably it is better just to remove checking for method existence and look only on service public or not? |
And maybe check for the version... |
Well, this |
Ok, @stof than we probably can check for both methods |
Why checking for both methods ? We only need to check for a method removed in 4.0. |
a4ba66f
to
90dd156
Compare
90dd156
to
198bee0
Compare
I rebased your branch on 3.4 and pushed it on your fork. Status: needs review |
Good catch, thanks @omnilight. |
…colas-grekas) This PR was merged into the 3.4 branch. Discussion ---------- [ProxyManagerBridge] Fixed support of private services | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #... | License | MIT | Doc PR | <!-- Write a short README entry for your feature/bugfix here (replace this comment block.) This will help people understand your PR and can be used as a start of the Doc PR. Additionally: - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. --> Fixed lazy loading of private services, that was broken since Symfony 4.0 release because of renaming addObjectResource https://github.com/symfony/symfony/blame/fa022f05be75aacc8afcdc11b63333685c719e13/src/Symfony/Component/DependencyInjection/CHANGELOG.md#L114 Commits ------- 198bee0 [ProxyManagerBridge] Fixed support of private services
@nicolas-grekas this patch is broken, because |
Shall we revert? |
I don't have the reference at hand, but it's already fixed. |
For reference, it is #27776 |
Fixed lazy loading of private services, that was broken since Symfony 4.0 release because of renaming
addObjectResource
https://github.com/symfony/symfony/blame/fa022f05be75aacc8afcdc11b63333685c719e13/src/Symfony/Component/DependencyInjection/CHANGELOG.md#L114