1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-11-16 16:30:09 +00:00

Add proper types to CommandCache

This commit is contained in:
Tim Düsterhus 2022-03-04 18:47:19 +01:00
parent fb2df33fc7
commit 4d6260a079
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF

View File

@ -56,11 +56,8 @@ protected function init()
/** /**
* Returns a specific command. * Returns a specific command.
*
* @param integer $commandID
* @return Command
*/ */
public function getCommand($commandID) public function getCommand(int $commandID): ?Command
{ {
if (isset($this->commands[$commandID])) { if (isset($this->commands[$commandID])) {
return $this->commands[$commandID]; return $this->commands[$commandID];
@ -71,11 +68,8 @@ public function getCommand($commandID)
/** /**
* Returns a specific command defined by a trigger. * Returns a specific command defined by a trigger.
*
* @param string $trigger
* @return Command
*/ */
public function getCommandByTrigger($trigger) public function getCommandByTrigger(string $trigger): ?Command
{ {
if (isset($this->triggers[$trigger])) { if (isset($this->triggers[$trigger])) {
return $this->commands[$this->triggers[$trigger]]; return $this->commands[$this->triggers[$trigger]];
@ -86,11 +80,8 @@ public function getCommandByTrigger($trigger)
/** /**
* Returns the command defined by the given package and identifier. * Returns the command defined by the given package and identifier.
*
* @param string $identifier
* @return Command
*/ */
public function getCommandByPackageAndIdentifier(Package $package, $identifier) public function getCommandByPackageAndIdentifier(Package $package, string $identifier): ?Command
{ {
if (isset($this->packages[$package->packageID][$identifier])) { if (isset($this->packages[$package->packageID][$identifier])) {
return $this->packages[$package->packageID][$identifier]; return $this->packages[$package->packageID][$identifier];