diff --git a/composer.json b/composer.json index 476aa854a..1a573f03f 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ "php-stubs/wordpress-stubs": "^6.3", "roave/security-advisories": "dev-master", "szepeviktor/phpstan-wordpress": "^1.0.3", - "wp-cli/wp-cli": "^2.4", + "wp-cli/wp-cli": "^2.9", "yoast/wp-test-utils": "^1.0" }, "autoload": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 26ea174b8..758015e47 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -15,3 +15,4 @@ parameters: ignoreErrors: # Ignore errors about reflection class variable being undefined. Errors are caught. - '/^Variable \$reflectionClass might not be defined\.$/' + checkGenericClassInNonGenericObjectType: false diff --git a/src/AdminMenus/AdminReusableBlocksMenuCli.php b/src/AdminMenus/AdminReusableBlocksMenuCli.php index 9bc6dad41..9a8419851 100644 --- a/src/AdminMenus/AdminReusableBlocksMenuCli.php +++ b/src/AdminMenus/AdminReusableBlocksMenuCli.php @@ -50,7 +50,7 @@ public function getDefaultArgs(): array 'title' => 'Reusable blocks', 'menu_title' => 'Reusable blocks', 'capability' => 'edit_posts', - 'menu_icon' => '', // phpcs:ignore + 'menu_icon' => 'dashicons-welcome-widgets-menus', 'menu_position' => 4, ]; } diff --git a/src/AdminMenus/AdminReusableBlocksMenuExample.php b/src/AdminMenus/AdminReusableBlocksMenuExample.php index 9b83ec800..94a9116b9 100644 --- a/src/AdminMenus/AdminReusableBlocksMenuExample.php +++ b/src/AdminMenus/AdminReusableBlocksMenuExample.php @@ -58,7 +58,7 @@ function () { $this->getMenuTitle(), $this->getCapability(), $this->getMenuSlug(), - '', + '', // @phpstan-ignore-line $this->getIcon(), $this->getPosition() ); diff --git a/src/AdminMenus/ReusableBlocksHeaderFooterExample.php b/src/AdminMenus/ReusableBlocksHeaderFooterExample.php index c4f463a2b..5cd7ffefe 100644 --- a/src/AdminMenus/ReusableBlocksHeaderFooterExample.php +++ b/src/AdminMenus/ReusableBlocksHeaderFooterExample.php @@ -34,7 +34,7 @@ class ReusableBlocksHeaderFooterExample extends AbstractAdminMenu /** * Admin icon. */ - public const ADMIN_ICON = ''; // phpcs:ignore + public const ADMIN_ICON = 'dashicons-embed-photo'; /** * Menu position for reusable blocks menu. diff --git a/src/AnalyticsGdpr/AnalyticsGdprExample.php b/src/AnalyticsGdpr/AnalyticsGdprExample.php index 6891a8184..f26095d00 100644 --- a/src/AnalyticsGdpr/AnalyticsGdprExample.php +++ b/src/AnalyticsGdpr/AnalyticsGdprExample.php @@ -836,7 +836,7 @@ public function registerGdprModalSettings(): void /** * Prepare the data for usage inside of the GDPR modal template. * - * @return array Prepared array filled with the data from options page. + * @return array> Prepared array filled with the data from options page. */ public function prepareGdprModalData(): array { diff --git a/src/ModifyAdminAppearance/ModifyAdminAppearanceExample.php b/src/ModifyAdminAppearance/ModifyAdminAppearanceExample.php index c8f2be314..a717a2ecd 100644 --- a/src/ModifyAdminAppearance/ModifyAdminAppearanceExample.php +++ b/src/ModifyAdminAppearance/ModifyAdminAppearanceExample.php @@ -22,7 +22,7 @@ class ModifyAdminAppearanceExample implements ServiceInterface /** * List of admin color schemes. * - * @var array + * @var array */ public const COLOR_SCHEMES = [ 'development' => 'fresh', diff --git a/src/Rest/Fields/FieldExample.php b/src/Rest/Fields/FieldExample.php index cf6f9e6bd..3d4c057a1 100644 --- a/src/Rest/Fields/FieldExample.php +++ b/src/Rest/Fields/FieldExample.php @@ -23,11 +23,11 @@ class FieldExample extends AbstractField implements CallableFieldInterface * * Object(s) the field is being registered to, "post"|"term"|"comment" etc. * - * @return string|array + * @return array */ - protected function getObjectType() + protected function getObjectType(): array { - return '%object_type%'; + return ['%object_type%']; } /** @@ -43,7 +43,7 @@ protected function getFieldName(): string /** * Get callback arguments array * - * @return array Either an array of options for the endpoint, or an array of arrays for multiple methods. + * @return array Either an array of options for the endpoint, or an array of arrays for multiple methods. */ protected function getCallbackArguments(): array { @@ -66,7 +66,7 @@ protected function getCallbackArguments(): array * is already an instance, WP_HTTP_Response, otherwise * returns a new WP_REST_Response instance. */ - public function fieldCallback($postObject, string $attr, object $request, string $objectType) + public function fieldCallback($postObject, string $attr, object $request, string $objectType) // @phpstan-ignore-line { return \rest_ensure_response('output data'); } diff --git a/src/Rest/Routes/LoadMore/LoadMoreRouteExample.php b/src/Rest/Routes/LoadMore/LoadMoreRouteExample.php index 1afefa771..a978c0ac2 100644 --- a/src/Rest/Routes/LoadMore/LoadMoreRouteExample.php +++ b/src/Rest/Routes/LoadMore/LoadMoreRouteExample.php @@ -63,7 +63,7 @@ protected function getRouteName(): string /** * Get callback arguments array * - * @return array Either an array of options for the endpoint or an array of arrays for multiple methods. + * @return array Either an array of options for the endpoint or an array of arrays for multiple methods. */ protected function getCallbackArguments(): array { diff --git a/src/Rest/Routes/RouteExample.php b/src/Rest/Routes/RouteExample.php index f56bf3c81..22ab3dbc9 100644 --- a/src/Rest/Routes/RouteExample.php +++ b/src/Rest/Routes/RouteExample.php @@ -53,7 +53,7 @@ protected function getRouteName(): string /** * Get callback arguments array * - * @return array Either an array of options for the endpoint, or an array of arrays for multiple methods. + * @return array Either an array of options for the endpoint, or an array of arrays for multiple methods. */ protected function getCallbackArguments(): array {