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

Skip to content

[Workflow] Added generic template in Event and his inheritors #44702

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
{
}
10 changes: 9 additions & 1 deletion 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 object $subject;
private Marking $marking;
private ?Transition $transition;
private ?WorkflowInterface $workflow;

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

/**
* @return object
* @return TSubject
*/
public function getSubject()
{
Expand Down
5 changes: 5 additions & 0 deletions 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 @@ -27,6 +30,8 @@ final class GuardEvent extends Event

/**
* {@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