Skip to content

Commit 4414a30

Browse files
authored
Merge pull request #394 from wayofdev/feat/laravel-11
2 parents ec47af1 + 3d07f67 commit 4414a30

File tree

8 files changed

+162
-12
lines changed

8 files changed

+162
-12
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on: # yamllint disable-line rule:truthy
99
name: 🧹 Fix PHP coding standards
1010

1111
env:
12+
# Disable docker support in Makefile
1213
APP_RUNNER: 'cd app &&'
1314

1415
jobs:

.github/workflows/deploy-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on: # yamllint disable-line rule:truthy
88
name: 🚀 Deploy to production
99

1010
env:
11+
# Disable docker support in Makefile
1112
APP_RUNNER: 'cd app &&'
1213

1314
concurrency: production

.github/workflows/deploy-staging.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on: # yamllint disable-line rule:truthy
88
name: 🚀 Deploy to staging
99

1010
env:
11+
# Disable docker support in Makefile
1112
APP_RUNNER: 'cd app &&'
1213

1314
concurrency: staging
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
pull_request:
5+
branches:
6+
- master
7+
- develop
8+
9+
name: 🔐 Security analysis
10+
11+
env:
12+
# Disable docker support in Makefile
13+
APP_RUNNER: 'cd app &&'
14+
15+
jobs:
16+
security-analysis:
17+
timeout-minutes: 4
18+
runs-on: ${{ matrix.os }}
19+
concurrency:
20+
cancel-in-progress: true
21+
group: security-analysis-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
os:
26+
- ubuntu-latest
27+
php-version:
28+
- '8.3'
29+
dependencies:
30+
- locked
31+
steps:
32+
- name: 📦 Check out the codebase
33+
uses: actions/checkout@v4.1.6
34+
35+
- name: 🛠️ Setup PHP
36+
uses: shivammathur/setup-php@2.30.4
37+
with:
38+
php-version: ${{ matrix.php-version }}
39+
extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo
40+
ini-values: error_reporting=E_ALL
41+
coverage: none
42+
43+
- name: 🛠️ Setup problem matchers
44+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
45+
46+
- name: 🤖 Validate composer.json and composer.lock
47+
run: make validate-composer
48+
49+
- name: 🔍 Get composer cache directory
50+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
51+
with:
52+
working-directory: app
53+
54+
- name: ♻️ Restore cached dependencies installed with composer
55+
uses: actions/cache@v4.0.2
56+
with:
57+
path: ${{ env.COMPOSER_CACHE_DIR }}
58+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
59+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
60+
61+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
62+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
63+
with:
64+
working-directory: app
65+
dependencies: ${{ matrix.dependencies }}
66+
67+
- name: 🐛 Check installed packages for security vulnerability advisories
68+
run: make lint-audit

.github/workflows/static-analysis.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
3+
on: # yamllint disable-line rule:truthy
4+
pull_request:
5+
branches:
6+
- master
7+
- develop
8+
paths:
9+
- 'app/config/**'
10+
- 'app/src/**'
11+
- 'app/tests/**'
12+
- 'app/.php-cs-fixer.dist.php'
13+
- 'app/composer.json'
14+
- 'app/composer.lock'
15+
- 'app/phpstan.neon.dist'
16+
- 'app/phpstan-baseline.neon'
17+
- 'app/psalm.xml'
18+
- 'app/psalm-baseline.xml'
19+
20+
name: 🔍 Static analysis
21+
22+
env:
23+
# Disable docker support in Makefile
24+
APP_RUNNER: 'cd app &&'
25+
26+
jobs:
27+
stan:
28+
timeout-minutes: 4
29+
runs-on: ${{ matrix.os }}
30+
concurrency:
31+
cancel-in-progress: true
32+
group: stan-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
33+
strategy:
34+
fail-fast: true
35+
matrix:
36+
os:
37+
- ubuntu-latest
38+
php-version:
39+
- '8.3'
40+
dependencies:
41+
- locked
42+
steps:
43+
- name: 📦 Check out the codebase
44+
uses: actions/checkout@v4.1.6
45+
46+
- name: 🛠️ Setup PHP
47+
uses: shivammathur/setup-php@2.30.4
48+
with:
49+
php-version: ${{ matrix.php-version }}
50+
extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql
51+
ini-values: error_reporting=E_ALL
52+
coverage: none
53+
54+
- name: 🛠️ Setup problem matchers
55+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
56+
57+
- name: 🤖 Validate composer.json and composer.lock
58+
run: make validate-composer
59+
60+
- name: 🔍 Get composer cache directory
61+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
62+
with:
63+
working-directory: app
64+
65+
- name: ♻️ Restore cached dependencies installed with composer
66+
uses: actions/cache@v4.0.2
67+
with:
68+
path: ${{ env.COMPOSER_CACHE_DIR }}
69+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
70+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
71+
72+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
73+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
74+
with:
75+
working-directory: app
76+
dependencies: ${{ matrix.dependencies }}
77+
78+
- name: 🔍 Run static analysis using phpstan/phpstan
79+
run: make lint-stan-ci

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ lint-composer: ## Normalize composer.json and composer.lock files
291291
.PHONY: lint-composer
292292

293293
lint-audit: ## Runs security checks for composer dependencies
294-
$(APP_COMPOSER) audit
294+
$(APP_COMPOSER) audit --ansi
295295
.PHONY: lint-security
296296

297297
validate-composer: ## Validates composer.json and composer.lock files

app/phpstan-baseline.neon

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@ parameters:
44
message: "#^Method Domain\\\\Product\\\\Models\\\\Product\\:\\:category\\(\\) return type with generic class Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\BelongsTo does not specify its types\\: TRelatedModel, TChildModel$#"
55
count: 1
66
path: src/Domain/Product/Models/Product.php
7-
8-
-
9-
message: "#^Class Support\\\\Filters\\\\FuzzyFilter implements generic interface Spatie\\\\QueryBuilder\\\\Filters\\\\Filter but does not specify its types\\: TModelClass$#"
10-
count: 1
11-
path: src/Support/Filters/FuzzyFilter.php
12-
13-
-
14-
message: "#^Method Support\\\\Filters\\\\FuzzyFilter\\:\\:__invoke\\(\\) return type with generic class Illuminate\\\\Database\\\\Eloquent\\\\Builder does not specify its types\\: TModelClass$#"
15-
count: 1
16-
path: src/Support/Filters/FuzzyFilter.php
17-
187
-
198
message: "#^Undefined variable\\: \\$this$#"
209
count: 1

app/src/Support/Filters/FuzzyFilter.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@
55
namespace Support\Filters;
66

77
use Illuminate\Database\Eloquent\Builder;
8+
use Illuminate\Database\Eloquent\Model;
89
use Spatie\QueryBuilder\Filters\Filter;
910

11+
/**
12+
* @template TModelClass of Model
13+
*
14+
* @implements Filter<TModelClass>
15+
*/
1016
class FuzzyFilter implements Filter
1117
{
1218
/**
@@ -19,6 +25,11 @@ public function __construct(string ...$fields)
1925
$this->fields = $fields;
2026
}
2127

28+
/**
29+
* @param Builder<TModelClass> $query
30+
*
31+
* @return Builder<TModelClass>
32+
*/
2233
public function __invoke(Builder $query, mixed $value, string $property): Builder
2334
{
2435
$query->where(function (Builder $query) use ($value): void {

0 commit comments

Comments
 (0)