Skip to content

Commit 6e53d89

Browse files
committed
Fixed PHPStan issues
1 parent 5030805 commit 6e53d89

File tree

4 files changed

+10
-35
lines changed

4 files changed

+10
-35
lines changed

includes/Updates/CheckForUpgrades.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace WPGraphQL\ContentBlocks\Updates;
66

77
if (! function_exists('wp_graphql_content_blocks_check_for_upgrades')) {
8-
function wp_graphql_content_blocks_check_for_upgrades() {
8+
function wp_graphql_content_blocks_check_for_upgrades() : void {
99
$properties = array(
1010
'plugin_slug' => 'wp-graphql-content-blocks',
1111
'plugin_basename' => WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_PATH,

includes/Updates/PluginUpdater.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PluginUpdater {
3131
* These properties are passed in when instantiating to identify the plugin and it's update location.
3232
* @var array
3333
*/
34-
private $properties;
34+
private $properties = [];
3535

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

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

56-
if ( ! $this->properties ) {
56+
if ( empty($this->properties) ) {
5757
return;
5858
}
5959

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

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

8888
// No matching plugin was found installed.
89-
return null;
89+
return [];
9090
}
9191

9292
/**
@@ -105,7 +105,7 @@ public function register() {
105105
* @param ?object $transient_value The value of the `site_transient_update_plugins` transient.
106106
*
107107
* @handles site_transient_update_plugins
108-
* @return object
108+
* @return object|null
109109
*/
110110
public function filter_plugin_update_transient( $transient_value ) {
111111
// No update object exists. Return early.

phpstan-baseline.neon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ parameters:
66
path: includes/Data/BlockAttributeResolver.php
77

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

1313

tests/unit/UpdateCallbacksTest.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)