Skip to content

Commit 7456d5a

Browse files
Merge pull request #9 from enricodelazzari/laravel-11
2 parents 7396e55 + 9e8c330 commit 7456d5a

File tree

11 files changed

+86
-88
lines changed

11 files changed

+86
-88
lines changed

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.0'
19+
php-version: '8.1'
2020
coverage: none
2121

2222
- name: Install composer dependencies

.github/workflows/run-tests.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
php: [8.3, 8.2, 8.1, 8.0]
17-
laravel: [10.*, 9.*]
18-
stability: [prefer-lowest, prefer-stable]
16+
php: [8.3, 8.2, 8.1]
17+
laravel: [11.*, 10.*,]
18+
stability: [prefer-stable] #prefer-lowest,
1919
include:
20+
- laravel: 11.*
21+
testbench: 9.*
2022
- laravel: 10.*
2123
testbench: 8.*
22-
carbon: ^2.63
23-
- laravel: 9.*
24-
testbench: 7.*
25-
carbon: ^2.63
2624
exclude:
27-
- laravel: 10.*
28-
php: 8.0
25+
- laravel: 11.*
26+
php: 8.1
2927

3028
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
3129

@@ -47,7 +45,7 @@ jobs:
4745
4846
- name: Install dependencies
4947
run: |
50-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
48+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
5149
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
5250
5351
- name: Execute tests

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ testbench.yaml
1212
vendor
1313
node_modules
1414
.php-cs-fixer.cache
15+
.phpunit.cache
16+
.phpunit.cache/test-results

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 MAIZE SRL <[email protected]>
3+
Copyright (c) 2024 MAIZE SRL <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,24 @@
2121
}
2222
],
2323
"require": {
24-
"php": "^8.0",
25-
"illuminate/database": "^9.0|^10.0",
26-
"illuminate/http": "^9.0|^10.0",
27-
"illuminate/routing": "^9.0|^10.0",
28-
"illuminate/support": "^9.0|^10.0",
29-
"illuminate/validation": "^9.0|^10.0",
24+
"php": "^8.1",
25+
"illuminate/database": "^10.0|^11.0",
26+
"illuminate/http": "^10.0|^11.0",
27+
"illuminate/routing": "^10.0|^11.0",
28+
"illuminate/support": "^10.0|^11.0",
29+
"illuminate/validation": "^10.0|^11.0",
3030
"spatie/laravel-package-tools": "^1.14.1"
3131
},
3232
"require-dev": {
3333
"friendsofphp/php-cs-fixer": "^3.4",
34-
"nunomaduro/collision": "^6.0",
35-
"nunomaduro/larastan": "^2.0.1",
36-
"orchestra/testbench": "^7.0|^8.0",
37-
"pestphp/pest": "^1.21",
38-
"pestphp/pest-plugin-laravel": "^1.1",
39-
"phpstan/extension-installer": "^1.1",
34+
"nunomaduro/collision": "^7.10.0|^8.1.1",
35+
"larastan/larastan": "^2.0.1",
36+
"orchestra/testbench": "^8.0|^9.0",
37+
"pestphp/pest": "^2.34",
38+
"pestphp/pest-plugin-laravel": "^2.3",
39+
"phpstan/extension-installer": "^1.3",
4040
"phpstan/phpstan-deprecation-rules": "^1.0",
41-
"phpstan/phpstan-phpunit": "^1.0",
42-
"phpunit/phpunit": "^9.5"
41+
"phpstan/phpstan-phpunit": "^1.0"
4342
},
4443
"autoload": {
4544
"psr-4": {

phpunit.xml.dist

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
7-
bootstrap="vendor/autoload.php"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
processIsolation="false"
13-
stopOnFailure="false"
14-
executionOrder="random"
15-
failOnWarning="true"
16-
failOnRisky="true"
17-
failOnEmptyTestSuite="true"
18-
beStrictAboutOutputDuringTests="true"
19-
verbose="true"
20-
>
21-
<testsuites>
22-
<testsuite name="Maize Test Suite">
23-
<directory>tests</directory>
24-
</testsuite>
25-
</testsuites>
26-
<coverage>
27-
<include>
28-
<directory suffix=".php">./src</directory>
29-
</include>
30-
<report>
31-
<html outputDirectory="build/coverage"/>
32-
<text outputFile="build/coverage.txt"/>
33-
<clover outputFile="build/logs/clover.xml"/>
34-
</report>
35-
</coverage>
36-
<logging>
37-
<junit outputFile="build/report.junit.xml"/>
38-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Maize Test Suite">
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage>
9+
<report>
10+
<html outputDirectory="build/coverage"/>
11+
<text outputFile="build/coverage.txt"/>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
</report>
14+
</coverage>
15+
<logging>
16+
<junit outputFile="build/report.junit.xml"/>
17+
</logging>
18+
<source>
19+
<include>
20+
<directory suffix=".php">./src</directory>
21+
</include>
22+
</source>
3923
</phpunit>

src/Http/Controllers/NpsAnswerController.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ class NpsAnswerController extends Controller
1010
{
1111
public function __invoke(NpsAnswerRequest $request, $id)
1212
{
13-
$request
14-
->user()
15-
->answerNps(
16-
Nps::findOrFail($id),
17-
$request->validated()
18-
);
13+
$user = $request->user();
14+
15+
/** @phpstan-ignore-next-line */
16+
$user->answerNps(
17+
Nps::findOrFail($id),
18+
$request->validated()
19+
);
1920

2021
return response()->noContent();
2122
}

src/Http/Controllers/NpsAnswerDelayController.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ class NpsAnswerDelayController extends Controller
1010
{
1111
public function __invoke(Request $request, $id)
1212
{
13-
$request
14-
->user()
15-
->delayNps(
16-
Nps::findOrFail($id),
17-
);
13+
$user = $request->user();
14+
15+
/** @phpstan-ignore-next-line */
16+
$user->delayNps(
17+
Nps::findOrFail($id),
18+
);
1819

1920
return response()->noContent();
2021
}

src/Http/Controllers/NpsController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ class NpsController extends Controller
1010
{
1111
public function __invoke(Request $request)
1212
{
13-
$nps = $request
14-
->user()
15-
->findCurrentNps(true);
13+
$user = $request->user();
1614

17-
return new NpsResource($nps);
15+
/** @phpstan-ignore-next-line */
16+
$nps = $user->findCurrentNps(true);
17+
18+
return NpsResource::make($nps);
1819
}
1920
}

src/NpsFinder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function find(bool $fail = false): ?Nps
1616
$model = $this->getNpsModel();
1717
$builder = $model::query();
1818

19+
/** @var ?Nps $nps */
1920
$nps = Cache::remember(
2021
$model::npsCacheKey(),
2122
config('nps.cache.nps_ttl'),

0 commit comments

Comments
 (0)