Skip to content

Commit

Permalink
addings fixes for php8
Browse files Browse the repository at this point in the history
  • Loading branch information
iruzevic committed Oct 26, 2023
1 parent 70034dd commit 06da106
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/AdminMenus/AdminReusableBlocksMenuCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getDefaultArgs(): array
'title' => 'Reusable blocks',
'menu_title' => 'Reusable blocks',
'capability' => 'edit_posts',
'menu_icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path d="m18.492 2.33 3.179 3.179a2.25 2.25 0 0 1 0 3.182l-2.423 2.422A2.501 2.501 0 0 1 21 13.5v5a2.5 2.5 0 0 1-2.5 2.5h-13A2.5 2.5 0 0 1 3 18.5v-13A2.5 2.5 0 0 1 5.5 3h5a2.5 2.5 0 0 1 2.387 1.754L15.31 2.33a2.25 2.25 0 0 1 3.182 0ZM11 13H5v5.5a.5.5 0 0 0 .5.5H11v-6Zm7.5 0H13v6h5.5a.5.5 0 0 0 .5-.5v-5a.5.5 0 0 0-.5-.5Zm-4.06-2.001L13 9.559v1.44h1.44Zm-3.94-6h-5a.5.5 0 0 0-.5.5V11h6V5.5a.5.5 0 0 0-.5-.5Z" fill="black"/></svg>', // phpcs:ignore
'menu_icon' => 'dashicons-welcome-widgets-menus',
'menu_position' => 4,
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/AdminMenus/AdminReusableBlocksMenuExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function () {
$this->getMenuTitle(),
$this->getCapability(),
$this->getMenuSlug(),
'',
'', // @phpstan-ignore-line
$this->getIcon(),
$this->getPosition()
);
Expand Down
2 changes: 1 addition & 1 deletion src/AdminMenus/ReusableBlocksHeaderFooterExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ReusableBlocksHeaderFooterExample extends AbstractAdminMenu
/**
* Admin icon.
*/
public const ADMIN_ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 1A1.5 1.5 0 0 0 0 2.5V4h20V2.5A1.5 1.5 0 0 0 18.5 1h-17ZM20 5H0v10h20V5ZM0 17.5V16h20v1.5a1.5 1.5 0 0 1-1.5 1.5h-17A1.5 1.5 0 0 1 0 17.5ZM19 6H1v8h18V6Z" fill="black"/></svg>'; // phpcs:ignore
public const ADMIN_ICON = 'dashicons-embed-photo';

/**
* Menu position for reusable blocks menu.
Expand Down
2 changes: 1 addition & 1 deletion src/AnalyticsGdpr/AnalyticsGdprExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public function registerGdprModalSettings(): void
/**
* Prepare the data for usage inside of the GDPR modal template.
*
* @return array<string, array> Prepared array filled with the data from options page.
* @return array<string, array<mixed>> Prepared array filled with the data from options page.
*/
public function prepareGdprModalData(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/ModifyAdminAppearance/ModifyAdminAppearanceExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ModifyAdminAppearanceExample implements ServiceInterface
/**
* List of admin color schemes.
*
* @var array
* @var array<string, string>
*/
public const COLOR_SCHEMES = [
'development' => 'fresh',
Expand Down
10 changes: 5 additions & 5 deletions src/Rest/Fields/FieldExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, string>
*/
protected function getObjectType()
protected function getObjectType(): array
{
return '%object_type%';
return ['%object_type%'];
}

/**
Expand All @@ -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<string, mixed> Either an array of options for the endpoint, or an array of arrays for multiple methods.
*/
protected function getCallbackArguments(): array
{
Expand All @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Rest/Routes/LoadMore/LoadMoreRouteExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> Either an array of options for the endpoint or an array of arrays for multiple methods.
*/
protected function getCallbackArguments(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Rest/Routes/RouteExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, mixed> Either an array of options for the endpoint, or an array of arrays for multiple methods.
*/
protected function getCallbackArguments(): array
{
Expand Down

0 comments on commit 06da106

Please sign in to comment.