private static function processTypeErrorOnGetValue($object, string $property, \TypeError $error): void
    {
        if (0 !== strpos($error->getMessage(), 'Return value of ')) {
            return;
        }

        $pos = strpos($error->getMessage(), $delim = 'must be of the type ') ?: (strpos($error->getMessage(), $delim = 'must be an instance of ') ?: strpos($error->getMessage(), $delim = 'must implement interface '));
        if (false !== $pos) {
            $ro = new \ReflectionObject($object);
            $rp = $ro->getProperty($property);
            $rp->setAccessible(true);
            $pos += strlen($delim);
            $actualValue = $rp->getValue($object);
            $expectedType = substr($error->getMessage(), $pos, (int) strpos($error->getMessage(), ',', $pos) - $pos);

            if (null === $actualValue) {
                throw new UninitializedPropertyException($object, $property, $expectedType);
            }

            $actualType = \is_object($actualValue) ? \get_class($actualValue) : \gettype($actualValue);

            // Until we are using strongly typed variables this should not happen.
            throw new UnexpectedValueException($object, $property, $expectedType, $actualType);
        }
    }