phpsa icon indicating copy to clipboard operation
phpsa copied to clipboard

[Bug] [Language-error] Function does not exist

Open kilgaloon opened this issue 7 years ago • 6 comments

I noticed that analyzer reports [language-error] when objects are invoked with error that function does not exists. This errors can be noticed at large numbers in Laravel/Lumen.

Sorry for edits, i pressed enter mid typing

kilgaloon avatar Jan 31 '17 18:01 kilgaloon

Hey! Can you submit related code for tests? Thanks

ovr avatar Feb 01 '17 07:02 ovr

@Kilgaloon Autoload of lumen-framework/composer.json contains src/helpers.php. Is it an error indication of a function in this file?

  • abort
  • app
  • base_path
  • decrypt
  • dispatch
  • config
  • database_path
  • encrypt
  • env
  • event
  • factory
  • info
  • redirect
  • resource_path
  • response
  • route
  • storage_path
  • trans
  • url
  • view

algo13 avatar Feb 05 '17 03:02 algo13

Yes, those helpers aren't registered by phpsa and they are reported as function does not exists.

kilgaloon avatar Nov 07 '17 12:11 kilgaloon

This is very irritating problem with any project that have this kind of global functions. Basically for lumen or laravel applications you get tons of notices. @ovr @ddmler Any thoughts about this?

kilgaloon avatar Nov 21 '17 19:11 kilgaloon

@Kilgaloon There is a precompile step inside PHPSA, all functions inside director are visible to any scope, I think it's an NS issue related latest changes like https://github.com/ovr/phpsa/commit/63d2b1f5013cd779d70507ee0acbc53d8b46470f

Or it's a problem related that, function is inside if expression

ovr avatar Nov 21 '17 20:11 ovr

Same problem for Thinkphp applications;

armoour avatar Jul 09 '18 03:07 armoour