Skip to content
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

Improve ClassAttributesPass for Dynamic Properties #1244

Merged
merged 14 commits into from Apr 23, 2023

Conversation

ghostwriter
Copy link
Member

This patch adds the \AllowDynamicProperties attribute on the mock object by default.

  • Allows us to use set and andSet to dynamically set properties on the object after the mock instance is created.

  • DefinedTargetClass Appends all additional attributes on PHP >= 8.0, via \ReflectionAttribute

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter added this to the 1.6.0 milestone Apr 23, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2023

Codecov Report

Merging #1244 (b089e1b) into 1.6.x (b64176d) will increase coverage by 0.01%.
The diff coverage is 100.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@             Coverage Diff              @@
##              1.6.x    #1244      +/-   ##
============================================
+ Coverage     77.39%   77.40%   +0.01%     
+ Complexity      994      993       -1     
============================================
  Files            74       74              
  Lines          2526     2523       -3     
============================================
- Hits           1955     1953       -2     
+ Misses          571      570       -1     
Impacted Files Coverage Δ
library/Mockery/Mock.php 13.53% <ø> (ø)
library/Mockery/Generator/DefinedTargetClass.php 80.43% <100.00%> (ø)
...or/StringManipulation/Pass/ClassAttributesPass.php 100.00% <100.00%> (ø)
...r/StringManipulation/Pass/MethodDefinitionPass.php 87.20% <100.00%> (ø)
library/Mockery/Generator/UndefinedTargetClass.php 58.06% <100.00%> (+0.48%) ⬆️

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@ghostwriter ghostwriter merged commit d168331 into 1.6.x Apr 23, 2023
8 checks passed
@ghostwriter ghostwriter deleted the chore/improve-allow-dynamic-properties branch April 23, 2023 17:57
@ghostwriter ghostwriter mentioned this pull request Apr 23, 2023
@ghostwriter
Copy link
Member Author

lbrutti reacted with thumbs down emoji.

@lbrutti do you have any suggestions for improving this? I'm open to learning and collaborating.

@lbrutti
Copy link

lbrutti commented Apr 30, 2023 via email

@ghostwriter
Copy link
Member Author

No worries, thank you for letting me know.

It's always good to figure out the root cause of an issue.

If you have any questions or concerns in the future, please don't hesitate to reach out.

@ghostwriter ghostwriter added Patch Backwards compatible bug fixes and improvements Changed for modifications to existing features or functionality labels Apr 30, 2023
@ghostwriter ghostwriter self-assigned this May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changed for modifications to existing features or functionality Patch Backwards compatible bug fixes and improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants