Skip to content

Commit

Permalink
Fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Rainville committed Nov 13, 2024
1 parent de9b9e9 commit 017bd8b
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Event/DataObjectEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function getObject(bool $useVersion = false): ?DataObject
}

if (!$useVersion || empty($this->version)) {
/** @var T|null $object*/
/** @var T|null $object */
$object = DataObject::get($this->objectClass)->byID($this->objectID);
return $object;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Extension/EventDispatchExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Extension that adds event dispatching capabilities to DataObjects.
*
* @phpstan-template T of DataObject
*
* @phpstan-extends Extension<T>
*/
class EventDispatchExtension extends Extension
Expand Down Expand Up @@ -144,6 +145,7 @@ public function onAfterRestore(): void
* Dispatches an event using the EventService
*
* @phpstan-param DataObjectEvent<T> $event
*
* @phpstan-return Future<DataObjectEvent<T>>
*/
protected function dispatchEvent(DataObjectEvent $event): Future
Expand Down
2 changes: 1 addition & 1 deletion src/Listener/DataObjectEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DataObjectEventListener
*
* @param Closure(DataObjectEvent<T>): void $callback Callback to execute when an event matches
* @param class-string<T>[] $classes Array of DataObject class names to listen for
* @param Operation[] $operations Array of operations to listen for. If null, listens for all operations.
* @param Operation[] $operations Array of operations to listen for. If null, listens for all operations.
*/
public function __construct(
private readonly Closure $callback,
Expand Down
4 changes: 3 additions & 1 deletion src/Service/EventService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class EventService

/**
* @config
*
* @var array<string,array<callable>> Map of event class names to arrays of listener callbacks
*/
private static array $listeners = [];
Expand Down Expand Up @@ -81,7 +82,8 @@ private function loadListeners(): void
* Adds a listener to the event service
*
* @template T of object
* @param class-string<T> $event The event class name
*
* @param class-string<T> $event The event class name
* @param callable(T): void $listener The listener callback
*/
public function addListener(string $event, callable $listener): void
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Extension/EventDispatchExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use ArchiPro\Silverstripe\EventDispatcher\Tests\Mock\VersionedDataObject;
use Revolt\EventLoop;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\DataObject;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\ORM\DataObject;

class EventDispatchExtensionTest extends SapphireTest
{
Expand Down
3 changes: 1 addition & 2 deletions tests/php/Mock/SimpleDataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
namespace ArchiPro\Silverstripe\EventDispatcher\Tests\Mock;

use ArchiPro\Silverstripe\EventDispatcher\Extension\EventDispatchExtension;
use SilverStripe\Core\Extension;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Core\Extension;

/**
* @property string $Title
*/
class SimpleDataObject extends DataObject implements TestOnly
{

private static string $table_name = 'EventDispatcher_SimpleDataObject';

/** @var array<string, string> */
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Mock/VersionedDataObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace ArchiPro\Silverstripe\EventDispatcher\Tests\Mock;

use ArchiPro\Silverstripe\EventDispatcher\Extension\EventDispatchExtension;
use SilverStripe\Core\Extension;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\Core\Extension;
use SilverStripe\Versioned\Versioned;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/TestListenerLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* This test loader will listen for the event provided in the constructor
* and set the eventFired property to true when the event is fired.
*
*
* @template T of object
*/
class TestListenerLoader implements ListenerLoaderInterface
Expand Down

0 comments on commit 017bd8b

Please sign in to comment.