Skip to main content

PHPStan Levels

Premium
5 min read

As you might have noticed - we have used quite a few levels of PHPStan in this course. Let's look at what they mean.

Level 0

  • basic checks
  • unknown classes
  • unknown functions
  • unknown methods called on $this
  • wrong number of arguments passed to those methods and functions
  • always undefined variables

It means that running PHPStan on level 0 will give you information about issues with the code, such as missing classes or functions. It will cover the basic syntax errors or misuse of functions.

Level 1

  • possibly undefined variables
  • unknown magic methods and properties on classes with call and get

It will warn you about possible issues with the code, such as calling a method that does not exist in the class, or they are accessed via magic methods.

The Full Lesson is Only for Premium Members

Want to access all of our courses? (31 h 16 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

GK
Geovane Kruger ✓ Link copied!

Hello,

I have um erro on my project about external package:

 Line   Traits/SocialiteProviders/StravaSocialiteProvider.php (in context of class
         App\Http\Controllers\Auth\LoginController)
 ------ --------------------------------------------------------------------------------
  18     Call to an undefined method Laravel\Socialite\Contracts\Provider::setScopes().
  26     Call to an undefined method Laravel\Socialite\Contracts\Provider::stateless().

i can't find how to solve this

PK
Povilas Korop ✓ Link copied!

Well, I guess that Strava provider uses the older version of Socialite? Now sure how to solve this, probably the best is to look at the source of that StravaProvider and try to submit a Pull Request (or an issue) on Github for the fix.