Fix phpstan issues

This commit is contained in:
2023-02-28 21:43:28 +01:00
parent 7dc07129f8
commit 318599334e
21 changed files with 81 additions and 208 deletions

View File

@@ -16,15 +16,17 @@ use Chill\DocStoreBundle\Entity\StoredObject;
/**
* Interface for context for document generation.
*
* @template T of object
*/
interface DocGeneratorContextInterface
{
/**
* Get the data that will be injected to the generated document.
*
* @param mixed $entity
* @param T $entity
*/
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array;
public function getData(DocGeneratorTemplate $template, object $entity, array $contextGenerationData = []): array;
public function getDescription(): string;
@@ -34,5 +36,8 @@ interface DocGeneratorContextInterface
public function getName(): string;
/**
* @param T $entity
*/
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void;
}

View File

@@ -14,34 +14,43 @@ namespace Chill\DocGeneratorBundle\Context;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Symfony\Component\Form\FormBuilderInterface;
/**
* @template T
*/
interface DocGeneratorContextWithPublicFormInterface extends DocGeneratorContextInterface
{
/**
* Generate the form that display.
*
* @param mixed $entity
* @param T $entity
*/
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void;
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, mixed $entity): void;
/**
* Fill the form with initial data
*
* @param T $entity
*/
public function getFormData(DocGeneratorTemplate $template, $entity): array;
public function getFormData(DocGeneratorTemplate $template, mixed $entity): array;
/**
* has form.
*
* @param mixed $entity
* @param T $entity
*/
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool;
public function hasPublicForm(DocGeneratorTemplate $template, mixed $entity): bool;
/**
* Transform the data from the form into serializable data, storable into messenger's message
*
* @param T $entity
*/
public function contextGenerationDataNormalize(DocGeneratorTemplate $template, $entity, array $data): array;
public function contextGenerationDataNormalize(DocGeneratorTemplate $template, mixed $entity, array $data): array;
/**
* Reverse the data from the messenger's message into data usable for doc's generation
*
* @param T $entity
*/
public function contextGenerationDataDenormalize(DocGeneratorTemplate $template, $entity, array $data): array;
public function contextGenerationDataDenormalize(DocGeneratorTemplate $template, mixed $entity, array $data): array;
}