Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions benchmarks/ASTUnserializationBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function prepareSchema(): void
*/
public function benchUnserializeDocumentNode(): void
{
// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
unserialize($this->documentNode);
}

Expand All @@ -62,6 +63,7 @@ public function benchUnserializeDocumentNode(): void
*/
public function benchUnserializeDocumentAST(): void
{
// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
unserialize($this->documentAST);
}
}
2 changes: 1 addition & 1 deletion src/Auth/BaseCanDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function handleField(FieldValue $fieldValue): void
} catch (\Throwable $throwable) {
$action = $this->directiveArgValue('action');
if ($action === 'EXCEPTION_NOT_AUTHORIZED') {
throw new AuthorizationException();
throw new AuthorizationException(AuthorizationException::MESSAGE, $throwable->getCode(), $throwable);
}

if ($action === 'RETURN_VALUE') {
Expand Down
4 changes: 1 addition & 3 deletions src/Execution/Arguments/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class Argument
*/
public mixed $value;

/**
* The type of the argument.
*/
/** The type of the argument. */
public ListType|NamedType|null $type = null;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Execution/ContextSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function unserialize(string $context): GraphQLContext
[
'request' => $rawRequest,
'user' => $rawUser
// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
] = unserialize($context);

if ($rawRequest) {
Expand Down
4 changes: 1 addition & 3 deletions src/Scout/ScoutEnhancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ class ScoutEnhancer

public function __construct(
protected ArgumentSet $argumentSet,
/**
* @var \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<TModel>|\Illuminate\Database\Eloquent\Relations\Relation<TModel>|\Laravel\Scout\Builder $builder
*/
/** @var \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder<TModel>|\Illuminate\Database\Eloquent\Relations\Relation<TModel>|\Laravel\Scout\Builder $builder */
protected QueryBuilder|EloquentBuilder|Relation|ScoutBuilder $builder,
) {
$this->gather($this->argumentSet);
Expand Down
2 changes: 2 additions & 0 deletions src/Subscriptions/Storage/RedisStorageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function subscribersByTopic(string $topic): Collection

// Other entries may contain invalid values.
try {
// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
$subscriber = unserialize($subscriber);

// This key exists so remove it from the list of missing keys.
Expand Down Expand Up @@ -164,6 +165,7 @@ protected function getSubscriber(string $channelKey): ?Subscriber
$subscriber = $this->connection->command('get', [$channelKey]);

return is_string($subscriber)
// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
? unserialize($subscriber)
: null;
}
Expand Down
1 change: 1 addition & 0 deletions src/Subscriptions/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function __unserialize(array $data): void
$this->topic = $data['topic'];

$documentNode = AST::fromArray(
// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
unserialize($data['query']),
);
assert($documentNode instanceof DocumentNode, 'We know the type since it is set during construction and serialized.');
Expand Down
2 changes: 2 additions & 0 deletions tests/Integration/Async/AsyncDirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function testDispatchesMutation(): void
foreach ($jobs as $job) {
$this->assertInstanceOf(AsyncMutation::class, $job);

// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
$jobCycledThroughSerialization = unserialize(serialize($job));
$this->assertInstanceOf(AsyncMutation::class, $jobCycledThroughSerialization);
Container::getInstance()->call([$jobCycledThroughSerialization, 'handle']);
Expand Down Expand Up @@ -71,6 +72,7 @@ public function testDispatchesMutationOnCustomQueue(): void
$this->assertInstanceOf(AsyncMutation::class, $job);
$this->assertSame('custom', $job->queue);

// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
$jobCycledThroughSerialization = unserialize(serialize($job));
$this->assertInstanceOf(AsyncMutation::class, $jobCycledThroughSerialization);
Container::getInstance()->call([$jobCycledThroughSerialization, 'handle']);
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Schema/AST/DocumentASTTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function testBeSerialized(): void
directive @foo on FIELD
GRAPHQL);

// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
$reserialized = unserialize(
serialize($documentAST),
);
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Subscriptions/SubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function testSerializable(): void

$channel = $subscriber->channel;

// @phpstan-ignore theCodingMachineSafe.function (Safe\unserialize is not available in thecodingmachine/safe ^1 and ^2)
$serialized = unserialize(serialize($subscriber));

$this->assertInstanceOf(Subscriber::class, $serialized);
Expand Down