Commit 8e3fb3b
committed
Do not error normalizing a nil path under a container
`phpstan-get-command-args' starts with
(config (or config (phpstan-normalize-path (phpstan-get-config-file))))
and `phpstan-get-config-file' returns nil when the project has no
phpstan.neon and `phpstan-config-file' is unset. For a container
executable `phpstan-normalize-path' then passed that nil to
`replace-regexp-in-string', raising `(wrong-type-argument arrayp nil)'.
The local case was unaffected, since it returns `(or source
source-original)' without touching the path.
So `M-x phpstan-analyze-project', `phpstan-analyze-this-file', flycheck,
and flymake all errored under `(phpstan-executable . docker)' /
`container' whenever the project had no config file -- which
`phpstan-enable-on-no-config-file' explicitly allows (Composer autoload is
enough to enable PHPStan).
Guard `phpstan-normalize-path' at the source: a nil path falls through to
the `(or source source-original)' branch instead of the container
rewrite, so it returns nil (or the optional SOURCE fallback) rather than
erroring. Fixing it in the one function protects every caller. With
config nil the command line now simply omits `-c', which is correct.1 parent 04a0c39 commit 8e3fb3b
3 files changed
Lines changed: 37 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
397 | | - | |
| 396 | + | |
398 | 397 | | |
399 | 398 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
406 | 409 | | |
407 | 410 | | |
408 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
125 | 139 | | |
126 | 140 | | |
127 | 141 | | |
| |||
184 | 198 | | |
185 | 199 | | |
186 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
187 | 212 | | |
188 | 213 | | |
0 commit comments