10000 [Console] introduce `__toString` `method` annotation to `InputInterface` by boesing · Pull Request #42056 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] introduce __toString method annotation to InputInterface #42056

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
---

* Add `TesterTrait::assertCommandIsSuccessful()` to test command
* Add `InputInterface::__toString()` method annotation. This will be replaced by the extension of the `Stringable` interface in 6.0.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Add `InputInterface::__toString()` method annotation. This will be replaced by the extension of the `Stringable` interface in 6.0.
* Add method `__toString()` to `InputInterface`


5.3
---
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Console/Input/InputInterface.php
10000
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
* InputInterface is the interface implemented by all input classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @method string __toString() Returns a stringified representation of the args passed to the command.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK if someone does not implement this method, a deprecation is thrown.

I would like to have a test case which asserts this deprecation (a missing implementation) and has the "@group legacy".

Not sure I missed sth.

Copy link
Contributor Author
@boesing boesing Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see how to achieved that. Thanks for clarification.
The unit test to verify the deprecation should be part of the docs repo?

* InputArguments MUST be escaped as well as the InputOption values passed to the command.
*/
interface InputInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,9 @@ public function getParameterOption($values, $default = false, $onlyParams = fals
public function parse()
{
}

public function __toString(): string
{
return '';
}
}
0