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
6 changes: 3 additions & 3 deletions src/Rector/RootResolverSignatureRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ protected function isUselessSingleRootParam(ClassMethod $method): bool
$type = $type->type;
}

if ($type instanceof Identifier && $type->name === 'array') {
return false;
if (! $type instanceof Identifier) {
return true;
}

return true;
return $type->name !== 'array';
Comment thread
spawnia marked this conversation as resolved.
}

protected function prependRootParam(ClassMethod $method): void
Expand Down
27 changes: 27 additions & 0 deletions tests/Unit/Rector/RootResolverSignatureRector/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@

define('LIGHTHOUSE_RECTOR_BOOTSTRAP_LOADED', true);

$errorHandler = set_error_handler(static fn (mixed ...$args): bool => false);
restore_error_handler();
$exceptionHandler = set_exception_handler(static fn (mixed ...$args) => null);
restore_exception_handler();

require_once __DIR__ . '/../../../../vendor/larastan/larastan/bootstrap.php';

// Undo handlers registered by Laravel's HandleExceptions bootstrapper
// to avoid PHPUnit risky test warnings about leaked handlers.
for ($i = 0; $i < 10; ++$i) {
if (set_error_handler(static fn (mixed ...$args): bool => false) === $errorHandler) {
restore_error_handler();
break;
}

restore_error_handler();
restore_error_handler();
}

for ($i = 0; $i < 10; ++$i) {
if (set_exception_handler(static fn (mixed ...$args) => null) === $exceptionHandler) {
restore_exception_handler();
break;
}

restore_exception_handler();
restore_exception_handler();
}
Comment thread
spawnia marked this conversation as resolved.

config()->set('lighthouse', require __DIR__ . '/../../../../src/lighthouse.php');
Loading