Skip to content

Commit 812cd53

Browse files
committed
support php 8.1 & laravel 9 with removed bensampo/laravel-enum package requirement
1 parent 52d74ef commit 812cd53

File tree

9 files changed

+73
-27
lines changed

9 files changed

+73
-27
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.gitattributes

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/art export-ignore
10+
/docs export-ignore
11+
/tests export-ignore
12+
/.editorconfig export-ignore
13+
/.php_cs.dist.php export-ignore
14+
/psalm.xml export-ignore
15+
/psalm.xml.dist export-ignore
16+
/testbench.yaml export-ignore
17+
/UPGRADING.md export-ignore
18+
/phpstan.neon.dist export-ignore
19+
/phpstan-baseline.neon export-ignore

.github/workflows/test.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ jobs:
1414
matrix:
1515
php: [8.0, 7.4]
1616
laravel: [8.*]
17-
os: [ubuntu-latest]
17+
os: [ubuntu-latest, windows-latest]
18+
stability: [prefer-lowest, prefer-stable]
1819
include:
1920
- laravel: 8.*
2021
testbench: 6.*
2122
enum: 3.*
2223

23-
name: PHP ${{ matrix.php }} with Laravel ${{ matrix.laravel }} - ${{ matrix.os }}
24+
name: PHP ${{ matrix.php }} with Laravel ${{ matrix.laravel }} -${{ matrix.stability }} - ${{ matrix.os }}
2425

2526
steps:
2627
- name: Checkout code
2728
uses: actions/checkout@v2
2829

2930
- name: Setup PHP
30-
uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
31+
uses: shivammathur/setup-php@v2
3132
with:
3233
php-version: ${{ matrix.php }}
3334
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, fileinfo
@@ -36,7 +37,7 @@ jobs:
3637
- name: Install dependencies
3738
run: |
3839
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "bensampo/laravel-enum:${{ matrix.enum }}" --no-interaction --no-update
39-
composer update --prefer-dist --no-interaction --no-suggest
40+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-suggest
4041
4142
- name: Execute pest tests
4243
run: vendor/bin/pest

.gitignore

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
/.idea
2-
/vendor
3-
/node_modules
4-
package-lock.json
5-
composer.phar
6-
composer.lock
1+
.idea
2+
.php_cs
3+
.php_cs.cache
74
.phpunit.result.cache
8-
.DS_Store
9-
Thumbs.db
5+
build
6+
composer.lock
7+
coverage
8+
docs
9+
phpunit.xml
10+
phpstan.neon
11+
testbench.yaml
12+
vendor
13+
node_modules
14+
.php-cs-fixer.cache

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v2.0.0 - 2022-24-02
2+
3+
### removed
4+
- php 7 and php < 8.1 no longer supported minimum php requirement is 8.1
5+
16
## v2.0.0 - 2021-12-05
27

38
### BREAKING CHANGES INTRODUCTED

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.4|^8.0",
20-
"illuminate/config": "^7.0|^8.0",
21-
"illuminate/database": "^7.0|^8.0",
22-
"illuminate/support": "^7.0|^8.0",
23-
"bensampo/laravel-enum": "^3.4"
19+
"php": "^8.1",
20+
"illuminate/database": "^7.0|^8.0|^9.0",
21+
"illuminate/support": "^7.0|^8.0|^9.0",
22+
"nesbot/carbon": "^2.0"
2423
},
2524
"require-dev": {
26-
"orchestra/testbench": "^6.23",
25+
"orchestra/testbench": "^6.0|^7.0",
2726
"pestphp/pest": "^1.21"
2827
},
2928
"autoload": {

database/migrations/create_actions_table.php.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CreateActionsTable extends Migration
1919
$table->morphs('actionable');
2020
$table->string('action', 20);
2121
$table->json('properties')->nullable();
22-
$table->enum('status', Status::getValues())->default(Status::PENDING); //TODO swap to native implementation
22+
$table->enum('status', Status::getValues())->default(Status::PENDING->value); //TODO swap to native implementation
2323
$table->date('act_date');
2424
$table->time('act_time');
2525
$table->timestamp('finished_at')->nullable();

src/Enums/Status.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Devsrv\ScheduledAction\Enums;
44

5-
use BenSampo\Enum\Enum;
6-
7-
final class Status extends Enum
5+
enum Status: string
86
{
9-
const PENDING = 'PENDING';
10-
const FINISHED = 'FINISHED';
11-
const CANCELLED = 'CANCELLED';
12-
const DISPATCHED = 'DISPATCHED';
7+
case PENDING = 'PENDING';
8+
case FINISHED = 'FINISHED';
9+
case CANCELLED = 'CANCELLED';
10+
case DISPATCHED = 'DISPATCHED';
11+
12+
public static function getValues() {
13+
return array_map(fn($v) => $v->value, static::cases());
14+
}
1315
}

src/Models/ModelAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Database\Factories\ActionFactory;
77
use Illuminate\Database\Eloquent\Model;
88
use Devsrv\ScheduledAction\Enums\Status;
9-
use Illuminate\Support\{Arr, Collection};
9+
use Illuminate\Support\Arr;
1010
use Illuminate\Database\Eloquent\Factories\HasFactory;
1111
use Devsrv\ScheduledAction\Traits\{ActionStatus, FluentUpdate, FluentCreate};
1212

0 commit comments

Comments
 (0)