Skip to content

Commit

Permalink
Correct return types (#39395)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ authored Feb 28, 2023
1 parent 6798f07 commit 98247b9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
4 changes: 3 additions & 1 deletion libraries/src/Application/ApplicationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static function stringURLSafe($string, $language = '')
* @param integer|string|null $id A client identifier
* @param boolean $byName If true, find the client by its name
*
* @return \stdClass|array|void Object describing the client, array containing all the clients or void if $id not known
* @return \stdClass|array|null Object describing the client, array containing all the clients or null if $id not known
*
* @since 1.5
*/
Expand Down Expand Up @@ -171,6 +171,8 @@ public static function getClientInfo($id = null, $byName = false)
}
}
}

return null;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion libraries/src/Application/CMSApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ protected function route()
* @param string $key The path of the state.
* @param mixed $value The value of the variable.
*
* @return mixed|void The previous state, if one existed.
* @return mixed The previous state, if one existed. Null otherwise.
*
* @since 3.2
*/
Expand All @@ -1111,6 +1111,8 @@ public function setUserState($key, $value)
if ($registry !== null) {
return $registry->set($key, $value);
}

return null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Application/CMSWebApplicationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function getUserStateFromRequest($key, $request, $default = null, $type =
* @param string $key The path of the state.
* @param mixed $value The value of the variable.
*
* @return mixed|void The previous state, if one existed. Void otherwise.
* @return mixed The previous state, if one existed. Null otherwise.
*
* @since 4.0.0
*/
Expand Down
4 changes: 2 additions & 2 deletions libraries/src/Document/HtmlDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,14 @@ public function setHeadData($data)
*
* @param array $data The document head data in array form
*
* @return HtmlDocument|void instance of $this to allow chaining or void for empty input data
* @return HtmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
public function mergeHeadData($data)
{
if (empty($data) || !\is_array($data)) {
return;
return $this;
}

$this->title = (isset($data['title']) && !empty($data['title']) && !stristr($this->title, $data['title']))
Expand Down
12 changes: 9 additions & 3 deletions libraries/src/Menu/AbstractMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function setDefault($id, $language = '*')
*
* @param string $language The language code, default value of * means all.
*
* @return MenuItem|void The item object or null when not found for given language
* @return MenuItem|null The item object or null when not found for given language
*
* @since 1.5
*/
Expand All @@ -206,14 +206,16 @@ public function getDefault($language = '*')
if (\array_key_exists('*', $this->default)) {
return $items[$this->default['*']];
}

return null;
}

/**
* Set the default item by id
*
* @param integer $id The item id
*
* @return MenuItem|void The menu item representing the given ID if present or null otherwise
* @return MenuItem|null The menu item representing the given ID if present or null otherwise
*
* @since 1.5
*/
Expand All @@ -224,12 +226,14 @@ public function setActive($id)

return $this->getMenu()[$id];
}

return null;
}

/**
* Get menu item by id.
*
* @return MenuItem|void The item object if an active menu item has been set or null
* @return MenuItem|null The item object if an active menu item has been set or null
*
* @since 1.5
*/
Expand All @@ -238,6 +242,8 @@ public function getActive()
if ($this->active) {
return $this->getMenu()[$this->active];
}

return null;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion libraries/src/Serializer/JoomlaSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getAttributes($post, array $fields = null)
* @param mixed $model The model of the entity being rendered
* @param string $name The name of the relationship to return
*
* @return \Tobscure\JsonApi\Relationship|void
* @return \Tobscure\JsonApi\Relationship|null
*
* @since 4.0.0
*/
Expand All @@ -111,5 +111,7 @@ public function getRelationship($model, $name)
if ($relationship instanceof Relationship) {
return $relationship;
}

return null;
}
}

0 comments on commit 98247b9

Please sign in to comment.