Skip to content

Commit

Permalink
Update to PHPStan 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 29, 2024
1 parent 186185f commit 49203b0
Show file tree
Hide file tree
Showing 42 changed files with 176 additions and 175 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"phpcompatibility/phpcompatibility-wp": "^2.1",
"phpmd/phpmd": "^2.9",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.2",
"phpstan/phpstan-deprecation-rules": "^2.0.1",
"phpstan/phpstan-phpunit": "^2.0.1",
"roave/security-advisories": "dev-latest",
"sirbrillig/phpcs-variable-analysis": "^2.8",
"slevomat/coding-standard": "^8.0.0",
"sniccowp/php-scoper-wordpress-excludes": "^6.0",
"swissspidy/phpstan-no-private": "^0.2.0",
"szepeviktor/phpstan-wordpress": "^1.1.3",
"swissspidy/phpstan-no-private": "^v1.0.0",
"szepeviktor/phpstan-wordpress": "^v2.0.0",
"wp-coding-standards/wpcs": "^3.0.0",
"yoast/wp-test-utils": "^1.0.0"
},
Expand Down
158 changes: 79 additions & 79 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion includes/AMP/Meta_Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Meta_Sanitizer extends AMP_Meta_Sanitizer {
* "Finally, specify the AMP boilerplate code. By putting the boilerplate code last, it prevents custom styles from
* accidentally overriding the boilerplate css rules."
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
*
* @since 1.1.0
*
Expand Down
4 changes: 2 additions & 2 deletions includes/AMP/Sanitization.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function validation_error_callback( array $error, array $data = [] ): boo
/**
* Adds missing scripts.
*
* @SuppressWarnings(PHPMD)
* @SuppressWarnings("PHPMD")
*
* @since 1.1.0
*
Expand Down Expand Up @@ -418,7 +418,7 @@ protected function is_amp_dev_mode(): bool {
* accessing options from the database, requiring AMP__VERSION,
* and causing conflicts with our own amp_is_request() compat shim.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.1.0
*
Expand Down
2 changes: 1 addition & 1 deletion includes/AMP/Traits/Sanitization_Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function transform_html_start_tag( $document ): void {
* Removes empty data-tooltip-icon and data-tooltip-text attributes
* to prevent validation issues.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
*
* @since 1.1.0
*
Expand Down
6 changes: 3 additions & 3 deletions includes/Admin/Activation_Notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ protected function is_plugins_page( $hook_suffix ): bool {
/**
* Sets the flag that the plugin has just been activated.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.13.0
*
Expand All @@ -252,7 +252,7 @@ protected function set_activation_flag( bool $network_wide = false ): bool {
/**
* Gets the flag that the plugin has just been activated.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.13.0
*
Expand All @@ -270,7 +270,7 @@ protected function get_activation_flag( bool $network_wide = false ): bool {
/**
* Deletes the flag that the plugin has just been activated.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.13.0
*
Expand Down
12 changes: 6 additions & 6 deletions includes/Admin/Customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/**
* Class customizer settings.
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
*
* @phpstan-type ThemeSupport array{
* customizer: array{
Expand Down Expand Up @@ -159,9 +159,9 @@ public static function is_needed(): bool {
/**
* Registers web stories customizer settings.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
* @SuppressWarnings("PHPMD.NPathComplexity")
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
*
* @since 1.5.0
*
Expand Down Expand Up @@ -531,8 +531,8 @@ public function validate_number_of_columns( WP_Error $validity, int $value ): WP
/**
* Renders web stories based on the customizer selected options.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
*
* @since 1.5.0
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class Dashboard extends Service_Base {
/**
* Dashboard constructor.
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings("PHPMD.ExcessiveParameterList")
*
* @since 1.0.0
*
Expand Down
4 changes: 2 additions & 2 deletions includes/Admin/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Editor extends Service_Base implements HasRequirements {
/**
* Dashboard constructor.
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings("PHPMD.ExcessiveParameterList")
*
* @since 1.0.0
*
Expand Down Expand Up @@ -333,7 +333,7 @@ public function admin_enqueue_scripts( string $hook ): void {
/**
* Get editor settings as an array.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.0.0
*
Expand Down
2 changes: 1 addition & 1 deletion includes/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function get_tracking_id(): string {
*
* Note: variables in single quotes will be substituted by <amp-analytics>.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @see https://github.com/ampproject/amphtml/blob/main/docs/spec/amp-var-substitutions.md
*
Expand Down
12 changes: 6 additions & 6 deletions includes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function get_asset_metadata( string $handle ): array {
/**
* Register script using handle.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.8.0
*
Expand Down Expand Up @@ -181,7 +181,7 @@ public function register_script_asset( string $script_handle, array $script_depe
/**
* Enqueue script using handle.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.8.0
*
Expand Down Expand Up @@ -255,7 +255,7 @@ public function enqueue_style_asset( string $style_handle, array $style_dependen
/**
* Register a CSS stylesheet.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.8.0
*
Expand Down Expand Up @@ -283,7 +283,7 @@ public function register_style( string $style_handle, $src, array $deps = [], $v
/**
* Register a new script.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.8.0
*
Expand Down Expand Up @@ -315,7 +315,7 @@ public function register_script( string $script_handle, $src, array $deps = [],
/**
* Enqueue a style.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.8.0
*
Expand All @@ -339,7 +339,7 @@ public function enqueue_style( string $style_handle, string $src = '', array $de
/**
* Enqueue a script.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.8.0
*
Expand Down
2 changes: 1 addition & 1 deletion includes/Block/Web_Stories_Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ protected function initialize_block_attributes( array $block_attributes = [] ):
/**
* Returns arguments to be passed to the WP_Query object initialization.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
*
* @since 1.5.0
*
Expand Down
2 changes: 1 addition & 1 deletion includes/Experiments.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function get_experiment_groups(): array {
/**
* Returns a list of all experiments.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.0.0
*
Expand Down
4 changes: 2 additions & 2 deletions includes/Infrastructure/ServiceBasedPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* This abstract base plugin provides all the boilerplate code for working with
* the dependency injector and the service container.
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
*
* @template C of Conditional
* @template D of Delayed
Expand Down Expand Up @@ -715,7 +715,7 @@ protected function instantiate_service( $class_name ): Service {
* object
* or into configuration files.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.6.0
*
Expand Down
4 changes: 2 additions & 2 deletions includes/Integrations/AMP.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
/**
* Class AMP.
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
*
* @phpstan-type AMPOptions array{
* theme_support?: string,
Expand Down Expand Up @@ -349,7 +349,7 @@ public function filter_amp_skip_post( $skipped, int $post ) {
/**
* Get the post type for the current request.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
*
* @since 1.2.0
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/Integrations/Jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/**
* Class Jetpack.
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
*
* @phpstan-type AttachmentData array{
* media_details?: array{
Expand Down
2 changes: 1 addition & 1 deletion includes/KSES.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
* Provides KSES utility methods to override the ones from core.
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
*
* @phpstan-type PostData array{
* post_parent: int|string|null,
Expand Down
2 changes: 1 addition & 1 deletion includes/Media/SVG.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ private function svg_already_enabled(): bool {
/**
* Get SVG image size.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
*
* @since 1.3.0
*
Expand Down
2 changes: 1 addition & 1 deletion includes/Post_Type_Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public function get_parent_controller(): WP_REST_Controller {
* Identical to {@see get_post_type_archive_link()}, but also returns a URL
* if the archive page has been disabled.
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*
* @since 1.14.0
*
Expand Down
6 changes: 3 additions & 3 deletions includes/REST_API/Embed_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*
* API endpoint to facilitate embedding web stories.
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
*
* @phpstan-type SchemaEntry array{
* description: string,
Expand Down Expand Up @@ -126,7 +126,7 @@ public function register_routes(): void {
*
* Returns information about the given story.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.0.0
*
Expand Down Expand Up @@ -365,7 +365,7 @@ private function get_data_from_post( string $url ) {
*
* Checks are supposedly from the hosted site blog.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
*
* @since 1.2.0
*
Expand Down
4 changes: 2 additions & 2 deletions includes/REST_API/Font_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function delete_item( $request ) {
/**
* Prepares a single post output for response.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
*
* @since 1.16.0
*
Expand Down Expand Up @@ -371,7 +371,7 @@ public function get_collection_params(): array {
/**
* Retrieves the font's schema, conforming to JSON Schema.
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.16.0
*
Expand Down
12 changes: 6 additions & 6 deletions includes/REST_API/Hotlinking_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*
* API endpoint for pinging and hotlinking media URLs.
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
*
* @phpstan-type LinkData array{
* ext?: string,
Expand Down Expand Up @@ -203,8 +203,8 @@ public function register_routes(): void {
/**
* Parses a URL to return some metadata for inserting external media.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.NPathComplexity")
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.11.0
*
Expand Down Expand Up @@ -327,7 +327,7 @@ public function parse_url( WP_REST_Request $request ) {
/**
* Parses a URL to return proxied file.
*
* @SuppressWarnings(PHPMD.ErrorControlOperator)
* @SuppressWarnings("PHPMD.ErrorControlOperator")
*
* @since 1.13.0
*
Expand Down Expand Up @@ -724,8 +724,8 @@ private function proxy_url_fallback( string $url, array $args ): void {
* Like {@see wp_http_validate_url} in core, but with extra hardening
* to avoid DNS rebinding issues.
*
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings("PHPMD.NPathComplexity")
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
*
* @since 1.22.0
*
Expand Down
6 changes: 3 additions & 3 deletions includes/REST_API/Link_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public function register_routes(): void {
/**
* Parses a URL to return some metadata for inserting links.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.CyclomaticComplexity")
* @SuppressWarnings("PHPMD.NPathComplexity")
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*
* @since 1.0.0
*
Expand Down
Loading

0 comments on commit 49203b0

Please sign in to comment.