Code Duplication    Length = 5-7 lines in 2 locations

src/Yacc/Macro/DollarExpansion.php 2 locations

@@ 150-154 (lines=5) @@
147
    protected function parseDollar(Context $ctx, Token $token, int $nth, int $len, string $type = null): array
148
    {
149
        if ($token->getValue() === '$') {
150
            if ($type) {
151
                $mp = $ctx->macros[self::SEMVAL_LHS_TYPED];
152
            } else {
153
                $mp = $ctx->macros[self::SEMVAL_LHS_UNTYPED];
154
            }
155
        } else {
156
            if ($type) {
157
                $mp = $ctx->macros[self::SEMVAL_RHS_TYPED];
@@ 155-161 (lines=7) @@
152
            } else {
153
                $mp = $ctx->macros[self::SEMVAL_LHS_UNTYPED];
154
            }
155
        } else {
156
            if ($type) {
157
                $mp = $ctx->macros[self::SEMVAL_RHS_TYPED];
158
            } else {
159
                $mp = $ctx->macros[self::SEMVAL_RHS_UNTYPED];
160
            }
161
        }
162
163
        $result = '';
164
        for ($i = 0; $i < \mb_strlen($mp); $i++) {