PHPSA\CompiledExpression::canBeObject PHP Method

canBeObject() public method

This is needed via in feature $this->type can store multiple type(s) by bitmask
public canBeObject ( ) : boolean
return boolean
    public function canBeObject()
    {
        return (bool) ($this->type == self::OBJECT || $this->type & self::OBJECT);
    }

Usage Example

Example #1
0
 public function testCanBeObject()
 {
     // Mixed type can be object
     $expr = new CompiledExpression(CompiledExpression::MIXED, null);
     parent::assertTrue($expr->canBeObject());
     // Integer type can't be object
     $expr2 = new CompiledExpression(CompiledExpression::INTEGER, 1);
     parent::assertFalse($expr2->canBeObject());
 }