Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.

PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.




git-svn-id: https://develop.svn.wordpress.org/trunk@45639 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2019-07-15 06:24:08 +00:00
parent e6c750b55c
commit 2da7f9f524
9 changed files with 32 additions and 20 deletions
@@ -24,7 +24,7 @@ class Tests_Query_GeneratePostdata extends WP_UnitTestCase {
$data = generate_postdata( $fake->ID );
// Fails because there's no post with this ID.
$this->assertNotSame( $fake->ID, $data['id'] );
$this->assertFalse( $data );
}
/**
+1 -1
View File
@@ -150,7 +150,7 @@ class Tests_TermExists extends WP_UnitTestCase {
_unregister_taxonomy( 'foo' );
$this->assertSame( null, $found['term_id'] );
$this->assertSame( null, $found );
}
public function test_term_exists_taxonomy_nonempty_parent_nonempty_match_name() {