Skip to content

Commit 9cc14a5

Browse files
committed
tests: exclude wp-include/blocks from PHPStan analysis
1 parent 086fb17 commit 9cc14a5

8 files changed

Lines changed: 2 additions & 1446 deletions

File tree

tests/phpstan/base.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ parameters:
3333
- ../../src/wp-admin/images
3434
- ../../src/wp-admin/js
3535
analyse:
36+
# These files are sourced by wordpress/gutenberg in `tools/release/sync-stable-blocks.js`.
37+
- ../../src/wp-includes/blocks
3638
# Third-party libraries.
3739
- ../../src/wp-admin/includes/class-ftp-pure.php
3840
- ../../src/wp-admin/includes/class-ftp-sockets.php

tests/phpstan/baseline/level-0.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,6 @@
6161
'count' => 1,
6262
'path' => __DIR__ . '/../../../src/wp-admin/press-this.php',
6363
];
64-
$ignoreErrors[] = [
65-
// identifier: return.missing
66-
'message' => '#^Function block_core_navigation_get_classic_menu_fallback\\(\\) should return object but return statement is missing\\.$#',
67-
'count' => 1,
68-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
69-
];
70-
$ignoreErrors[] = [
71-
// identifier: return.missing
72-
'message' => '#^Method WP_Navigation_Block_Renderer\\:\\:get_inner_blocks_from_navigation_post\\(\\) should return WP_Block_List but return statement is missing\\.$#',
73-
'count' => 1,
74-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
75-
];
76-
$ignoreErrors[] = [
77-
// identifier: function.notFound
78-
'message' => '#^Function gutenberg_serialize_blocks not found\\.$#',
79-
'count' => 1,
80-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/pattern.php',
81-
];
8264
$ignoreErrors[] = [
8365
// identifier: return.missing
8466
'message' => '#^Method WP_Comment\\:\\:__isset\\(\\) should return bool but return statement is missing\\.$#',

tests/phpstan/baseline/level-1.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,6 @@
121121
'count' => 1,
122122
'path' => __DIR__ . '/../../../src/wp-includes/block-template-utils.php',
123123
];
124-
$ignoreErrors[] = [
125-
// identifier: isset.variable
126-
'message' => '#^Variable \\$lightbox_settings in isset\\(\\) always exists and is not nullable\\.$#',
127-
'count' => 1,
128-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/image.php',
129-
];
130-
$ignoreErrors[] = [
131-
// identifier: empty.variable
132-
'message' => '#^Variable \\$inner_blocks in empty\\(\\) always exists and is not falsy\\.$#',
133-
'count' => 1,
134-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
135-
];
136124
$ignoreErrors[] = [
137125
// identifier: empty.variable
138126
'message' => '#^Variable \\$addl_path in empty\\(\\) always exists and is always falsy\\.$#',

tests/phpstan/baseline/level-2.php

Lines changed: 0 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -961,186 +961,6 @@
961961
'count' => 2,
962962
'path' => __DIR__ . '/../../../src/wp-includes/admin-bar.php',
963963
];
964-
$ignoreErrors[] = [
965-
// identifier: parameter.notFound
966-
'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$block$#',
967-
'count' => 1,
968-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/button.php',
969-
];
970-
$ignoreErrors[] = [
971-
// identifier: parameter.notFound
972-
'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$block$#',
973-
'count' => 1,
974-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/file.php',
975-
];
976-
$ignoreErrors[] = [
977-
// identifier: throws.notThrowable
978-
'message' => '#^PHPDoc tag @throws with type WP_Error is not subtype of Throwable$#',
979-
'count' => 1,
980-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/home-link.php',
981-
];
982-
$ignoreErrors[] = [
983-
// identifier: throws.notThrowable
984-
'message' => '#^PHPDoc tag @throws with type WP_Error is not subtype of Throwable$#',
985-
'count' => 1,
986-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation-link.php',
987-
];
988-
$ignoreErrors[] = [
989-
// identifier: throws.notThrowable
990-
'message' => '#^PHPDoc tag @throws with type WP_Error is not subtype of Throwable$#',
991-
'count' => 1,
992-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation-submenu.php',
993-
];
994-
$ignoreErrors[] = [
995-
// identifier: throws.notThrowable
996-
'message' => '#^PHPDoc tag @throws with type WP_Error is not subtype of Throwable$#',
997-
'count' => 1,
998-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
999-
];
1000-
$ignoreErrors[] = [
1001-
// identifier: staticClassAccess.privateProperty
1002-
'message' => '#^Unsafe access to private property WP_Navigation_Block_Renderer\\:\\:\\$has_submenus through static\\:\\:\\.$#',
1003-
'count' => 5,
1004-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1005-
];
1006-
$ignoreErrors[] = [
1007-
// identifier: staticClassAccess.privateProperty
1008-
'message' => '#^Unsafe access to private property WP_Navigation_Block_Renderer\\:\\:\\$needs_list_item_wrapper through static\\:\\:\\.$#',
1009-
'count' => 1,
1010-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1011-
];
1012-
$ignoreErrors[] = [
1013-
// identifier: staticClassAccess.privateProperty
1014-
'message' => '#^Unsafe access to private property WP_Navigation_Block_Renderer\\:\\:\\$seen_menu_names through static\\:\\:\\.$#',
1015-
'count' => 6,
1016-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1017-
];
1018-
$ignoreErrors[] = [
1019-
// identifier: staticClassAccess.privateMethod
1020-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:does_block_need_a_list_item_wrapper\\(\\) through static\\:\\:\\.$#',
1021-
'count' => 1,
1022-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1023-
];
1024-
$ignoreErrors[] = [
1025-
// identifier: staticClassAccess.privateMethod
1026-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_classes\\(\\) through static\\:\\:\\.$#',
1027-
'count' => 2,
1028-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1029-
];
1030-
$ignoreErrors[] = [
1031-
// identifier: staticClassAccess.privateMethod
1032-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_inner_blocks\\(\\) through static\\:\\:\\.$#',
1033-
'count' => 1,
1034-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1035-
];
1036-
$ignoreErrors[] = [
1037-
// identifier: staticClassAccess.privateMethod
1038-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_inner_blocks_from_fallback\\(\\) through static\\:\\:\\.$#',
1039-
'count' => 1,
1040-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1041-
];
1042-
$ignoreErrors[] = [
1043-
// identifier: staticClassAccess.privateMethod
1044-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_inner_blocks_from_navigation_post\\(\\) through static\\:\\:\\.$#',
1045-
'count' => 1,
1046-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1047-
];
1048-
$ignoreErrors[] = [
1049-
// identifier: staticClassAccess.privateMethod
1050-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_inner_blocks_html\\(\\) through static\\:\\:\\.$#',
1051-
'count' => 1,
1052-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1053-
];
1054-
$ignoreErrors[] = [
1055-
// identifier: staticClassAccess.privateMethod
1056-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_layout_class\\(\\) through static\\:\\:\\.$#',
1057-
'count' => 1,
1058-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1059-
];
1060-
$ignoreErrors[] = [
1061-
// identifier: staticClassAccess.privateMethod
1062-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_markup_for_inner_block\\(\\) through static\\:\\:\\.$#',
1063-
'count' => 1,
1064-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1065-
];
1066-
$ignoreErrors[] = [
1067-
// identifier: staticClassAccess.privateMethod
1068-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_nav_element_directives\\(\\) through static\\:\\:\\.$#',
1069-
'count' => 1,
1070-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1071-
];
1072-
$ignoreErrors[] = [
1073-
// identifier: staticClassAccess.privateMethod
1074-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_nav_wrapper_attributes\\(\\) through static\\:\\:\\.$#',
1075-
'count' => 1,
1076-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1077-
];
1078-
$ignoreErrors[] = [
1079-
// identifier: staticClassAccess.privateMethod
1080-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_navigation_name\\(\\) through static\\:\\:\\.$#',
1081-
'count' => 1,
1082-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1083-
];
1084-
$ignoreErrors[] = [
1085-
// identifier: staticClassAccess.privateMethod
1086-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_responsive_container_markup\\(\\) through static\\:\\:\\.$#',
1087-
'count' => 1,
1088-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1089-
];
1090-
$ignoreErrors[] = [
1091-
// identifier: staticClassAccess.privateMethod
1092-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_styles\\(\\) through static\\:\\:\\.$#',
1093-
'count' => 2,
1094-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1095-
];
1096-
$ignoreErrors[] = [
1097-
// identifier: staticClassAccess.privateMethod
1098-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_unique_navigation_name\\(\\) through static\\:\\:\\.$#',
1099-
'count' => 1,
1100-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1101-
];
1102-
$ignoreErrors[] = [
1103-
// identifier: staticClassAccess.privateMethod
1104-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:get_wrapper_markup\\(\\) through static\\:\\:\\.$#',
1105-
'count' => 1,
1106-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1107-
];
1108-
$ignoreErrors[] = [
1109-
// identifier: staticClassAccess.privateMethod
1110-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:handle_view_script_module_loading\\(\\) through static\\:\\:\\.$#',
1111-
'count' => 1,
1112-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1113-
];
1114-
$ignoreErrors[] = [
1115-
// identifier: staticClassAccess.privateMethod
1116-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:has_submenus\\(\\) through static\\:\\:\\.$#',
1117-
'count' => 2,
1118-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1119-
];
1120-
$ignoreErrors[] = [
1121-
// identifier: staticClassAccess.privateMethod
1122-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:is_interactive\\(\\) through static\\:\\:\\.$#',
1123-
'count' => 4,
1124-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1125-
];
1126-
$ignoreErrors[] = [
1127-
// identifier: staticClassAccess.privateMethod
1128-
'message' => '#^Unsafe call to private method WP_Navigation_Block_Renderer\\:\\:is_responsive\\(\\) through static\\:\\:\\.$#',
1129-
'count' => 4,
1130-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/navigation.php',
1131-
];
1132-
$ignoreErrors[] = [
1133-
// identifier: parameter.notFound
1134-
'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$block$#',
1135-
'count' => 1,
1136-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/search.php',
1137-
];
1138-
$ignoreErrors[] = [
1139-
// identifier: parameter.notFound
1140-
'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$content$#',
1141-
'count' => 1,
1142-
'path' => __DIR__ . '/../../../src/wp-includes/blocks/search.php',
1143-
];
1144964
$ignoreErrors[] = [
1145965
// identifier: property.notFound
1146966
'message' => '#^Access to an undefined property object\\:\\:\\$taxonomy\\.$#',
@@ -1177,84 +997,6 @@
1177997
'count' => 1,
1178998
'path' => __DIR__ . '/../../../src/wp-includes/category.php',
1179999
];
1180-
$ignoreErrors[] = [
1181-
// identifier: class.notFound
1182-
'message' => '#^Function Avifinfo\\\\read\\(\\) has invalid return type Avifinfo\\\\binary\\.$#',
1183-
'count' => 1,
1184-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1185-
];
1186-
$ignoreErrors[] = [
1187-
// identifier: class.notFound
1188-
'message' => '#^Method Avifinfo\\\\Box\\:\\:parse\\(\\) has invalid return type Avifinfo\\\\Status\\.$#',
1189-
'count' => 1,
1190-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1191-
];
1192-
$ignoreErrors[] = [
1193-
// identifier: class.notFound
1194-
'message' => '#^Method Avifinfo\\\\Features\\:\\:get_item_features\\(\\) has invalid return type Avifinfo\\\\Status\\.$#',
1195-
'count' => 1,
1196-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1197-
];
1198-
$ignoreErrors[] = [
1199-
// identifier: class.notFound
1200-
'message' => '#^Method Avifinfo\\\\Features\\:\\:get_primary_item_features\\(\\) has invalid return type Avifinfo\\\\Status\\.$#',
1201-
'count' => 1,
1202-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1203-
];
1204-
$ignoreErrors[] = [
1205-
// identifier: class.notFound
1206-
'message' => '#^Method Avifinfo\\\\Parser\\:\\:parse_ipco\\(\\) has invalid return type Avifinfo\\\\Status\\.$#',
1207-
'count' => 1,
1208-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1209-
];
1210-
$ignoreErrors[] = [
1211-
// identifier: class.notFound
1212-
'message' => '#^Method Avifinfo\\\\Parser\\:\\:parse_iprp\\(\\) has invalid return type Avifinfo\\\\Status\\.$#',
1213-
'count' => 1,
1214-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1215-
];
1216-
$ignoreErrors[] = [
1217-
// identifier: class.notFound
1218-
'message' => '#^Method Avifinfo\\\\Parser\\:\\:parse_iref\\(\\) has invalid return type Avifinfo\\\\Status\\.$#',
1219-
'count' => 1,
1220-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1221-
];
1222-
$ignoreErrors[] = [
1223-
// identifier: class.notFound
1224-
'message' => '#^Method Avifinfo\\\\Parser\\:\\:parse_meta\\(\\) has invalid return type Avifinfo\\\\Status\\.$#',
1225-
'count' => 1,
1226-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1227-
];
1228-
$ignoreErrors[] = [
1229-
// identifier: phpDoc.parseError
1230-
'message' => '#^PHPDoc tag @param has invalid value \\(binary string \\$input Must be at least \\$num_bytes\\-long\\.\\)\\: Unexpected token "string", expected variable at offset 87$#',
1231-
'count' => 1,
1232-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1233-
];
1234-
$ignoreErrors[] = [
1235-
// identifier: parameter.notFound
1236-
'message' => '#^PHPDoc tag @param references unknown parameter\\: \\$handle$#',
1237-
'count' => 4,
1238-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1239-
];
1240-
$ignoreErrors[] = [
1241-
// identifier: class.notFound
1242-
'message' => '#^Parameter \\$handle of function Avifinfo\\\\read\\(\\) has invalid type Avifinfo\\\\stream\\.$#',
1243-
'count' => 1,
1244-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1245-
];
1246-
$ignoreErrors[] = [
1247-
// identifier: class.notFound
1248-
'message' => '#^Parameter \\$handle of function Avifinfo\\\\skip\\(\\) has invalid type Avifinfo\\\\stream\\.$#',
1249-
'count' => 1,
1250-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1251-
];
1252-
$ignoreErrors[] = [
1253-
// identifier: class.notFound
1254-
'message' => '#^Parameter \\$handle of method Avifinfo\\\\Box\\:\\:parse\\(\\) has invalid type Avifinfo\\\\stream\\.$#',
1255-
'count' => 1,
1256-
'path' => __DIR__ . '/../../../src/wp-includes/class-avif-info.php',
1257-
];
12581000
$ignoreErrors[] = [
12591001
// identifier: property.notFound
12601002
'message' => '#^Access to an undefined property WP_Post\\:\\:\\$current\\.$#',

0 commit comments

Comments
 (0)