Skip to content

Commit

Permalink
fix php stan
Browse files Browse the repository at this point in the history
  • Loading branch information
godruoyi committed Apr 8, 2024
1 parent 41f1bf3 commit e8f849d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
},
"scripts": {
"test": "vendor/bin/phpunit",
"phpstan": "vendor/bin/phpstan",
"pint": "vendor/bin/pint --config pint.json"
},
"config": {
Expand Down
6 changes: 2 additions & 4 deletions src/LaravelSequenceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,19 @@ class LaravelSequenceResolver implements SequenceResolver
/**
* Init resolve instance, must be connected.
*/
public function __construct(protected Repository $cache) // @phpstan-ignore-line
public function __construct(protected Repository $cache)
{
}

public function sequence(int $currentTime): int
{
$key = $this->prefix.$currentTime;

// @phpstan-ignore-next-line
if ($this->cache->add($key, 1, 10)) {
return 0;
}

// @phpstan-ignore-next-line
return $this->cache->increment($key, 1);
return $this->cache->increment($key) | 0;
}

public function setCachePrefix(string $prefix): self
Expand Down

0 comments on commit e8f849d

Please sign in to comment.