Skip to content

Commit

Permalink
Address remaining PHPStan warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 1, 2024
1 parent a5e804f commit b0e101d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
19 changes: 8 additions & 11 deletions includes/embeds/class-amp-youtube-embed-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ private function prepare_attributes( $url, $video_id = '' ) {
$query_vars = [];
$query_param = wp_parse_url( $url, PHP_URL_QUERY );
wp_parse_str( $query_param, $query_vars );
$query_vars = ( is_array( $query_vars ) ) ? $query_vars : [];

$excluded_param = [ 'start', 'v', 'vi', 'w', 'h' ];

Expand Down Expand Up @@ -476,16 +475,14 @@ private function get_start_time_from_url( $url ) {

preg_match( $regex, $parsed_url['fragment'], $matches );

if ( is_array( $matches ) ) {
$matches = wp_parse_args(
$matches,
[
'minutes' => 0,
'seconds' => 0,
]
);
$start_time = ( (int) $matches['seconds'] + ( (int) $matches['minutes'] * 60 ) );
}
$matches = wp_parse_args(
$matches,
[
'minutes' => 0,
'seconds' => 0,
]
);
$start_time = ( (int) $matches['seconds'] + ( (int) $matches['minutes'] * 60 ) );
}

return $start_time;
Expand Down
4 changes: 2 additions & 2 deletions includes/utils/class-amp-dom-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public static function merge_amp_actions( $first, $second ) {
$matches = [];
$results = preg_match_all( self::AMP_EVENT_ACTIONS_REGEX_PATTERN, $event_action_string, $matches );

if ( ! $results || ! isset( $matches['event'] ) ) {
if ( ! $results ) {
continue;
}

Expand All @@ -391,7 +391,7 @@ static function ( $actions ) use ( &$actions_array ) {
$matches = [];
$results = preg_match_all( self::AMP_ACTION_REGEX_PATTERN, $actions, $matches );

if ( ! $results || ! isset( $matches['action'] ) ) {
if ( ! $results ) {
$actions_array[] = $actions;
return;
}
Expand Down

0 comments on commit b0e101d

Please sign in to comment.