phpstan : discovering symbols with scanFiles and scanDirectories

144 views Asked by At

I'm using phpstan 1.10.41 and get this error

 ------ --------------------------------------------------------------------- 
  Line   lib/src/fpdf17/fpdf.php                                       
 ------ --------------------------------------------------------------------- 
  1055   Function set_magic_quotes_runtime not found.                         
          Learn more at https://phpstan.org/user-guide/discovering-symbols   
 ------ --------------------------------------------------------------------- 

this my config file:

parameters:
 level: 0
 scanFiles:
 - lib/src/fpdf17/fpdf.php
 scanDirectories:
 - lib/src/fpdf17/
 paths:
 - lib/
 - realsite/

I guess using scanFiles or scanDirectories should prevent that error but it doesn't! I could use ignoreErrors but I would like to understand why scanFiles and scanDirectories are not doinf the job, what's my fault?

1

There are 1 answers

4
Ondřej Mirtes On

According to PHP docs this function was deprecated in PHP 5.3 and removed in PHP 7.

scanFiles and scanDirectories would help you if this function was actually redefined somewhere in your codebase. Is it actually somewhere under the directories and files you've configured as scanFiles and scanDirectories?

Also from the looks of your question it seems you're analysing code that's not yours. Is lib/src/fpdf17/fpdf.php your code that you're interested in its errors and is able to fix them?

With PHPStan you should only analyse your own source code in whose bugs you're interested in.