-
Notifications
You must be signed in to change notification settings - Fork 94
PHPStan level 6 #536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
swissspidy
wants to merge
6
commits into
main
Choose a base branch
from
add/phpstan
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
PHPStan level 6 #536
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d8c60d0
PHPStan level 6
swissspidy db4f48e
Fix object access
swissspidy 99de66c
Almost level 7
swissspidy cd773ae
Almost level 8
swissspidy 9785355
Almost level 9
swissspidy 9799ea8
Remove some pre-4.7 compat code
swissspidy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
parameters: | ||
level: 6 | ||
paths: | ||
- src | ||
- entity-command.php | ||
scanDirectories: | ||
- vendor/wp-cli/wp-cli/php | ||
- vendor/wp-cli/wp-cli-tests | ||
scanFiles: | ||
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php | ||
treatPhpDocTypesAsCertain: false | ||
dynamicConstantNames: | ||
- WP_DEBUG | ||
- WP_DEBUG_LOG | ||
- WP_DEBUG_DISPLAY | ||
ignoreErrors: | ||
- identifier: missingType.iterableValue | ||
- identifier: missingType.property | ||
- identifier: missingType.parameter | ||
- identifier: missingType.return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,10 +182,6 @@ public function create( $args, $assoc_args ) { | |
$assoc_args['post_category'] = $this->get_category_ids( $assoc_args['post_category'] ); | ||
} | ||
|
||
if ( isset( $assoc_args['meta_input'] ) && Utils\wp_version_compare( '4.4', '<' ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Figured with our move to WP 4.9+ we can remove this compat code. |
||
WP_CLI::warning( "The 'meta_input' field was only introduced in WordPress 4.4 so will have no effect." ); | ||
} | ||
|
||
$array_arguments = [ 'meta_input' ]; | ||
$assoc_args = Utils\parse_shell_arrays( $assoc_args, $array_arguments ); | ||
|
||
|
@@ -351,10 +347,6 @@ public function update( $args, $assoc_args ) { | |
$assoc_args['post_category'] = $this->get_category_ids( $assoc_args['post_category'] ); | ||
} | ||
|
||
if ( isset( $assoc_args['meta_input'] ) && Utils\wp_version_compare( '4.4', '<' ) ) { | ||
WP_CLI::warning( "The 'meta_input' field was only introduced in WordPress 4.4 so will have no effect." ); | ||
} | ||
|
||
$array_arguments = [ 'meta_input' ]; | ||
$assoc_args = Utils\parse_shell_arrays( $assoc_args, $array_arguments ); | ||
|
||
|
@@ -387,7 +379,7 @@ public function edit( $args, $assoc_args ) { | |
$result = $this->_edit( $post->post_content, "WP-CLI post {$post->ID}" ); | ||
|
||
if ( false === $result ) { | ||
WP_CLI::warning( 'No change made to post content.', 'Aborted' ); | ||
WP_CLI::warning( 'No change made to post content.' ); | ||
} else { | ||
$this->update( $args, [ 'post_content' => $result ] ); | ||
} | ||
|
@@ -644,9 +636,12 @@ public function list_( $args, $assoc_args ) { | |
$query_args['post_type'] = explode( ',', $query_args['post_type'] ); | ||
} | ||
|
||
// To be fixed in wp-cli/wp-cli. | ||
// @phpstan-ignore property.notFound | ||
if ( 'ids' === $formatter->format ) { | ||
$query_args['fields'] = 'ids'; | ||
$query = new WP_Query( $query_args ); | ||
// @phpstan-ignore argument.type | ||
echo implode( ' ', $query->posts ); | ||
} elseif ( 'count' === $formatter->format ) { | ||
$query_args['fields'] = 'ids'; | ||
|
@@ -656,8 +651,13 @@ public function list_( $args, $assoc_args ) { | |
$query = new WP_Query( $query_args ); | ||
$posts = array_map( | ||
function ( $post ) { | ||
$post->url = get_permalink( $post->ID ); | ||
return $post; | ||
/** | ||
* @var \WP_Post $post | ||
*/ | ||
|
||
// @phpstan-ignore property.notFound | ||
$post->url = get_permalink( $post->ID ); | ||
return $post; | ||
}, | ||
$query->posts | ||
); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this is not the wrong way around 🤔