-
Notifications
You must be signed in to change notification settings - Fork 117
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
Fixes for PHP8 and static analysis #1006
base: trunk
Are you sure you want to change the base?
Conversation
This makes some improvements to docblock comments to improve static analysis and fixes some issues found by verifying PHP8 compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @prettyboymp!
Thanks for submitting these fixes. Overall this looks good, but I left some questions/comments. Please let me know what you think.
@@ -711,7 +711,7 @@ protected function bulk_cancel_actions( $query_args ) { | |||
|
|||
while ( $action_ids ) { | |||
$action_ids = $this->query_actions( $query_args ); | |||
if ( empty( $action_ids ) ) { | |||
if ( empty( $action_ids ) || ! is_countable( $action_ids ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think query_actions()
can return anything other than an array. Is this check really needed here?
@@ -142,6 +142,7 @@ private function init_logging() { | |||
WP_CLI::debug( 'Beginning migration of batch: ' . print_r( $batch, true ) ); | |||
}, 10, 1 ); | |||
add_action( 'action_scheduler/migration_batch_complete', function ( $batch ) { | |||
/** @var array $batch */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this truly have any effect at this location in the code?
@@ -94,7 +94,8 @@ public function __construct($expression, CronExpression_FieldFactory $fieldFacto | |||
*/ | |||
public function setExpression($value) | |||
{ | |||
$this->cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); | |||
$cronParts = preg_split('/\s/', $value, -1, PREG_SPLIT_NO_EMPTY); | |||
$this->cronParts = is_array($cronParts) ? $cronParts : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with WP coding standards:
$this->cronParts = is_array($cronParts) ? $cronParts : []; | |
$this->cronParts = is_array( $cronParts ) ? $cronParts : array(); |
This makes some improvements to docblock comments to improve static analysis and fixes some issues found by verifying PHP8 compatibility.