Phpstan: Unusable for CI

Created on 4 May 2018  Β·  3Comments  Β·  Source: phpstan/phpstan

Summary of a problem or a feature request

Is phpStan unsuable for continous integration?

Code snippet that reproduces the problem

$ vendor/bin/phpstan analyse -l 1 -c phpstan.neon src
 85/85 [β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“] 100%

 --------------------------------------------------------------------------------------------------------------------------- 
  Error                                                                                                                      
 --------------------------------------------------------------------------------------------------------------------------- 
  Ignored error pattern #Access to an undefined property object::\$[\w]+.# was not matched in reported errors.               
 --------------------------------------------------------------------------------------------------------------------------- 


 [ERROR] Found 1 error                                                                                                 


www-data@13da5ca8cbd4:~/www$ echo $?
1

Really? Having no error is an error. Cool!

Expected output

0

Most helpful comment

You can set reportUnmatchedIgnoredErrors

to false to ignore this and exit code will be 0. But it’s not the default
so you can find out that something does no longer have to be ingnored, or
that you can ponder why the error does no longer show up.

The current behaviour is by design.

n Fri, 4 May 2018 at 17:54, Michael Moravec notifications@github.com
wrote:

There is no error, just superfluous ignoreErrors pattern (which could be
for multiple reasons).
I agree non-zero exit code in this case is wrong.

β€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/phpstan/phpstan/issues/988#issuecomment-386644959,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAGZuOK9AAk-koDY8R9uYuKnFFBBcn1Eks5tvHmogaJpZM4Ty2qH
.

>

OndΕ™ej Mirtes

All 3 comments

Wait, what?
https://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
0 means that the program passed, non-zero exit code means an error, so your snippet behaves correctly.

There is no error, just superfluous ignoreErrors pattern (which could be for multiple reasons).
I agree non-zero exit code in this case is wrong.

You can set reportUnmatchedIgnoredErrors

to false to ignore this and exit code will be 0. But it’s not the default
so you can find out that something does no longer have to be ingnored, or
that you can ponder why the error does no longer show up.

The current behaviour is by design.

n Fri, 4 May 2018 at 17:54, Michael Moravec notifications@github.com
wrote:

There is no error, just superfluous ignoreErrors pattern (which could be
for multiple reasons).
I agree non-zero exit code in this case is wrong.

β€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/phpstan/phpstan/issues/988#issuecomment-386644959,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAGZuOK9AAk-koDY8R9uYuKnFFBBcn1Eks5tvHmogaJpZM4Ty2qH
.

>

OndΕ™ej Mirtes

Was this page helpful?
0 / 5 - 0 ratings