Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended robo files are not parsed for commands for consolidation/annotated-command >= 4.5.7 #1128

Open
mattsqd opened this issue Nov 3, 2022 · 3 comments

Comments

@mattsqd
Copy link

mattsqd commented Nov 3, 2022

Steps to reproduce

  1. Upgraded consolidation/annotated-command to a version >= 4.5.7 (4.6.0, in my case).
  2. Run vendor/bin/robo list

I've tracked down the issue to this commit from this list of commits. I can see it skip over the command in my debugger because the class of the initially loaded robo file does not match the extended one.

I believe it boils down to the way I've structured the RoboFile, which may be an anti-pattern, and I'm open to any suggestions.

In the RoboFile, I extend another RoboFile. The original RoboFile is used to to override methods from the extended file. This wasn't done so much to completely replace a command but instead override the helper functions that were not commands but had full access to robo.

RoboFile.php


require_once 'RoboFileSite.php';

class RoboFile extends \RoboFileSite
{
    
}

RoboFileSite.php


class RoboFileSite
{

  function hello(\Robo\Symfony\ConsoleIO $io, array $world)
  {
    $io->say("Hello, " . implode(', ', $world));
  }
}

Expected behavior

The 'hello' command is listed.

Actual behavior

The 'hello' command is not listed.

System Configuration

Linux PHP 8.1 wodby/php:8.1-dev-4.32.7

@nortmas
Copy link

nortmas commented Nov 9, 2022

I confirm, I also have this problem with the version 3.0.10

@greg-1-anderson
Copy link
Member

See consolidation/annotated-command#277; this should be resolved on the next release of consolidation/annotated-command. As a workaround, pin to an older release.

@nortmas
Copy link

nortmas commented Nov 9, 2022

Awesome! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants