Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"phpstan/phpstan-phpunit": "^1.4 || ^2.0",
"phpstan/phpstan-strict-rules": "^1.6 || ^2.0",
"swissspidy/phpstan-no-private": "^0.2.1 || ^1.0",
"szepeviktor/phpstan-wordpress": "^v1.3.5",
"szepeviktor/phpstan-wordpress": "^1.3.5 || ^2.0.3",
"wp-cli/config-command": "^1 || ^2",
"wp-cli/core-command": "^1 || ^2",
"wp-cli/eval-command": "^1 || ^2",
Expand Down
16 changes: 16 additions & 0 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ parameters:
switchConditionsMatchingType: false
noVariableVariables: false
strictArrayFilter: false
booleansInLoopConditions: false
disallowedBacktick: false
disallowedEmpty: false
disallowedImplicitArrayCreation: false
disallowedShortTernary: false
strictFunctionCalls: false
dynamicCallOnStaticMethod: false
illegalConstructorMethodCall: false

# Add the schema from phpstan-strict-rules so it's available without loading the extension
# and the above configuration works.
Expand All @@ -48,4 +56,12 @@ parametersSchema:
switchConditionsMatchingType: anyOf(bool(), arrayOf(bool()))
noVariableVariables: anyOf(bool(), arrayOf(bool()))
strictArrayFilter: anyOf(bool(), arrayOf(bool()))
booleansInLoopConditions: anyOf(bool(), arrayOf(bool()))
disallowedBacktick: anyOf(bool(), arrayOf(bool()))
disallowedEmpty: anyOf(bool(), arrayOf(bool()))
disallowedImplicitArrayCreation: anyOf(bool(), arrayOf(bool()))
disallowedShortTernary: anyOf(bool(), arrayOf(bool()))
strictFunctionCalls: anyOf(bool(), arrayOf(bool()))
dynamicCallOnStaticMethod: anyOf(bool(), arrayOf(bool()))
illegalConstructorMethodCall: anyOf(bool(), arrayOf(bool()))
])
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ parameters:
ignoreErrors:
# Needs fixing in WP-CLI.
- message: '#Parameter \#1 \$cmd of function WP_CLI\\Utils\\esc_cmd expects array<string>#'
- message: '#Dynamic call to static method#'
path: 'tests/tests'
strictRules:
strictCalls: true
4 changes: 2 additions & 2 deletions src/Context/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ private function set_cache_dir(): void {
* Run a MySQL command with `$db_settings`.
*
* @param string $sql_cmd Command to run.
* @param array<string, string> $assoc_args Optional. Associative array of options. Default empty.
* @param array<string, string|bool> $assoc_args Optional. Associative array of options. Default empty.
* @param bool $add_database Optional. Whether to add dbname to the $sql_cmd. Default false.
* @return array{stdout: string, stderr: string, exit_code: int}
*/
Expand Down Expand Up @@ -1247,7 +1247,7 @@ public function drop_db(): void {

/**
* @param string $command
* @param array<string, string> $assoc_args
* @param array<string, mixed> $assoc_args
* @param string $path
* @return Process
*/
Expand Down
3 changes: 0 additions & 3 deletions src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@
): Type {
$args = $methodCall->getArgs();

/** @var ConstantBooleanType|ConstantStringType $returnOption */
$returnOption = new ConstantBooleanType( true );

Check warning on line 42 in src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / code-quality / PHPCS

Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
/** @var ConstantBooleanType|ConstantStringType $parseOption */
$parseOption = new ConstantBooleanType( false );

Check warning on line 43 in src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / code-quality / PHPCS

Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
/** @var ConstantBooleanType $exitOnErrorOption */
$exitOnErrorOption = new ConstantBooleanType( true );

$optionsAreStaticallyKnown = true;
Expand Down
Loading