from @Majkl578:
Invalid:
echo "x" ^ 1;
echo "x" | new stdClass();
Valid:
echo "x" ^ "y";
echo 4 ^ 5;
If both operands for the &, | and ^ operators are strings, then the operation will be performed on the ASCII values of the characters that make up the strings and the result will be a string.
http://php.net/manual/en/language.operators.bitwise.php
So echo "x" ^ "y"; is not invalid.
Yup, it's a modified example from https://github.com/phpstan/phpstan/issues/1082.
"x" ^ 1 is invalid though. #php
Good points, I've updated the ticket