public function analyze() { // Function returning a type, then casted to that type $casts = array('T_STRING_CAST' => 'string', 'T_BOOL_CAST' => 'bool', 'T_INT_CAST' => 'int', 'T_ARRAY_CAST' => 'array', 'T_DOUBLE_CAST' => 'real'); $data = new Methods(); $returnTypes = $data->getFunctionsByReturn(); foreach ($casts as $token => $type) { $this->atomIs('Cast')->tokenIs($token)->outIs('CAST')->outIsIE('CODE')->atomIs('Functioncall')->fullnspathIs($returnTypes[$type])->back('first'); $this->prepareQuery(); } // (bool) ($a > 2) $this->atomIs('Cast')->tokenIs('T_BOOL_CAST')->outIs('CAST')->outIsIE('CODE')->atomIs('Comparison')->back('first'); $this->prepareQuery(); }