protected function handleMethodCall(string $method, array $arguments, bool $shouldReturnSelf)
    {
        $invocation = $this->invocations($method)->recordCall($arguments);
        if (null !== $this->callMap && $this->callMap->hasResultFor($method, $invocation)) {
            return $this->callMap->resultFor($method, $arguments, $invocation);
        }

        if ($this->parentCallsAllowed && is_callable(['parent', $method])) {
            // is_callable() returns true even for abstract methods
            $refMethod = new \ReflectionMethod(get_parent_class(), $method);
            if (!$refMethod->isAbstract()) {
                return parent::$method(...$arguments);
            }
        }

        if ($shouldReturnSelf) {
            return $this;
        }

        return null;
    }