Either enable or disable the given flag on
the given bit vector.
public static bitVectorWithState ( integer $bit_vector, integer $flag, boolean $value ) : integer | ||
$bit_vector | integer | The bit vector we're operating on |
$flag | integer | The flag we're setting on the bit vector such as Flags::IS_DEPRECATED. |
$value | boolean | True to or the flag in, false to & the bit vector with the flags negation |
Результат | integer | A new bit vector with the given flag set or unset |
/** * Returns the Parameter in the form expected by a caller. * * If this parameter is variadic (e.g. `DateTime ...$args`), then this * would return a parameter with the type of the elements (e.g. `DateTime`) * * If this parameter is not variadic, returns $this. * * @return static (usually $this) */ public function asNonVariadic() { if (!$this->isVariadic()) { return $this; } // TODO: Is it possible to cache this while maintaining correctness? PostOrderAnalysisVisitor clones the value to avoid it being reused. // // Also, figure out if the cloning still working correctly after this PR for fixing variadic args. // create a single Parameter instance for analyzing callers // of the corresponding method/function. // e.g. $this->getUnionType() is of type T[] // $this->non_variadic->getUnionType() is of type T return new Parameter($this->getContext(), $this->getName(), $this->getVariadicElementUnionType(), Flags::bitVectorWithState($this->getFlags(), \ast\flags\PARAM_VARIADIC, false)); }
/** * @param bool $is_override * True if this method overrides another method * * @return void */ public function setIsOverride(bool $is_override) { $this->setPhanFlags(Flags::bitVectorWithState($this->getPhanFlags(), Flags::IS_OVERRIDE, $is_override)); }
/** * @return void */ public function setIsParentConstructorCalled(bool $is_parent_constructor_called) { $this->setPhanFlags(Flags::bitVectorWithState($this->getPhanFlags(), Flags::IS_PARENT_CONSTRUCTOR_CALLED, $is_parent_constructor_called)); }
/** * @return void */ private function setIsInternal(bool $is_internal) { $this->setFlags(Flags::bitVectorWithState($this->getFlags(), Flags::IS_INTERNAL, $is_internal)); }
/** * @param bool $has_return * Set to true to mark this method as having a * return value * * @return void */ public function setHasReturn(bool $has_return) { $this->setFlags(Flags::bitVectorWithState($this->getFlags(), Flags::HAS_RETURN, $has_return)); }
/** * @return void */ public function setHasDynamicProperties(bool $has_dynamic_properties) { $this->setPhanFlags(Flags::bitVectorWithState($this->getPhanFlags(), Flags::CLASS_HAS_DYNAMIC_PROPERTIES, $has_dynamic_properties)); }
/** * @param bool $has_yield * Set to true to mark this method as having a * yield value * * @return void */ public function setHasYield(bool $has_yield) { $this->setPhanFlags(Flags::bitVectorWithState($this->getPhanFlags(), Flags::HAS_YIELD, $has_yield)); }