Fix PHP Deprecation warnings in PHP8+ - #1046
Open
mike-healy wants to merge 3 commits into
Open
Conversation
This was referenced Jan 9, 2024
|
👍 Here for this. Let's fix these bugs instead of saying the solution is to turn off deprecation notices. |
| function &add( $id, $properties = array(), $update = false ) { | ||
| // Create item | ||
| $args = func_get_args(); | ||
| $ret = call_user_func_array( array( 'parent', 'add' ), $args ); |
There was a problem hiding this comment.
I resolved this with this code:
$ret = parent::add(...func_get_args());
I was coming to see if it was implemented.. but I guess both ways work. Cheers!
Author
There was a problem hiding this comment.
yes, both seem to work. I don't mind updating my PR to that style.
Author
There was a problem hiding this comment.
@archetyped do you have a preference, and are you interested in merging this PR?
There was a problem hiding this comment.
I can confirm this being helpful.
But My IDE wants me to change Return type too:
/**
* Add option to collection
* @uses SLB_Field_Collection::add() to add item
* @param string $id Unique item ID
* @param array $properties Item properties
* @param bool $update (optional) Should item be updated or overwritten (Default: FALSE)
* @return false|object|SLB_Field Option instance
*/
function &add( $id, $properties = array(), $update = false ) {
// Create item
$ret = parent::add(...func_get_args());
return $ret;
}
There was a problem hiding this comment.
Closed
6 tasks
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.
PHP 8.1 & 8.2 issue some deprecation notices when using Simple Lightbox.
This fixes those warnings without changing functionality.