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
1 changed files with 3 additions and 12 deletions

View File

@ -56,11 +56,8 @@ class CommandCache extends SingletonFactory
/** /**
* 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 @@ class CommandCache extends SingletonFactory
/** /**
* 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 @@ class CommandCache extends SingletonFactory
/** /**
* 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];