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

Reduce deprecations due to FieldMapping array access #2889

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Jean85
Copy link

@Jean85 Jean85 commented Oct 18, 2024

Fixes #2827, at least in large part.

I did a simple regex find&replace of access to $mapping['...'], and then:

  • added parentheses everywhere, since ?? (null coalescing) has one of the lowest operator precedence in PHP
  • removed the parentheses (with another regex) when:
    • it was already inside a pair of them
    • it was an argument (so already separated by parentheses and\or a comma)
  • reviewed all the changes manually and:
    • reverted the changes in the ODM class (since there is no deprecation there)
    • reverted all the times where it was inside an isset call (it wouldn't work)
    • removed the parentheses manually when it was already followed by a ?? (so it's a concatenation)

I realize this may not cover all the places where this deprecation may be triggered, but I'm sure that all my changes are covering some, so it's a good start.

@Jean85 Jean85 mentioned this pull request Oct 18, 2024
@Jean85
Copy link
Author

Jean85 commented Oct 18, 2024

Ok I renamed my first commit (since it addressed only variables named $mapping) and added a second one for $fieldMapping. I'll proceed to add more stuff.

@Jean85
Copy link
Author

Jean85 commented Oct 18, 2024

Ok that's all for me. Let me know if there are more ways to fetch the FieldMapping object that I should inspect.

@mbabker
Copy link
Contributor

mbabker commented Oct 18, 2024

Check the changes in the YAML mapping drivers, some of those are parsing the YAML files as arrays and not from the metadata objects.

@mbabker
Copy link
Contributor

mbabker commented Oct 18, 2024

Likewise, anything that's in MongoDB ODM specific code (like document repository classes) doesn't need to change as the deprecations only affect the ORM.

@Jean85
Copy link
Author

Jean85 commented Oct 19, 2024

@mbabker I addressed your comments with some reverts; it may be a good idea to squash this PR while merging.

@Jean85
Copy link
Author

Jean85 commented Oct 23, 2024

Thanks @mbabker, I've addressed all the comments of your review.

@Jean85 Jean85 requested a review from mbabker October 23, 2024 07:20
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 84.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 78.67%. Comparing base (ee63c20) to head (4a89cd3).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../ReferenceIntegrity/ReferenceIntegrityListener.php 75.00% 3 Missing ⚠️
src/Blameable/Mapping/Driver/Xml.php 0.00% 1 Missing ⚠️
src/Blameable/Mapping/Driver/Yaml.php 0.00% 1 Missing ⚠️
src/IpTraceable/Mapping/Driver/Xml.php 0.00% 1 Missing ⚠️
src/IpTraceable/Mapping/Driver/Yaml.php 0.00% 1 Missing ⚠️
src/SoftDeleteable/Mapping/Validator.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2889      +/-   ##
==========================================
- Coverage   78.82%   78.67%   -0.15%     
==========================================
  Files         167      167              
  Lines        8637     8752     +115     
==========================================
+ Hits         6808     6886      +78     
- Misses       1829     1866      +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jean85 Jean85 requested a review from mbabker November 12, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ORM 3 deprecations
2 participants