Skip to content

Commit 62a6fb9

Browse files
committed
PHPStan level 9
1 parent 3474dc8 commit 62a6fb9

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ parameters:
99
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
1010
treatPhpDocTypesAsCertain: false
1111
ignoreErrors:
12+
- identifier: class.notFound
1213
- identifier: missingType.property
1314
- identifier: missingType.parameter
1415
- identifier: missingType.return

src/Shell_Command.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@ class Shell_Command extends WP_CLI_Command {
2727
* => string(6) "WP-CLI"
2828
*/
2929
public function __invoke( $_, $assoc_args ) {
30-
/**
31-
* @var array<class-string> $implementations
32-
*/
30+
$class = WP_CLI\Shell\REPL::class;
31+
3332
$implementations = array(
34-
'Psy\\Shell',
35-
'Boris\\Boris',
36-
'WP_CLI\\Shell\\REPL',
33+
\Psy\Shell::class,
34+
\Boris\Boris::class,
35+
WP_CLI\Shell\REPL::class,
3736
);
3837

39-
if ( Utils\get_flag_value( $assoc_args, 'basic' ) ) {
40-
$class = 'WP_CLI\\Shell\\REPL';
41-
} else {
38+
if ( ! Utils\get_flag_value( $assoc_args, 'basic' ) ) {
4239
foreach ( $implementations as $candidate ) {
4340
if ( class_exists( $candidate ) ) {
4441
$class = $candidate;
@@ -51,10 +48,13 @@ public function __invoke( $_, $assoc_args ) {
5148
* @var class-string $class
5249
*/
5350

54-
if ( 'Psy\\Shell' === $class ) {
51+
if ( \Psy\Shell::class === $class ) {
5552
$shell = new Psy\Shell();
5653
$shell->run();
5754
} else {
55+
/**
56+
* @var class-string<WP_CLI\Shell\REPL> $class
57+
*/
5858
$repl = new $class( 'wp> ' );
5959
$repl->start();
6060
}

src/WP_CLI/Shell/REPL.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ private function prompt() {
8383

8484
$done = false;
8585
do {
86+
// @phpstan-ignore booleanNot.alwaysTrue
8687
$prompt = ( ! $done && false !== $full_line ) ? '--> ' : $this->prompt;
8788

8889
$fp = popen( self::create_prompt_cmd( $prompt, $this->history_file ), 'r' );

0 commit comments

Comments
 (0)