Skip to content

Commit

Permalink
Add some return types and typed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSot committed Oct 21, 2022
1 parent c9c088a commit 1ab435e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Metable.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ public function setManyMeta(array $metaDictionary): void
/**
* Replace all associated `Meta` with the keys and values provided.
*
* @param array|Traversable $array
* @param iterable $array
*
* @return void
*/
public function syncMeta($array): void
public function syncMeta(iterable $array): void
{
$meta = [];

Expand Down Expand Up @@ -178,7 +178,7 @@ public function getMeta(string $key, $default = null)
* @param string $key
* @return boolean
*/
protected function hasDefaultMetaValue($key)
protected function hasDefaultMetaValue(string $key): bool
{
return property_exists($this, 'defaultMetaValues')
&& array_key_exists($key, $this->defaultMetaValues);
Expand All @@ -190,15 +190,15 @@ protected function hasDefaultMetaValue($key)
* @param string $key
* @return mixed
*/
protected function getDefaultMetaValue($key)
protected function getDefaultMetaValue(string $key)
{
return $this->defaultMetaValues[$key];
}

/**
* Retrieve all meta attached to the model as a key/value map.
*
* @return \Illuminate\Support\Collection
* @return \Illuminate\Support\Collection<int, mixed>
*/
public function getAllMeta(): \Illuminate\Support\Collection
{
Expand Down Expand Up @@ -467,7 +467,7 @@ public function scopeOrderByMetaNumeric(
*
* @return string
*/
private function joinMetaTable(Builder $q, string $key, $type = 'left'): string
private function joinMetaTable(Builder $q, string $key, string $type = 'left'): string
{
$relation = $this->meta();
$metaTable = $relation->getRelated()->getTable();
Expand Down Expand Up @@ -547,7 +547,7 @@ public function setRelations(array $relations)
/**
* Retrieve the FQCN of the class to use for Meta models.
*
* @return string
* @return class-string<Meta>
*/
protected function getMetaClassName(): string
{
Expand Down

0 comments on commit 1ab435e

Please sign in to comment.