Adding support for variadic arguments' method in generated proxy c… #15177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proxy for class with variadic argument method
Pull request fixes proxy class generation, so class with method with variadic arguments can be also used in proxy class.
Description
In
Magento/Framework/ObjectManager/Code/Generator/Proxy
(lines 158, 159) I added check if parameter is variadic and if so its name is suffixed by '...', so then in method_getMethodBody()
proxy method body is generated properly.Fixed Issues (if relevant)
Extends fixes from 27065cf
Manual testing scenarios
/generated/code
.I was trying to extend unit test for modified class (
Magento\Framework\ObjectManager\Test\Unit\Code\Generator
), so it also would generate and test class with method with variadic argument, but with no success. Test broke on (mocked) method -generateResultFileName()
. Actually, I only tried to edit fixtures files for test, not test itself:Magento\Framework\ObjectManager\Code\Generator\Sample
, adding method like:And
Magento\Framework\ObjectManager\Code\Generator\Sample_Proxy.txt
, adding generated method like this:Maybe someone else would be able to extend unit test for this class. If we don't change anything in case of unit tests, test is green.
Original PR
#16080