diff --git a/src/Model/AbstractModel.php b/src/Model/AbstractModel.php index 90aa79d1..39976be6 100644 --- a/src/Model/AbstractModel.php +++ b/src/Model/AbstractModel.php @@ -29,42 +29,34 @@ abstract class AbstractModel implements ModelInterface * model is queried, it will load its referenced * models together. * - * @var array + * @var string[] */ - public $with = []; + public array $with = []; /** * The $dynamic property tells if the object will accept additional fields * that are not specified in the $fillable or $guarded properties. * This is useful if you do not have a strict document format or * if you want to take full advantage of the "schemaless" nature of MongoDB. - * - * @var bool */ - protected $dynamic = true; + protected bool $dynamic = true; /** * Whether the model should manage the `created_at` and `updated_at` * timestamps automatically. - * - * @var bool */ - protected $timestamps = true; + protected bool $timestamps = true; /** * Name of the collection where this kind of Model is going to be saved or * retrieved from. - * - * @var string */ - protected $collection = null; + protected ?string $collection = null; /** * @see https://docs.mongodb.com/manual/reference/write-concern/ - * - * @var int */ - protected $writeConcern = 1; + protected int $writeConcern = 1; /** * Gets a cursor of this kind of entities that matches the query from the @@ -93,10 +85,8 @@ public static function all(): CursorInterface * @param mixed $query mongoDB selection criteria * @param array $projection fields to project in Mongo query * @param boolean $useCache retrieves the first through a CacheableCursor - * - * @return AbstractModel|null */ - public static function first($query = [], array $projection = [], bool $useCache = false) + public static function first(mixed $query = [], array $projection = [], bool $useCache = false): ?static { return self::getBuilderInstance()->first(new static(), $query, $projection, $useCache); } @@ -110,10 +100,8 @@ public static function first($query = [], array $projection = [], bool $useCache * @param boolean $useCache retrieves the first through a CacheableCursor * * @throws ModelNotFoundException If no document was found - * - * @return AbstractModel|null */ - public static function firstOrFail($query = [], array $projection = [], bool $useCache = false) + public static function firstOrFail(mixed $query = [], array $projection = [], bool $useCache = false): ?static { return self::getBuilderInstance()->firstOrFail(new static(), $query, $projection); } @@ -124,10 +112,8 @@ public static function firstOrFail($query = [], array $projection = [], bool $us * _if field filled. * * @param mixed $id document id - * - * @return AbstractModel|null */ - public static function firstOrNew($id) + public static function firstOrNew(mixed $id): ?static { if (!$model = self::first($id)) { $model = new static(); @@ -187,10 +173,8 @@ public function delete(): bool * Dynamically retrieve attributes on the model. * * @param string $key name of the attribute - * - * @return mixed */ - public function &__get(string $key) + public function &__get(string $key): mixed { return $this->getDocumentAttribute($key); } @@ -201,7 +185,7 @@ public function &__get(string $key) * @param string $key attribute name * @param mixed $value value to be set */ - public function __set(string $key, $value): void + public function __set(string $key, mixed $value): void { $this->setDocumentAttribute($key, $value); } diff --git a/src/Model/AttributesService.php b/src/Model/AttributesService.php index 6bfb9ee5..86b4e25e 100644 --- a/src/Model/AttributesService.php +++ b/src/Model/AttributesService.php @@ -11,51 +11,46 @@ class AttributesService * the attributes specified here will be changed * with the setDocumentAttribute method. * - * @var array + * @var string[] */ - protected $fillable = []; + protected array $fillable = []; /** * The attributes that are not mass assignable. The opposite * to the fillable array;. * - * @var array + * @var string[] */ - protected $guarded = []; + protected array $guarded = []; /** * Check if model should mutate attributes checking * the existence of a specific method on model * class. Default is false. - * - * @var bool */ - protected $mutable = false; + protected bool $mutable = false; /** * Store mutable attribute values to work with `&__get()`. * - * @var array + * @var string[] */ - protected $mutableCache = []; + protected array $mutableCache = []; /** * The model's attributes. * - * @var array + * @var array */ - private $attributes = []; + private array $attributes = []; /** * The model attribute's original state. * - * @var array + * @var array */ - private $originalAttributes = []; + private array $originalAttributes = []; - /** - * {@inheritdoc} - */ public static function fill( array $input, HasAttributesInterface $object = null, @@ -68,7 +63,7 @@ public static function fill( if ($object instanceof PolymorphableModelInterface) { $class = $object->polymorph(array_merge($object->getDocumentAttributes(), $input)); - if ($class !== get_class($object)) { + if ($class !== $object::class) { $originalAttributes = $object->getDocumentAttributes(); $object = new $class(); @@ -92,18 +87,12 @@ public static function fill( return $object; } - /** - * {@inheritdoc} - */ public function hasDocumentAttribute(string $key): bool { return !is_null($this->getDocumentAttribute($key)); } - /** - * {@inheritdoc} - */ - public function &getDocumentAttribute(string $key) + public function &getDocumentAttribute(string $key): mixed { if ($this->mutable && $this->hasMutatorMethod($key, 'get')) { $this->mutableCache[$key] = $this->{$this->buildMutatorMethod($key, 'get')}(); @@ -124,9 +113,6 @@ public function &getDocumentAttribute(string $key) return $this->attributes[$key]; } - /** - * {@inheritdoc} - */ public function getDocumentAttributes(): array { foreach ($this->attributes as $field => $value) { @@ -138,10 +124,7 @@ public function getDocumentAttributes(): array return $this->attributes ?? []; } - /** - * {@inheritdoc} - */ - public function cleanDocumentAttribute(string $key) + public function cleanDocumentAttribute(string $key): void { unset($this->attributes[$key]); @@ -150,10 +133,7 @@ public function cleanDocumentAttribute(string $key) } } - /** - * {@inheritdoc} - */ - public function setDocumentAttribute(string $key, $value) + public function setDocumentAttribute(string $key, mixed $value): void { if ($this->mutable && $this->hasMutatorMethod($key, 'set')) { $value = $this->{$this->buildMutatorMethod($key, 'set')}($value); @@ -172,29 +152,20 @@ public function setDocumentAttribute(string $key, $value) } } - /** - * {@inheritdoc} - */ - public function syncOriginalDocumentAttributes() + public function syncOriginalDocumentAttributes(): void { try { $this->originalAttributes = unserialize(serialize($this->getDocumentAttributes())); - } catch (Exception $e) { + } catch (Exception) { $this->originalAttributes = $this->getDocumentAttributes(); } } - /** - * {@inheritdoc} - */ public function getOriginalDocumentAttributes(): array { return $this->originalAttributes; } - /** - * {@inheritdoc} - */ public function toArray(): array { return $this->getDocumentAttributes(); @@ -206,7 +177,7 @@ public function toArray(): array * @param string $key attribute name * @param string $prefix method prefix to be used (get, set) */ - protected function hasMutatorMethod(string $key, $prefix): bool + protected function hasMutatorMethod(string $key, string $prefix): bool { $method = $this->buildMutatorMethod($key, $prefix); diff --git a/src/Model/DocumentEmbedder.php b/src/Model/DocumentEmbedder.php index 0835f1b5..53d9fa0b 100644 --- a/src/Model/DocumentEmbedder.php +++ b/src/Model/DocumentEmbedder.php @@ -20,7 +20,7 @@ class DocumentEmbedder * * @return bool Success */ - public function embed($parent, string $field, &$entity): bool + public function embed(mixed $parent, string $field, mixed &$entity): bool { // In order to update the document if it exists inside the $parent $this->unembed($parent, $field, $entity); @@ -39,10 +39,8 @@ public function embed($parent, string $field, &$entity): bool * @param mixed $parent the object where the $entity will be removed * @param string $field name of the field of the object where the document is * @param mixed $entity entity that will be removed from $parent - * - * @return bool Success */ - public function unembed($parent, string $field, &$entity): bool + public function unembed(mixed $parent, string $field, mixed &$entity): bool { $fieldValue = (array) $parent->$field; $id = $this->getId($entity); @@ -61,21 +59,19 @@ public function unembed($parent, string $field, &$entity): bool /** * Attach a new _id reference into $field of $parent. * - * @param mixed $parent the object where $entity will be referenced - * @param string $field the field where the _id reference of $entity will be stored - * @param object|array $entity the object that is being attached + * @param mixed $parent the object where $entity will be referenced + * @param string $field the field where the _id reference of $entity will be stored + * @param mixed $entity the object that is being attached * * @return bool Success */ - public function attach($parent, string $field, &$entity): bool + public function attach(mixed $parent, string $field, mixed &$entity): bool { $fieldValue = (array) $parent->$field; $newId = $this->getId($entity); - foreach ($fieldValue as $id) { - if ($id == $newId) { - return true; - } + if (in_array($newId, $fieldValue)) { + return true; } $fieldValue[] = $newId; @@ -93,7 +89,7 @@ public function attach($parent, string $field, &$entity): bool * * @return bool Success */ - public function detach($parent, string $field, &$entity): bool + public function detach(mixed $parent, string $field, mixed &$entity): bool { $fieldValue = (array) $parent->$field; $newId = $this->getId($entity); @@ -114,10 +110,8 @@ public function detach($parent, string $field, &$entity): bool * _id will be generated and set on the object (while still returning it). * * @param mixed $object the object|array that the _id will be retrieved from - * - * @return ObjectId|mixed */ - protected function getId(&$object) + protected function getId(mixed &$object): mixed { if (is_array($object)) { if (isset($object['_id']) && $object['_id']) { diff --git a/src/Model/Exception/ModelNotFoundException.php b/src/Model/Exception/ModelNotFoundException.php index f51e8282..0dfe873e 100644 --- a/src/Model/Exception/ModelNotFoundException.php +++ b/src/Model/Exception/ModelNotFoundException.php @@ -17,19 +17,15 @@ class ModelNotFoundException extends RuntimeException /** * Name of the affected Mongolid model. - * - * @var string */ - protected $model; + protected string $model; /** * Set the affected Mongolid model. * * @param string $model name of the model - * - * @return $this */ - public function setModel(string $model) + public function setModel(string $model): self { $this->model = $model; @@ -40,10 +36,8 @@ public function setModel(string $model) /** * Get the affected Mongolid model. - * - * @return string */ - public function getModel() + public function getModel(): string { return $this->model; } diff --git a/src/Model/HasAttributesInterface.php b/src/Model/HasAttributesInterface.php index d7bdedda..6411b6a5 100644 --- a/src/Model/HasAttributesInterface.php +++ b/src/Model/HasAttributesInterface.php @@ -22,10 +22,8 @@ public function hasDocumentAttribute(string $key): bool; * Get an attribute from the model. * * @param string $key the attribute to be accessed - * - * @return mixed */ - public function getDocumentAttribute(string $key); + public function getDocumentAttribute(string $key): mixed; /** * Get all attributes from the model. @@ -37,7 +35,7 @@ public function getDocumentAttributes(): array; * * @param string $key name of the attribute to be unset */ - public function cleanDocumentAttribute(string $key); + public function cleanDocumentAttribute(string $key): void; /** * Set a given attribute on the model. @@ -45,7 +43,7 @@ public function cleanDocumentAttribute(string $key); * @param string $key name of the attribute to be set * @param mixed $value value to be set */ - public function setDocumentAttribute(string $key, $value); + public function setDocumentAttribute(string $key, mixed $value): void; /** * Stores original attributes from actual data from attributes @@ -54,7 +52,7 @@ public function setDocumentAttribute(string $key, $value); * Ideally should be called once right after retrieving data from * the database. */ - public function syncOriginalDocumentAttributes(); + public function syncOriginalDocumentAttributes(): void; /** * Retrieve original attributes. diff --git a/src/Model/HasAttributesTrait.php b/src/Model/HasAttributesTrait.php index f4c57a7e..1ff0c7e1 100644 --- a/src/Model/HasAttributesTrait.php +++ b/src/Model/HasAttributesTrait.php @@ -23,47 +23,45 @@ trait HasAttributesTrait * the attributes specified here will be changed * with the setDocumentAttribute method. * - * @var array + * @var string[] */ - protected $fillable = []; + protected array $fillable = []; /** * The attributes that are not mass assignable. The opposite * to the fillable array;. * - * @var array + * @var string[] */ - protected $guarded = []; + protected array $guarded = []; /** * Check if model should mutate attributes checking * the existence of a specific method on model * class. Default is false. - * - * @var bool */ - protected $mutable = false; + protected bool $mutable = false; /** * Store mutable attribute values to work with `&__get()`. * - * @var array + * @var string[] */ - protected $mutableCache = []; + protected array $mutableCache = []; /** * The model's attributes. * - * @var array + * @var array */ - private $attributes = []; + private array $attributes = []; /** * The model attribute's original state. * - * @var array + * @var array */ - private $originalAttributes = []; + private array $originalAttributes = []; /** * {@inheritdoc} @@ -80,7 +78,7 @@ public static function fill( if ($object instanceof PolymorphableModelInterface) { $class = $object->polymorph(array_merge($object->getDocumentAttributes(), $input)); - if ($class !== get_class($object)) { + if ($class !== $object::class) { $originalAttributes = $object->getDocumentAttributes(); $object = new $class(); @@ -115,7 +113,7 @@ public function hasDocumentAttribute(string $key): bool /** * {@inheritdoc} */ - public function &getDocumentAttribute(string $key) + public function &getDocumentAttribute(string $key): mixed { if ($this->mutable && $this->hasMutatorMethod($key, 'get')) { $this->mutableCache[$key] = $this->{$this->buildMutatorMethod($key, 'get')}(); @@ -153,7 +151,7 @@ public function getDocumentAttributes(): array /** * {@inheritdoc} */ - public function cleanDocumentAttribute(string $key) + public function cleanDocumentAttribute(string $key): void { unset($this->attributes[$key]); @@ -165,7 +163,7 @@ public function cleanDocumentAttribute(string $key) /** * {@inheritdoc} */ - public function setDocumentAttribute(string $key, $value) + public function setDocumentAttribute(string $key, mixed $value): void { if ($this->mutable && $this->hasMutatorMethod($key, 'set')) { $value = $this->{$this->buildMutatorMethod($key, 'set')}($value); @@ -187,11 +185,11 @@ public function setDocumentAttribute(string $key, $value) /** * {@inheritdoc} */ - public function syncOriginalDocumentAttributes() + public function syncOriginalDocumentAttributes(): void { try { $this->originalAttributes = unserialize(serialize($this->getDocumentAttributes())); - } catch (Exception $e) { + } catch (Exception) { $this->originalAttributes = $this->getDocumentAttributes(); } } @@ -218,7 +216,7 @@ public function toArray(): array * @param string $key attribute name * @param string $prefix method prefix to be used (get, set) */ - protected function hasMutatorMethod(string $key, $prefix): bool + protected function hasMutatorMethod(string $key, string $prefix): bool { $method = $this->buildMutatorMethod($key, $prefix); diff --git a/src/Model/HasLegacyAttributesTrait.php b/src/Model/HasLegacyAttributesTrait.php index 1496f66a..b777412e 100644 --- a/src/Model/HasLegacyAttributesTrait.php +++ b/src/Model/HasLegacyAttributesTrait.php @@ -16,67 +16,64 @@ trait HasLegacyAttributesTrait /** * The model's attributes. * - * @var array + * @var array */ - protected $attributes = []; + protected array $attributes = []; /** * The model attribute's original state. * - * @var array + * @var array */ - protected $original = []; + protected array $original = []; /** * Once you put at least one string in this array, only * the attributes specified here will be changed * with the setAttributes method. * - * @var array + * @var string[] */ - protected $fillable = []; + protected array $fillable = []; /** * The attributes that are not mass assignable. The opposite * to the fillable array;. * - * @var array + * @var string[] */ - protected $guarded = []; + protected array $guarded = []; /** * Check if model should mutate attributes checking * the existence of a specific method on model * class. Default is false. - * - * @var bool */ - public $mutable = false; + public bool $mutable = false; /** * Get an attribute from the model. * * @param string $key the attribute to be accessed - * - * @return mixed */ - public function getAttribute(string $key) + public function getAttribute(string $key): mixed { $inAttributes = array_key_exists($key, $this->attributes); - if ($inAttributes) { return $this->attributes[$key]; - } elseif ('attributes' == $key) { + } + + if ('attributes' == $key) { return $this->attributes; } + + return null; } /** * Get all attributes from the model. - * - * @return mixed */ - public function getAttributes() + public function getAttributes(): array { return $this->attributes; } @@ -109,7 +106,7 @@ public function fill(array $input, bool $force = false): HasAttributesInterface * * @param string $key name of the attribute to be unset */ - public function cleanAttribute(string $key) + public function cleanAttribute(string $key): void { unset($this->attributes[$key]); } @@ -120,7 +117,7 @@ public function cleanAttribute(string $key) * @param string $key name of the attribute to be set * @param mixed $value value to be set */ - public function setAttribute(string $key, $value) + public function setAttribute(string $key, mixed $value): void { $this->attributes[$key] = $value; } @@ -128,7 +125,7 @@ public function setAttribute(string $key, $value) /** * Get original attributes. */ - public function originalAttributes() + public function originalAttributes(): array { return $this->original; } @@ -140,7 +137,7 @@ public function originalAttributes() * Ideally should be called once right after retrieving data from * the database. */ - public function syncOriginalAttributes() + public function syncOriginalAttributes(): void { $this->original = $this->attributes; } @@ -150,10 +147,8 @@ public function syncOriginalAttributes() * * @param mixed $key attribute name * @param mixed $prefix method prefix to be used - * - * @return bool */ - protected function hasMutatorMethod($key, $prefix) + protected function hasMutatorMethod(string $key, mixed $prefix): bool { $method = $this->buildMutatorMethod($key, $prefix); @@ -165,20 +160,16 @@ protected function hasMutatorMethod($key, $prefix) * * @param mixed $key attribute name * @param mixed $prefix method prefix to be used - * - * @return string */ - protected function buildMutatorMethod($key, $prefix) + protected function buildMutatorMethod(string $key, mixed $prefix): string { return $prefix.ucfirst($key).'Attribute'; } /** * Returns the model instance as an Array. - * - * @return array */ - public function toArray() + public function toArray(): array { return $this->getAttributes(); } @@ -187,10 +178,8 @@ public function toArray() * Dynamically retrieve attributes on the model. * * @param mixed $key name of the attribute - * - * @return mixed */ - public function __get($key) + public function __get(string $key): mixed { if ($this->mutable && $this->hasMutatorMethod($key, 'get')) { return $this->{$this->buildMutatorMethod($key, 'get')}(); @@ -205,7 +194,7 @@ public function __get($key) * @param mixed $key attribute name * @param mixed $value value to be set */ - public function __set($key, $value) + public function __set(string $key, mixed $value): void { if ($this->mutable && $this->hasMutatorMethod($key, 'set')) { $value = $this->{$this->buildMutatorMethod($key, 'set')}($value); @@ -218,10 +207,8 @@ public function __set($key, $value) * Determine if an attribute exists on the model. * * @param mixed $key attribute name - * - * @return bool */ - public function __isset($key) + public function __isset(mixed $key): bool { return !is_null($this->{$key}); } @@ -231,7 +218,7 @@ public function __isset($key) * * @param mixed $key attribute name */ - public function __unset($key) + public function __unset(string $key): void { unset($this->attributes[$key]); } @@ -247,7 +234,7 @@ public function hasDocumentAttribute(string $key): bool return $this->hasAttribute($key); } - public function getDocumentAttribute(string $key) + public function getDocumentAttribute(string $key): mixed { return $this->getAttribute($key); } @@ -266,12 +253,12 @@ public function cleanDocumentAttribute(string $key): void } } - public function setDocumentAttribute(string $key, $value): void + public function setDocumentAttribute(string $key, mixed $value): void { $this->setAttribute($key, $value); } - public function syncOriginalDocumentAttributes() + public function syncOriginalDocumentAttributes(): void { $this->syncOriginalAttributes(); } diff --git a/src/Model/Relations/AbstractRelation.php b/src/Model/Relations/AbstractRelation.php index a6379990..aae0dc3a 100644 --- a/src/Model/Relations/AbstractRelation.php +++ b/src/Model/Relations/AbstractRelation.php @@ -6,58 +6,31 @@ abstract class AbstractRelation implements RelationInterface { - /** - * @var ModelInterface - */ - protected $parent; - - /** - * @var string - */ - protected $model; - - /** - * @var string - */ - protected $field; - - /** - * @var bool - */ - protected $pristine = false; + protected bool $pristine = false; /** * Cached results. - * - * @var mixed */ - protected $results; + protected mixed $results; - /** - * @var string - */ - protected $key = '_id'; + protected string $key = '_id'; - public function __construct(ModelInterface $parent, string $model, string $field) - { - $this->parent = $parent; - $this->model = $model; - $this->field = $field; + public function __construct( + protected ModelInterface $parent, + protected string $model, + protected string $field + ) { } /** * Retrieve Relation Results. - * - * @return mixed */ - abstract public function get(); + abstract public function get(): mixed; /** * Retrieve cached Relation Results. - * - * @return mixed */ - public function &getResults() + public function &getResults(): mixed { if (!$this->pristine()) { $this->results = $this->get(); @@ -77,10 +50,8 @@ protected function pristine(): bool * a new key will be generated and set on the model (while still returning it). * * @param ModelInterface $model the object that the key will be retrieved from - * - * @return ObjectId|mixed */ - protected function getKey(ModelInterface $model) + protected function getKey(ModelInterface $model): mixed { if (!$model->{$this->key}) { $model->{$this->key} = new ObjectId(); diff --git a/src/Model/Relations/EmbedsMany.php b/src/Model/Relations/EmbedsMany.php index fdfe015a..b083d011 100644 --- a/src/Model/Relations/EmbedsMany.php +++ b/src/Model/Relations/EmbedsMany.php @@ -34,8 +34,6 @@ public function addMany(array $entities): void /** * Replace embedded documents. - * - * @param array $entities */ public function replace(array $entities): void { @@ -69,10 +67,7 @@ public function removeAll(): void $this->pristine = false; } - /** - * @return EmbeddedCursor - */ - public function get() + public function get(): EmbeddedCursor { $items = $this->parent->{$this->field} ?? []; diff --git a/src/Model/Relations/EmbedsOne.php b/src/Model/Relations/EmbedsOne.php index 1a18d864..ce6831f7 100644 --- a/src/Model/Relations/EmbedsOne.php +++ b/src/Model/Relations/EmbedsOne.php @@ -17,10 +17,7 @@ public function remove(): void $this->pristine = false; } - /** - * @return ModelInterface|null - */ - public function get() + public function get(): ?ModelInterface { return $this->parent->{$this->field}; } diff --git a/src/Model/Relations/ReferencesMany.php b/src/Model/Relations/ReferencesMany.php index 12247b02..7919980c 100644 --- a/src/Model/Relations/ReferencesMany.php +++ b/src/Model/Relations/ReferencesMany.php @@ -3,15 +3,13 @@ use MongoDB\BSON\ObjectId; use Mongolid\Container\Container; +use Mongolid\Cursor\CursorInterface; use Mongolid\Model\ModelInterface; use Mongolid\Util\ObjectIdUtils; class ReferencesMany extends AbstractRelation { - /** - * @var ModelInterface - */ - protected $modelInstance; + protected ModelInterface $modelInstance; public function __construct(ModelInterface $parent, string $model, string $field, string $key) { @@ -29,10 +27,8 @@ public function attach(ModelInterface $model): void $referencedKey = $this->getKey($model); $fieldValue = (array) $this->parent->{$this->field}; - foreach ($fieldValue as $key) { - if ($key == $referencedKey) { - return; - } + if (in_array($referencedKey, $fieldValue)) { + return; } $fieldValue[] = $referencedKey; @@ -89,7 +85,7 @@ public function detachAll(): void $this->pristine = false; } - public function get() + public function get(): CursorInterface { $referencedKeys = (array) $this->parent->{$this->field}; diff --git a/src/Model/Relations/ReferencesOne.php b/src/Model/Relations/ReferencesOne.php index 2fb017ee..f689d889 100644 --- a/src/Model/Relations/ReferencesOne.php +++ b/src/Model/Relations/ReferencesOne.php @@ -8,10 +8,7 @@ class ReferencesOne extends AbstractRelation { - /** - * @var ModelInterface - */ - protected $modelInstance; + protected ModelInterface $modelInstance; public function __construct(ModelInterface $parent, string $model, string $field, string $key) { @@ -32,7 +29,7 @@ public function detach(): void $this->pristine = false; } - public function get() + public function get(): ?ModelInterface { if (!$referencedKey = $this->parent->{$this->field}) { return null; diff --git a/src/Model/Relations/RelationInterface.php b/src/Model/Relations/RelationInterface.php index 425e3ea9..789b1621 100644 --- a/src/Model/Relations/RelationInterface.php +++ b/src/Model/Relations/RelationInterface.php @@ -5,8 +5,6 @@ interface RelationInterface { /** * Get the results of the relation. - * - * @return mixed */ - public function getResults(); + public function getResults(): mixed; }