Merge branch 'master' into upgrade-php82

This commit is contained in:
2023-03-06 16:37:09 +01:00
41 changed files with 254 additions and 233 deletions

View File

@@ -39,6 +39,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use function strlen;
use const JSON_PRETTY_PRINT;
final class DocGeneratorTemplateController extends AbstractController
{
@@ -255,7 +256,7 @@ final class DocGeneratorTemplateController extends AbstractController
// if is test, render the data or generate the doc
if ($isTest && isset($form) && $form['show_data']->getData()) {
return $this->render('@ChillDocGenerator/Generator/debug_value.html.twig', [
'datas' => json_encode($context->getData($template, $entity, $contextGenerationData), JSON_PRETTY_PRINT)
'datas' => json_encode($context->getData($template, $entity, $contextGenerationData), JSON_PRETTY_PRINT),
]);
}
if ($isTest) {

View File

@@ -11,18 +11,21 @@ declare(strict_types=1);
namespace Chill\DocGeneratorBundle\Service\Generator;
class GeneratorException extends \RuntimeException
use RuntimeException;
use Throwable;
class GeneratorException extends RuntimeException
{
/**
* @var list<string>
*/
private array $errors;
public function __construct(array $errors = [], \Throwable $previous = null)
public function __construct(array $errors = [], ?Throwable $previous = null)
{
$this->errors = $errors;
parent::__construct(
"Could not generate the document",
'Could not generate the document',
15252,
$previous
);

View File

@@ -11,10 +11,12 @@ declare(strict_types=1);
namespace Chill\DocGeneratorBundle\Service\Generator;
class ObjectReadyException extends \RuntimeException
use RuntimeException;
class ObjectReadyException extends RuntimeException
{
public function __construct()
{
parent::__construct("object is already ready", 6698856);
parent::__construct('object is already ready', 6698856);
}
}

View File

@@ -11,12 +11,14 @@ declare(strict_types=1);
namespace Chill\DocGeneratorBundle\Service\Generator;
class RelatedEntityNotFoundException extends \RuntimeException
use RuntimeException;
class RelatedEntityNotFoundException extends RuntimeException
{
public function __construct(string $relatedEntityClass, int $relatedEntityId, \Throwable $previous = null)
public function __construct(string $relatedEntityClass, int $relatedEntityId, ?\Throwable $previous = null)
{
parent::__construct(
sprintf("Related entity not found: %s, %s", $relatedEntityClass, $relatedEntityId),
sprintf('Related entity not found: %s, %s', $relatedEntityClass, $relatedEntityId),
99876652,
$previous
);