Skip to content

Commit c0ac23c

Browse files
swissspidyclaude
andauthored
Exclude the wp-compat false positives from the PHPStan config (#18)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent f76d351 commit c0ac23c

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

‎phpstan.neon.dist‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,52 @@ parameters:
6464
-
6565
message: '#Access to an undefined property WP_Block_Type::#'
6666
reportUnmatched: false
67+
# johnbillion/wp-compat checks every WordPress symbol against the WordPress 4.9
68+
# baseline that wp-cli-tests configures. It only recognizes function_exists() and
69+
# method_exists() guards, so it cannot see the per-command `before_invoke` checks in
70+
# block-command.php, and reports every block API symbol as an error.
71+
#
72+
# Each entry below matches on the message as well as the identifier, pinning the
73+
# version that the corresponding command is gated on, so a call to anything newer
74+
# than that gate still gets reported rather than swallowed by a file-wide ignore.
75+
76+
# `wp block type` is gated on WordPress 5.0.
77+
-
78+
identifier: WPCompat.methodNotAvailable
79+
message: '#^(WP_Block_Type::is_dynamic|WP_Block_Type_Registry::(get_all_registered|get_instance|get_registered|is_registered))\(\) is only available since WordPress version 5\.0\.0\.$#'
80+
path: src/Block_Type_Command.php
81+
82+
# `wp block synced-pattern` is gated on WordPress 5.0.
83+
-
84+
identifier: WPCompat.functionNotAvailable
85+
message: '#^parse_blocks\(\) is only available since WordPress version 5\.0\.0\.$#'
86+
path: src/Block_Synced_Pattern_Command.php
87+
88+
# `wp block style` is gated on WordPress 5.3.
89+
-
90+
identifier: WPCompat.methodNotAvailable
91+
message: '#^WP_Block_Styles_Registry::(get_all_registered|get_instance|get_registered_styles_for_block)\(\) is only available since WordPress version 5\.3\.0\.$#'
92+
path: src/Block_Style_Command.php
93+
94+
# `wp block pattern` and `wp block pattern-category` are gated on WordPress 5.5.
95+
-
96+
identifier: WPCompat.methodNotAvailable
97+
message: '#^WP_Block_Patterns_Registry::(get_all_registered|get_instance|get_registered)\(\) is only available since WordPress version 5\.5\.0\.$#'
98+
path: src/Block_Pattern_Command.php
99+
-
100+
identifier: WPCompat.methodNotAvailable
101+
message: '#^WP_Block_Pattern_Categories_Registry::(get_all_registered|get_instance|get_registered)\(\) is only available since WordPress version 5\.5\.0\.$#'
102+
path: src/Block_Pattern_Category_Command.php
103+
104+
# `wp block template` is gated on WordPress 5.9, so the WordPress 5.8 template
105+
# functions it calls are comfortably covered.
106+
-
107+
identifier: WPCompat.functionNotAvailable
108+
message: '#^get_block_templates?\(\) is only available since WordPress version 5\.8\.0\.$#'
109+
path: src/Block_Template_Command.php
110+
111+
# `wp block binding` is gated on WordPress 6.5.
112+
-
113+
identifier: WPCompat.functionNotAvailable
114+
message: '#^(get_all_registered_block_bindings_sources|get_block_bindings_source)\(\) is only available since WordPress version 6\.5\.0\.$#'
115+
path: src/Block_Binding_Command.php

0 commit comments

Comments
 (0)