Skip to content

Commit 49635f4

Browse files
committed
Add initial PHPStan configuration
1 parent c3d2513 commit 49635f4

5 files changed

Lines changed: 25 additions & 3 deletions

File tree

lib/cli/Arguments.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public function offsetGet($offset) {
110110
if (isset($this->_parsed[$offset])) {
111111
return $this->_parsed[$offset];
112112
}
113+
114+
return null;
113115
}
114116

115117
/**
@@ -302,6 +304,8 @@ public function getFlag($flag) {
302304
return $settings;
303305
}
304306
}
307+
308+
return null;
305309
}
306310

307311
public function getFlags() {
@@ -362,6 +366,8 @@ public function getOption($option) {
362366
return $settings;
363367
}
364368
}
369+
370+
return null;
365371
}
366372

367373
public function getOptions() {
@@ -388,7 +394,7 @@ public function isOption($argument) {
388394
* will use either the first long name given or the first name in the list
389395
* if a long name is not given.
390396
*
391-
* @return array
397+
* @return void
392398
* @throws arguments\InvalidArguments
393399
*/
394400
public function parse() {

lib/cli/arguments/Argument.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
/**
1818
* Represents an Argument or a value and provides several helpers related to parsing an argument list.
19+
*
20+
* @property-read bool $isLong
21+
* @property-read bool $isShort
22+
* @property-read bool $isArgument
1923
*/
2024
class Argument extends Memoize {
2125
/**

lib/cli/table/Ascii.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ public function border() {
163163
public function row( array $row ) {
164164

165165
$extra_row_count = 0;
166+
$extra_rows = [];
166167

167168
if ( count( $row ) > 0 ) {
168169
$extra_rows = array_fill( 0, count( $row ), array() );

lib/cli/table/Tabular.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ class Tabular extends Renderer {
2323
* @return string The formatted table row.
2424
*/
2525
public function row( array $row ) {
26-
$rows = [];
27-
$output = '';
26+
$rows = [];
27+
$output = '';
28+
$split_lines = [];
29+
$col = null;
2830

2931
foreach ( $row as $col => $value ) {
3032
$value = isset( $value ) ? (string) $value : '';

phpstan.neon.dist

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
parameters:
2+
level: 1
3+
paths:
4+
- lib
5+
scanDirectories:
6+
- vendor/wp-cli/wp-cli/php
7+
scanFiles:
8+
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
9+
treatPhpDocTypesAsCertain: false

0 commit comments

Comments
 (0)