Make arrays implement Traversable and KeyedTraversable
This diff changes HHVM so that arrays are considered to implement the Traversable and KeyedTraversable interfaces (which have no methods). The idea is that these interfaces will be useful for parameter type constraints for PHP code that wants to be compatible with both arrays and collections (and possibly other objects that implement these interfaces).
Esse commit está contido em:
@@ -579,8 +579,15 @@ ExpressionPtr BinaryOpExpression::foldConst(AnalysisResultConstPtr ar) {
|
||||
result = v1 || v2; break;
|
||||
case T_LOGICAL_AND:
|
||||
result = v1 && v2; break;
|
||||
case T_INSTANCEOF:
|
||||
result = false; break;
|
||||
case T_INSTANCEOF: {
|
||||
if (v1.isArray() && v2.isString() &&
|
||||
interface_supports_array(v2.getStringData())) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return ExpressionPtr();
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário