0

I'm using PHP Stan on lvl 0 to analyse my code. I could fix everything except those 2 errors. I checked everything but the files are fine, also checked every use and the file itself. In the same folder there are like 100 more files with the same namespace and structure. Do you have any idea what else I can test or is this a bug?

Error: Class object was not found while trying to analyse it - discovering symbols is probably not configured properly.

Error: Class object was not found while trying to analyse it - discovering symbols is probably not configured properly.


Line tool/tool/classes/Results.class.php


     Class object was not found while trying to analyse it - discovering  
     symbols is probably not configured properly.                         
      Learn more at https://phpstan.org/user-guide/discovering-symbols  
     ✏️  tool/tool/classes/Results.class.php                              


Line tool/tool/classes/TrainingManager.class.php


     Class object was not found while trying to analyse it - discovering  
     symbols is probably not configured properly.                         
      Learn more at https://phpstan.org/user-guide/discovering-symbols  
     ✏️  tool/tool/classes/TrainingManager.class.php                      

th3_sh0w3r
  • 37
  • 7

1 Answers1

1

This is a weird error, especially because object is a PHP reserved keyword and there can be no class with that name. PHPStan understands that.

How does the code look like that reports this error?

I suspect you might have something like \object instead of object in your PHPDoc.

Also maybe some custom rules might be the reason why this error is reported.

Ondřej Mirtes
  • 5,054
  • 25
  • 36
  • OMG you are my hero, my colleague and me were completely blind. We thought it couldn't find the 2 mentioned classes, and not the keyword "object". In TrainingManager I could find this: @return boolean|\object which probably triggered that. in Results I can't find anything, but maybe it is connected. Thank you!!! – th3_sh0w3r Aug 23 '23 at 23:13