Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Console] FixOutputInterface
options int-mask for PHPStan#48384
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
* @param self::VERBOSITY_*|self::OUTPUT_* $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), | ||
* 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL | ||
* @param bool $newline Whether to add a newline | ||
* @param int-mask-of<self::VERBOSITY_*,self::OUTPUT_*> $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), |
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.
Psalm doesn't work correctly when combining globs together here. Let's go for eitherint-mask-of<self::*>
orint
.
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.
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.
As I'm not a PhpStorm user myself, does this also create issues when using this method in PhpStorm? (e.g. issues with completion or adding false-positive inspection errors)
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 to my knowledge nor experience actually ; theint
typehint is still in use for the quick documentation, autocomplete or inspections, but I don't know if it can cause quirks with some plugins.
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 EAP version of PHPStorm has full support for parsing constant wildcards (the stable release supports the case with a name prefix but not the full wildcard on the class IIRC). But indeed, it will fallback toint
in such case.
OutputInterface
options int-mask for PHPStanThank you@ogizanagi. |
Uh oh!
There was an error while loading.Please reload this page.
When upgrading an application to 6.2, I encountered this issue with PHPStan:
The
MultiplexingOutput
implements theOutputInterface
and defined0
as the default value for$options
:as defined by the interface:
symfony/src/Symfony/Component/Console/Output/OutputInterface.php
Line 40 in69f46f2
When trying to use
self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
as default value:Or simply using
Output::write()
with specific options:Using PHPStan's
int-mask-of
is the solution for this, and allows by nature the0
value.It was even usedat some point, but reverted to use
self::VERBOSITY_*|self::OUTPUT_*
. However, it does not behave as expected for masks.So, either we use
int-mask-of
, or we revert toint
?