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 deprecation warnings on PHP 8.2 #16

Merged
merged 1 commit into from
Aug 19, 2023
Merged

Conversation

jnamenyi
Copy link
Contributor

The ${variable} styled string interpolation and dynamic property creation became deprecated in PHP 8.2, because of which we get a deprecation warning using Zen.

This change fixes these issues by replacing ${variable} to {$variable} and checking the existence of the property before assigning it in AbstractCompiledContainer

@codecov
Copy link

codecov bot commented Feb 25, 2023

Codecov Report

Merging #16 (e694e95) into master (a7abc84) will decrease coverage by 0.08%.
The diff coverage is 92.85%.

❗ Current head e694e95 differs from pull request most recent head 535428d. Consider uploading reports for the commit 535428d to get more accurate results

@@             Coverage Diff              @@
##             master      #16      +/-   ##
============================================
- Coverage     89.16%   89.08%   -0.08%     
- Complexity      437      438       +1     
============================================
  Files            33       33              
  Lines          1117     1118       +1     
============================================
  Hits            996      996              
- Misses          121      122       +1     
Impacted Files Coverage Δ
src/AbstractCompiledContainer.php 90.00% <50.00%> (-10.00%) ⬇️
src/Container/Definition/ClassDefinition.php 95.55% <100.00%> (ø)
src/Container/Definition/ReferenceDefinition.php 85.36% <100.00%> (ø)
src/Container/Definition/SelfDefinition.php 89.47% <100.00%> (ø)

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

@ellisgl
Copy link

ellisgl commented Jul 15, 2023

@jnamenyi Can you make a signed commit for this?

@szepeviktor
Copy link
Contributor

szepeviktor commented Jul 15, 2023

Here is how to find them all: git grep -e '\${[A-Z_a-z]' -- '*.php'

source

@kocsismate
Copy link
Member

kocsismate commented Aug 16, 2023

Thanks for the PR! I prefer not to add the property_exists check because facing a dynamic property creation deprecation notice should be a configuration error (as in maybe you have a wrong property override in your ContainerConfig?). If it's not the case, I'd be eager to receive some kind of reproducer/excerpt from your code for debugging if possible.

For reference: this is the only place where a property may be added to the injectable properties array via the #[Inject] attribute, and they are added here via the user config.

@kocsismate
Copy link
Member

I'm merging the PR as is, but will remove the property_exists() call in a followup commit.

@kocsismate kocsismate merged commit 9565511 into woohoolabs:master Aug 19, 2023
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.

4 participants