Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
97386a7
Add `phpstan/phpdoc-parser`
thelovekesh Jun 28, 2026
576eb4c
Add phpdoc type name resolver
thelovekesh Jun 28, 2026
6c4964f
Add phpdoc rewriter with fully qualified name in phpdoc
thelovekesh Jun 28, 2026
4276792
Update visitor to resolve FQCN in phpdoc
thelovekesh Jun 28, 2026
3ca9ff8
Fix linting errors
thelovekesh Jun 28, 2026
3543f1a
Fix writing bad node to phpdoc
thelovekesh Jun 28, 2026
156c151
Fix breaking the doc parser for invalid phpdoc
thelovekesh Jun 28, 2026
35c3210
Add test cases for PhpDocFqcnRewriter
thelovekesh Jun 28, 2026
7531665
Add mikey179/vfsstream
thelovekesh Jun 28, 2026
2fc4a19
Add integration test for visitor to test fcqn rewrite
thelovekesh Jun 28, 2026
1aef474
Update test function name
thelovekesh Jun 28, 2026
3c6f266
Fix catch support for php7.4
thelovekesh Jun 28, 2026
cc56f8b
Fix lint error
thelovekesh Jun 28, 2026
ab00b72
Spell fix
thelovekesh Jun 28, 2026
57127cf
Update WordPress 7.0.0 stubs with FQCN resolved phpdocs
thelovekesh Jun 28, 2026
4d00324
Disable matrix fail fast
thelovekesh Jun 28, 2026
9e5ece8
Update core nav block functions
thelovekesh Jun 28, 2026
24f5ba9
Update array shape
thelovekesh Jun 28, 2026
5059958
Update WordPress 7.0.0 stubs with FQCN resolved phpdocs
thelovekesh Jun 28, 2026
b123d19
Run composer test command items in parallel
thelovekesh Jun 28, 2026
26c3d5f
Move phpdoc parser to php-stubs/generator
thelovekesh Jun 28, 2026
764d7ec
Update phpstan return type for `block_core_shared_navigation_render_s…
thelovekesh Jun 28, 2026
f2ce721
Simplify test execution in GitHub Actions
szepeviktor Jun 28, 2026
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
3 changes: 1 addition & 2 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,12 @@
'block_core_navigation_build_css_font_sizes' => ['array{css_classes: list<string>, inline_styles: string}'],
'block_core_navigation_link_build_css_colors' => ['array{css_classes: list<string>, inline_styles: string}'],
'block_core_navigation_link_build_css_font_sizes' => ['array{css_classes: list<string>, inline_styles: string}'],
'block_core_navigation_link_render_submenu_icon' => ['non-falsy-string'],
Comment thread
szepeviktor marked this conversation as resolved.
'block_core_navigation_render_submenu_icon' => ['non-falsy-string'],
'block_core_navigation_submenu_build_css_font_sizes' => ['array{css_classes: list<string>, inline_styles: string}'],
'block_core_navigation_submenu_render_submenu_icon' => ['non-falsy-string'],
'block_core_page_list_build_css_colors' => ['array{css_classes: list<string>, inline_styles: string, overlay_css_classes: list<string>, overlay_inline_styles: string}'],
'block_core_page_list_build_css_font_sizes' => ['array{css_classes: list<string>, inline_styles: string}'],
'block_core_post_time_to_read_word_count' => ['int<0, max>'],
'block_core_shared_navigation_render_submenu_icon' => ['non-falsy-string'],
'block_version' => ["(\$content is '' ? 0 : 0|1)", '@phpstan-pure' => ''],
'bool_from_yn' => ["(\$yn is 'y' ? true : false)", '@phpstan-pure' => ''],
'build_dropdown_script_block_core_categories' => ['non-falsy-string'],
Expand Down
6 changes: 3 additions & 3 deletions src/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ private function getAdditionalTagsFromMap(string $symbolName): array

foreach ($parameters as $paramName => $paramType) {
if (str_starts_with($paramName, '@')) {
$format = ( $paramType === '' ) ? '%s' : '%s %s';
$format = ($paramType === '') ? '%s' : '%s %s';
$additions[] = sprintf(
$format,
$paramName,
Expand Down Expand Up @@ -684,8 +684,8 @@ private static function getTypeNameFromString(string $tagVariable): ?string

$tagVariableType = str_replace(
[
'stdClass',
'\\object',
'stdClass',
'\\object',
],
'object',
$tagVariableType
Expand Down
2 changes: 1 addition & 1 deletion tests/data/assert/wp-is-numeric-array.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
// Check with mixed keys constant array
$data = [1 => 'intKey', 'key' => 'stringKey'];
if (wp_is_numeric_array($data)) {
assertType("non-empty-array<1, 'intKey'|'stringKey'>", $data);
assertType("array{1: 'intKey'}", $data);
Comment thread
szepeviktor marked this conversation as resolved.
}
if (! wp_is_numeric_array($data)) {
assertType("array{1: 'intKey', key: 'stringKey'}", $data);
Expand Down
3 changes: 1 addition & 2 deletions tests/data/return/block-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
assertType('non-falsy-string', build_dropdown_script_block_core_categories(Faker::string()));

// Submenu icon
assertType('non-falsy-string', block_core_navigation_link_render_submenu_icon());
assertType('non-falsy-string', block_core_navigation_render_submenu_icon());
assertType('non-falsy-string', block_core_navigation_submenu_render_submenu_icon());
assertType('non-falsy-string', block_core_shared_navigation_render_submenu_icon());

// Render block
assertType('non-falsy-string', render_block_core_archives(Faker::array()));
Expand Down
1 change: 1 addition & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -114656,6 +114656,7 @@ function block_core_shared_navigation_item_should_render($attributes, $block)
* @since 5.9.0
*
* @return string
* @phpstan-return non-falsy-string
*/
function block_core_shared_navigation_render_submenu_icon()
{
Expand Down