From cd8dbbec1319156e8cace7d1a5669b36ae6dd85a Mon Sep 17 00:00:00 2001 From: emreakay Date: Fri, 23 Feb 2024 18:45:01 +0000 Subject: [PATCH] Fix styling --- src/Collections/ConnectiveCollection.php | 2 +- src/Contracts/ConnectiveContract.php | 4 ++-- src/Models/Connection.php | 8 ++++---- src/Traits/Connective.php | 8 ++++---- tests/Models/OtherConnective.php | 1 - tests/PackageTest.php | 3 --- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/Collections/ConnectiveCollection.php b/src/Collections/ConnectiveCollection.php index 3499b1a..92f9d2c 100644 --- a/src/Collections/ConnectiveCollection.php +++ b/src/Collections/ConnectiveCollection.php @@ -11,7 +11,7 @@ class ConnectiveCollection extends Collection /** * @return ?ConnectiveCollection */ - public function connectives(string|array $connectionTypes = null, string|array $modelTypes = null): ?ConnectiveCollection + public function connectives(string|array|null $connectionTypes = null, string|array|null $modelTypes = null): ?ConnectiveCollection { /** * @var ConnectiveCollection $collection; diff --git a/src/Contracts/ConnectiveContract.php b/src/Contracts/ConnectiveContract.php index 4d5c1bb..0c98ac6 100644 --- a/src/Contracts/ConnectiveContract.php +++ b/src/Contracts/ConnectiveContract.php @@ -32,7 +32,7 @@ public function connectTo(ConnectiveContract&Model $model, string $connectionTyp * @param string|array $modelTypes * @return Collection|null */ - public function connections(string|array $connectionTypes = null, string|array $modelTypes = null): ?Collection; + public function connections(string|array|null $connectionTypes = null, string|array|null $modelTypes = null): ?Collection; /** * returns connected model instances (connective models) as a collection @@ -48,7 +48,7 @@ public function connectives(string|array $connectionTypes, string|array $modelTy * @param string|array $modelTypes * @return Collection|null */ - public function inverseConnections(string|array $connectionTypes = null, string|array $modelTypes = null): ?Collection; + public function inverseConnections(string|array|null $connectionTypes = null, string|array|null $modelTypes = null): ?Collection; /** * returns connected model instances (connective models) as a collection diff --git a/src/Models/Connection.php b/src/Models/Connection.php index 0c64346..3623fd6 100644 --- a/src/Models/Connection.php +++ b/src/Models/Connection.php @@ -6,10 +6,10 @@ use Illuminate\Database\Eloquent\Model; /** - * @property class-string $to_model_type - * @property int $to_model_id - * @property class-string $from_model_type - * @property int $from_model_id + * @property class-string $to_model_type + * @property int $to_model_id + * @property class-string $from_model_type + * @property int $from_model_id */ class Connection extends Model { diff --git a/src/Traits/Connective.php b/src/Traits/Connective.php index 72d52c8..a7f17b7 100644 --- a/src/Traits/Connective.php +++ b/src/Traits/Connective.php @@ -54,7 +54,7 @@ public function connectTo(ConnectiveContract&Model $model, string $connectionTyp * @param string|array $modelTypes * @return Collection|null */ - public function connections(string|array $connectionTypes = null, string|array $modelTypes = null): ?Collection + public function connections(string|array|null $connectionTypes = null, string|array|null $modelTypes = null): ?Collection { $query = Connection::query(); @@ -77,7 +77,7 @@ public function connections(string|array $connectionTypes = null, string|array $ /** * @return ConnectiveCollection|null */ - public function connectives(string|array $connectionTypes = null, string|array $modelTypes = null): ?ConnectiveCollection + public function connectives(string|array|null $connectionTypes = null, string|array|null $modelTypes = null): ?ConnectiveCollection { $connections = $this->connections($connectionTypes, $modelTypes); $collection = ConnectiveCollection::make(); @@ -99,7 +99,7 @@ public function connectives(string|array $connectionTypes = null, string|array $ * @param string|array $modelTypes * @return Collection|null */ - public function inverseConnections(string|array $connectionTypes = null, string|array $modelTypes = null): ?Collection + public function inverseConnections(string|array|null $connectionTypes = null, string|array|null $modelTypes = null): ?Collection { $query = Connection::query(); @@ -122,7 +122,7 @@ public function inverseConnections(string|array $connectionTypes = null, string| /** * @return ConnectiveCollection|null */ - public function inverseConnectives(string|array $connectionTypes = null, string|array $modelTypes = null): ?ConnectiveCollection + public function inverseConnectives(string|array|null $connectionTypes = null, string|array|null $modelTypes = null): ?ConnectiveCollection { $incomingConnections = $this->inverseConnections($connectionTypes, $modelTypes); $collection = ConnectiveCollection::make(); diff --git a/tests/Models/OtherConnective.php b/tests/Models/OtherConnective.php index 7e1f9fc..0217888 100644 --- a/tests/Models/OtherConnective.php +++ b/tests/Models/OtherConnective.php @@ -5,7 +5,6 @@ use AuroraWebSoftware\Connective\Contracts\ConnectiveContract; use Illuminate\Database\Eloquent\Model; - /** * @property string $name */ diff --git a/tests/PackageTest.php b/tests/PackageTest.php index dae03e7..7dd0290 100644 --- a/tests/PackageTest.php +++ b/tests/PackageTest.php @@ -471,7 +471,6 @@ ->toHaveCount(1) ->each->toBeInstanceOf(ConnectiveContract::class); - expect($connective3->inverseConnectives(connectionTypes: 'a')) ->toHaveCount(1) ->each->toBeInstanceOf(ConnectiveContract::class); @@ -496,6 +495,4 @@ ->toHaveCount(1); }); - - // connected to ve coonetedfrom testleri