Skip to content

Commit 2390835

Browse files
authored
Enable listType everywhere (#147)
1 parent 6107fda commit 2390835

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ parameters:
99
level: 8
1010
featureToggles:
1111
alwaysTrueAlwaysReported: true
12-
instanceofType: true
12+
listType: true

tests/data/get_term.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313

1414
assertType( 'array<string, int|string>|WP_Error|null', get_term( 2, '', ARRAY_A ) );
1515
assertType( 'array<string, int|string>|WP_Error|null', get_term( 2, 'category', ARRAY_A ) );
16-
assertType( 'array<int, int|string>|WP_Error|null', get_term( 2, '', ARRAY_N ) );
17-
assertType( 'array<int, int|string>|WP_Error|null', get_term( 2, 'category', ARRAY_N ) );
16+
assertType( 'list<int|string>|WP_Error|null', get_term( 2, '', ARRAY_N ) );
17+
assertType( 'list<int|string>|WP_Error|null', get_term( 2, 'category', ARRAY_N ) );

tests/data/get_term_by.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
assertType( 'WP_Error|WP_Term|false', get_term_by( 'term_id', 2, '', OBJECT ) );
1111
assertType( 'WP_Error|WP_Term|false', get_term_by( 'slug', 'test' ) );
1212
assertType( 'array<string, int|string>|WP_Error|false', get_term_by( 'term_id', 2, '', ARRAY_A ) );
13-
assertType( 'array<int, int|string>|WP_Error|false', get_term_by( 'term_id', 2, '', ARRAY_N ) );
13+
assertType( 'list<int|string>|WP_Error|false', get_term_by( 'term_id', 2, '', ARRAY_N ) );

tests/data/wpdb.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
assertType('stdClass|void|null', wpdb::get_row());
1212
assertType('stdClass|void|null', wpdb::get_row(null, 'OBJECT'));
1313
assertType('array|void|null', wpdb::get_row(null, 'ARRAY_A'));
14-
assertType('array<int, mixed>|void|null', wpdb::get_row(null, 'ARRAY_N'));
14+
assertType('list<mixed>|void|null', wpdb::get_row(null, 'ARRAY_N'));
1515

1616
// wpdb::get_results()
17-
assertType('array<int, array>|null', wpdb::get_results(null, 'ARRAY_A'));
18-
assertType('array<int, array<int, mixed>>|null', wpdb::get_results(null, 'ARRAY_N'));
19-
assertType('array<int, stdClass>|null', wpdb::get_results());
20-
assertType('array<int, stdClass>|null', wpdb::get_results(null, 'OBJECT'));
17+
assertType('list<array>|null', wpdb::get_results(null, 'ARRAY_A'));
18+
assertType('list<array<int, mixed>>|null', wpdb::get_results(null, 'ARRAY_N'));
19+
assertType('list<stdClass>|null', wpdb::get_results());
20+
assertType('list<stdClass>|null', wpdb::get_results(null, 'OBJECT'));
2121
assertType('array<stdClass>|null', wpdb::get_results(null, 'OBJECT_K'));

tests/phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
parameters:
22
bootstrapFiles:
33
- ../wordpress-stubs.php
4+
featureToggles:
5+
listType: true

0 commit comments

Comments
 (0)