Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Workflow] Add generic template for event classes #44622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Symfony/Component/Workflow/Event/AnnounceEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

namespace Symfony\Component\Workflow\Event;

/**
* @template TSubject of object
* @extends Event<TSubject>
*/
final class AnnounceEvent extends Event
{
}
4 changes: 4 additions & 0 deletions src/Symfony/Component/Workflow/Event/CompletedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

namespace Symfony\Component\Workflow\Event;

/**
* @template TSubject of object
* @extends Event<TSubject>
*/
final class CompletedEvent extends Event
{
}
4 changes: 4 additions & 0 deletions src/Symfony/Component/Workflow/Event/EnterEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

namespace Symfony\Component\Workflow\Event;

/**
* @template TSubject of object
* @extends Event<TSubject>
*/
final class EnterEvent extends Event
{
}
4 changes: 4 additions & 0 deletions src/Symfony/Component/Workflow/Event/EnteredEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

namespace Symfony\Component\Workflow\Event;

/**
* @template TSubject of object
* @extends Event<TSubject>
*/
final class EnteredEvent extends Event
{
}
14 changes: 14 additions & 0 deletions src/Symfony/Component/Workflow/Event/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,26 @@
use Symfony\Contracts\EventDispatcher\Event as BaseEvent;

/**
* @template TSubject of object
*
* @author Fabien Potencier <[email protected]>
* @author Grégoire Pineau <[email protected]>
* @author Carlos Pereira De Amorim <[email protected]>
*/
class Event extends BaseEvent
{
protected $context;
/**
* @var TSubject
*/
private $subject;
private $marking;
private $transition;
private $workflow;

/**
* @param TSubject $subject
*/
public function __construct(object $subject, Marking $marking, Transition $transition = null, WorkflowInterface $workflow = null, array $context = [])
{
$this->subject = $subject;
Expand All @@ -43,6 +51,9 @@ public function getMarking()
return $this->marking;
}

/**
* @return TSubject
*/
public function getSubject()
{
return $this->subject;
Expand All @@ -63,6 +74,9 @@ public function getWorkflowName()
return $this->workflow->getName();
}

/**
* @param TSubject $subject
*/
public function getMetadata(string $key, $subject)
{
return $this->workflow->getMetadataStore()->getMetadata($key, $subject);
Expand Down
5 changes: 4 additions & 1 deletion src/Symfony/Component/Workflow/Event/GuardEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
use Symfony\Component\Workflow\WorkflowInterface;

/**
* @template TSubject of object
* @extends Event<TSubject>
*
* @author Fabien Potencier <[email protected]>
* @author Grégoire Pineau <[email protected]>
*/
Expand All @@ -26,7 +29,7 @@ final class GuardEvent extends Event
private $transitionBlockerList;

/**
* {@inheritdoc}
* @param TSubject $subject
*/
public function __construct(object $subject, Marking $marking, Transition $transition, WorkflowInterface $workflow = null)
{
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Workflow/Event/LeaveEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

namespace Symfony\Component\Workflow\Event;

/**
* @template TSubject of object
* @extends Event<TSubject>
*/
final class LeaveEvent extends Event
{
}
4 changes: 4 additions & 0 deletions src/Symfony/Component/Workflow/Event/TransitionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

namespace Symfony\Component\Workflow\Event;

/**
* @template TSubject of object
* @extends Event<TSubject>
*/
final class TransitionEvent extends Event
{
public function setContext(array $context): void
Expand Down