private function validateSorting(array $originalTokens, array $sortedTokens): void
    {
        $sortedPositions = array_keys($sortedTokens);
        $sortedIndex = 0;

        foreach ($originalTokens as $originalPosition => $originalToken) {
            $sortedPosition = $sortedPositions[$sortedIndex++];
            $sortedToken = $sortedTokens[$sortedPosition];

            // We don't need an error if the "type block" is the same, so check the code additionally.
            if (($sortedPosition !== $originalPosition) && ($originalToken['code'] !== $sortedToken['code'])) {
                $this->file->addError(
                    self::MESSAGE_WRONG_POSITION,
                    $originalPosition,
                    static::CODE_WRONG_POSITION,
                    [
                        $sortedToken['type'],
                        $sortedToken['content']
                    ]
                );
            }
        }
    }