public function removePhone(PhoneInterface $phone)
    {
        if (!$this->hasPhone($phone)) {
            throw new \InvalidArgumentException('Trying to remove a phone that does not belong to this contact');
        }

        $this->phones->removeElement($phone);

        if ($phone === $this->defaultPhone) {
            if ($this->phones->count() > 0) {
                $this->defaultPhone = $this->phones->first();

                return;
            }

            $this->defaultPhone = null;
        }
    }
public function removePhone(PhoneInterface $phone)
    {
        if (!$this->hasPhone($phone)) {
            throw new \InvalidArgumentException('Trying to remove a phone that does not belong to this contact');
        }

        $this->phones->removeElement($phone);

        if ($phone === $this->defaultPhone) {
            if ($this->phones->count() > 0) {
                $this->defaultPhone = $this->phones->first();

                return;
            }

            $this->defaultPhone = null;
        }
    }
public function removePhone ( PhoneInterface $ phone ) { if ( ! $ this -> hasPhone ( $ phone ) ) { throw new \ InvalidArgumentException ( 'Trying to remove a phone that does not belong to this contact' ) ; } $ this -> phones -> removeElement ( $ phone ) ; if ( $ phone === $ this -> defaultPhone ) { if ( $ this -> phones -> count ( ) > 0 ) { $ this -> defaultPhone = $ this -> phones -> first ( ) ; return ; } $ this -> defaultPhone = null ; } }
Remove a Phone from the collection.

@param PhoneInterface $phone
Remove a Phone from the collection .