Code Duplication    Length = 5-7 lines in 2 locations

src/Query.php 2 locations

@@ 359-363 (lines=5) @@
356
     */
357
    public function except($filter): Query
358
    {
359
        if (\is_string($filter) && ! \is_callable($filter)) {
360
            return $this->only(function (CriterionInterface $criterion) use ($filter): bool {
361
                return ! $criterion instanceof $filter;
362
            });
363
        }
364
365
        return $this->only(function (CriterionInterface $criterion) use ($filter): bool {
366
            return ! $filter($criterion);
@@ 399-405 (lines=7) @@
396
    {
397
        \assert(\is_string($filter) || \is_callable($filter));
398
399
        if (\is_string($filter) && ! \is_callable($filter)) {
400
            $typeOf = $filter;
401
402
            return function (CriterionInterface $criterion) use ($typeOf): bool {
403
                return $criterion instanceof $typeOf;
404
            };
405
        }
406
407
        return $filter;
408
    }