-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Adding a deprecation note about DialogHelper #12737
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
Conversation
rodrigobb
commented
Nov 29, 2014
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | #12704 |
License | MIT |
Doc PR | - |
@@ -28,6 +28,12 @@ class DialogHelper extends InputAwareHelper | |||
private static $shell; | |||
private static $stty; | |||
|
|||
function __construct() | |||
{ | |||
trigger_error( 'DialogHelper is deprecated since version 2.5 and will be removed in 3.0. Use QuestionHelper instead.', E_USER_DEPRECATED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the last space before the parenthese
👍 but the extra space |
9df998c
to
cbddc8d
Compare
Thank you @rodrigobb. |
@@ -28,6 +28,12 @@ class DialogHelper extends InputAwareHelper | |||
private static $shell; | |||
private static $stty; | |||
|
|||
public function __construct() | |||
{ | |||
trigger_error('DialogHelper is deprecated since version 2.5 and will be removed in 3.0. Use QuestionHelper instead.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to create constructor? Should be sufficient to add this after the class namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stack trace is more precise when done in the constructor (I think).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, could be. I just think we should do this consistently in all classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this really matters. And having only one notice instead of one per instance is good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas Right.
@rodrigobb Can you move the line to the beginning of the file? Just after the namespace declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done a commit and push but as the PR is closed it doesn't appear here. How should I do it?
This PR was squashed before being merged into the 2.7 branch (closes #12759). Discussion ---------- Append to PR #12737 referring Ticket #12704 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #12704 | License | MIT | Doc PR | - Commits ------- b57ce38 Append to PR #12737 referring Ticket #12704
…l constructor in DialogHelper.php on line 37 (driskell) This PR was merged into the 2.7 branch. Discussion ---------- [Console] [DialogHelper] Fix PHP Fatal error: Cannot call constructor in DialogHelper.php on line 37 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A Since yesterday our composer builds have been failing due to an error originating from Symfony/console. We've also been seeing duplicated deprecation warnings: ``` PHP Deprecated: \Symfony\Component\Console\Helper\DialogHelper is deprecated since version 2.5 and will be removed in 3.0. Use QuestionHelper instead. in vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 14 PHP Deprecated: DialogHelper is deprecated since version 2.5 and will be removed in 3.0. Use QuestionHelper instead. in vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 35 PHP Fatal error: Cannot call constructor in vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 37 ``` It looks like this was introduced in PR #12737. Then #12759 was raised to change the warning to the header to only print a single warning. But rather than #12759 having #12737 as a parent and reverting it - it's parent is from before #12737 was merged. So there's now a situation of both PR having being merged - one adding deprecation warning to file header, and one adding deprecation to construct() (and also causing fatal error.) This PR fixes the issue by reverting the breaking parent::construct() added by #12737 so essentially only #12759 is active, which adds a single deprecation warning, and does not break the code. NB: This is the test failure for the Console component - test fails since #12737. This patch fixes this and passes all tests for the Console component. ``` $ phpunit src/Symfony/Component/Console PHP Fatal error: Cannot call constructor in src/Symfony/Component/Console/Helper/DialogHelper.php on line 37 ``` Jason Commits ------- ada9a58 Fix PHP Fatal error: Cannot call constructor in symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 37
note to maintainers: we need to be careful when merging deprecation messages, to be sure that our BC layers don't trigger them, but only the usage of the BC layers. So here, the instantiation should not trigger it, given the Application class triggers the instantiation |
To add to @stof - investigating some issues I'm having with composer and third party command integrators. It seems that Symfony/Console/Application actually instantiates these classes when initialising Helpers. (For example, it creates instances of DialogHelper and TableHelper) It does not seem intentional to me that Symfony should be raising Deprecation messages when you instantiate or use a non-deprecated object like Symfony/Console/Application |
* 2.7: (65 commits) Configure firewall's kernel exception listener with configured entry point or a default entry point PSR-2 fixes [DependencyInjection] make paths relative to __DIR__ in the generated container [FrameworkBundle][Router Cmd] use debug namespace. [FrameworkBundle] Update deprecated service call Fix PHP Fatal error: Cannot call constructor in symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 37 Removed a dev annotation from a version constraint Fixed the syntax of a composer.json file Fixed the symfony/config version constraint Tweaked the password-compat version constraint Docblock fixes Append to PR #12737 referring Ticket #12704 Issue #12658 Add a deprecation note about Translator's setFallbackLocale... Issue #12606 Adding warning logs about the deprecation of [...]/Tests/FormIntegration... Hackday deprecated 12621 Added deprecation log for validate and validateValue on ExecutionContext... [Console] [Hackday] [2.7] Add a deprecation note about ProgressHelper [Hackday][2.7] Add a deprecation note about MetadataInterface's accept() method [Validator] Added a deprecation note about setPropertyAccessor #12698 [Locale] Adding a deprecation note about the Locale component ...
* 2.7: (65 commits) Configure firewall's kernel exception listener with configured entry point or a default entry point PSR-2 fixes [DependencyInjection] make paths relative to __DIR__ in the generated container [FrameworkBundle][Router Cmd] use debug namespace. [FrameworkBundle] Update deprecated service call Fix PHP Fatal error: Cannot call constructor in symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 37 Removed a dev annotation from a version constraint Fixed the syntax of a composer.json file Fixed the symfony/config version constraint Tweaked the password-compat version constraint Docblock fixes Append to PR symfony#12737 referring Ticket symfony#12704 Issue symfony#12658 Add a deprecation note about Translator's setFallbackLocale... Issue symfony#12606 Adding warning logs about the deprecation of [...]/Tests/FormIntegration... Hackday deprecated 12621 Added deprecation log for validate and validateValue on ExecutionContext... [Console] [Hackday] [2.7] Add a deprecation note about ProgressHelper [Hackday][2.7] Add a deprecation note about MetadataInterface's accept() method [Validator] Added a deprecation note about setPropertyAccessor symfony#12698 [Locale] Adding a deprecation note about the Locale component ...
* 2.7: (65 commits) Configure firewall's kernel exception listener with configured entry point or a default entry point PSR-2 fixes [DependencyInjection] make paths relative to __DIR__ in the generated container [FrameworkBundle][Router Cmd] use debug namespace. [FrameworkBundle] Update deprecated service call Fix PHP Fatal error: Cannot call constructor in symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 37 Removed a dev annotation from a version constraint Fixed the syntax of a composer.json file Fixed the symfony/config version constraint Tweaked the password-compat version constraint Docblock fixes Append to PR symfony#12737 referring Ticket symfony#12704 Issue symfony#12658 Add a deprecation note about Translator's setFallbackLocale... Issue symfony#12606 Adding warning logs about the deprecation of [...]/Tests/FormIntegration... Hackday deprecated 12621 Added deprecation log for validate and validateValue on ExecutionContext... [Console] [Hackday] [2.7] Add a deprecation note about ProgressHelper [Hackday][2.7] Add a deprecation note about MetadataInterface's accept() method [Validator] Added a deprecation note about setPropertyAccessor symfony#12698 [Locale] Adding a deprecation note about the Locale component ...