private static function myParsePart(string $part, bool $isLastPart, callable $partValidator, ?callable $stringDecoder, ?bool $isAbsolute, ?int &$aboveBaseLevel, ?array &$directoryParts = null, ?string &$filename = null, ?string &$error = null): bool
    {
        // Skip empty and current directory parts.
        if ($part === '' || $part === '.') {
            return true;
        }

        // Handle parent directory-part.
        if ($part === '..') {
            return self::myHandleParentDirectoryPart($isAbsolute, $aboveBaseLevel, $directoryParts, $error);
        }

        // Handle directory part.
        if (!$isLastPart) {
            return self::myHandleDirectoryPart($part, $partValidator, $stringDecoder, $directoryParts, $error);
        }

        // Handle last (i.e. filename) part.
        return self::myHandleFilenamePart($part, $partValidator, $stringDecoder, $filename, $error);
    }