Skip to content

Commit

Permalink
Ecs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabulousPuppet committed Jul 28, 2022
1 parent a6d2056 commit b911adf
Show file tree
Hide file tree
Showing 20 changed files with 27 additions and 54 deletions.
3 changes: 1 addition & 2 deletions src/Bus/Command/CreateReferenceForRefund.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public function __construct(
string $refundReference,
RefundPaymentInterface $refundPayment,
PaymentInterface $payment
)
{
) {
$details = $payment->getDetails();
Assert::keyExists($details, 'pspReference', 'Payment pspReference is not present');

Expand Down
3 changes: 1 addition & 2 deletions src/Controller/Shop/DropinConfigurationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public function __invoke(
Request $request,
string $code,
?string $orderToken = null
): JsonResponse
{
): JsonResponse {
$order = $this->getOrder($orderToken);

if (null === $order || null === $order->getId()) {
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/Shop/RemoveStoredTokenAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public function __invoke(
string $code,
string $paymentReference,
Request $request
): Response
{
): Response {
/**
* @var ?CustomerInterface $customer
*/
Expand Down
3 changes: 1 addition & 2 deletions src/Factory/LogFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public function create(
string $message,
int $level,
int $errorCode
): LogInterface
{
): LogInterface {
/** @var LogInterface $log */
$log = $this->createNew();

Expand Down
3 changes: 1 addition & 2 deletions src/Form/Type/CredentialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public function buildView(
FormView $view,
FormInterface $form,
array $options
): void
{
): void {
if (0 === strlen((string) $view->vars['value']) || $form->isSubmitted()) {
return;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Form/Type/PaymentMethodChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public function buildView(
FormView $view,
FormInterface $form,
array $options
): void
{
): void {
parent::buildView($view, $form, $options);
$view->vars['environment'] = $options['environment'];
$view->vars['payment_methods'] = $options['payment_methods'];
Expand Down
3 changes: 1 addition & 2 deletions src/Grid/Filter/LoggerLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public function apply(
string $name,
$data,
array $options
): void
{
): void {
/** @psalm-suppress MixedArrayAccess */
$dataSource->restrict($dataSource->getExpressionBuilder()->equals('level', $data['loggerLevel']));
}
Expand Down
3 changes: 1 addition & 2 deletions src/Normalizer/AbstractPaymentNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public function supportsNormalization(
$data,
string $format = null,
array $context = []
): bool
{
): bool {
return isset($context[self::NORMALIZER_ENABLED]);
}
}
6 changes: 2 additions & 4 deletions src/Normalizer/AdditionalDetailsNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public function supportsNormalization(
$data,
string $format = null,
array $context = []
): bool
{
): bool {
return parent::supportsNormalization($data, $format, $context) && $data instanceof OrderInterface;
}

Expand Down Expand Up @@ -82,8 +81,7 @@ public function normalize(
$object,
string $format = null,
array $context = []
): array
{
): array {
Assert::isInstanceOf($object, OrderInterface::class);

$customer = $object->getCustomer();
Expand Down
6 changes: 2 additions & 4 deletions src/Normalizer/AddressNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public function supportsNormalization(
$data,
string $format = null,
array $context = []
): bool
{
): bool {
return parent::supportsNormalization($data, $format, $context) && $data instanceof AddressInterface;
}

Expand All @@ -44,8 +43,7 @@ public function normalize(
$object,
string $format = null,
array $context = []
): array
{
): array {
Assert::isInstanceOf($object, AddressInterface::class);

$address = [
Expand Down
6 changes: 2 additions & 4 deletions src/Normalizer/OrderItemToLineItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public function supportsNormalization(
$data,
string $format = null,
array $context = []
): bool
{
): bool {
return parent::supportsNormalization($data, $format, $context) && $data instanceof OrderItemInterface;
}

Expand All @@ -58,8 +57,7 @@ public function normalize(
$object,
string $format = null,
array $context = []
): array
{
): array {
Assert::isInstanceOf($object, OrderItemInterface::class);

$locale = $this->getLocale();
Expand Down
6 changes: 2 additions & 4 deletions src/Processor/PaymentResponseProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ private function processForPaymentSpecified(
string $code,
Request $request,
PaymentInterface $payment
): ?string
{
): ?string {
foreach ($this->processors as $processor) {
if (!$processor->accepts($request, $payment)) {
continue;
Expand All @@ -57,8 +56,7 @@ public function process(
string $code,
Request $request,
?PaymentInterface $payment
): string
{
): string {
$result = null;
if (null !== $payment) {
$result = $this->processForPaymentSpecified($code, $request, $payment);
Expand Down
3 changes: 1 addition & 2 deletions src/Processor/PaymentResponseProcessor/AbstractProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ protected function addFlash(
Request $request,
string $type,
string $message
): void
{
): void {
if (null !== $this->translator) {
$message = $this->translator->trans($message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ public function process(
string $code,
Request $request,
PaymentInterface $payment
): string
{
): string {
$this->addFlash($request, self::FLASH_ERROR, self::LABEL_PAYMENT_FAILED);

$this->dispatchPaymentStatusReceived($payment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public function process(
string $code,
Request $request,
PaymentInterface $payment
): string
{
): string {
$tokenValue = $request->query->get('tokenValue');
if (null === $tokenValue) {
$this->setActiveOrderViaPayment($request, $payment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public function process(
string $code,
Request $request,
PaymentInterface $payment
): string
{
): string {
$this->dispatchPaymentStatusReceived($payment);
$this->addFlash($request, self::FLASH_INFO, self::LABEL_PROCESSING);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public function process(
string $code,
Request $request,
PaymentInterface $payment
): string
{
): string {
$targetRoute = self::THANKS_ROUTE_NAME;

$this->dispatchPaymentStatusReceived($payment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ private function fetchPayment(
string $paymentCode,
string $reference,
?string $originalReference
): PaymentInterface
{
): PaymentInterface {
try {
$reference = $this->adyenReferenceRepository->getOneByCodeAndReference(
$paymentCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public function denormalize(
string $type,
string $format = null,
array $context = []
)
{
) {
if (!isset($data[self::DENORMALIZATION_PROCESSED_FLAG]) && is_array($data)) {
$data['eventCode'] = strtolower((string) $data['eventCode']);
$data[self::DENORMALIZATION_PROCESSED_FLAG] = true;
Expand All @@ -49,8 +48,7 @@ public function supportsDenormalization(
$data,
string $type,
string $format = null
): bool
{
): bool {
return
NotificationItemData::class === $type
&& isset($data['eventCode'], $data['paymentMethod'])
Expand All @@ -77,8 +75,7 @@ public function normalize(
$object,
string $format = null,
array $context = []
)
{
) {
if (!isset($context[$this->getNormalizationMarking($object)])) {
$context[$this->getNormalizationMarking($object)] = true;
}
Expand All @@ -99,8 +96,7 @@ public function supportsNormalization(
$data,
string $format = null,
array $context = []
)
{
) {
return
$data instanceof NotificationItemData
&& !isset($context[$this->getNormalizationMarking($data)])
Expand Down
3 changes: 1 addition & 2 deletions src/Validator/Constraint/AdyenCredentialsValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public function isApiKeyValid(
string $environment,
?string $merchantAccount,
?string $apiKey
): bool
{
): bool {
$this->validateArguments($merchantAccount, $apiKey);

$payload = [
Expand Down

0 comments on commit b911adf

Please sign in to comment.