public function withFlag(FlagInterface $flag): self
    {
        $clone = clone ($this);
        $clone->flags[$flag->__toString()] = deep_clone($flag);

        return $clone;
    }
public function withFlag(FlagInterface $flag): self
    {
        $clone = clone ($this);
        $clone->flags[$flag->__toString()] = deep_clone($flag);

        return $clone;
    }
public function withFlag ( FlagInterface $ flag ) : self { $ clone = clone ( $ this ) ; $ clone -> flags [ $ flag -> __toString ( ) ] = deep_clone ( $ flag ) ; return $ clone ; }
Creates a new instance of the bag with the given flag. If a flag with the same identifier already exists, the
existing value will be replaced.

@return FlagBag
Creates a new instance of the bag with the given flag . If a flag with the same identifier already exists the existing value will be replaced .