-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from yohang/feature/get-state-classes
feat: Added getStateClasses() and hasState() methods on StateMachine
- Loading branch information
Showing
10 changed files
with
194 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Finite\Tests\Fixtures; | ||
|
||
class AlternativeArticle | ||
{ | ||
private SimpleArticleState $state = SimpleArticleState::DRAFT; | ||
private AlternativeArticleState $alternativeState = AlternativeArticleState::NEW; | ||
private readonly \DateTimeInterface $createdAt; | ||
|
||
public function __construct(public readonly string $title) | ||
{ | ||
$this->createdAt = new \DateTimeImmutable; | ||
} | ||
|
||
public function getTitle(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function getCreatedAt(): \DateTimeInterface | ||
{ | ||
return $this->createdAt; | ||
} | ||
|
||
public function getState(): SimpleArticleState | ||
{ | ||
return $this->state; | ||
} | ||
|
||
public function setState(SimpleArticleState $state): void | ||
{ | ||
$this->state = $state; | ||
} | ||
|
||
public function getAlternativeState(): AlternativeArticleState | ||
{ | ||
return $this->alternativeState; | ||
} | ||
|
||
public function setAlternativeState(AlternativeArticleState $alternativeState): void | ||
{ | ||
$this->alternativeState = $alternativeState; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/E2E/AlternativeArticleState.php → tests/Fixtures/AlternativeArticleState.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Finite\Tests\Fixtures; | ||
|
||
class Article | ||
{ | ||
public $noTypeHere = null; | ||
|
||
public int|float $unionType = 0; | ||
|
||
public \Traversable&\Countable $intersectionType; | ||
|
||
public string $namedType = 'named'; | ||
|
||
private SimpleArticleState $state = SimpleArticleState::DRAFT; | ||
|
||
private readonly \DateTimeInterface $createdAt; | ||
|
||
public function __construct(public readonly string $title) | ||
{ | ||
$this->createdAt = new \DateTimeImmutable; | ||
} | ||
|
||
public function getTitle(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function getCreatedAt(): \DateTimeInterface | ||
{ | ||
return $this->createdAt; | ||
} | ||
|
||
public function getState(): SimpleArticleState | ||
{ | ||
return $this->state; | ||
} | ||
|
||
public function setState(SimpleArticleState $state): void | ||
{ | ||
$this->state = $state; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/E2E/SimpleArticleState.php → tests/Fixtures/SimpleArticleState.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters