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
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
"wp-cli/wp-cli": "^2.5"
},
"require-dev": {
"wp-cli/wp-cli-tests": "^4.3.2",
"phpcompatibility/php-compatibility": "dev-develop"
"wp-cli/wp-cli-tests": "^5.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"behat": "run-behat-tests",
"behat-rerun": "rerun-behat-tests",
"lint": "run-linter-tests",
"phpcs": "run-phpcs-tests",
"phpstan": "run-phpstan-tests",
"phpcbf": "run-phpcbf-cleanup",
"phpunit": "run-php-unit-tests",
"prepare-tests": "install-package-tests",
Expand All @@ -48,7 +50,8 @@
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
}
241 changes: 241 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
parameters:
ignoreErrors:
-
message: '#^Binary operation "\." between mixed and "\\n"\|"\\r\\n" results in an error\.$#'
identifier: binaryOp.invalid
count: 2
path: src/Export.php

-
message: '#^Call to method get_connection\(\) on an unknown class WP_SQLite_Driver\.$#'
identifier: class.notFound
count: 2
path: src/Export.php

-
message: '#^Call to method get_pdo\(\) on an unknown class WP_SQLite_Translator\.$#'
identifier: class.notFound
count: 1
path: src/Export.php

-
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Driver\.$#'
identifier: class.notFound
count: 2
path: src/Export.php

-
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Translator\.$#'
identifier: class.notFound
count: 2
path: src/Export.php

-
message: '#^Class WP_SQLite_Driver not found\.$#'
identifier: class.notFound
count: 1
path: src/Export.php

-
message: '#^Class WP_SQLite_Translator not found\.$#'
identifier: class.notFound
count: 1
path: src/Export.php

-
message: '#^Parameter \#1 \$handle of method Automattic\\WP_CLI\\SQLite\\Export\:\:write_sql_statements\(\) expects resource, resource\|false given\.$#'
identifier: argument.type
count: 1
path: src/Export.php

-
message: '#^Parameter \#2 \$haystack of function in_array expects array, array\<string\>\|false given\.$#'
identifier: argument.type
count: 1
path: src/Export.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$args has no type specified\.$#'
identifier: missingType.property
count: 1
path: src/Export.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$driver has unknown class WP_SQLite_Driver as its type\.$#'
identifier: class.notFound
count: 1
path: src/Export.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$driver has unknown class WP_SQLite_Translator as its type\.$#'
identifier: class.notFound
count: 1
path: src/Export.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$is_stdout has no type specified\.$#'
identifier: missingType.property
count: 1
path: src/Export.php

-
message: '#^Binary operation "\." between ''Converted ecoding…'' and array\|string\|false results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: src/Import.php

-
message: '#^Binary operation "\." between ''Could not execute…'' and mixed results in an error\.$#'
identifier: binaryOp.invalid
count: 1
path: src/Import.php

-
message: '#^Call to method query\(\) on an unknown class Automattic\\WP_CLI\\SQLite\\WP_SQLite_Driver\.$#'
identifier: class.notFound
count: 8
path: src/Import.php

-
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Translator\.$#'
identifier: class.notFound
count: 8
path: src/Import.php

-
message: '#^Parameter \#1 \$stream of function fclose expects resource, resource\|false given\.$#'
identifier: argument.type
count: 1
path: src/Import.php

-
message: '#^Parameter \#1 \$stream of function fgets expects resource, resource\|false given\.$#'
identifier: argument.type
count: 1
path: src/Import.php

-
message: '#^Parameter \#1 \$string of function mb_convert_encoding expects array\|string, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Import.php

-
message: '#^Parameter \#1 \$string of function mb_detect_encoding expects string, mixed given\.$#'
identifier: argument.type
count: 1
path: src/Import.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$args has no type specified\.$#'
identifier: missingType.property
count: 1
path: src/Import.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$driver \(Automattic\\WP_CLI\\SQLite\\WP_SQLite_Driver\|WP_SQLite_Translator\) does not accept WP_SQLite_Driver\|WP_SQLite_Translator\.$#'
identifier: assign.propertyType
count: 1
path: src/Import.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$driver has unknown class Automattic\\WP_CLI\\SQLite\\WP_SQLite_Driver as its type\.$#'
identifier: class.notFound
count: 1
path: src/Import.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$driver has unknown class WP_SQLite_Translator as its type\.$#'
identifier: class.notFound
count: 1
path: src/Import.php

-
message: '#^Parameter \#1 \$version1 of function version_compare expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: src/SQLiteDatabaseIntegrationLoader.php

-
message: '#^Parameter \#2 \$subject of function preg_match expects string, string\|false given\.$#'
identifier: argument.type
count: 2
path: src/SQLiteDatabaseIntegrationLoader.php

-
message: '#^Constant FQDB not found\.$#'
identifier: constant.notFound
count: 1
path: src/SQLiteDriverFactory.php

-
message: '#^Instantiated class WP_SQLite_Connection not found\.$#'
identifier: class.notFound
count: 1
path: src/SQLiteDriverFactory.php

-
message: '#^Instantiated class WP_SQLite_Driver not found\.$#'
identifier: class.notFound
count: 1
path: src/SQLiteDriverFactory.php

-
message: '#^Instantiated class WP_SQLite_Translator not found\.$#'
identifier: class.notFound
count: 1
path: src/SQLiteDriverFactory.php

-
message: '#^Method Automattic\\WP_CLI\\SQLite\\SQLiteDriverFactory\:\:create_driver\(\) has invalid return type WP_SQLite_Driver\.$#'
identifier: class.notFound
count: 1
path: src/SQLiteDriverFactory.php

-
message: '#^Method Automattic\\WP_CLI\\SQLite\\SQLiteDriverFactory\:\:create_driver\(\) has invalid return type WP_SQLite_Translator\.$#'
identifier: class.notFound
count: 1
path: src/SQLiteDriverFactory.php

-
message: '#^Parameter \#1 \$string of function md5 expects string, int\<0, max\> given\.$#'
identifier: argument.type
count: 1
path: src/SQLite_Command.php

-
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Driver\.$#'
identifier: class.notFound
count: 1
path: src/Tables.php

-
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Translator\.$#'
identifier: class.notFound
count: 1
path: src/Tables.php

-
message: '#^Class WP_SQLite_Translator not found\.$#'
identifier: class.notFound
count: 1
path: src/Tables.php

-
message: '#^Parameter \#1 \$message of static method WP_CLI\:\:line\(\) expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: src/Tables.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Tables\:\:\$driver has unknown class WP_SQLite_Driver as its type\.$#'
identifier: class.notFound
count: 1
path: src/Tables.php

-
message: '#^Property Automattic\\WP_CLI\\SQLite\\Tables\:\:\$driver has unknown class WP_SQLite_Translator as its type\.$#'
identifier: class.notFound
count: 1
path: src/Tables.php
17 changes: 17 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
includes:
- phpstan-baseline.neon

parameters:
level: 9
paths:
- src
- command.php
scanDirectories:
- vendor/wp-cli/wp-cli/php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.parameter
- identifier: missingType.return