Skip to content

ThrowWithPreviousExceptionRector not using named arguments if they are already used #8687

@nikolicaleksa

Description

@nikolicaleksa

Bug Report

Subject Details
Rector version last dev-main

Minimal PHP Code Causing Issue

See https://getrector.com/demo/d999289f-45a0-4ea5-9bb4-d18d1ddefe75

<?php

namespace Rector\Tests\CodeQuality\Rector\Catch_\ThrowWithPreviousExceptionRector\Fixture;

class NamedArgumentForMessage
{
    public function run()
    {
	try {
            $this->run();
        }catch(\Throwable $throwable) {
            throw new LogicException(message: 'Some exception');
        }
    }
}

Expected Behaviour

Named arguments are used if message argument used named arguments, otherwise, PHP will complain about "Cannot use a positional argument after a named argument"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions