public function defines(array $defines): self
    {
        if (!$defines) {
            return $this;
        }

        $dup_keys = array_intersect_key($this->defines, $defines);
        if ($dup_keys) {
            throw new \InvalidArgumentException(
                "Cannot redefine defines: " . join(', ', array_keys($dup_keys))
            );
        }

        $copy = clone $this;
        $copy->defines += $defines;
        return $copy;
    }
public function defines(array $defines): self
    {
        if (!$defines) {
            return $this;
        }

        $dup_keys = array_intersect_key($this->defines, $defines);
        if ($dup_keys) {
            throw new \InvalidArgumentException(
                "Cannot redefine defines: " . join(', ', array_keys($dup_keys))
            );
        }

        $copy = clone $this;
        $copy->defines += $defines;
        return $copy;
    }
public function defines ( array $ defines ) : self { if ( ! $ defines ) { return $ this ; } $ dup_keys = array_intersect_key ( $ this -> defines , $ defines ) ; if ( $ dup_keys ) { throw new \ InvalidArgumentException ( "Cannot redefine defines: " . join ( ', ' , array_keys ( $ dup_keys ) ) ) ; } $ copy = clone $ this ; $ copy -> defines += $ defines ; return $ copy ; }
Create new Lexer extending this one with DEFINEs

DEFINEs are named regexps to be used as from terminals and whitespaces
with named recursion `(?&name)` to simplify regexp code duplication.
DEFINEs can refer to each other. Order should not matter.

> Note: Returned object can be the same one in case of empty additions.
@param array $defines Additional DEFINEs regexps. Duplicating names is restricted.
@return static
@since 1.4.0
Create new Lexer extending this one with DEFINEs