Set return types to MetadataExtractor

This commit is contained in:
Julien Fastré 2024-10-18 19:14:23 +02:00
parent 508c4cd674
commit 29fa086fde
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -25,6 +25,9 @@ class MetadataExtractor
private readonly DuplicateEntityWorkflowFinder $duplicateEntityWorkflowFinder, private readonly DuplicateEntityWorkflowFinder $duplicateEntityWorkflowFinder,
) {} ) {}
/**
* @return list<array{name: string, text: string}>
*/
public function availableWorkflowFor(string $relatedEntityClass, ?int $relatedEntityId = 0): array public function availableWorkflowFor(string $relatedEntityClass, ?int $relatedEntityId = 0): array
{ {
$blankEntityWorkflow = new EntityWorkflow(); $blankEntityWorkflow = new EntityWorkflow();
@ -56,6 +59,9 @@ class MetadataExtractor
return $workflowsList; return $workflowsList;
} }
/**
* @return array{name: string, text: string}
*/
public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow, ?EntityWorkflowStep $step = null): array public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow, ?EntityWorkflowStep $step = null): array
{ {
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
@ -69,6 +75,9 @@ class MetadataExtractor
return ['name' => $step->getCurrentStep(), 'text' => $text]; return ['name' => $step->getCurrentStep(), 'text' => $text];
} }
/**
* @return array{name?: string, text?: string, isForward?: bool}
*/
public function buildArrayPresentationForTransition(EntityWorkflow $entityWorkflow, string $transitionName): array public function buildArrayPresentationForTransition(EntityWorkflow $entityWorkflow, string $transitionName): array
{ {
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
@ -90,6 +99,9 @@ class MetadataExtractor
return []; return [];
} }
/**
* @return array{name: string, text: string}
*/
public function buildArrayPresentationForWorkflow(WorkflowInterface $workflow): array public function buildArrayPresentationForWorkflow(WorkflowInterface $workflow): array
{ {
$metadata = $workflow->getMetadataStore()->getWorkflowMetadata(); $metadata = $workflow->getMetadataStore()->getWorkflowMetadata();