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

Integrate FidryConsole #1702

Open
theofidry opened this issue Jun 21, 2022 · 0 comments
Open

Integrate FidryConsole #1702

theofidry opened this issue Jun 21, 2022 · 0 comments

Comments

@theofidry
Copy link
Member

While working mostly CLI centric applications (Box, PHP-Scoper, Infection), I have always been frustrated with a couple of points regarding symfony/console.

After years of trying to ignore this, it finally reached the tipping point and I decided to write fidry/console.

The initial promise is:

  • Make the API more transparent: there is clear, documented interfaces. No more extending a 600-1200 LoC base class with sometimes hard to find hooks
  • A typed API: the input arguments and options can be accessed via a rich typed API which goes beyond providing a type information, but also does check if the type coercion makes sense. A concrete example, you want a natural argument. At the end of the day the input is a user-based input so anything (physically possible) can be given. For an argument it is null|string|list<string>. With the typed API, you can easily coerce it to a natural value (PHPStan/Psalm compatible) whilst failing gracefully, providing a helpful message to the user when the input is incorrect.
  • A few utilities (IO object, CommandTester, ApplicationTester) to make your life easier.

I designed the library with goal to merge it back to Symfony eventually and I'm working with @chalasr for that, but that will realistically take a while. As a result though, the library can be seen as a very thing layer on top of the Symfony console as opposed to competing with it.

Anyway, the library has now been merged both in Box (see box-project/box#646) and PHP-Scoper (humbug/php-scoper#480 – earlier version and less clean probably in terms of PR). I'll be happy to do a PR for Infection as well if you are interested.

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

1 participant