Skip to content

Commit 02dad7d

Browse files
authored
Ensure PHP 8.4 compatibility, allow thecodingmachine/safe 3 (#2657)
1 parent 9222272 commit 02dad7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+289
-300
lines changed

.github/workflows/proto.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
coverage: none
2121
extensions: mbstring
22-
php-version: 8.3
22+
php-version: 8.4
2323

2424
- run: composer install --no-interaction --no-progress --no-suggest
2525

.github/workflows/validate.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- "8.1"
2828
- "8.2"
2929
- "8.3"
30+
- "8.4"
3031
laravel-version:
3132
- "^9"
3233
- "^10"
@@ -74,7 +75,7 @@ jobs:
7475
--update-with-all-dependencies
7576
${{ matrix.composer.arg }}
7677
77-
- run: vendor/bin/phpstan
78+
- run: vendor/bin/phpstan --verbose
7879

7980
tests:
8081
name: PHPUnit on PHP ${{ matrix.php-version }} with Laravel ${{ matrix.laravel-version }} and ${{ matrix.composer.name }} dependencies
@@ -88,6 +89,7 @@ jobs:
8889
- "8.1"
8990
- "8.2"
9091
- "8.3"
92+
- "8.4"
9193
laravel-version:
9294
- "^9"
9395
- "^10"
@@ -159,7 +161,7 @@ jobs:
159161

160162
strategy:
161163
matrix:
162-
php-version: ["8.3"]
164+
php-version: ["8.4"]
163165
laravel-version: ["^11"]
164166

165167
services:
@@ -206,7 +208,7 @@ jobs:
206208

207209
strategy:
208210
matrix:
209-
php-version: ["8.3"]
211+
php-version: ["8.4"]
210212
laravel-version: ["^11"]
211213

212214
steps:

CHANGELOG.md

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

1010
## Unreleased
1111

12+
## v6.50.0
13+
14+
### Added
15+
16+
- Allow `thecodingmachine/safe` 3 https://github.com/nuwave/lighthouse/pull/2657
17+
1218
## v6.49.1
1319

1420
### Fixed

_ide_helper.php

+158-154
Original file line numberDiff line numberDiff line change
@@ -1,161 +1,165 @@
11
<?php declare(strict_types=1);
22

3-
namespace Illuminate\Testing;
4-
5-
use Mockery\MockInterface;
6-
use Nuwave\Lighthouse\Subscriptions\Contracts\Broadcaster;
7-
use PHPUnit\Framework\TestCase;
8-
9-
class TestResponse
10-
{
11-
/**
12-
* Assert the response contains an error with a matching message.
13-
*
14-
* @param \Throwable $error the expected error
15-
*
16-
* @return $this
17-
*/
18-
public function assertGraphQLError(\Throwable $error): self
19-
{
20-
return $this;
21-
}
22-
23-
/**
24-
* Assert the response contains an error with the given message.
25-
*
26-
* @param string $message the expected error message
27-
*
28-
* @return $this
29-
*/
30-
public function assertGraphQLErrorMessage(string $message): self
31-
{
32-
return $this;
33-
}
34-
35-
/**
36-
* Assert the response contains an error with the given debug message.
37-
*
38-
* Requires the config `lighthouse.debug` to include the option \GraphQL\Error\DebugFlag::INCLUDE_DEBUG_MESSAGE.
39-
*
40-
* @param string $message the expected debug message
41-
*
42-
* @return $this
43-
*/
44-
public function assertGraphQLDebugMessage(string $message): self
45-
{
46-
return $this;
47-
}
48-
49-
/**
50-
* Assert the response contains no errors.
51-
*
52-
* @return $this
53-
*/
54-
public function assertGraphQLErrorFree(): self
55-
{
56-
return $this;
57-
}
58-
59-
/**
60-
* Assert the returned result contains exactly the given validation keys.
61-
*
62-
* @param array<string> $keys the validation keys the result should have
63-
*
64-
* @return $this
65-
*/
66-
public function assertGraphQLValidationKeys(array $keys): self
67-
{
68-
return $this;
69-
}
70-
71-
/**
72-
* Assert a given validation error is present in the response.
73-
*
74-
* @param string $key the validation key that should be present
75-
* @param string $message the expected validation message
76-
*
77-
* @return $this
78-
*/
79-
public function assertGraphQLValidationError(string $key, string $message): self
80-
{
81-
return $this;
82-
}
83-
84-
/**
85-
* Assert no validation errors are present in the response.
86-
*
87-
* @return $this
88-
*/
89-
public function assertGraphQLValidationPasses(): self
90-
{
91-
return $this;
92-
}
93-
94-
/**
95-
* Assert current user is authorized to join a subscription.
96-
*
97-
* @param TestCase $testClassInstance usually $this when calling this from a test class
98-
*
99-
* @return $this
100-
*/
101-
public function assertGraphQLSubscriptionAuthorized(TestCase $testClassInstance): self
102-
{
103-
return $this;
104-
}
105-
106-
/**
107-
* Assert current user is NOT authorized to join a subscription.
108-
*
109-
* @param TestCase $testClassInstance usually $this when calling this from a test class
110-
*
111-
* @return $this
112-
*/
113-
public function assertGraphQLSubscriptionNotAuthorized(TestCase $testClassInstance): self
114-
{
115-
return $this;
116-
}
117-
118-
/**
119-
* For cases where you need more control over your broadcast assertions.
120-
*
121-
* @see \Nuwave\Lighthouse\Testing\TestResponseMixin::assertGraphQLBroadcasted
122-
* @see \Nuwave\Lighthouse\Testing\TestResponseMixin::assertGraphQLNotBroadcasted
123-
*
124-
* @return \Mockery\MockInterface&\Nuwave\Lighthouse\Subscriptions\Contracts\Broadcaster
125-
*/
126-
public function graphQLSubscriptionMock() // @phpstan-ignore-line invalid return type?
127-
{
128-
$mock = \Mockery::mock(Broadcaster::class);
129-
assert($mock instanceof Broadcaster && $mock instanceof MockInterface);
130-
131-
return $mock;
132-
}
133-
134-
/** Get the channel name from a subscription query. */
135-
public function graphQLSubscriptionChannelName(): string
136-
{
137-
return '';
138-
}
3+
namespace Nuwave\Lighthouse\Subscriptions\Contracts {
4+
interface Broadcaster {}
5+
}
1396

140-
/**
141-
* Assert the subscription received the given broadcasts.
142-
*
143-
* @param array<int, array<string, mixed>> $data the broadcast pattern that you are expecting
144-
*
145-
* @return $this
146-
*/
147-
public function assertGraphQLBroadcasted(array $data): self
148-
{
149-
return $this;
150-
}
7+
namespace Illuminate\Testing {
8+
use Mockery\MockInterface;
9+
use Nuwave\Lighthouse\Subscriptions\Contracts\Broadcaster;
10+
use PHPUnit\Framework\TestCase;
15111

152-
/**
153-
* Assert the subscription received no broadcast.
154-
*
155-
* @return $this
156-
*/
157-
public function assertGraphQLNotBroadcasted(): self
12+
class TestResponse
15813
{
159-
return $this;
14+
/**
15+
* Assert the response contains an error with a matching message.
16+
*
17+
* @param \Throwable $error the expected error
18+
*
19+
* @return $this
20+
*/
21+
public function assertGraphQLError(\Throwable $error): self
22+
{
23+
return $this;
24+
}
25+
26+
/**
27+
* Assert the response contains an error with the given message.
28+
*
29+
* @param string $message the expected error message
30+
*
31+
* @return $this
32+
*/
33+
public function assertGraphQLErrorMessage(string $message): self
34+
{
35+
return $this;
36+
}
37+
38+
/**
39+
* Assert the response contains an error with the given debug message.
40+
*
41+
* Requires the config `lighthouse.debug` to include the option \GraphQL\Error\DebugFlag::INCLUDE_DEBUG_MESSAGE.
42+
*
43+
* @param string $message the expected debug message
44+
*
45+
* @return $this
46+
*/
47+
public function assertGraphQLDebugMessage(string $message): self
48+
{
49+
return $this;
50+
}
51+
52+
/**
53+
* Assert the response contains no errors.
54+
*
55+
* @return $this
56+
*/
57+
public function assertGraphQLErrorFree(): self
58+
{
59+
return $this;
60+
}
61+
62+
/**
63+
* Assert the returned result contains exactly the given validation keys.
64+
*
65+
* @param array<string> $keys the validation keys the result should have
66+
*
67+
* @return $this
68+
*/
69+
public function assertGraphQLValidationKeys(array $keys): self
70+
{
71+
return $this;
72+
}
73+
74+
/**
75+
* Assert a given validation error is present in the response.
76+
*
77+
* @param string $key the validation key that should be present
78+
* @param string $message the expected validation message
79+
*
80+
* @return $this
81+
*/
82+
public function assertGraphQLValidationError(string $key, string $message): self
83+
{
84+
return $this;
85+
}
86+
87+
/**
88+
* Assert no validation errors are present in the response.
89+
*
90+
* @return $this
91+
*/
92+
public function assertGraphQLValidationPasses(): self
93+
{
94+
return $this;
95+
}
96+
97+
/**
98+
* Assert current user is authorized to join a subscription.
99+
*
100+
* @param \PHPUnit\Framework\TestCase $testClassInstance usually $this when calling this from a test class
101+
*
102+
* @return $this
103+
*/
104+
public function assertGraphQLSubscriptionAuthorized(TestCase $testClassInstance): self
105+
{
106+
return $this;
107+
}
108+
109+
/**
110+
* Assert current user is NOT authorized to join a subscription.
111+
*
112+
* @param \PHPUnit\Framework\TestCase $testClassInstance usually $this when calling this from a test class
113+
*
114+
* @return $this
115+
*/
116+
public function assertGraphQLSubscriptionNotAuthorized(TestCase $testClassInstance): self
117+
{
118+
return $this;
119+
}
120+
121+
/**
122+
* For cases where you need more control over your broadcast assertions.
123+
*
124+
* @return \Nuwave\Lighthouse\Subscriptions\Contracts\Broadcaster&\Mockery\MockInterface
125+
*
126+
* @see \Nuwave\Lighthouse\Testing\TestResponseMixin::assertGraphQLNotBroadcasted
127+
* @see \Nuwave\Lighthouse\Testing\TestResponseMixin::assertGraphQLBroadcasted
128+
*/
129+
public function graphQLSubscriptionMock(): Broadcaster
130+
{
131+
$mock = \Mockery::mock(Broadcaster::class);
132+
assert($mock instanceof Broadcaster && $mock instanceof MockInterface);
133+
134+
return $mock;
135+
}
136+
137+
/** Get the channel name from a subscription query. */
138+
public function graphQLSubscriptionChannelName(): string
139+
{
140+
return '';
141+
}
142+
143+
/**
144+
* Assert the subscription received the given broadcasts.
145+
*
146+
* @param array<int, array<string, mixed>> $data the broadcast pattern that you are expecting
147+
*
148+
* @return $this
149+
*/
150+
public function assertGraphQLBroadcasted(array $data): self
151+
{
152+
return $this;
153+
}
154+
155+
/**
156+
* Assert the subscription received no broadcast.
157+
*
158+
* @return $this
159+
*/
160+
public function assertGraphQLNotBroadcasted(): self
161+
{
162+
return $this;
163+
}
160164
}
161165
}

0 commit comments

Comments
 (0)