diff --git a/composer.json b/composer.json index 55d8c20..a90d48a 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,9 @@ "email": "alex@standiford.us" } ], + "require": { + "phpnomad/event": "^1.0" + }, "require-dev": { "doctrine/instantiator": "^1.5", "myclabs/deep-copy": ">=1.13.4 <1.14", diff --git a/composer.lock b/composer.lock index a6153fe..5075bdb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,49 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0fa283ca307757d17b39502f6c4e6736", - "packages": [], + "content-hash": "6638e777210e2a06a5c0d87ec74fd210", + "packages": [ + { + "name": "phpnomad/event", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpnomad/event.git", + "reference": "b418d8fc90af18b7cb37e118795f9dd92ffeb538" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpnomad/event/zipball/b418d8fc90af18b7cb37e118795f9dd92ffeb538", + "reference": "b418d8fc90af18b7cb37e118795f9dd92ffeb538", + "shasum": "" + }, + "require-dev": { + "phpnomad/tests": "^0.1.0 || ^0.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPNomad\\Events\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alex Standiford", + "email": "alex@standiford.us" + } + ], + "homepage": "https://github.com/phpnomad/core", + "support": { + "issues": "https://github.com/phpnomad/event/issues", + "source": "https://github.com/phpnomad/event/tree/1.0.1" + }, + "time": "2026-06-12T10:56:48+00:00" + } + ], "packages-dev": [ { "name": "clue/ndjson-react", diff --git a/lib/Events/ModelsMerged.php b/lib/Events/ModelsMerged.php index 252108c..27b67d3 100644 --- a/lib/Events/ModelsMerged.php +++ b/lib/Events/ModelsMerged.php @@ -10,14 +10,19 @@ */ class ModelsMerged implements Event { + /** @var T */ protected DataModel $mergedModel; + + /** @var array */ protected array $removedModels; + + /** @var T */ protected DataModel $originalModel; /** * @param T $mergedModel * @param T $originalModel - * @param T[] $removedModels + * @param array $removedModels */ public function __construct(DataModel $mergedModel, DataModel $originalModel, array $removedModels) { @@ -35,7 +40,7 @@ public function getOriginalModel(): DataModel } /** - * @return T[] + * @return array */ public function getRemovedModels(): array { @@ -54,4 +59,4 @@ public static function getId(): string { return 'datastore_models_merged'; } -} \ No newline at end of file +} diff --git a/lib/Events/RecordDeleted.php b/lib/Events/RecordDeleted.php index 8c3ba49..8e52e12 100644 --- a/lib/Events/RecordDeleted.php +++ b/lib/Events/RecordDeleted.php @@ -8,11 +8,13 @@ class RecordDeleted implements Event { protected string $type; + + /** @var array */ protected array $identity; /** * @param class-string|string $type - * @param array $identity + * @param array $identity */ public function __construct(string $type, array $identity) { @@ -23,7 +25,7 @@ public function __construct(string $type, array $identity) /** * Gets the identity for the record that was deleted. * - * @return array + * @return array */ public function getIdentity(): array { @@ -44,4 +46,4 @@ public static function getId(): string { return 'record_deleted'; } -} \ No newline at end of file +} diff --git a/lib/Events/RecordUpdated.php b/lib/Events/RecordUpdated.php index bc3df74..e1ca226 100644 --- a/lib/Events/RecordUpdated.php +++ b/lib/Events/RecordUpdated.php @@ -6,10 +6,17 @@ class RecordUpdated implements Event { + /** @var array */ protected array $data; + + /** @var array */ protected array $identity; protected string $type; + /** + * @param array $identity + * @param array $data + */ public function __construct(string $type, array $identity, array $data) { $this->identity = $identity; @@ -20,7 +27,7 @@ public function __construct(string $type, array $identity, array $data) /** * Gets the data used to store the record in the database. * - * @return array + * @return array */ public function getData() : array { @@ -30,7 +37,7 @@ public function getData() : array /** * Gets the identity for the record that was updated. * - * @return array + * @return array */ public function getIdentity() : array { @@ -51,4 +58,4 @@ public static function getId() : string { return 'record_updated'; } -} \ No newline at end of file +} diff --git a/lib/Factories/IdentityToWhere.php b/lib/Factories/IdentityToWhere.php index f45d993..ba75fde 100644 --- a/lib/Factories/IdentityToWhere.php +++ b/lib/Factories/IdentityToWhere.php @@ -4,8 +4,10 @@ class IdentityToWhere { + /** @var array */ protected array $identity; + /** @param array $identity */ public function __construct(array $identity) { $this->identity = $identity; @@ -14,7 +16,7 @@ public function __construct(array $identity) /** * Returns the where statement for a given identity. * - * @return array + * @return array