contao / contao-manager

Contao Manager
GNU Lesser General Public License v3.0
83 stars 33 forks source link

Error message at the end of the output of "about" command in CLI #817

Closed tabcontao closed 1 week ago

tabcontao commented 1 week ago

When I use the command

php contao-manager.phar.php about

with Contao-Manager 1.8.6 in the CLI, I get the error message below at the bottom of the output below the "Server" info section:

  Server                                                                        
 ------------------ ----------------------------------------------------------------------------------------------------
  Operating System   Linux (6.1.0-22-cloud-amd64)                               
  Architecture       x86_64                                                     
 ------------------ ----------------------------------------------------------------------------------------------------

In Command.php line 261:

  Return value of "_ContaoManager\Contao\ManagerApi\Command\AboutCommand::exe
  cute()" must be of the type int, "null" returned.

about

See also: Corresponding Thread in the Contao community forum

zoglo commented 1 week ago

The return type in the contao-manager method is void, however in the newest symfony version (^7.0), it's more strict: https://github.com/symfony/symfony/blob/68a5704edace3371b649e779fc31ee860a19bd01/src/Symfony/Component/Console/Command/Command.php#L183

According to the phpdocs, it always wanted an integer as a return type tho: https://github.com/symfony/console/blob/6473d441a913cb997123b59ff2dbe3d1cf9e11ba/Command/Command.php#L192-L209

We might want to check on the return values on every execute() in the available manager commands and return int 0

fritzmg commented 1 week ago

But why does this occur in the first place? The Contao Manager requires "symfony/console": "^5.4".

zoglo commented 1 week ago

But why does this occur in the first place? The Contao Manager requires "symfony/console": "^5.4".

Neither the Symfony\Command nor the AboutCommand class in the current contao-manager.phar.php have a forced return value. I'd love to know this as well but maybe going with the standard approach and fixing this bug (since every other command in the manager does return an integer) may still be the best solution.

fritzmg commented 1 week ago

The PR should be fine, since the constants are available in Symfony 5.4+.