Project

General

Profile

Actions

Bug #92313

closed

Wrongly Hint in method 'getCommandByIdentifier'

Added by Dieter Porth about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
scheduler
Target version:
-
Start date:
2020-09-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The hint `:command` in the function `getCommandByIdentifier` will cause an error, if $this->commands[$identifier] is not defined. PHPStorm mark the 'null' as error

Line 87 in TYPO3\CMS\Core\Console\CommandRegistry


/**
     * @param string $identifier
     * @throws CommandNameAlreadyInUseException
     * @throws UnknownCommandException
     * @return Command
     */
    public function getCommandByIdentifier(string $identifier): Command
    {
        $this->populateCommandsFromPackages();

        if (!isset($this->commands[$identifier])) {
            throw new UnknownCommandException(
                sprintf('Command "%s" has not been registered.', $identifier),
                1510906768
            );
        }

        return $this->commands[$identifier] ?? null;
    }

Actions

Also available in: Atom PDF