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

Fix PHP 8.4 deprecations #2981

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

JeppeKnockaert
Copy link
Contributor

Description

This PR removes implicitly nullable parameters because these result in deprecation warnings for PHP 8.4.

https://www.php.net/manual/en/migration84.deprecated.php#migration84.deprecated.core.implicitly-nullable-parameter

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@JeppeKnockaert JeppeKnockaert requested review from a team as code owners December 3, 2024 10:22
@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 9.09091% with 20 lines in your changes missing coverage. Please review.

Project coverage is 1.96%. Comparing base (c69df0a) to head (82c8574).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/ddtrace_php_api.stubs.php 0.00% 7 Missing ⚠️
src/DDTrace/OpenTelemetry/Span.php 0.00% 5 Missing ⚠️
src/DDTrace/OpenTelemetry/SpanBuilder.php 0.00% 2 Missing ⚠️
src/DDTrace/OpenTracer/Tracer.php 0.00% 2 Missing ⚠️
src/DDTrace/OpenTracer1/Tracer.php 0.00% 2 Missing ⚠️
...grations/CodeIgniter/V2/CodeIgniterIntegration.php 0.00% 1 Missing ⚠️
src/DDTrace/Integrations/Logs/LogsIntegration.php 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (c69df0a) and HEAD (82c8574). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (c69df0a) HEAD (82c8574)
tracer-php 9 4
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #2981       +/-   ##
============================================
- Coverage     73.88%   1.96%   -71.93%     
  Complexity     2750    2750               
============================================
  Files           111     111               
  Lines         10900   10900               
============================================
- Hits           8054     214     -7840     
- Misses         2846   10686     +7840     
Flag Coverage Δ
tracer-php 1.96% <9.09%> (-71.93%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/DDTrace/Integrations/AMQP/AMQPIntegration.php 0.00% <ø> (-98.45%) ⬇️
...egrations/WordPress/WordPressIntegrationLoader.php 0.00% <ø> (-80.60%) ⬇️
src/DDTrace/ScopeManager.php 3.03% <100.00%> (-96.97%) ⬇️
src/DDTrace/Tracer.php 9.45% <100.00%> (-66.90%) ⬇️
...grations/CodeIgniter/V2/CodeIgniterIntegration.php 0.00% <0.00%> (-50.00%) ⬇️
src/DDTrace/Integrations/Logs/LogsIntegration.php 0.00% <0.00%> (-93.29%) ⬇️
src/DDTrace/OpenTelemetry/SpanBuilder.php 0.00% <0.00%> (-93.85%) ⬇️
src/DDTrace/OpenTracer/Tracer.php 0.00% <0.00%> (ø)
src/DDTrace/OpenTracer1/Tracer.php 0.00% <0.00%> (-86.67%) ⬇️
src/DDTrace/OpenTelemetry/Span.php 0.00% <0.00%> (-85.43%) ⬇️
... and 1 more

... and 75 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c69df0a...82c8574. Read the comment docs.

@bwoebi
Copy link
Collaborator

bwoebi commented Jan 2, 2025

Hey @JeppeKnockaert,

Thanks for the contribution, however we still support 7.0, so that's a bit unfortunate, as this PR breaks that version.

I believe the only solution to keep it working on 7.0 and no incurring the deprecations is removing the types for the nullable values altogether.

@JeppeKnockaert JeppeKnockaert force-pushed the fix-php84-deprecations branch from 3a452b3 to 9a9b4ca Compare January 2, 2025 11:29
In order to keep PHP 7.0 compatibility, I removed the implicitely nullable types instead of making them explicitely nullable.
@JeppeKnockaert JeppeKnockaert force-pushed the fix-php84-deprecations branch from 9a9b4ca to aa32943 Compare January 2, 2025 11:29
@JeppeKnockaert
Copy link
Contributor Author

@bwoebi Thanks for reviewing, I updated the PR to remove the implicitly nullable types instead

@bwoebi bwoebi force-pushed the fix-php84-deprecations branch from 62ba353 to 2aaaa29 Compare January 6, 2025 16:30
Copy link
Collaborator

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes.
I've moved the OpenTelemetry part back to nullable types as that code anyway isn't available for PHP 7.0.

That code is not available on PHP 7.0 anyway.

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
@bwoebi bwoebi force-pushed the fix-php84-deprecations branch from 2aaaa29 to 82c8574 Compare January 6, 2025 18:26
@bwoebi bwoebi merged commit 906cbc5 into DataDog:master Jan 6, 2025
398 of 457 checks passed
@bwoebi bwoebi mentioned this pull request Jan 8, 2025
2 tasks
@bwoebi bwoebi added this to the 1.6.0 milestone Jan 8, 2025
@realFlowControl
Copy link
Member

Hey @JeppeKnockaert 👋
thanks for this PR, it has been released with v1.6.0 just now 🎉

@JeppeKnockaert JeppeKnockaert deleted the fix-php84-deprecations branch January 9, 2025 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants