Skip to content

Commit

Permalink
Fixing phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Apr 2, 2024
1 parent e4e593f commit 80dfa50
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,13 @@
"vendor/{$vendor}/{$name}/": ["type:wordpress-plugin"]
}
},
"autoload": {
"files": ["vendor/alleyinteractive/wordpress-fieldmanager/fieldmanager.php"]
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"phpcbf": "phpcbf .",
"phpcs": "phpcs .",
"phpunit": "phpunit",
"phpstan": "phpstan --memory-limit=512M",
"phpstan": "phpstan --memory-limit=1024M",
"test": [
"@phpcs",
"@phpunit",
Expand Down
8 changes: 5 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ parameters:
# Level 9 is the highest level
level: max

# Disable generics in type hints.
checkGenericClassInNonGenericObjectType: false

paths:
- blocks/
- entries/
- src/
- plugin.php

scanDirectories:
- %currentWorkingDirectory%/vendor/campaignmonitor/
- %currentWorkingDirectory%/vendor/wordpress-fieldmanager/
- %currentWorkingDirectory%/../../../wp-includes/
- %currentWorkingDirectory%/vendor/alleyinteractive/wordpress-fieldmanager/php
- %currentWorkingDirectory%/vendor/campaignmonitor/createsend-php/class
4 changes: 1 addition & 3 deletions src/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ public function get_client(): \CS_REST_General|false {
if ( empty( $settings ) || ! is_array( $settings ) || empty( $settings['api_key'] ) ) {
return false;
}
$auth = [ 'api_key' => $settings['api_key'] ];
$wrap = new \CS_REST_General( $auth );

return $wrap;
return new \CS_REST_General( [ 'api_key' => $settings['api_key'] ] );
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/class-wp-newsletter-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ public function on_after_insert_post( int $post_id ): void {
$breaking_post_id = wp_insert_post(
[
'post_title' => "Breaking News {$post->ID}",
'post_content' => get_post_meta( $post->ID, 'nb_breaking_content', true ),
// @phpstan-ignore-next-line cast to string is necessary.
'post_content' => (string) get_post_meta( $post->ID, 'nb_breaking_content', true ),
'post_status' => 'publish',
'post_type' => 'nb_newsletter',
'meta_input' => [
Expand Down

0 comments on commit 80dfa50

Please sign in to comment.