8000 [Workflow] BC Break in Event class (potential real issue) · Issue #27759 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Workflow] BC Break in Event class (potential real issue) #27759
Closed
@Nek-

Description

@Nek-

Symfony version(s) affected: 4.1.x

Description

$event = new \Symfony\Component\Workflow\Event($subject, $marking, $transition);

This previously was an authorized usage. With 4.1 it now fails. But the last (and missing here) arg is still optional while it generates the throw of an exception.

This is due to this commit.

Possible Solution

I thinks something's wrong with the exception InvalidArgumentException, I suggest to remove it for now and adding it in 5.0.

public function __construct($subject, Marking $marking, Transition $transition, $workflow = null)
{
$this->subject = $subject;
$this->marking = $marking;
$this->transition = $transition;
if (is_string($workflow)) {
@trigger_error(sprintf('Passing a string as 4th parameter of "%s" is deprecated since Symfony 4.1. Pass a %s instance instead.', __METHOD__, WorkflowInterface::class), E_USER_DEPRECATED);
$this->workflowName = $workflow;
} elseif ($workflow instanceof WorkflowInterface) {
$this->workflow = $workflow;
} else {
throw new InvalidArgumentException(sprintf('The 4th parameter of "%s" should be a "%s" instance instead.', __METHOD__, WorkflowInterface::class));
}
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0