Skip to content

Commit

Permalink
fix phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Aug 30, 2023
1 parent 9acfa1f commit 62270df
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 43 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"require": {
"php": "^8.2",
"pimcore/pimcore": "^11.0",
"symfony/form": "^6.0",
"symfony/form": "^6.2",
"symfony/intl": "^6.2",
"doctrine/orm": "^2.7"
},
"require-dev": {
Expand Down
17 changes: 4 additions & 13 deletions src/OutputWorkflow/Channel/Api/ApiOutputChannelWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,12 @@

class ApiOutputChannelWorker
{
protected FormValuesOutputApplierInterface $formValuesOutputApplier;
protected ApiProviderRegistry $apiProviderRegistry;
protected FieldTransformerRegistry $fieldTransformerRegistry;
protected EventDispatcherInterface $eventDispatcher;

public function __construct(
FormValuesOutputApplierInterface $formValuesOutputApplier,
ApiProviderRegistry $apiProviderRegistry,
FieldTransformerRegistry $fieldTransformerRegistry,
EventDispatcherInterface $eventDispatcher
protected FormValuesOutputApplierInterface $formValuesOutputApplier,
protected ApiProviderRegistry $apiProviderRegistry,
protected FieldTransformerRegistry $fieldTransformerRegistry,
protected EventDispatcherInterface $eventDispatcher
) {
$this->formValuesOutputApplier = $formValuesOutputApplier;
$this->apiProviderRegistry = $apiProviderRegistry;
$this->fieldTransformerRegistry = $fieldTransformerRegistry;
$this->eventDispatcher = $eventDispatcher;
}

public function process(SubmissionEvent $submissionEvent, string $workflowName, array $channelConfiguration): void
Expand Down
11 changes: 4 additions & 7 deletions src/OutputWorkflow/Channel/Email/EmailOutputChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@

class EmailOutputChannel implements ChannelInterface
{
protected EmailOutputChannelWorker $channelWorker;
protected LocaleDataMapper $localeDataMapper;

public function __construct(EmailOutputChannelWorker $channelWorker, LocaleDataMapper $localeDataMapper)
{
$this->channelWorker = $channelWorker;
$this->localeDataMapper = $localeDataMapper;
public function __construct(
protected EmailOutputChannelWorker $channelWorker,
protected LocaleDataMapper $localeDataMapper
) {
}

public function getFormType(): string
Expand Down
15 changes: 4 additions & 11 deletions src/OutputWorkflow/Channel/Email/EmailOutputChannelWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@

class EmailOutputChannelWorker
{
protected Configuration $configuration;
protected MailParser $mailParser;
protected EventDispatcherInterface $eventDispatcher;

public function __construct(
Configuration $configuration,
MailParser $mailParser,
EventDispatcherInterface $eventDispatcher
protected Configuration $configuration,
protected MailParser $mailParser,
protected EventDispatcherInterface $eventDispatcher
) {
$this->configuration = $configuration;
$this->mailParser = $mailParser;
$this->eventDispatcher = $eventDispatcher;
}

/**
Expand Down Expand Up @@ -89,7 +82,7 @@ public function process(FormInterface $form, array $channelConfiguration, array
*/
protected function sendPlainTextOnly(Mail $mail): void
{
$mail->setSubject($mail->getSubjectRendered());
$mail->subject($mail->getSubjectRendered());
$bodyTextRendered = $mail->getBodyTextRendered();

if ($bodyTextRendered) {
Expand Down
5 changes: 1 addition & 4 deletions src/OutputWorkflow/Channel/Funnel/Action/ChannelAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@

class ChannelAction implements FunnelActionInterface
{
protected UrlGeneratorInterface $router;

public function __construct(UrlGeneratorInterface $router)
public function __construct(protected UrlGeneratorInterface $router)
{
$this->router = $router;
}

public function getName(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function checkConditionalLogicConstraints(array $defaultFieldConstraints
$defaultFieldConstraints = [];
} else {
foreach ($returnStack->getData() as $constraint) {
$defaultFieldConstraints = array_filter($defaultFieldConstraints, function ($val) use ($constraint) {
$defaultFieldConstraints = array_filter($defaultFieldConstraints, static function ($val) use ($constraint) {
return $val['type'] !== $constraint;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class FieldReturnStack implements ReturnStackInterface
*/
public function __construct(
protected string $actionType,
protected array $data = []
protected mixed $data
) {
if (!$this->isAssoc($this->data)) {
throw new \Exception('FieldReturnStack: Wrong data structure: data keys must contain form field names!');
Expand All @@ -21,12 +21,12 @@ public function getActionType(): string
return $this->actionType;
}

public function getData(): array
public function getData(): mixed
{
return $this->data;
}

public function updateData(array $data): void
public function updateData(mixed $data): void
{
$this->data = $data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SimpleReturnStack implements ReturnStackInterface
{
public function __construct(
protected string $actionType,
protected array $data = []
protected mixed $data
) {
}

Expand All @@ -15,7 +15,7 @@ public function getActionType(): string
return $this->actionType;
}

public function getData(): array
public function getData(): mixed
{
return $this->data;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Constraints/Recaptcha3Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ private function validateCaptcha(string $value): bool
return false;
}

return $this->reCaptchaProcessor->verify($value);
return $this->reCaptchaProcessor->verify($value)->isSuccess();
}
}

0 comments on commit 62270df

Please sign in to comment.