mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
update code style after upgrade rector and phpstan
This commit is contained in:
parent
bb848746d5
commit
8a374864fa
@ -25,9 +25,9 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
class SignatureRequestController
|
||||
{
|
||||
public function __construct(
|
||||
private MessageBusInterface $messageBus,
|
||||
private StoredObjectManagerInterface $storedObjectManager,
|
||||
private EntityWorkflowManager $entityWorkflowManager,
|
||||
private readonly MessageBusInterface $messageBus,
|
||||
private readonly StoredObjectManagerInterface $storedObjectManager,
|
||||
private readonly EntityWorkflowManager $entityWorkflowManager,
|
||||
) {}
|
||||
|
||||
#[Route('/api/1.0/document/workflow/{id}/signature-request', name: 'chill_docstore_signature_request')]
|
||||
|
@ -45,7 +45,7 @@ class StoredObjectVoter extends Voter
|
||||
$grant = $storedObjectVoter->voteOnAttribute($attributeAsEnum, $subject, $token);
|
||||
|
||||
if (false === $grant) {
|
||||
$this->logger->debug(self::LOG_PREFIX.'deny access by storedObjectVoter', ['stored_object_voter' => get_class($storedObjectVoter)]);
|
||||
$this->logger->debug(self::LOG_PREFIX.'deny access by storedObjectVoter', ['stored_object_voter' => $storedObjectVoter::class]);
|
||||
}
|
||||
|
||||
return $grant;
|
||||
|
@ -25,7 +25,7 @@ final readonly class PdfSignedMessageSerializer implements SerializerInterface
|
||||
$body = $encodedEnvelope['body'];
|
||||
|
||||
try {
|
||||
$decoded = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
|
||||
$decoded = json_decode((string) $body, true, 512, JSON_THROW_ON_ERROR);
|
||||
} catch (\JsonException $e) {
|
||||
throw new MessageDecodingFailedException('Could not deserialize message', previous: $e);
|
||||
}
|
||||
@ -34,7 +34,7 @@ final readonly class PdfSignedMessageSerializer implements SerializerInterface
|
||||
throw new MessageDecodingFailedException('Could not find expected keys: signatureId or content');
|
||||
}
|
||||
|
||||
$content = base64_decode($decoded['content'], true);
|
||||
$content = base64_decode((string) $decoded['content'], true);
|
||||
|
||||
if (false === $content) {
|
||||
throw new MessageDecodingFailedException('Invalid character found in the base64 encoded content');
|
||||
|
@ -39,13 +39,13 @@ final readonly class RequestPdfSignMessageSerializer implements SerializerInterf
|
||||
throw new MessageDecodingFailedException('serializer does not support this message');
|
||||
}
|
||||
|
||||
$data = json_decode($body, true);
|
||||
$data = json_decode((string) $body, true);
|
||||
|
||||
$zoneSignature = $this->denormalizer->denormalize($data['signatureZone'], PDFSignatureZone::class, 'json', [
|
||||
AbstractNormalizer::GROUPS => ['write'],
|
||||
]);
|
||||
|
||||
$content = base64_decode($data['content'], true);
|
||||
$content = base64_decode((string) $data['content'], true);
|
||||
|
||||
if (false === $content) {
|
||||
throw new MessageDecodingFailedException('the content could not be converted from base64 encoding');
|
||||
|
@ -17,7 +17,7 @@ class PDFSignatureZoneParser
|
||||
{
|
||||
public const ZONE_SIGNATURE_START = 'signature_zone';
|
||||
|
||||
private Parser $parser;
|
||||
private readonly Parser $parser;
|
||||
|
||||
public function __construct(
|
||||
public float $defaultHeight = 90.0,
|
||||
@ -48,7 +48,7 @@ class PDFSignatureZoneParser
|
||||
);
|
||||
|
||||
foreach ($page->getDataTm() as $dataTm) {
|
||||
if (str_starts_with($dataTm[1], self::ZONE_SIGNATURE_START)) {
|
||||
if (str_starts_with((string) $dataTm[1], self::ZONE_SIGNATURE_START)) {
|
||||
$zones[] = new PDFSignatureZone($zoneIndex, (float) $dataTm[0][4], (float) $dataTm[0][5], $this->defaultHeight, $this->defaultWidth, $pdfPage);
|
||||
++$zoneIndex;
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ class AbstractStoredObjectVoterTest extends TestCase
|
||||
// Anonymous class extending the abstract class
|
||||
return new class ($canBeAssociatedWithWorkflow, $repository, $security, $workflowDocumentService) extends AbstractStoredObjectVoter {
|
||||
public function __construct(
|
||||
private bool $canBeAssociatedWithWorkflow,
|
||||
private AssociatedEntityToStoredObjectInterface $repository,
|
||||
private readonly bool $canBeAssociatedWithWorkflow,
|
||||
private readonly AssociatedEntityToStoredObjectInterface $repository,
|
||||
Security $security,
|
||||
?WorkflowStoredObjectPermissionHelper $workflowDocumentService = null
|
||||
) {
|
||||
@ -101,7 +101,7 @@ class AbstractStoredObjectVoterTest extends TestCase
|
||||
|
||||
public function testSupportsOnAttribute(): void
|
||||
{
|
||||
list($user, $token, $subject, $entity) = $this->setupMockObjects();
|
||||
[$user, $token, $subject, $entity] = $this->setupMockObjects();
|
||||
|
||||
// Setup mocks for voteOnAttribute method
|
||||
$this->setupMocksForVoteOnAttribute($user, $token, true, $entity, true);
|
||||
@ -112,7 +112,7 @@ class AbstractStoredObjectVoterTest extends TestCase
|
||||
|
||||
public function testVoteOnAttributeAllowedAndWorkflowAllowed(): void
|
||||
{
|
||||
list($user, $token, $subject, $entity) = $this->setupMockObjects();
|
||||
[$user, $token, $subject, $entity] = $this->setupMockObjects();
|
||||
|
||||
// Setup mocks for voteOnAttribute method
|
||||
$this->setupMocksForVoteOnAttribute($user, $token, true, $entity, true);
|
||||
@ -124,7 +124,7 @@ class AbstractStoredObjectVoterTest extends TestCase
|
||||
|
||||
public function testVoteOnAttributeNotAllowed(): void
|
||||
{
|
||||
list($user, $token, $subject, $entity) = $this->setupMockObjects();
|
||||
[$user, $token, $subject, $entity] = $this->setupMockObjects();
|
||||
|
||||
// Setup mocks for voteOnAttribute method where isGranted() returns false
|
||||
$this->setupMocksForVoteOnAttribute($user, $token, false, $entity, true);
|
||||
@ -136,7 +136,7 @@ class AbstractStoredObjectVoterTest extends TestCase
|
||||
|
||||
public function testVoteOnAttributeAllowedWorkflowNotAllowed(): void
|
||||
{
|
||||
list($user, $token, $subject, $entity) = $this->setupMockObjects();
|
||||
[$user, $token, $subject, $entity] = $this->setupMockObjects();
|
||||
|
||||
// Setup mocks for voteOnAttribute method
|
||||
$this->setupMocksForVoteOnAttribute($user, $token, true, $entity, false);
|
||||
@ -152,7 +152,7 @@ class AbstractStoredObjectVoterTest extends TestCase
|
||||
|
||||
public function testVoteOnAttributeAllowedWorkflowAllowedToSeeDocument(): void
|
||||
{
|
||||
list($user, $token, $subject, $entity) = $this->setupMockObjects();
|
||||
[$user, $token, $subject, $entity] = $this->setupMockObjects();
|
||||
|
||||
// Setup mocks for voteOnAttribute method
|
||||
$this->setupMocksForVoteOnAttribute($user, $token, true, $entity, false);
|
||||
|
@ -17,6 +17,7 @@ use Chill\DocStoreBundle\Security\Authorization\StoredObjectVoter\AbstractStored
|
||||
use Chill\DocStoreBundle\Service\WorkflowStoredObjectPermissionHelper;
|
||||
use Chill\EventBundle\Entity\Event;
|
||||
use Chill\EventBundle\Repository\EventRepository;
|
||||
use Chill\EventBundle\Security\EventVoter;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class EventStoredObjectVoter extends AbstractStoredObjectVoter
|
||||
|
@ -161,8 +161,6 @@ class EntityWorkflowStep
|
||||
$this->signatures->removeElement($signature);
|
||||
}
|
||||
|
||||
$signature->detachEntityWorkflowStep();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -51,16 +51,12 @@ class EntityWorkflowStepSignature implements TrackCreationInterface, TrackUpdate
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true, options: ['default' => null])]
|
||||
private ?int $zoneSignatureIndex = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: EntityWorkflowStep::class, inversedBy: 'signatures')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?EntityWorkflowStep $step = null;
|
||||
|
||||
public function __construct(
|
||||
EntityWorkflowStep $step,
|
||||
#[ORM\ManyToOne(targetEntity: EntityWorkflowStep::class, inversedBy: 'signatures')]
|
||||
private EntityWorkflowStep $step,
|
||||
User|Person $signer,
|
||||
) {
|
||||
$this->step = $step;
|
||||
$step->addSignature($this);
|
||||
$this->step->addSignature($this);
|
||||
$this->setSigner($signer);
|
||||
}
|
||||
|
||||
@ -139,18 +135,4 @@ class EntityWorkflowStepSignature implements TrackCreationInterface, TrackUpdate
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach from the @see{EntityWorkflowStep}.
|
||||
*
|
||||
* @internal used internally to remove the current signature
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function detachEntityWorkflowStep(): self
|
||||
{
|
||||
$this->step = null;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ use Doctrine\Persistence\ObjectRepository;
|
||||
*/
|
||||
class EntityWorkflowStepSignatureRepository implements ObjectRepository
|
||||
{
|
||||
private \Doctrine\ORM\EntityRepository $repository;
|
||||
private readonly \Doctrine\ORM\EntityRepository $repository;
|
||||
|
||||
public function __construct(EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user