Skip to content

Commit

Permalink
Fixed PHPStan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmurphy committed Feb 6, 2025
1 parent 5030805 commit 6e53d89
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 35 deletions.
2 changes: 1 addition & 1 deletion includes/Updates/CheckForUpgrades.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace WPGraphQL\ContentBlocks\Updates;

if (! function_exists('wp_graphql_content_blocks_check_for_upgrades')) {
function wp_graphql_content_blocks_check_for_upgrades() {
function wp_graphql_content_blocks_check_for_upgrades() : void {
$properties = array(
'plugin_slug' => 'wp-graphql-content-blocks',
'plugin_basename' => WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_PATH,
Expand Down
12 changes: 6 additions & 6 deletions includes/Updates/PluginUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PluginUpdater {
* These properties are passed in when instantiating to identify the plugin and it's update location.
* @var array
*/
private $properties;
private $properties = [];

/**
* Get the class constructed.
Expand All @@ -53,7 +53,7 @@ public function __construct( $properties ) {

$this->properties = $this->get_full_plugin_properties( $properties, $this->api_url );

if ( ! $this->properties ) {
if ( empty($this->properties) ) {
return;
}

Expand All @@ -65,9 +65,9 @@ public function __construct( $properties ) {
*
* @param array $properties These properties are passed in when instantiating to identify the plugin and it's update location.
* @param string $api_url The URL where the api is located.
* @return array|null
* @return array
*/
public function get_full_plugin_properties( $properties, $api_url ) {
public function get_full_plugin_properties( $properties, $api_url ) : array {
$plugins = \get_plugins();

// Scan through all plugins installed and find the one which matches this one in question.
Expand All @@ -86,7 +86,7 @@ public function get_full_plugin_properties( $properties, $api_url ) {
}

// No matching plugin was found installed.
return null;
return [];
}

/**
Expand All @@ -105,7 +105,7 @@ public function register() {
* @param ?object $transient_value The value of the `site_transient_update_plugins` transient.
*
* @handles site_transient_update_plugins
* @return object
* @return object|null
*/
public function filter_plugin_update_transient( $transient_value ) {
// No update object exists. Return early.
Expand Down
6 changes: 3 additions & 3 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ parameters:
path: includes/Data/BlockAttributeResolver.php

-
message: "#^Access to an undefined property object\\:\\:\\$response\\.$#"
count: 1
path: includes/PluginUpdater/UpdateCallbacks.php
message: '#Access to an undefined property .+#'
count: 18
path: includes/Updates/PluginUpdater.php


25 changes: 0 additions & 25 deletions tests/unit/UpdateCallbacksTest.php

This file was deleted.

0 comments on commit 6e53d89

Please sign in to comment.