Conversation
| { | ||
| $mask = substr($mask, 0, strlen($data)); | ||
| $data ^= $mask; | ||
| return(base64_encode($data)); |
There was a problem hiding this comment.
Was reporting an error on level 5 on php 7.4 https://phpstan.org/r/12e63cdd-d516-4db2-a314-51da4f5c3101
d80297a to
ca5edd1
Compare
ca5edd1 to
34385de
Compare
| { | ||
| assertType('int', $a & $b); | ||
| assertNativeType('int', $a & $b); | ||
| assertNativeType('*ERROR*', $a & $b); |
There was a problem hiding this comment.
This is equivalent to mixed & mixed which is now reported as an error. (we can't be sure it's an int, it could be string & string for instance or worst, int & string)
There was a problem hiding this comment.
if we can't know what it is, why is it an ERROR then? shouldn't it be mixed instead?
There was a problem hiding this comment.
Current mixed behavior is weird. A good example of the issue is
int ^ mixed = ? // currently int ; so no error is reported InvalidBinaryOperationRule
string ^ mixed = ? // currently Error ; an error is reported by InvalidBinaryOperationRule
mixed ^ mixed = ? // currently int ; so no error is reported by InvalidBinaryOperationRule
I'm not sure what should be done. Either error for all or something like
int ^ mixed = int
string ^ mixed = string
mixed ^ mixed = (int|string)
There was a problem hiding this comment.
I tried another solution, tell me your opinion about it @staabm :)
5866d4a to
6e91d05
Compare
6e91d05 to
03cd5a4
Compare
|
Thank you! |
Closes phpstan/phpstan#8094