Skip to content

Commit

Permalink
CS fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
s4ddly committed Jan 10, 2024
1 parent acb1763 commit c38730d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"url": "https://github.com/magento/magento2.git"
}
],
"scripts": {
"cs:fixer": "./vendor/bin/php-cs-fixer fix -vvv --diff",
"cs:phpstan": "./vendor/bin/phpstan",
"cs:psalm": "./vendor/bin/psalm"
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
run: composer normalize --diff --dry-run --indent-size=4 --indent-style=space ../composer.json

- working-directory: .dev-tools
run: ./vendor/bin/php-cs-fixer fix -vvv --diff --dry-run
run: composer cs:fixer -- --dry-run

- working-directory: .dev-tools
run: ./vendor/bin/phpstan
run: composer cs:phpstan

- working-directory: .dev-tools
run: ./vendor/bin/psalm --no-progress --shepherd
run: composer cs:psalm -- --no-progress --shepherd
2 changes: 1 addition & 1 deletion Model/ApiFacade/CardTransaction/CardApiFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private function getCurrent()

private function createOpenApiInstance(TpayInterface $tpay, TpayTokensService $tokensService, TpayService $tpayService)
{
if ($this->storeManager->getStore()->getCurrentCurrencyCode() !== 'PLN') {
if ('PLN' !== $this->storeManager->getStore()->getCurrentCurrencyCode()) {
$this->cardOpen = null;
$this->useOpenCard = false;

Expand Down
2 changes: 1 addition & 1 deletion Model/ApiFacade/TpayConfig/ConfigFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private function getCurrentApi()

private function createOpenApiInstance(TpayInterface $tpay, Repository $assetRepository, TpayTokensService $tokensService, StoreManagerInterface $storeManager)
{
if ($storeManager->getStore()->getCurrentCurrencyCode() !== 'PLN') {
if ('PLN' !== $storeManager->getStore()->getCurrentCurrencyCode()) {
$this->openApi = null;
$this->useOpenApi = false;

Expand Down
2 changes: 1 addition & 1 deletion Model/GenericPaymentPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function beforeImportData(Payment $compiled, array $data): array
$data['channel'] = explode('-', $data['method'])[1];
$data['method'] = TpayInterface::CODE;
}
if ($data['method'] == 'tpaycom_magento2basic_cards') {
if ('tpaycom_magento2basic_cards' == $data['method']) {
$data['method'] = TpayInterface::CODE;
}

Expand Down
4 changes: 2 additions & 2 deletions Model/MethodListPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public function getMethodInstance(string $title, string $code): MethodInterface

private function filterResult(array $result): array
{
if ($this->storeManager->getStore()->getCurrentCurrencyCode() === 'PLN') {
if ('PLN' === $this->storeManager->getStore()->getCurrentCurrencyCode()) {
return $result;
}

return array_filter($result, function ($method) {
return $method->getCode() !== 'tpaycom_magento2basic';
return 'tpaycom_magento2basic' !== $method->getCode();
});
}
}

0 comments on commit c38730d

Please sign in to comment.