Skip to content

Commit afe6254

Browse files
laravel-shiftksassnowski
authored andcommitted
feat: Laravel 10.x compatibility
* Bump dependencies for Laravel 10 * Update GitHub Actions for Laravel 10
1 parent 8af85ab commit afe6254

File tree

7 files changed

+30
-20
lines changed

7 files changed

+30
-20
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
php: [8.0, 8.1]
11+
php: [8.1]
1212
stability: [prefer-lowest, prefer-stable]
1313
os: [ubuntu-latest]
1414

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor/
2+
.phpunit.cache/
23
.phpunit.result.cache

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^8.0",
14-
"illuminate/database": "^9.0",
15-
"illuminate/http": "^9.0",
16-
"illuminate/support": "^9.0",
17-
"ramsey/uuid": "^4.0"
13+
"php": "^8.1",
14+
"illuminate/database": "^10.0",
15+
"illuminate/http": "^10.0",
16+
"illuminate/support": "^10.0",
17+
"ramsey/uuid": "^4.7"
1818
},
1919
"require-dev": {
20-
"doctrine/dbal": "^3.1",
21-
"ergebnis/composer-normalize": "^2.15",
22-
"mockery/mockery": "^1.4",
23-
"nunomaduro/larastan": "^1.0",
24-
"orchestra/testbench": "^7.0",
25-
"phpunit/phpunit": "^9.5.8",
20+
"doctrine/dbal": "^3.5",
21+
"ergebnis/composer-normalize": "^2.29",
22+
"mockery/mockery": "^1.4.4",
23+
"nunomaduro/larastan": "^2.4",
24+
"orchestra/testbench": "^8.0",
25+
"phpunit/phpunit": "^9.5.10",
2626
"roave/security-advisories": "dev-latest"
2727
},
2828
"minimum-stability": "dev",

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
33
<coverage>
44
<include>
55
<directory>src</directory>
66
</include>
77
</coverage>
88
<testsuites>
99
<testsuite name="Package Test Suite">
10-
<directory suffix=".php">./tests/</directory>
10+
<directory suffix="Test.php">./tests/</directory>
1111
</testsuite>
1212
</testsuites>
1313
</phpunit>

src/Shareable/Shareable.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
namespace Sassnowski\LaravelShareableModel\Shareable;
44

5+
use Illuminate\Database\Eloquent\Relations\MorphMany;
6+
use Illuminate\Database\Eloquent\Relations\MorphTo;
7+
58
trait Shareable
69
{
7-
public function links()
10+
public function links(): MorphMany
811
{
912
return $this->morphMany(ShareableLink::class, 'shareable');
1013
}

src/Shareable/ShareableInterface.php

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

33
namespace Sassnowski\LaravelShareableModel\Shareable;
44

5-
use Illuminate\Database\Eloquent\Relations\MorphOne;
65
use Illuminate\Database\Eloquent\Relations\MorphMany;
7-
use Illuminate\Database\Eloquent\Relations\MorphOneOrMany;
86

97
interface ShareableInterface
108
{
119
/**
12-
* @return MorphOne|MorphMany|MorphOneOrMany
10+
* @return MorphMany<ShareableLink>
1311
*/
14-
public function links();
12+
public function links(): MorphMany;
1513
}

src/Shareable/ShareableLink.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@
1616
*/
1717
class ShareableLink extends Model
1818
{
19-
/** @var string[] */
19+
/**
20+
* @var array<string, string>
21+
*/
2022
protected $guarded = [];
2123

24+
/**
25+
* @var array<string, string>
26+
*/
2227
protected $casts = [
2328
'should_notify' => 'bool',
2429
'active' => 'bool',
@@ -29,6 +34,9 @@ public static function buildFor(ShareableInterface $entity): ShareableLinkBuilde
2934
return new ShareableLinkBuilder($entity);
3035
}
3136

37+
/**
38+
* @return MorphTo<Model, ShareableLink>
39+
*/
3240
public function shareable(): MorphTo
3341
{
3442
return $this->morphTo();

0 commit comments

Comments
 (0)