Skip to content

Commit 405ac15

Browse files
ADD laravel 9 support
1 parent f6dd22a commit 405ac15

File tree

7 files changed

+35
-31
lines changed

7 files changed

+35
-31
lines changed

.github/workflows/psalm.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: '7.4'
19+
php-version: '8.0'
2020
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
2121
coverage: none
2222

.github/workflows/run-tests.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: run-tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
48

59
jobs:
610
test:
@@ -9,12 +13,12 @@ jobs:
913
fail-fast: true
1014
matrix:
1115
os: [ubuntu-latest, windows-latest]
12-
php: [8.0, 7.4]
13-
laravel: [8.*]
16+
php: [8.1, 8.0]
17+
laravel: [9.*]
1418
stability: [prefer-lowest, prefer-stable]
1519
include:
16-
- laravel: 8.*
17-
testbench: 6.*
20+
- laravel: 9.*
21+
testbench: 7.*
1822

1923
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2024

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
return (new PhpCsFixer\Config())
1414
->setRules([
15-
'@PSR2' => true,
15+
'@PSR12' => true,
1616
'array_syntax' => ['syntax' => 'short'],
1717
'ordered_imports' => ['sort_algorithm' => 'alpha'],
1818
'no_unused_imports' => true,

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.4|^8.0",
19+
"php": "^8.0",
2020
"ext-json": "*",
21-
"illuminate/database": "^8.0",
22-
"illuminate/http": "^8.0",
23-
"illuminate/routing": "^8.0",
24-
"illuminate/support": "^8.0",
25-
"spatie/laravel-package-tools": "^1.4.3"
21+
"illuminate/database": "^9.0",
22+
"illuminate/http": "^9.0",
23+
"illuminate/routing": "^9.0",
24+
"illuminate/support": "^9.0",
25+
"spatie/laravel-package-tools": "^1.9.2"
2626
},
2727
"require-dev": {
28-
"friendsofphp/php-cs-fixer": "^2.18",
29-
"orchestra/testbench": "^6.0",
30-
"phpunit/phpunit": "^9.3",
31-
"spatie/laravel-ray": "^1.9",
32-
"vimeo/psalm": "^4.4"
28+
"friendsofphp/php-cs-fixer": "^3.4",
29+
"orchestra/testbench": "^7.0",
30+
"phpunit/phpunit": "^9.5",
31+
"spatie/laravel-ray": "^1.26",
32+
"vimeo/psalm": "^4.20"
3333
},
3434
"autoload": {
3535
"psr-4": {

src/LegalDocumentFinder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ protected function getLegalDocumentModel(): LegalDocument
3333
{
3434
$legalDocumentModelClass = (string) config('legal-consent.legal_document_model');
3535

36-
return new $legalDocumentModelClass;
36+
return new $legalDocumentModelClass();
3737
}
3838

3939
protected function validateType(string $type): void
4040
{
4141
if (! in_array($type, config('legal-consent.allowed_document_types'))) {
42-
throw new InvalidDocumentTypeException;
42+
throw new InvalidDocumentTypeException();
4343
}
4444
}
4545
}

tests/AcceptLegalDocumentListenerTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ public function can_auto_accept_documents_after_registration()
3737

3838
$event = new Registered($user);
3939

40-
$listener = new AcceptLegalDocumentListener;
40+
$listener = new AcceptLegalDocumentListener();
4141

4242
$listener->handle($event);
4343

44-
$table = (new LegalConsent)->getTable();
44+
$table = (new LegalConsent())->getTable();
4545

4646
$this->assertDatabaseCount($table, 2);
4747
}
@@ -71,11 +71,11 @@ public function can_auto_accept_document_after_registration()
7171

7272
$event = new Registered($user);
7373

74-
$listener = new AcceptLegalDocumentListener;
74+
$listener = new AcceptLegalDocumentListener();
7575

7676
$listener->handle($event);
7777

78-
$table = (new LegalConsent)->getTable();
78+
$table = (new LegalConsent())->getTable();
7979

8080
$this->assertDatabaseCount($table, 1);
8181
}
@@ -100,26 +100,26 @@ public function can_not_auto_accept_document_after_registration_if_request_is_em
100100

101101
$event = new Registered($user);
102102

103-
$listener = new AcceptLegalDocumentListener;
103+
$listener = new AcceptLegalDocumentListener();
104104

105105
$listener->handle($event);
106106

107-
$table = (new LegalConsent)->getTable();
107+
$table = (new LegalConsent())->getTable();
108108

109109
$this->assertDatabaseCount($table, 0);
110110
}
111111

112112
/** @test */
113113
public function ignore_event_if_not_have_user_setted()
114114
{
115-
$event = new class() {
115+
$event = new class () {
116116
};
117117

118-
$listener = new AcceptLegalDocumentListener;
118+
$listener = new AcceptLegalDocumentListener();
119119

120120
$listener->handle($event);
121121

122-
$table = (new LegalConsent)->getTable();
122+
$table = (new LegalConsent())->getTable();
123123

124124
$this->assertDatabaseCount($table, 0);
125125
}

tests/LegalConsentTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function can_accept_document()
2727
$doc->getKey()
2828
);
2929

30-
$table = (new LegalConsent)->getTable();
30+
$table = (new LegalConsent())->getTable();
3131

3232
$this
3333
->actingAs($user, 'api')
@@ -52,7 +52,7 @@ public function can_not_accept_document_if_user_is_not_authenticated()
5252
$doc->getKey()
5353
);
5454

55-
$table = (new LegalConsent)->getTable();
55+
$table = (new LegalConsent())->getTable();
5656

5757
$this
5858
->postJson($route)

0 commit comments

Comments
 (0)