framework icon indicating copy to clipboard operation
framework copied to clipboard

Issue #456: Align arguments resolving in NamedArgumentsInstantiator with native PHP 8 behavior.

Open donquixote opened this issue 2 years ago • 8 comments

Q A
Bugfix? ✔️ or TBD, see changes in tests.
Breaks BC? ❌ or TBD, see changes in tests.
New feature? ❌ or TBD, see changes in tests.
Issues #456
Docs PR (none)

The arguments resolving in NamedArgumentsInstantiator has some edge cases where it diverges from native behavior in PHP 8. This PR adds more test cases and attempts to align the behavior more with PHP 8.

(I might still do some tweaking with force-push)

donquixote avatar Sep 28 '21 23:09 donquixote

Master branch is the 2.9.x-dev version. Are you sure these fixes should be reserved for the next minor release instead of 2.8.x patch?

SerafimArts avatar Sep 29 '21 00:09 SerafimArts

I am splitting the big function, but I am not sure if that's really so helpful. It is nice if local variables have a limited scope. But does the split really create meaningful separation?

donquixote avatar Sep 29 '21 00:09 donquixote

@SerafimArts I recommend to keep the commit history of this PR. Each commit is meant to have passing tests, so we see the effect of before/after. Only the last commit (splitting the big method) we could squash with the previous one, but we should first fine-tune.

donquixote avatar Sep 29 '21 00:09 donquixote

Master branch is the 2.9.x-dev version. Are you sure these fixes should be reserved for the next minor release instead of 2.8.x patch?

Ah. Sure, I can use 2.8.x as a base instead.

donquixote avatar Sep 29 '21 00:09 donquixote

Base changed.

donquixote avatar Sep 29 '21 01:09 donquixote

I forgot to add a test for the variadic parameter. Going to do it now.

donquixote avatar Sep 29 '21 17:09 donquixote

@donquixote It's okay, dont worry. I haven't started (as you might have noticed) the review yet.

The current code for the appendNamedArgs function looks pretty impressive and complex, so to understand whether it can be simplified, I need to investigate its work. But since I have other tasks in my work now, I may be able to do a review either by the end or next week.

SerafimArts avatar Sep 29 '21 18:09 SerafimArts

Improved test coverage and support for various edge cases.

donquixote avatar Sep 30 '21 03:09 donquixote

Codecov Report

Merging #459 (71115e5) into master (195b876) will increase coverage by 0.14%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #459      +/-   ##
============================================
+ Coverage     79.96%   80.11%   +0.14%     
- Complexity     6743     6754      +11     
============================================
  Files           761      761              
  Lines         17064    17100      +36     
============================================
+ Hits          13645    13699      +54     
+ Misses         3419     3401      -18     
Impacted Files Coverage Δ
...ternal/Instantiator/NamedArgumentsInstantiator.php 98.61% <100.00%> (+29.16%) :arrow_up:
src/Attributes/src/Internal/Exception.php 100.00% <0.00%> (+100.00%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 30 '22 09:08 codecov[bot]