Skip to content

Commit e4b8b0c

Browse files
BrianHenryIEgemini-code-assist[bot]swissspidy
authored
Upgrade require szepeviktor/phpstan-wordpress (#298)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com> Co-authored-by: Pascal Birchler <pascalb@google.com>
1 parent 35887cf commit e4b8b0c

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"phpstan/phpstan-phpunit": "^1.4 || ^2.0",
2222
"phpstan/phpstan-strict-rules": "^1.6 || ^2.0",
2323
"swissspidy/phpstan-no-private": "^0.2.1 || ^1.0",
24-
"szepeviktor/phpstan-wordpress": "^v1.3.5",
24+
"szepeviktor/phpstan-wordpress": "^1.3.5 || ^2.0.3",
2525
"wp-cli/config-command": "^1 || ^2",
2626
"wp-cli/core-command": "^1 || ^2",
2727
"wp-cli/eval-command": "^1 || ^2",

extension.neon

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ parameters:
2929
switchConditionsMatchingType: false
3030
noVariableVariables: false
3131
strictArrayFilter: false
32+
booleansInLoopConditions: false
33+
disallowedBacktick: false
34+
disallowedEmpty: false
35+
disallowedImplicitArrayCreation: false
36+
disallowedShortTernary: false
37+
strictFunctionCalls: false
38+
dynamicCallOnStaticMethod: false
39+
illegalConstructorMethodCall: false
3240

3341
# Add the schema from phpstan-strict-rules so it's available without loading the extension
3442
# and the above configuration works.
@@ -48,4 +56,12 @@ parametersSchema:
4856
switchConditionsMatchingType: anyOf(bool(), arrayOf(bool()))
4957
noVariableVariables: anyOf(bool(), arrayOf(bool()))
5058
strictArrayFilter: anyOf(bool(), arrayOf(bool()))
59+
booleansInLoopConditions: anyOf(bool(), arrayOf(bool()))
60+
disallowedBacktick: anyOf(bool(), arrayOf(bool()))
61+
disallowedEmpty: anyOf(bool(), arrayOf(bool()))
62+
disallowedImplicitArrayCreation: anyOf(bool(), arrayOf(bool()))
63+
disallowedShortTernary: anyOf(bool(), arrayOf(bool()))
64+
strictFunctionCalls: anyOf(bool(), arrayOf(bool()))
65+
dynamicCallOnStaticMethod: anyOf(bool(), arrayOf(bool()))
66+
illegalConstructorMethodCall: anyOf(bool(), arrayOf(bool()))
5167
])

phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@ parameters:
2121
ignoreErrors:
2222
# Needs fixing in WP-CLI.
2323
- message: '#Parameter \#1 \$cmd of function WP_CLI\\Utils\\esc_cmd expects array<string>#'
24-
- message: '#Dynamic call to static method#'
25-
path: 'tests/tests'
2624
strictRules:
2725
strictCalls: true

src/Context/FeatureContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ private function set_cache_dir(): void {
11691169
* Run a MySQL command with `$db_settings`.
11701170
*
11711171
* @param string $sql_cmd Command to run.
1172-
* @param array<string, string> $assoc_args Optional. Associative array of options. Default empty.
1172+
* @param array<string, string|bool> $assoc_args Optional. Associative array of options. Default empty.
11731173
* @param bool $add_database Optional. Whether to add dbname to the $sql_cmd. Default false.
11741174
* @return array{stdout: string, stderr: string, exit_code: int}
11751175
*/
@@ -1247,7 +1247,7 @@ public function drop_db(): void {
12471247

12481248
/**
12491249
* @param string $command
1250-
* @param array<string, string> $assoc_args
1250+
* @param array<string, mixed> $assoc_args
12511251
* @param string $path
12521252
* @return Process
12531253
*/

src/PHPStan/WPCliRuncommandDynamicReturnTypeExtension.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ public function getTypeFromStaticMethodCall(
3939
): Type {
4040
$args = $methodCall->getArgs();
4141

42-
/** @var ConstantBooleanType|ConstantStringType $returnOption */
43-
$returnOption = new ConstantBooleanType( true );
44-
/** @var ConstantBooleanType|ConstantStringType $parseOption */
45-
$parseOption = new ConstantBooleanType( false );
46-
/** @var ConstantBooleanType $exitOnErrorOption */
42+
$returnOption = new ConstantBooleanType( true );
43+
$parseOption = new ConstantBooleanType( false );
4744
$exitOnErrorOption = new ConstantBooleanType( true );
4845

4946
$optionsAreStaticallyKnown = true;

0 commit comments

Comments
 (0)