Skip to content

Commit

Permalink
Issue #841: Return an array() inside the conditional.
Browse files Browse the repository at this point in the history
As Weston mentioned, the DocBlock indicates an array().
So return an empty array instead of void.
  • Loading branch information
Ryan Kienstra committed Feb 15, 2018
1 parent d3cc386 commit 1b07e90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion includes/embeds/class-amp-playlist-embed-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function video_playlist() {
*/
public function get_thumb_dimensions( $track ) {
if ( ! isset( $track['thumb']['width'], $track['thumb']['height'] ) ) {
return;
return array();
}
$original_width = intval( $track['thumb']['width'] );
$original_height = intval( $track['thumb']['height'] );
Expand Down
5 changes: 5 additions & 0 deletions tests/test-class-amp-playlist-embed-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public function test_get_thumb_dimensions() {
'thumb' => $dimensions,
);
$this->assertEquals( $expected_dimensions, $this->instance->get_thumb_dimensions( $track ) );

$track = array(
'thumb' => array(),
);
$this->assertEquals( array(), $this->instance->get_thumb_dimensions( $track ) );
}

/**
Expand Down

0 comments on commit 1b07e90

Please sign in to comment.