-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix some cases of PhanTypeSuspiciousStringExpression #28751
Fix some cases of PhanTypeSuspiciousStringExpression #28751
Conversation
56cb9b5
to
13bf3bd
Compare
723dd68
to
552ac11
Compare
4f30477
to
290f82f
Compare
@@ -297,6 +297,10 @@ private function amountToLetters($montant, $devise1 = '', $devise2 = '') | |||
$prim = array(); | |||
$secon = array(); | |||
$trio = array(); | |||
'@phan-var string[] $prim |
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.
Did you try to use
/** var string[] $prim */
before the $prim = array();
So this avoid to introduce phan specific code. Dos this trick works ?
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 use phan in other projects - as far as I am used to using PHPDoc does not work here for phan, so I do not try '/** @var ... */ anymore when the case corresponds to something where that would not work.
The documentation explains that this is a limition of AST:
https://github.com/phan/phan/wiki/Annotating-Your-Source-Code#inline-type-checks-via-string-literals
I try to avoid specific code as much as possible myself too.
Fix some cases of PhanTypeSuspiciousStringExpression
PhanTypeSuspiciousStringExpression is generally about using a boolean in "concatenation" to a string.
Fixed mostly by converting to a string value. There were a few cases with a misplaced parentheses in a (cond?X:Y) expression.