Bug #92313

Wrongly Hint in method 'getCommandByIdentifier'

Added by Dieter Porth 11 days ago. Updated 8 days ago.

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

100%

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;
    }

Associated revisions

Revision 9ed135c1 (diff)
Added by Georg Ringer 8 days ago

[BUGFIX] Set correct return type for CommandRegistry::getCommandByIdentifier

The method `getCommandByIdentifier` can return `null`, therefore the
return type must be adjusted.

Resolves: #92313
Releases: 10.4, 9.5
Change-Id: I15b272ae922fb86012fe6412b767e5d83436a6ae
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65757
Tested-by: TYPO3com <>
Tested-by: Oliver Bartsch <>
Tested-by: Christian Kuhn <>
Tested-by: Anja Leichsenring <>
Reviewed-by: Oliver Bartsch <>
Reviewed-by: Christian Kuhn <>
Reviewed-by: Anja Leichsenring <>

Revision 922d4dd1 (diff)
Added by Georg Ringer 8 days ago

[BUGFIX] Set correct return type for CommandRegistry::getCommandByIdentifier

The method `getCommandByIdentifier` can return `null`, therefore the
return type must be adjusted.

Resolves: #92313
Releases: 10.4, 9.5
Change-Id: I15b272ae922fb86012fe6412b767e5d83436a6ae
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65775
Tested-by: TYPO3com <>
Tested-by: Anja Leichsenring <>
Reviewed-by: Anja Leichsenring <>

History

#1 Updated by Gerrit Code Review 9 days ago

  • Status changed from New to Under Review

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65757

#2 Updated by Gerrit Code Review 8 days ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65775

#3 Updated by Georg Ringer 8 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF