Skip to content

Commit 573d729

Browse files
committed
Apply php-cs-fixer and add Events to phpunit exclusions
1 parent 4e39739 commit 573d729

9 files changed

Lines changed: 41 additions & 37 deletions

File tree

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<testsuites>
1414
<testsuite name="Hypervel Packages Test Suite">
1515
<directory suffix="Test.php">./tests</directory>
16+
<exclude>./tests/Events</exclude>
1617
<exclude>./tests/Prompts</exclude>
1718
<exclude>./tests/Sentry</exclude>
1819
<exclude>./tests/Horizon</exclude>

src/bus/src/Queueable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ trait Queueable
3838
/**
3939
* The job deduplicator callback the job should use to generate the deduplication ID.
4040
*
41-
* @var \Laravel\SerializableClosure\SerializableClosure|null
41+
* @var null|\Laravel\SerializableClosure\SerializableClosure
4242
*/
43-
public $deduplicator = null;
43+
public $deduplicator;
4444

4545
/**
4646
* The number of seconds before the job should be made available.

src/contracts/src/Events/ShouldDispatchAfterCommit.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
interface ShouldDispatchAfterCommit
88
{
9-
//
109
}

src/contracts/src/Events/ShouldHandleEventsAfterCommit.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66

77
interface ShouldHandleEventsAfterCommit
88
{
9-
//
109
}

src/events/src/CallQueuedListener.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ class CallQueuedListener implements ShouldQueue
9696
/**
9797
* Create a new job instance.
9898
*
99-
* @param class-string $class
100-
* @param string $method
101-
* @param array $data
99+
* @param class-string $class
100+
* @param string $method
101+
* @param array $data
102102
*/
103103
public function __construct($class, $method, $data)
104104
{
@@ -115,7 +115,8 @@ public function handle(Container $container): void
115115
$this->prepareData();
116116

117117
$handler = $this->setJobInstanceIfNecessary(
118-
$this->job, $container->make($this->class)
118+
$this->job,
119+
$container->make($this->class)
119120
);
120121

121122
$handler->{$this->method}(...array_values($this->data));

src/events/src/Dispatcher.php

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Dispatcher implements DispatcherContract
4040
/**
4141
* The registered event listeners.
4242
*
43-
* @var array<string, array<callable|array|class-string|null>>
43+
* @var array<string, array<null|array|callable|class-string>>
4444
*/
4545
protected array $listeners = [];
4646

@@ -61,16 +61,16 @@ class Dispatcher implements DispatcherContract
6161
/**
6262
* The queue resolver instance.
6363
*
64-
* @var (callable(): mixed)|null
64+
* @var null|(callable(): mixed)
6565
*/
66-
protected $queueResolver = null;
66+
protected $queueResolver;
6767

6868
/**
6969
* The database transaction manager resolver instance.
7070
*
71-
* @var (callable(): mixed)|null
71+
* @var null|(callable(): mixed)
7272
*/
73-
protected $transactionManagerResolver = null;
73+
protected $transactionManagerResolver;
7474

7575
/**
7676
* The currently deferred events.
@@ -85,7 +85,7 @@ class Dispatcher implements DispatcherContract
8585
/**
8686
* The specific events to defer (null means defer all events).
8787
*
88-
* @var string[]|null
88+
* @var null|string[]
8989
*/
9090
protected ?array $eventsToDefer = null;
9191

@@ -148,9 +148,9 @@ protected function setupWildcardListen(string $event, Closure|string|array $list
148148
*/
149149
public function hasListeners(string $eventName): bool
150150
{
151-
return isset($this->listeners[$eventName]) ||
152-
isset($this->wildcards[$eventName]) ||
153-
$this->hasWildcardListeners($eventName);
151+
return isset($this->listeners[$eventName])
152+
|| isset($this->wildcards[$eventName])
153+
|| $this->hasWildcardListeners($eventName);
154154
}
155155

156156
/**
@@ -251,9 +251,9 @@ public function dispatch(string|object $event, mixed $payload = [], bool $halt =
251251
// If the event is not intended to be dispatched unless the current database
252252
// transaction is successful, we'll register a callback which will handle
253253
// dispatching this event on the next successful DB transaction commit.
254-
if ($isEventObject &&
255-
$parsedPayload[0] instanceof ShouldDispatchAfterCommit &&
256-
! is_null($transactions = $this->resolveTransactionManager())) {
254+
if ($isEventObject
255+
&& $parsedPayload[0] instanceof ShouldDispatchAfterCommit
256+
&& ! is_null($transactions = $this->resolveTransactionManager())) {
257257
$transactions->addCallback(
258258
fn () => $this->invokeListeners($parsedEvent, $parsedPayload, $halt)
259259
);
@@ -317,9 +317,9 @@ protected function parseEventAndPayload(mixed $event, mixed $payload): array
317317
*/
318318
protected function shouldBroadcast(array $payload): bool
319319
{
320-
return isset($payload[0]) &&
321-
$payload[0] instanceof ShouldBroadcast &&
322-
$this->broadcastWhen($payload[0]);
320+
return isset($payload[0])
321+
&& $payload[0] instanceof ShouldBroadcast
322+
&& $this->broadcastWhen($payload[0]);
323323
}
324324

325325
/**
@@ -516,9 +516,9 @@ protected function createQueuedHandlerCallable(string $class, string $method): C
516516
*/
517517
protected function handlerShouldBeDispatchedAfterDatabaseTransactions(mixed $listener): bool
518518
{
519-
return (($listener->afterCommit ?? null) ||
520-
$listener instanceof ShouldHandleEventsAfterCommit) &&
521-
$this->resolveTransactionManager();
519+
return (($listener->afterCommit ?? null)
520+
|| $listener instanceof ShouldHandleEventsAfterCommit)
521+
&& $this->resolveTransactionManager();
522522
}
523523

524524
/**
@@ -531,7 +531,7 @@ protected function createCallbackForListenerRunningAfterCommits(mixed $listener,
531531

532532
$this->resolveTransactionManager()->addCallback(
533533
function () use ($listener, $method, $payload) {
534-
$listener->$method(...$payload);
534+
$listener->{$method}(...$payload);
535535
}
536536
);
537537
};
@@ -600,7 +600,8 @@ protected function createListenerAndJob(string $class, string $method, array $ar
600600
$listener = (new ReflectionClass($class))->newInstanceWithoutConstructor();
601601

602602
return [$listener, $this->propagateListenerOptions(
603-
$listener, new CallQueuedListener($class, $method, $arguments)
603+
$listener,
604+
new CallQueuedListener($class, $method, $arguments)
604605
)];
605606
}
606607

@@ -627,7 +628,8 @@ protected function propagateListenerOptions(mixed $listener, CallQueuedListener
627628
$job->deleteWhenMissingModels = $listener->deleteWhenMissingModels ?? false;
628629
$job->tries = method_exists($listener, 'tries') ? $listener->tries(...$data) : ($listener->tries ?? null);
629630
$job->messageGroup = method_exists($listener, 'messageGroup') ? $listener->messageGroup(...$data) : ($listener->messageGroup ?? null);
630-
$job->withDeduplicator(method_exists($listener, 'deduplicator')
631+
$job->withDeduplicator(
632+
method_exists($listener, 'deduplicator')
631633
? $listener->deduplicator(...$data)
632634
: (method_exists($listener, 'deduplicationId') ? $listener->deduplicationId(...) : null)
633635
);
@@ -713,7 +715,7 @@ public function setTransactionManagerResolver(callable $resolver): static
713715
* @template TResult
714716
*
715717
* @param callable(): TResult $callback
716-
* @param string[]|null $events
718+
* @param null|string[] $events
717719
* @return TResult
718720
*/
719721
public function defer(callable $callback, ?array $events = null): mixed
@@ -731,7 +733,7 @@ public function defer(callable $callback, ?array $events = null): mixed
731733

732734
$this->deferringEvents = false;
733735

734-
/** @phpstan-ignore foreach.emptyArray (callback may add deferred events) */
736+
/* @phpstan-ignore foreach.emptyArray (callback may add deferred events) */
735737
foreach ($this->deferredEvents as $args) {
736738
$this->dispatch(...$args);
737739
}

src/events/src/NullDispatcher.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ public function __construct(DispatcherContract $dispatcher)
3030
*/
3131
public function dispatch(string|object $event, mixed $payload = [], bool $halt = false): void
3232
{
33-
//
3433
}
3534

3635
/**
3736
* Don't register an event and payload to be fired later.
3837
*/
3938
public function push(string $event, array $payload = []): void
4039
{
41-
//
4240
}
4341

4442
/**

src/queue/src/QueueRoutes.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class QueueRoutes
99
/**
1010
* The mapping of class names to their default routes.
1111
*
12-
* @var array<class-string, string|array{string|null, string|null}>
12+
* @var array<class-string, array{null|string, null|string}|string>
1313
*/
1414
protected array $routes = [];
1515

@@ -48,7 +48,7 @@ public function getQueue(object $queueable): ?string
4848
/**
4949
* Get the route for a given queueable instance.
5050
*
51-
* @return string|array{string|null, string|null}|null
51+
* @return null|array{null|string, null|string}|string
5252
*/
5353
public function getRoute(object $queueable): string|array|null
5454
{
@@ -75,7 +75,7 @@ class_uses_recursive($queueable)
7575
/**
7676
* Register the queue route for the given class.
7777
*
78-
* @param array<class-string, string|array{string|null, string|null}>|class-string $class
78+
* @param array<class-string, array{null|string, null|string}|string>|class-string $class
7979
*/
8080
public function set(array|string $class, ?string $queue = null, ?string $connection = null): void
8181
{
@@ -89,7 +89,7 @@ public function set(array|string $class, ?string $queue = null, ?string $connect
8989
/**
9090
* Get all registered queue routes.
9191
*
92-
* @return array<class-string, string|array{string|null, string|null}>
92+
* @return array<class-string, array{null|string, null|string}|string>
9393
*/
9494
public function all(): array
9595
{

tests/Integration/Database/Laravel/EloquentAggregateTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ public function testNumericAggregate()
9292
}
9393
}
9494

95+
/**
96+
* @internal
97+
* @coversNothing
98+
*/
9599
class UserAggregateTest extends Model
96100
{
97101
protected ?string $table = 'users';

0 commit comments

Comments
 (0)