Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"scripts": {
"format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source",
"lint": "phpcs --standard=phpcs.xml.dist",
"phpstan": "@php tools/phpstan/generate-wordpress-stubs.php && phpstan analyse --memory-limit=2G",
"phpstan": "@php tools/phpstan/generate-wordpress-stubs.php --quiet && phpstan analyse --memory-limit=2G",
"phpstan:baselines": "@phpstan --configuration=phpstan.neon.dist --generate-baseline=tools/phpstan/baseline.neon --allow-empty-baseline",
"phpstan:generate-wordpress-stubs": "@php tools/phpstan/generate-wordpress-stubs.php",
"test": "phpunit",
Expand Down
150 changes: 0 additions & 150 deletions tools/phpstan/baseline.neon
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
parameters:
ignoreErrors:
-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''FIGURE'' given\.$#'
identifier: argument.type
count: 1
path: ../../lib/block-supports/layout.php

-
message: '#^Method WP_Duotone_Gutenberg\:\:get_all_global_style_block_names\(\) never returns null so it can be removed from the return type\.$#'
identifier: return.unusedType
Expand Down Expand Up @@ -48,12 +42,6 @@ parameters:
count: 1
path: ../../lib/compat/wordpress-7.1/block-bindings.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''SPAN'' given\.$#'
identifier: argument.type
count: 1
path: ../../lib/compat/wordpress-7.1/block-comments.php

-
message: '#^Cannot assign offset ''media_type'' to WP_REST_Request\.$#'
identifier: offsetAssign.dimType
Expand All @@ -72,12 +60,6 @@ parameters:
count: 2
path: ../../lib/compat/wordpress-7.1/class-gutenberg-rest-attachments-controller-7-1.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''svg'' given\.$#'
identifier: argument.type
count: 1
path: ../../lib/compat/wordpress-7.1/icons.php

-
message: '#^Property WP_Post\:\:\$post_date \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -156,30 +138,12 @@ parameters:
count: 1
path: ../../lib/media/load.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''SCRIPT'' given\.$#'
identifier: argument.type
count: 1
path: ../../lib/media/load.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''IMG'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/accordion-item/index.php

-
message: '#^Property WP_Comment\:\:\$comment_author_url \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../packages/block-library/src/avatar/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''a'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/categories/index.php

-
message: '#^Parameter \#2 \$size of function get_avatar expects int, null given\.$#'
identifier: argument.type
Expand All @@ -198,66 +162,18 @@ parameters:
count: 1
path: ../../packages/block-library/src/comment-date/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''IFRAME'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/cover/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''IMG'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/details/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''OBJECT'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/file/index.php

-
message: '#^Cannot access property \$context on array\.$#'
identifier: property.nonObject
count: 3
path: ../../packages/block-library/src/gallery/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''figure'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/gallery/index.php

-
message: '#^Parameter \#2 \$block of function block_core_gallery_resolve_dynamic_source expects WP_Block, array given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/gallery/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''svg'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/icon/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''FIGCAPTION'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/image/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''figure'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/image/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''img'' given\.$#'
identifier: argument.type
count: 4
path: ../../packages/block-library/src/image/index.php

-
message: '#^Parameter \#1 \$author_id of function get_author_posts_url expects int, string given\.$#'
identifier: argument.type
Expand All @@ -270,12 +186,6 @@ parameters:
count: 1
path: ../../packages/block-library/src/latest-comments/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''input'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/loginout/index.php

-
message: '#^Call to function is_array\(\) with array\<mixed\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
Expand Down Expand Up @@ -312,18 +222,6 @@ parameters:
count: 1
path: ../../packages/block-library/src/navigation/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''IMG'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/navigation/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''LI'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/navigation/index.php

-
message: '#^Property WP_Block\:\:\$inner_blocks \(WP_Block_List\) in empty\(\) is not falsy\.$#'
identifier: empty.property
Expand All @@ -336,30 +234,12 @@ parameters:
count: 1
path: ../../packages/block-library/src/navigation/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''p'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/paragraph/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''figure'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/playlist/index.php

-
message: '#^Property WP_Block\:\:\$inner_blocks \(WP_Block_List\) in empty\(\) is not falsy\.$#'
identifier: empty.property
count: 1
path: ../../packages/block-library/src/playlist/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''img'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/post-featured-image/index.php

-
message: '#^Function block_core_post_time_to_read_word_count\(\) should return string but returns int\.$#'
identifier: return.type
Expand Down Expand Up @@ -408,36 +288,6 @@ parameters:
count: 1
path: ../../packages/block-library/src/search/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''a'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/site-logo/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''a'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/social-link/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''button'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/tab-list/index.php

-
message: '#^Parameter \#1 \$query of method WP_HTML_Tag_Processor\:\:next_tag\(\) expects array\{tag_name\?\: string\|null, match_offset\?\: int\|null, class_name\?\: string\|null, tag_closers\?\: string\|null\}\|null, ''nav'' given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/table-of-contents/index.php

-
message: '#^Parameter \#1 \$args of function wp_tag_cloud expects array\{number\?\: int, link\?\: string, post_type\?\: string, echo\?\: bool, smallest\?\: int, largest\?\: int, unit\?\: string, format\?\: string, \.\.\.\}, array\{echo\: false, unit\: non\-empty\-string, taxonomy\: mixed, show_count\: mixed, number\: mixed, smallest\: float, largest\: float\} given\.$#'
identifier: argument.type
count: 1
path: ../../packages/block-library/src/tag-cloud/index.php

-
message: '#^Right side of \|\| is always true\.$#'
identifier: booleanOr.rightAlwaysTrue
Expand Down
12 changes: 10 additions & 2 deletions tools/phpstan/generate-wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* in composer.json in place of the released package.
*
* The stubs are not committed. The package's composer.json records the source that they are generated
* from, and `composer phpstan` runs this script with no option first, which generates them when they
* from, and `composer phpstan` runs this script with only `--quiet` first, which generates them when they
* are missing or were generated from another source.
*
* This is temporary. Once php-stubs/wordpress-stubs publishes builds from trunk, require a pinned one
Expand All @@ -18,7 +18,8 @@
* Usage, through `composer phpstan:generate-wordpress-stubs -- <option>`:
*
* (no option) Generate the stubs from the source recorded in wordpress-stubs/composer.json,
* unless they already were. Add `--force` to generate them anyway.
* unless they already were. Add `--force` to generate them anyway, or
* `--quiet` to not report that they already were, as `composer phpstan` does.
* --commit=<ref> Generate from a commit of wordpress-develop, such as `trunk`.
* --pr=<number|url> Generate from the head of a wordpress-develop pull request, for a Gutenberg
* pull request that depends on it. Before the Gutenberg pull request is
Expand Down Expand Up @@ -568,6 +569,7 @@ function main( array $args ): void {
$checkout = '';
$use_checkout = false;
$force = false;
$quiet = false;
foreach ( $args as $arg ) {
if ( preg_match( '/^--(commit|pr|checkout)=(.+)$/', $arg, $matches ) ) {
if ( 'commit' === $matches[1] ) {
Expand All @@ -582,6 +584,8 @@ function main( array $args ): void {
$use_checkout = true;
} elseif ( '--force' === $arg ) {
$force = true;
} elseif ( '--quiet' === $arg ) {
$quiet = true;
} elseif ( '--help' === $arg ) {
usage( 0 );
} else {
Expand Down Expand Up @@ -625,6 +629,10 @@ function main( array $args ): void {
} elseif ( read_stub_key( $stub_file ) !== $generation_key( $commit, $pr ) ) {
$reason = 'out of date';
} else {
if ( ! $quiet ) {
$source_label = '' !== $pr ? "$develop_repo#$pr at " . short_commit( $commit ) : "$develop_repo@" . short_commit( $commit );
report( "The WordPress stubs are already generated from $source_label. Add --force to generate them again." );
}
return;
}
}
Expand Down
8 changes: 4 additions & 4 deletions tools/phpstan/wordpress-stubs/composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "php-stubs/wordpress-stubs",
"version": "7.2.0-beta3.65047",
"description": "WordPress stubs generated from https://github.com/WordPress/wordpress-develop/commit/cb5eaeacdfec3c15eae12f52397520d06ae190de (r65047), in place of the released package.",
"version": "7.2.0-beta3.65220",
"description": "WordPress stubs generated from https://github.com/WordPress/wordpress-develop/commit/140b182252392fb12733a9c7cc7d5136a522ba43 (r65220), in place of the released package.",
"license": "GPL-2.0-or-later",
"extra": {
"source": {
"commit": "cb5eaeacdfec3c15eae12f52397520d06ae190de",
"revision": 65047
"commit": "140b182252392fb12733a9c7cc7d5136a522ba43",
"revision": 65220
}
}
}
Loading