diff --git a/page.php b/page.php
index 77c1b26db3..ca68afe6e3 100755
--- a/page.php
+++ b/page.php
@@ -35,7 +35,7 @@
$context = Timber::get_context();
$post = new Post(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$page_meta_data = get_post_meta( $post->ID );
-$page_meta_data = array_map( 'reset', $page_meta_data );
+reset( $page_meta_data );
// Ensure redirect is only performed if we're not already on a tag URL. Because tag.php includes this file.
if ( ! is_tag() && RedirectRedirectPages::is_active() ) {
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 4ede356964..16ec293166 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -38,6 +38,13 @@
+
+
+
+
+
+
+
diff --git a/single.php b/single.php
index 5735b33c0d..7938a08f22 100755
--- a/single.php
+++ b/single.php
@@ -32,8 +32,8 @@
// Articles block parameters to populate the articles block
// p4_take_action_page parameter to populate the take action boxout block
// Author override parameter. If this is set then the author profile section will not be displayed.
-$page_meta_data = get_post_meta( $post->ID );
-$page_meta_data = array_map( 'reset', $page_meta_data );
+$page_meta_data = get_post_meta( $post->ID );
+reset( $page_meta_data );
$page_terms_data = get_the_terms( $post, 'p4-page-type' );
$page_terms_data = is_array( $page_terms_data ) ? reset( $page_terms_data ) : null;
$context['background_image'] = $page_meta_data['p4_background_image_override'] ?? '';
diff --git a/src/Settings/Features.php b/src/Settings/Features.php
index ea07291ca8..d5112f5f58 100644
--- a/src/Settings/Features.php
+++ b/src/Settings/Features.php
@@ -65,7 +65,7 @@ public static function get_description(): string {
$description = 'Enable or disable specific Planet 4 features.';
$dev_flags = '
Options with the 👷 icon are only available in dev sites.';
- $dev_site = in_array( WP_APP_ENV, [ 'local', 'development' ], true );
+ $dev_site = defined( 'WP_APP_ENV' ) && in_array( WP_APP_ENV, [ 'local', 'development' ], true );
return $dev_site
? $description . $dev_flags
@@ -78,7 +78,7 @@ public static function get_description(): string {
* @return array[] The fields for each feature.
*/
public static function get_fields(): array {
- $include_all = in_array( WP_APP_ENV, [ 'local', 'development' ], true );
+ $include_all = defined( 'WP_APP_ENV' ) && in_array( WP_APP_ENV, [ 'local', 'development' ], true );
$features = $include_all
? self::all_features()
diff --git a/src/Settings/InformationArchitecture.php b/src/Settings/InformationArchitecture.php
index 9b68ab120f..13e6ac5cb8 100644
--- a/src/Settings/InformationArchitecture.php
+++ b/src/Settings/InformationArchitecture.php
@@ -33,7 +33,7 @@ public static function get_description(): string {
$description = 'These options are related to the new Information architecture development.';
$dev_flags = '
Options with the 👷 icon are only available in dev sites.';
- $dev_site = in_array( WP_APP_ENV, [ 'local', 'development' ], true );
+ $dev_site = defined( 'WP_APP_ENV' ) && in_array( WP_APP_ENV, [ 'local', 'development' ], true );
return $dev_site
? $description . $dev_flags
diff --git a/tests/p4-testcase.php b/tests/p4-testcase.php
index b467558fc6..bce6e1288b 100644
--- a/tests/p4-testcase.php
+++ b/tests/p4-testcase.php
@@ -13,7 +13,7 @@ class P4_TestCase extends WP_UnitTestCase {
/**
* Setup test
*/
- public function setUp() {
+ public function setUp(): void {
parent::setUp();
$this->initialize_planet4_data();
require_once get_template_directory() . '/functions.php';
diff --git a/tests/test-category-page.php b/tests/test-category-page.php
index 53aebb44f8..50eec832aa 100644
--- a/tests/test-category-page.php
+++ b/tests/test-category-page.php
@@ -115,6 +115,7 @@ public function test_category_page_results() {
$this->assertFalse( is_404() );
$this->assertTrue( is_category() );
+ wp_styles();
$output = TimberHelper::ob_function(
function () {
include get_template_directory() . '/category.php';
diff --git a/tests/test-open-graph.php b/tests/test-open-graph.php
index 2efec26c08..2b2f0e2b41 100644
--- a/tests/test-open-graph.php
+++ b/tests/test-open-graph.php
@@ -35,6 +35,7 @@ public function test_post_custom_open_graph_data( $post_data, $template ) {
\Timber\Timber::$context_cache = [];
+ wp_styles();
$output = TimberHelper::ob_function(
function () use ( $template ) {
include get_template_directory() . '/' . $template;
@@ -99,6 +100,7 @@ public function test_post_open_graph_data( $post_data, $template ) {
\Timber\Timber::$context_cache = [];
+ wp_styles();
$output = TimberHelper::ob_function(
function () use ( $template ) {
include get_template_directory() . '/' . $template;
diff --git a/tests/test-p4-master-theme.php b/tests/test-p4-master-theme.php
index b09679af58..28b53c1889 100644
--- a/tests/test-p4-master-theme.php
+++ b/tests/test-p4-master-theme.php
@@ -15,14 +15,14 @@ class P4MasterThemeTest extends P4_TestCase {
/**
* Setup test
*/
- public function setUp() { // phpcs:ignore
+ public function setUp(): void { // phpcs:ignore
parent::setUp();
}
/**
* Tear down
*/
- public function tearDown() {
+ public function tearDown(): void {
switch_theme( 'planet4-master-theme' );
}