public function setParent($parent)
    {
        if (!$parent instanceof ClassDescriptor && !$parent instanceof InterfaceDescriptor && $parent !== null) {
            throw new \InvalidArgumentException('Constants can only have an interface or class as parent');
        }

        $fqsen = $parent !== null
            ? $parent->getFullyQualifiedStructuralElementName() . '::' . $this->getName()
            : $this->getName();

        $this->setFullyQualifiedStructuralElementName($fqsen);

        $this->parent = $parent;
    }
public function setParent($parent)
    {
        if (!$parent instanceof ClassDescriptor && !$parent instanceof InterfaceDescriptor && $parent !== null) {
            throw new \InvalidArgumentException('Constants can only have an interface or class as parent');
        }

        $fqsen = $parent !== null
            ? $parent->getFullyQualifiedStructuralElementName() . '::' . $this->getName()
            : $this->getName();

        $this->setFullyQualifiedStructuralElementName($fqsen);

        $this->parent = $parent;
    }
public function setParent ( $ parent ) { if ( ! $ parent instanceof ClassDescriptor && ! $ parent instanceof InterfaceDescriptor && $ parent !== null ) { throw new \ InvalidArgumentException ( 'Constants can only have an interface or class as parent' ) ; } $ fqsen = $ parent !== null ? $ parent -> getFullyQualifiedStructuralElementName ( ) . '::' . $ this -> getName ( ) : $ this -> getName ( ) ; $ this -> setFullyQualifiedStructuralElementName ( $ fqsen ) ; $ this -> parent = $ parent ; }
Registers a parent class or interface with this constant.

@param ClassDescriptor|InterfaceDescriptor|null $parent

@throws \InvalidArgumentException if anything other than a class, interface or null was passed.
Registers a parent class or interface with this constant .