Skip to content
Closed
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
21 changes: 20 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,33 @@ includes:
# Regenerate with `composer phpstan:baselines`, which rewrites both the files
# and the list between the markers. Do not edit that list by hand.
# phpstan:baselines start
- tests/phpstan/baselines/arguments.count.neon
- tests/phpstan/baselines/binaryOp.invalid.neon
- tests/phpstan/baselines/class.nameCase.neon
- tests/phpstan/baselines/class.notFound.neon
- tests/phpstan/baselines/empty.variable.neon
- tests/phpstan/baselines/encapsedStringPart.nonString.neon
- tests/phpstan/baselines/greater.invalid.neon
- tests/phpstan/baselines/isset.variable.neon
- tests/phpstan/baselines/method.nonObject.neon
- tests/phpstan/baselines/method.notFound.neon
- tests/phpstan/baselines/parameter.defaultValue.neon
- tests/phpstan/baselines/parameter.notFound.neon
- tests/phpstan/baselines/parameter.phpDocType.neon
- tests/phpstan/baselines/parameter.unresolvableType.neon
- tests/phpstan/baselines/property.nonObject.neon
- tests/phpstan/baselines/property.notFound.neon
- tests/phpstan/baselines/property.private.neon
- tests/phpstan/baselines/property.protected.neon
- tests/phpstan/baselines/return.missing.neon
- tests/phpstan/baselines/staticClassAccess.privateMethod.neon
- tests/phpstan/baselines/varTag.noVariable.neon
- tests/phpstan/baselines/variable.undefined.neon
# phpstan:baselines end

parameters:
# https://phpstan.org/user-guide/rule-levels
level: 1
level: 2
reportUnmatchedIgnoredErrors: true

# The following ignored errors are not intended to be fixed, as distinct from the baselines
Expand Down
50 changes: 50 additions & 0 deletions tests/phpstan/baselines/arguments.count.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# PHPStan baseline for the `arguments.count` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/arguments.count
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=arguments.count
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Method WP_List_Table\:\:display_rows\(\) invoked with 2 parameters, 0 required\.$#'
identifier: arguments.count
count: 1
path: ../../../src/wp-admin/includes/ajax-actions.php
-
message: '#^Method WP_List_Table\:\:single_row\(\) invoked with 2 parameters, 1 required\.$#'
identifier: arguments.count
count: 2
path: ../../../src/wp-admin/includes/ajax-actions.php
-
message: '#^Method WP_List_Table\:\:single_row\(\) invoked with 3 parameters, 1 required\.$#'
identifier: arguments.count
count: 1
path: ../../../src/wp-admin/includes/ajax-actions.php
-
message: '#^Method WP_Upgrader_Skin\:\:before\(\) invoked with 1 parameter, 0 required\.$#'
identifier: arguments.count
count: 2
path: ../../../src/wp-admin/includes/class-plugin-upgrader.php
-
message: '#^Method WP_Upgrader_Skin\:\:before\(\) invoked with 1 parameter, 0 required\.$#'
identifier: arguments.count
count: 2
path: ../../../src/wp-admin/includes/class-theme-upgrader.php
-
message: '#^Method WP_List_Table\:\:display\(\) invoked with 1 parameter, 0 required\.$#'
identifier: arguments.count
count: 1
path: ../../../src/wp-admin/includes/meta-boxes.php
35 changes: 35 additions & 0 deletions tests/phpstan/baselines/binaryOp.invalid.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# PHPStan baseline for the `binaryOp.invalid` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/binaryOp.invalid
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=binaryOp.invalid
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Binary operation "/" between string and 2 results in an error\.$#'
identifier: binaryOp.invalid
count: 2
path: ../../../src/wp-content/themes/twentytwenty/functions.php
-
message: '#^Binary operation "\+" between array\<int\<0, max\>\|WP_Comment\>\|int\<1, max\> and 1 results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: ../../../src/wp-includes/comment.php
-
message: '#^Binary operation "\+" between string and int results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: ../../../src/wp-includes/user.php
25 changes: 25 additions & 0 deletions tests/phpstan/baselines/class.nameCase.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# PHPStan baseline for the `class.nameCase` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/class.nameCase
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=class.nameCase
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Class MO referenced with incorrect case\: Mo\.$#'
identifier: class.nameCase
count: 1
path: ../../../src/wp-includes/class-wp-locale-switcher.php
90 changes: 90 additions & 0 deletions tests/phpstan/baselines/class.notFound.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# PHPStan baseline for the `class.notFound` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/class.notFound
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=class.notFound
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Property WP_Filesystem_FTPext\:\:\$link has unknown class FTP\\Connection as its type\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/class-wp-filesystem-ftpext.php
-
message: '#^Function _crop_image_resource\(\) has invalid return type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/image-edit.php
-
message: '#^Function _flip_image_resource\(\) has invalid return type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/image-edit.php
-
message: '#^Function _rotate_image_resource\(\) has invalid return type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/image-edit.php
-
message: '#^Parameter \$img of function _crop_image_resource\(\) has invalid type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/image-edit.php
-
message: '#^Parameter \$img of function _flip_image_resource\(\) has invalid type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/image-edit.php
-
message: '#^Parameter \$img of function _rotate_image_resource\(\) has invalid type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/image-edit.php
-
message: '#^Function load_image_to_edit\(\) has invalid return type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/includes/image.php
-
message: '#^Call to method html\(\) on an unknown class WP_Press_This_Plugin\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-admin/press-this.php
-
message: '#^Method WP_Image_Editor_GD\:\:_resize\(\) has invalid return type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-includes/class-wp-image-editor-gd.php
-
message: '#^Parameter \$image of method WP_Image_Editor_GD\:\:_save\(\) has invalid type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-includes/class-wp-image-editor-gd.php
-
message: '#^Property WP_Image_Editor_GD\:\:\$image has unknown class GdImage as its type\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-includes/class-wp-image-editor-gd.php
-
message: '#^Function wp_imagecreatetruecolor\(\) has invalid return type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-includes/media.php
-
message: '#^Parameter \$image of function is_gd_image\(\) has invalid type GdImage\.$#'
identifier: class.notFound
count: 1
path: ../../../src/wp-includes/media.php
25 changes: 25 additions & 0 deletions tests/phpstan/baselines/encapsedStringPart.nonString.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# PHPStan baseline for the `encapsedStringPart.nonString` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/encapsedStringPart.nonString
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=encapsedStringPart.nonString
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Part \$form_fields\[''_final''\] \(non\-empty\-array\<string, mixed\>\) of encapsed string cannot be cast to string\.$#'
identifier: encapsedStringPart.nonString
count: 1
path: ../../../src/wp-admin/includes/media.php
25 changes: 25 additions & 0 deletions tests/phpstan/baselines/greater.invalid.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# PHPStan baseline for the `greater.invalid` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/greater.invalid
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=greater.invalid
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Comparison operation "\>" between \*NEVER\* and 0 results in an error\.$#'
identifier: greater.invalid
count: 1
path: ../../../src/wp-admin/includes/upgrade.php
55 changes: 55 additions & 0 deletions tests/phpstan/baselines/method.nonObject.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# PHPStan baseline for the `method.nonObject` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/method.nonObject
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=method.nonObject
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Cannot call method inline_edit\(\) on WP_List_Table\|false\.$#'
identifier: method.nonObject
count: 1
path: ../../../src/wp-admin/edit-tags.php
-
message: '#^Cannot call method inline_edit\(\) on WP_List_Table\|false\.$#'
identifier: method.nonObject
count: 1
path: ../../../src/wp-admin/edit.php
-
message: '#^Cannot call method embed_scripts\(\) on WP_List_Table\|false\.$#'
identifier: method.nonObject
count: 1
path: ../../../src/wp-admin/erase-personal-data.php
-
message: '#^Cannot call method process_bulk_action\(\) on WP_List_Table\|false\.$#'
identifier: method.nonObject
count: 1
path: ../../../src/wp-admin/erase-personal-data.php
-
message: '#^Cannot call method embed_scripts\(\) on WP_List_Table\|false\.$#'
identifier: method.nonObject
count: 1
path: ../../../src/wp-admin/export-personal-data.php
-
message: '#^Cannot call method process_bulk_action\(\) on WP_List_Table\|false\.$#'
identifier: method.nonObject
count: 1
path: ../../../src/wp-admin/export-personal-data.php
-
message: '#^Cannot call method theme_installer_single\(\) on WP_List_Table\|false\.$#'
identifier: method.nonObject
count: 1
path: ../../../src/wp-admin/includes/theme-install.php
45 changes: 45 additions & 0 deletions tests/phpstan/baselines/method.notFound.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# PHPStan baseline for the `method.notFound` errors in WordPress core.
#
# https://phpstan.org/error-identifiers/method.notFound
#
# Each entry is scoped to a single file and carries an exact occurrence count,
# so that a new instance is reported as a new error rather than being absorbed
# silently. Fixing an occurrence therefore means decrementing or removing its
# entry here as part of the same change.
#
# The goal is to empty this file and delete it, along with the `includes` entry
# for it in phpstan.neon.dist.
#
# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with
#
# composer phpstan:baselines -- --identifier=method.notFound
#
# which reruns the analysis with this file suppressed so the errors surface again.

parameters:
ignoreErrors:
-
message: '#^Call to an undefined method WP_Upgrader\:\:get_name_for_update\(\)\.$#'
identifier: method.notFound
count: 1
path: ../../../src/wp-admin/includes/class-language-pack-upgrader-skin.php
-
message: '#^Call to an undefined method WP_Upgrader\:\:plugin_info\(\)\.$#'
identifier: method.notFound
count: 1
path: ../../../src/wp-admin/includes/class-plugin-installer-skin.php
-
message: '#^Call to an undefined method WP_Upgrader\:\:plugin_info\(\)\.$#'
identifier: method.notFound
count: 1
path: ../../../src/wp-admin/includes/class-plugin-upgrader-skin.php
-
message: '#^Call to an undefined method WP_Upgrader\:\:theme_info\(\)\.$#'
identifier: method.notFound
count: 1
path: ../../../src/wp-admin/includes/class-theme-installer-skin.php
-
message: '#^Call to an undefined method WP_Upgrader\:\:theme_info\(\)\.$#'
identifier: method.notFound
count: 1
path: ../../../src/wp-admin/includes/class-theme-upgrader-skin.php
Loading