fix(core): fix preg_replace deprecation notice#1535
Merged
alecritson merged 1 commit intolunarphp:0.8from Feb 9, 2024
Merged
Conversation
Fix notice: "Passing null to parameter lunarphp#3 ($subject) of type array|string is deprecated"
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
alecritson
approved these changes
Feb 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the deprecation warning: "Passing null to parameter #3 ($subject) of type array|string is deprecated"
As the notice says passing null as third parameter is deprecated. I simply bypassed the preg_replace.
Another option would be checking for null value and if so return a zero PriceDataType avoiding the validation and value casting.
I've choosen the first option in order to minimize the amount of duplicated code. If you prefer the second option for the small optimization that gives, i'll update the PR.