Code Duplication    Length = 13-13 lines in 2 locations

src/Spec.php 2 locations

@@ 127-139 (lines=13) @@
124
    /**
125
     * @return AndX
126
     */
127
    public static function andX()
128
    {
129
        // NEXT_MAJOR: use variable-length argument lists (...$specs)
130
        $spec = (new \ReflectionClass(AndX::class))->newInstanceArgs(func_get_args());
131
132
        // hook for PHPStan
133
        if (!($spec instanceof AndX)) {
134
            throw new \RuntimeException(
135
                sprintf('The specification must be an instance of "%s", but got "%s".', AndX::class, get_class($spec))
136
            );
137
        }
138
139
        return $spec;
140
    }
141
142
    /**
@@ 145-157 (lines=13) @@
142
    /**
143
     * @return OrX
144
     */
145
    public static function orX()
146
    {
147
        // NEXT_MAJOR: use variable-length argument lists (...$specs)
148
        $spec = (new \ReflectionClass(OrX::class))->newInstanceArgs(func_get_args());
149
150
        // hook for PHPStan
151
        if (!($spec instanceof OrX)) {
152
            throw new \RuntimeException(
153
                sprintf('The specification must be an instance of "%s", but got "%s".', OrX::class, get_class($spec))
154
            );
155
        }
156
157
        return $spec;
158
    }
159
160
    /**