Skip to content

Commit

Permalink
Fixes for phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Feb 28, 2024
1 parent 62caffb commit 7d5edee
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
12 changes: 10 additions & 2 deletions src/alley/wp/alleyvate/class-feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,16 @@ public function filtered_boot(): void {
/**
* Add debug information to the Site Health screen.
*
* @param array $info Debug information.
* @return array
* @param array{
* wp-alleyvate?: array{
* fields?: array<array{label:string,value:string}>
* }
* } $info Debug information.
* @return array{
* wp-alleyvate?: array{
* fields?: array<array{label:string,value:string}>
* }
* } $info Debug information. Debug information.
*/
public function add_debug_information( $info ): array {
if ( ! \is_array( $info ) ) {
Expand Down
15 changes: 9 additions & 6 deletions src/alley/wp/alleyvate/features/class-clean-admin-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ public function boot(): void {

/**
* Disables specified menus in admin bar.
*
* @return void
*/
public function before_admin_bar_render() {
public function before_admin_bar_render(): void {
global $wp_admin_bar;

foreach ( $this->get_disposable_nodes() as $node ) {
Expand All @@ -41,16 +39,21 @@ public function before_admin_bar_render() {
/**
* Set menus to be disabled.
*
* @return mixed|void
* @return array<string>
*/
public function get_disposable_nodes() {
public function get_disposable_nodes(): array {
$disposable_nodes = [
'comments',
'themes',
'updates',
'wp-logo',
];

return apply_filters( 'alleyvate_clean_admin_bar_menus', $disposable_nodes );
/**
* Filters the admin bar menus to be removed.
*
* @param array<string> $disposable_nodes Admin bar menus to be removed.
*/
return (array) apply_filters( 'alleyvate_clean_admin_bar_menus', $disposable_nodes );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function boot(): void {
/**
* Remove support for the attachment rewrite rule.
*
* @param array $rules Rewrite rules.
* @return array
* @param array<string, string> $rules Rewrite rules.
* @return array<string, string>
*/
public static function filter__rewrite_rules_array( $rules ): array {
foreach ( $rules as $regex => $query ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function boot(): void {
* if any, since the result of a permission callback is not filterable.
*
* @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client.
* @param array $handler Route handler used for the request.
* @param array<mixed> $handler Route handler used for the request.
* @param WP_REST_Request $request Request used to generate the response.
* @return WP_REST_Response|WP_HTTP_Response|WP_Error|mixed The updated result.
*/
Expand Down

0 comments on commit 7d5edee

Please sign in to comment.