update code style after upgrade rector and phpstan

This commit is contained in:
2024-08-28 14:03:26 +02:00
parent bb848746d5
commit 8a374864fa
10 changed files with 22 additions and 41 deletions

View File

@@ -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')]

View File

@@ -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;

View File

@@ -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');

View File

@@ -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');

View File

@@ -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;
}

View File

@@ -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);