Skip to content

Commit ee1f3af

Browse files
authored
Add missing dependencies to dev (#73)
* Add new dev-dependencies to composer.json The dependencies illuminate/contracts, predis/predis, ext-redis, and ext-swoole have been added to the "require-dev" section of composer.json file. This provides additional functionality for development purposes, including dependency injection, connection with Redis, and asynchronous tasks. * Update GitHub workflows and remove unnecessary packages This commit modifies the fail-fast strategy in the static analysis workflow and removes the installation of 'predis/predis' and 'illuminate/contracts' packages across multiple workflow files. This results in a cleaner setup, less dependency on external packages, and a more effective fail-fast configuration. Now, the workflows will use a matrix strategy for the PHP version, targeting specifically PHP * fix missing dependencies in action * fix php stan
1 parent b8dfbc3 commit ee1f3af

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

.github/workflows/codestyle.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ jobs:
3636
- name: Install dependencies with composer
3737
run: composer update --no-ansi --no-interaction --no-progress
3838

39-
- name: Install Laravel Illuminate Contracts
40-
run: composer require "illuminate/contracts"
41-
42-
- name: Install Predis Package
43-
run: composer require "predis/predis:^2.0"
44-
4539
- name: Code Style
4640
run: vendor/bin/pint --test --config ./pint.json
4741

.github/workflows/static-analysis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ jobs:
1616
runs-on: ubuntu-22.04
1717

1818
strategy:
19-
fail-fast: true
19+
fail-fast: false
20+
matrix:
21+
php-version:
22+
- 8.2
2023

2124
name: Static Analysis
2225

@@ -30,6 +33,7 @@ jobs:
3033
php-version: 8.2
3134
tools: composer:v2
3235
coverage: none
36+
extensions: swoole, redis, pcntl
3337

3438
- name: Install dependencies
3539
uses: nick-fields/retry@v2
@@ -38,8 +42,5 @@ jobs:
3842
max_attempts: 3
3943
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
4044

41-
- name: Install Predis Package
42-
run: composer require "predis/predis:^2.0"
43-
4445
- name: Execute type checking
4546
run: vendor/bin/phpstan

.github/workflows/test.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ jobs:
3737
- name: Install dependencies
3838
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
3939

40-
- name: Install Laravel Illuminate Contracts
41-
run: composer require "illuminate/contracts"
42-
43-
- name: Install Predis Package
44-
run: composer require "predis/predis:^2.0"
45-
4640
- name: PHPUnit Test
4741
run: vendor/bin/phpunit --display-incomplete --display-skipped --display-deprecations --display-errors --display-notices --display-warnings
4842
env:

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
"require-dev": {
2525
"phpunit/phpunit": "^10",
2626
"laravel/pint": "^1.10",
27-
"phpstan/phpstan": "^1.10"
27+
"phpstan/phpstan": "^1.10",
28+
"illuminate/contracts": "^10.0 || ^11.0",
29+
"predis/predis": "^2.0",
30+
"ext-redis": "*",
31+
"ext-swoole": "*"
2832
},
2933
"autoload-dev": {
3034
"psr-4": {
@@ -38,6 +42,7 @@
3842
},
3943
"scripts": {
4044
"test": "vendor/bin/phpunit",
45+
"phpstan": "vendor/bin/phpstan",
4146
"pint": "vendor/bin/pint --config pint.json"
4247
},
4348
"config": {

src/LaravelSequenceResolver.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,19 @@ class LaravelSequenceResolver implements SequenceResolver
2424
/**
2525
* Init resolve instance, must be connected.
2626
*/
27-
public function __construct(protected Repository $cache) // @phpstan-ignore-line
27+
public function __construct(protected Repository $cache)
2828
{
2929
}
3030

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

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

40-
// @phpstan-ignore-next-line
41-
return $this->cache->increment($key, 1);
39+
return $this->cache->increment($key) | 0;
4240
}
4341

4442
public function setCachePrefix(string $prefix): self

0 commit comments

Comments
 (0)