beyondcode / laravel-sliding-window-limiter

Sliding Time Window Rate Limiter for Laravel
MIT License
42 stars 5 forks source link

Static analysis #1

Open szepeviktor opened 5 years ago

szepeviktor commented 5 years ago

Hello!

$ vendor/bin/phpstan analyze -l max src/

 ------ ------------------------------------------------------------------------------------------------------------------------------
  Line   SlidingWindowLimiter.php
 ------ ------------------------------------------------------------------------------------------------------------------------------
  22     Property BeyondCode\SlidingWindowLimiter\SlidingWindowLimiter::$timeWindow (int) does not accept float.
  26     Property BeyondCode\SlidingWindowLimiter\SlidingWindowLimiter::$minimumInterval (int) does not accept Carbon\CarbonInterval.
  26     Static call to instance method Carbon\CarbonInterval::minute().

There are some problems, but only very few!

discovered by @phpstan

szepeviktor commented 5 years ago

I wonder how CarbonInterval has both static and non-static minute() ...

CarbonInterval.php:60: * @method static CarbonInterval minute($minutes = 1) Alias for minutes()
CarbonInterval.php:79: * @method $this minute($minutes = 1) Alias for minutes().

Known issue https://github.com/phpstan/phpstan/issues/1557 - without resolution.