Skip to content

Commit 009fdf5

Browse files
committed
Allow Laravel 12
1 parent e09a9d5 commit 009fdf5

File tree

9 files changed

+52
-26
lines changed

9 files changed

+52
-26
lines changed

.github/workflows/validate.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
- "^9"
3333
- "^10"
3434
- "^11"
35+
- "^12"
3536
composer:
3637
- name: lowest
3738
arg: "--prefer-lowest --prefer-stable"
@@ -44,6 +45,10 @@ jobs:
4445
laravel-version: "^11"
4546
- php-version: "8.1"
4647
laravel-version: "^11"
48+
- php-version: "8.0"
49+
laravel-version: "^12"
50+
- php-version: "8.1"
51+
laravel-version: "^12"
4752

4853
steps:
4954
- uses: actions/checkout@v4
@@ -63,7 +68,8 @@ jobs:
6368
- name: "Remove conflicting dependencies that are not needed here"
6469
run: composer remove --dev --no-update phpbench/phpbench rector/rector
6570

66-
- if: matrix.laravel-version != '^10'
71+
- name: "Remove Pennant for Laravel 9 because it is not compatible"
72+
if: matrix.laravel-version == '^9'
6773
run: composer remove --dev --no-update laravel/pennant
6874

6975
- run: >
@@ -94,6 +100,7 @@ jobs:
94100
- "^9"
95101
- "^10"
96102
- "^11"
103+
- "^12"
97104
os:
98105
- ubuntu-latest
99106
composer:
@@ -108,6 +115,10 @@ jobs:
108115
laravel-version: "^11"
109116
- php-version: "8.1"
110117
laravel-version: "^11"
118+
- php-version: "8.0"
119+
laravel-version: "^12"
120+
- php-version: "8.1"
121+
laravel-version: "^12"
111122

112123
services:
113124
mysql:
@@ -142,7 +153,8 @@ jobs:
142153
- name: "Remove conflicting dependencies that are not needed here"
143154
run: composer remove --dev --no-update larastan/larastan phpstan/phpstan-mockery phpbench/phpbench rector/rector
144155

145-
- if: matrix.laravel-version != '^10' && matrix.laravel-version != '^11'
156+
- name: "Remove Pennant for Laravel 9 because it is not compatible"
157+
if: matrix.laravel-version == '^9'
146158
run: composer remove --dev --no-update laravel/pennant
147159

148160
- run: >
@@ -162,7 +174,7 @@ jobs:
162174
strategy:
163175
matrix:
164176
php-version: ["8.4"]
165-
laravel-version: ["^11"]
177+
laravel-version: ["^12"]
166178

167179
services:
168180
mysql:
@@ -209,7 +221,7 @@ jobs:
209221
strategy:
210222
matrix:
211223
php-version: ["8.4"]
212-
laravel-version: ["^11"]
224+
laravel-version: ["^12"]
213225

214226
steps:
215227
- uses: actions/checkout@v4

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ You can find and compare releases at the [GitHub release page](https://github.co
99

1010
## Unreleased
1111

12+
### Added
13+
14+
- Support Laravel 12 https://github.com/nuwave/lighthouse/pull/2665
15+
1216
## v6.50.0
1317

1418
### Added

composer.json

+20-14
Original file line numberDiff line numberDiff line change
@@ -29,37 +29,37 @@
2929
"php": "^8",
3030
"ext-json": "*",
3131
"haydenpierce/class-finder": "^0.4 || ^0.5",
32-
"illuminate/auth": "^9 || ^10 || ^11",
33-
"illuminate/bus": "^9 || ^10 || ^11",
34-
"illuminate/contracts": "^9 || ^10 || ^11",
35-
"illuminate/http": "^9 || ^10 || ^11",
36-
"illuminate/pagination": "^9 || ^10 || ^11",
37-
"illuminate/queue": "^9 || ^10 || ^11",
38-
"illuminate/routing": "^9 || ^10 || ^11",
39-
"illuminate/support": "^9 || ^10 || ^11",
40-
"illuminate/validation": "^9 || ^10 || ^11",
32+
"illuminate/auth": "^9 || ^10 || ^11 || ^12",
33+
"illuminate/bus": "^9 || ^10 || ^11 || ^12",
34+
"illuminate/contracts": "^9 || ^10 || ^11 || ^12",
35+
"illuminate/http": "^9 || ^10 || ^11 || ^12",
36+
"illuminate/pagination": "^9 || ^10 || ^11 || ^12",
37+
"illuminate/queue": "^9 || ^10 || ^11 || ^12",
38+
"illuminate/routing": "^9 || ^10 || ^11 || ^12",
39+
"illuminate/support": "^9 || ^10 || ^11 || ^12",
40+
"illuminate/validation": "^9 || ^10 || ^11 || ^12",
4141
"laragraph/utils": "^1.5 || ^2",
4242
"thecodingmachine/safe": "^1 || ^2 || ^3",
4343
"webonyx/graphql-php": "^15"
4444
},
4545
"require-dev": {
4646
"algolia/algoliasearch-client-php": "^3",
4747
"bensampo/laravel-enum": "^5 || ^6",
48-
"dms/phpunit-arraysubset-asserts": "^0.4 || ^0.5",
48+
"dms/phpunit-arraysubset-asserts": "^0.4 || ^0.5 || dev-add-phpunit-11-support",
4949
"ergebnis/composer-normalize": "^2.2.2",
5050
"fakerphp/faker": "^1.21",
5151
"google/protobuf": "^3.21",
5252
"larastan/larastan": "^2.9.14 || ^3.0.4",
53-
"laravel/framework": "^9 || ^10 || ^11",
53+
"laravel/framework": "^9 || ^10 || ^11 || ^12",
5454
"laravel/legacy-factories": "^1.1.1",
5555
"laravel/pennant": "^1",
56-
"laravel/scout": "^8 || ^9 || ^10 || ^11",
56+
"laravel/scout": "^8 || ^9 || ^10",
5757
"mattiasgeniar/phpunit-query-count-assertions": "^1.1",
5858
"mll-lab/graphql-php-scalars": "^6",
5959
"mll-lab/php-cs-fixer-config": "^5",
6060
"mockery/mockery": "^1.5",
61-
"nesbot/carbon": "^2.62.1",
62-
"orchestra/testbench": "^7.50 || ^8.32 || ^9.10",
61+
"nesbot/carbon": "^2.62.1 || ^3.8.4",
62+
"orchestra/testbench": "^7.50 || ^8.32 || ^9.10 || ^10.1",
6363
"phpbench/phpbench": "^1.2.6",
6464
"phpstan/extension-installer": "^1",
6565
"phpstan/phpstan": "^1.12.18 || ^2",
@@ -80,6 +80,12 @@
8080
"mll-lab/laravel-graphiql": "A graphical interactive in-browser GraphQL IDE - integrated with Laravel",
8181
"pusher/pusher-php-server": "Required when using the Pusher Subscriptions driver"
8282
},
83+
"repositories": [
84+
{
85+
"type": "vcs",
86+
"url": "https://github.com/pieterocp/phpunit-arraysubset-asserts"
87+
}
88+
],
8389
"minimum-stability": "dev",
8490
"prefer-stable": true,
8591
"autoload": {

src/Console/LighthouseGeneratorCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ abstract class LighthouseGeneratorCommand extends GeneratorCommand
1515
*/
1616
protected function getNameInput(): string
1717
{
18-
$name = $this->argument('name');
18+
$name = (string) $this->argument('name');
1919

2020
return ucfirst(trim($name));
2121
}

src/Schema/Types/Scalars/Date.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ protected function format(Carbon $carbon): string
1111
return $carbon->toDateString();
1212
}
1313

14-
protected function parse(mixed $value): Carbon
14+
protected function parse(string $value): Carbon
1515
{
1616
// @phpstan-ignore-next-line We know the format to be good, so this can never return `false`
1717
return Carbon::createFromFormat('Y-m-d', $value)->startOfDay();

src/Schema/Types/Scalars/DateScalar.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ protected function tryParsingDate(mixed $value, string $exceptionClass): Illumin
8080
}
8181
}
8282

83+
if (! is_string($value)) {
84+
throw new $exceptionClass('Query error: Can only parse strings.');
85+
}
86+
8387
return $this->parse($value);
8488
} catch (\Exception $exception) {
8589
throw new $exceptionClass($exception->getMessage());
@@ -92,7 +96,7 @@ abstract protected function format(IlluminateCarbon $carbon): string;
9296
/**
9397
* Try turning a client value into a Carbon instance.
9498
*
95-
* @param mixed $value a possibly faulty client value
99+
* @param string $value a possibly faulty client value
96100
*/
97-
abstract protected function parse(mixed $value): IlluminateCarbon;
101+
abstract protected function parse(string $value): IlluminateCarbon;
98102
}

src/Schema/Types/Scalars/DateTime.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ protected function format(Carbon $carbon): string
1111
return $carbon->toDateTimeString();
1212
}
1313

14-
protected function parse(mixed $value): Carbon
14+
protected function parse(string $value): Carbon
1515
{
1616
// @phpstan-ignore-next-line We know the format to be good, so this can never return `false`
1717
return Carbon::createFromFormat(Carbon::DEFAULT_TO_STRING_FORMAT, $value);

src/Schema/Types/Scalars/DateTimeTz.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ protected function format(Carbon $carbon): string
1111
return $carbon->toIso8601String();
1212
}
1313

14-
protected function parse(mixed $value): Carbon
14+
protected function parse(string $value): Carbon
1515
{
1616
// @phpstan-ignore-next-line We know the format to be good, so this can never return `false`
1717
return Carbon::createFromFormat(

src/Schema/Types/Scalars/DateTimeUtc.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\Carbon;
66

77
/**
8-
* Only works with Carbon 2.
8+
* Works with Carbon 2.x & 3.x.
99
*/
1010
class DateTimeUtc extends DateScalar
1111
{
@@ -14,7 +14,7 @@ protected function format(Carbon $carbon): string
1414
return $carbon->toJSON();
1515
}
1616

17-
protected function parse(mixed $value): Carbon
17+
protected function parse(string $value): Carbon
1818
{
1919
// @phpstan-ignore-next-line We know the format to be good, so this can never return `false`
2020
return Carbon::createFromIsoFormat('YYYY-MM-DDTHH:mm:ss.SSSSSSZ', $value);

0 commit comments

Comments
 (0)