Skip to content

Commit 94fca70

Browse files
committed
PHPStan: restore and baseline inner function smells.
1 parent 9125d57 commit 94fca70

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

phpstan.neon.dist

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@ parameters:
2222
reportUnmatchedIgnoredErrors: true
2323

2424
ignoreErrors:
25-
# Inner functions aren't supported:
26-
- '#Inner named functions are not supported by PHPStan#'
27-
# Inner functions within the importer:
28-
- '#Function wxr_[a-z_]+ not found#'
25+
# Level 0:
26+
- # Inner functions arent supported by PHPstan.
27+
message: '#Function wxr_[a-z_]+ not found#'
28+
path: src/wp-admin/includes/export.php
2929

3030
# Level 1:
31-
32-
# These are too noisy at the moment.
33-
- '#Variable \$[a-zA-Z0-9_]+ might not be defined\.#'
31+
- These are too noisy at the moment.
32+
message: '#Variable \$[a-zA-Z0-9_]+ might not be defined\.#'
3433

3534
# Level 2:
36-
# Callable-strings are used as callables in WordPress.
37-
- '#Default value of the parameter .* is incompatible with type callable.*#'
35+
- # Callable-strings are used as callables in WordPress.
36+
message: '#Default value of the parameter .* is incompatible with type callable.*#'
3837

3938
# Level 6:
4039
- # WPCS syntax for iterable types is not supported.

tests/phpstan/baseline/level-0.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
'count' => 1,
88
'path' => __DIR__ . '/../../../src/wp-admin/includes/class-wp-filesystem-ssh2.php',
99
];
10+
$ignoreErrors[] = [
11+
'message' => '#^Inner named functions are not supported by PHPStan\\. Consider refactoring to an anonymous function, class method, or a top\\-level\\-defined function\\. See issue \\#165 \\(https\\://github\\.com/phpstan/phpstan/issues/165\\) for more details\\.$#',
12+
'identifier' => 'function.inner',
13+
'count' => 13,
14+
'path' => __DIR__ . '/../../../src/wp-admin/includes/export.php',
15+
];
16+
$ignoreErrors[] = [
17+
'message' => '#^Inner named functions are not supported by PHPStan\\. Consider refactoring to an anonymous function, class method, or a top\\-level\\-defined function\\. See issue \\#165 \\(https\\://github\\.com/phpstan/phpstan/issues/165\\) for more details\\.$#',
18+
'identifier' => 'function.inner',
19+
'count' => 1,
20+
'path' => __DIR__ . '/../../../src/wp-admin/includes/file.php',
21+
];
1022
$ignoreErrors[] = [
1123
'message' => '#^Function get_file not found\\.$#',
1224
'identifier' => 'function.notFound',
@@ -31,6 +43,12 @@
3143
'count' => 1,
3244
'path' => __DIR__ . '/../../../src/wp-admin/press-this.php',
3345
];
46+
$ignoreErrors[] = [
47+
'message' => '#^Inner named functions are not supported by PHPStan\\. Consider refactoring to an anonymous function, class method, or a top\\-level\\-defined function\\. See issue \\#165 \\(https\\://github\\.com/phpstan/phpstan/issues/165\\) for more details\\.$#',
48+
'identifier' => 'function.inner',
49+
'count' => 1,
50+
'path' => __DIR__ . '/../../../src/wp-includes/canonical.php',
51+
];
3452
$ignoreErrors[] = [
3553
'message' => '#^Method WP_Theme_JSON\\:\\:should_override_preset\\(\\) should return bool but return statement is missing\\.$#',
3654
'identifier' => 'return.missing',

0 commit comments

Comments
 (0)