Skip to content
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

Support PHP8.0 #92

Open
wants to merge 2 commits into
base: 1.4
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Add the dependency to `phpmentors/workflower` into your `composer.json` file as
composer require phpmentors/workflower "1.4.*"
```

when your PHP version >= 8.0, you can install `1.5.*`

```
composer require phpmentors/workflower "1.5.*"
```

## Documentation

* [Quick Start Guide](https://github.com/phpmentors-jp/workflower/blob/master/docs/GUIDE.md)
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
}
],
"require": {
"php": ">=5.3.9",
"php": "^8.0",
"phpmentors/domain-kata": "~1.4",
"piece/stagehand-fsm": "~2.6",
"symfony/expression-language": "~2.8|~3.0|~4.0"
"symfony/expression-language": "~3.4|~4.0|~5.0",
"ext-dom": "*"
},
"require-dev": {
"phake/phake": "~2.0",
"phpunit/phpunit": "~4.0"
"phake/phake": "^4.0",
"phpunit/phpunit": "~8.0"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 2 additions & 3 deletions src/Definition/Bpmn2File.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Bpmn2File implements EntityInterface, IdentifiableInterface
private $file;

/**
* @param string $file
* @param string $file
*/
public function __construct($file)
{
Expand All @@ -47,8 +47,7 @@ public function getFile()
}

/**
* @param string $file
*
* @param string $file
* @return string
*/
public static function getWorkflowId($file)
Expand Down
47 changes: 21 additions & 26 deletions src/Definition/Bpmn2Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
class Bpmn2Reader implements ServiceInterface
{
/**
* @param string $file
*
* @param string $file
* @return Workflow
*
* @throws IdAttributeNotFoundException
Expand All @@ -37,8 +36,7 @@ public function read($file)
}

/**
* @param string $source
*
* @param string $source
* @return Workflow
*
* @throws IdAttributeNotFoundException
Expand All @@ -57,9 +55,8 @@ public function readSource($source)
}

/**
* @param DOMDocument $document
* @param int|string $workflowId
*
* @param DOMDocument $document
* @param int|string $workflowId
* @return Workflow
*
* @throws IdAttributeNotFoundException
Expand All @@ -85,9 +82,9 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
}
}

$flowObjectRoles = array();
$flowObjectRoles = [];
foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'lane') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

Expand All @@ -105,26 +102,26 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
$workflowBuilder->addRole(Workflow::DEFAULT_ROLE_ID);
}

$messages = array();
$messages = [];
foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'message') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

$messages[$element->getAttribute('id')] = $element->getAttribute('name');
}

$operations = array();
$operations = [];
foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'operation') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

$operations[$element->getAttribute('id')] = $element->getAttribute('name');
}

foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'startEvent') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

Expand All @@ -137,7 +134,7 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
}

foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'task') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

Expand All @@ -150,7 +147,7 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
}

foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'serviceTask') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

Expand All @@ -164,7 +161,7 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
}

foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'sendTask') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

Expand All @@ -179,7 +176,7 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
}

foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'exclusiveGateway') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

Expand All @@ -192,15 +189,15 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
}

foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'endEvent') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

$workflowBuilder->addEndEvent($element->getAttribute('id'), $this->provideRoleIdForFlowObject($flowObjectRoles, $element->getAttribute('id')), $element->hasAttribute('name') ? $element->getAttribute('name') : null);
}

foreach ($document->getElementsByTagNameNs('http://www.omg.org/spec/BPMN/20100524/MODEL', 'sequenceFlow') as $element) {
if (!$element->hasAttribute('id')) {
if (! $element->hasAttribute('id')) {
throw $this->createIdAttributeNotFoundException($element, $workflowId);
}

Expand All @@ -223,9 +220,8 @@ private function readDocument(\DOMDocument $document, $workflowId = null)
}

/**
* @param \DOMElement $element
* @param int|string $workflowId
*
* @param \DOMElement $element
* @param int|string $workflowId
* @return IdAttributeNotFoundException
*/
private function createIdAttributeNotFoundException(\DOMElement $element, $workflowId)
Expand All @@ -234,9 +230,8 @@ private function createIdAttributeNotFoundException(\DOMElement $element, $workf
}

/**
* @param array $flowObjectRoles
* @param string $flowObjectId
*
* @param array $flowObjectRoles
* @param string $flowObjectId
* @return string
*
* @since Method available since Release 1.3.0
Expand Down
4 changes: 2 additions & 2 deletions src/Definition/Bpmn2WorkflowRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Bpmn2WorkflowRepository implements WorkflowRepositoryInterface
/**
* @var array
*/
private $bpmn2Files = array();
private $bpmn2Files = [];

/**
* {@inheritdoc}
Expand Down Expand Up @@ -51,7 +51,7 @@ public function remove(EntityInterface $entity)
*/
public function findById($id)
{
if (!array_key_exists($id, $this->bpmn2Files)) {
if (! array_key_exists($id, $this->bpmn2Files)) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Definition/ErrorToExceptionContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class ErrorToExceptionContext
private $target;

/**
* @param int $errorReportingLevel
* @param \Closure $target
* @param int $errorReportingLevel
* @param \Closure $target
*/
public function __construct($errorReportingLevel, \Closure $target)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Persistence/WorkflowSerializableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
interface WorkflowSerializableInterface extends OperationInterface, WorkflowAwareInterface
{
/**
* @param string $serializedWorkflow
* @param string $serializedWorkflow
*/
public function setSerializedWorkflow($serializedWorkflow);

Expand Down
6 changes: 2 additions & 4 deletions src/Persistence/WorkflowSerializerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@
interface WorkflowSerializerInterface extends ServiceInterface
{
/**
* @param Workflow $workflow
*
* @param Workflow $workflow
* @return string
*/
public function serialize(Workflow $workflow);

/**
* @param string $workflow
*
* @param string $workflow
* @return Workflow
*/
public function deserialize($workflow);
Expand Down
4 changes: 2 additions & 2 deletions src/Process/EventContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class EventContext implements EventContextInterface
private $processContext;

/**
* @param int|string $eventId
* @param ProcessContextInterface $processContext
* @param int|string $eventId
* @param ProcessContextInterface $processContext
*/
public function __construct($eventId, ProcessContextInterface $processContext)
{
Expand Down
21 changes: 10 additions & 11 deletions src/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class Process implements ServiceInterface
private $operationRunner;

/**
* @param int|string|WorkflowContextInterface $workflowContext
* @param WorkflowRepositoryInterface $workflowRepository
* @param OperationRunnerInterface $operationRunner
* @param int|string|WorkflowContextInterface $workflowContext
* @param WorkflowRepositoryInterface $workflowRepository
* @param OperationRunnerInterface $operationRunner
*/
public function __construct($workflowContext, WorkflowRepositoryInterface $workflowRepository, OperationRunnerInterface $operationRunner)
{
Expand All @@ -59,7 +59,7 @@ public function __construct($workflowContext, WorkflowRepositoryInterface $workf
}

/**
* @param ExpressionLanguage $expressionLanguage
* @param ExpressionLanguage $expressionLanguage
*
* @since Method available since Release 1.2.0
*/
Expand All @@ -69,7 +69,7 @@ public function setExpressionLanguage(ExpressionLanguage $expressionLanguage)
}

/**
* @param EventContextInterface $eventContext
* @param EventContextInterface $eventContext
*/
public function start(EventContextInterface $eventContext)
{
Expand All @@ -84,7 +84,7 @@ public function start(EventContextInterface $eventContext)
}

/**
* @param WorkItemContextInterface $workItemContext
* @param WorkItemContextInterface $workItemContext
*/
public function allocateWorkItem(WorkItemContextInterface $workItemContext)
{
Expand All @@ -97,7 +97,7 @@ public function allocateWorkItem(WorkItemContextInterface $workItemContext)
}

/**
* @param WorkItemContextInterface $workItemContext
* @param WorkItemContextInterface $workItemContext
*/
public function startWorkItem(WorkItemContextInterface $workItemContext)
{
Expand All @@ -110,7 +110,7 @@ public function startWorkItem(WorkItemContextInterface $workItemContext)
}

/**
* @param WorkItemContextInterface $workItemContext
* @param WorkItemContextInterface $workItemContext
*/
public function completeWorkItem(WorkItemContextInterface $workItemContext)
{
Expand All @@ -124,7 +124,7 @@ public function completeWorkItem(WorkItemContextInterface $workItemContext)
}

/**
* @param WorkItemContextInterface $workItemContext
* @param WorkItemContextInterface $workItemContext
*
* @throws UnexpectedActivityStateException
*/
Expand Down Expand Up @@ -184,8 +184,7 @@ private function createWorkflow()
}

/**
* @param Workflow $workflow
*
* @param Workflow $workflow
* @return Workflow
*
* @since Method available since Release 1.2.0
Expand Down
2 changes: 1 addition & 1 deletion src/Process/ProcessAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
interface ProcessAwareInterface extends OperationInterface
{
/**
* @param Process $process
* @param Process $process
*/
public function setProcess(Process $process);
}
8 changes: 4 additions & 4 deletions src/Process/WorkItemContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ class WorkItemContext implements WorkItemContextInterface
private $processContext;

/**
* @param ParticipantInterface $participant
* @param ParticipantInterface $participant
*/
public function __construct(ParticipantInterface $participant)
{
$this->participant = $participant;
}

/**
* @param int|string $activityId
* @param int|string $activityId
*/
public function setActivityId($activityId)
{
$this->activityId = $activityId;
}

/**
* @param ProcessContextInterface $processContext
* @param ProcessContextInterface $processContext
*/
public function setProcessContext(ProcessContextInterface $processContext)
{
Expand All @@ -64,7 +64,7 @@ public function getActivityId()
}

/**
* @param ParticipantInterface $participant
* @param ParticipantInterface $participant
*
* @since Method available since Release 1.1.0
*/
Expand Down
Loading