Skip to content

Commit

Permalink
2.4 coding standart
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyraul committed Jul 19, 2022
1 parent feea702 commit a2fe8c3
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 112 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/grumphp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Static Test

on:
workflow_dispatch:
pull_request:
branches:
- v2.4
push:
branches:
- v2.4

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.1']
steps:
- uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, intl, mysql
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- run: composer self-update --2
- run: echo "{\"http-basic\":{\"repo.magento.com\":{\"username\":\"${MAGE_LOGIN}\",\"password\":\"${MAGE_PWD}\"}}}" > auth.json
env:
MAGE_LOGIN: ${{ secrets.MAGE_LOGIN }}
MAGE_PWD: ${{ secrets.MAGE_PWD }}
- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- run: php vendor/bin/phpcs --config-set ignore_warnings_on_exit 1
- run: php vendor/bin/phpcs --config-set show_warnings 0
- name: Run Tests
run: php vendor/bin/grumphp run
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
/composer.lock
.DS_Store
.php_cs.cache
.php-cs-fixer.cache
auth.json
/generate
File renamed without changes.
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Api/Data/KeysInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

interface KeysInterface
{
const ID = 'id';
const CODE = 'code';
const ORDER_ID = 'order_id';
const HKEY = 'hkey';
public const ID = 'id';
public const CODE = 'code';
public const ORDER_ID = 'order_id';
public const HKEY = 'hkey';

/**
* Get id
Expand Down
16 changes: 8 additions & 8 deletions Api/Data/RegistrationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

interface RegistrationInterface
{
const ID = 'id';
const CODE = 'code';
const ORDER_ID = 'order_id';
const PAYMENT_ID = 'payment_id';
const PAYMENT_URL = 'payment_url';
const TRY = 'try';
const PAYMENT_TYPE = 'payment_type';
const CREATED_AT = 'created_at';
public const ID = 'id';
public const CODE = 'code';
public const ORDER_ID = 'order_id';
public const PAYMENT_ID = 'payment_id';
public const PAYMENT_URL = 'payment_url';
public const TRY = 'try';
public const PAYMENT_TYPE = 'payment_type';
public const CREATED_AT = 'created_at';

/**
* Get id
Expand Down
3 changes: 2 additions & 1 deletion Block/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public function isPaid()
public function isComplete()
{
$state = $this->getOrder()->getState();
if ($this->getOrder()->isCanceled() ||
if (
$this->getOrder()->isCanceled() ||
$state === Order::STATE_COMPLETE ||
$state === Order::STATE_CLOSED
) {
Expand Down
24 changes: 14 additions & 10 deletions Helper/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ public function proceedReceipt($order, $transactionId, $parentTransactionId, $tr
{
$this->helper->debug('proceed receipt: ' . $transactionId, $transData);

if ($this->checkIfTransactionExists(
$transactionId,
$order->getPayment()->getId(),
$order->getId()
)) {
if (
$this->checkIfTransactionExists(
$transactionId,
$order->getPayment()->getId(),
$order->getId()
)
) {
$this->helper->notice('transaction %1 already exists', $transactionId);

return;
Expand Down Expand Up @@ -199,11 +201,13 @@ public function proceedRefundReceipt($order, $transactionId, $parentTransactionI
{
$this->helper->debug('Proceed receipt refund: ' . $transactionId, $transData);

if ($this->checkIfTransactionExists(
$transactionId,
$order->getPayment()->getId(),
$order->getId()
)) {
if (
$this->checkIfTransactionExists(
$transactionId,
$order->getPayment()->getId(),
$order->getId()
)
) {
$this->helper->notice('Transaction %1 already exists', $transactionId);

return;
Expand Down
5 changes: 3 additions & 2 deletions Model/Method/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ public function executeCustomCommand($commandCode, $arguments = [])
return;
}

if (isset($arguments['payment'])
if (
isset($arguments['payment'])
&& $arguments['payment'] instanceof \Magento\Payment\Model\InfoInterface
) {
) {
$arguments['payment'] = $this->paymentDataObjectFactory->create($arguments['payment']);
}
$command = $this->commandPool->get($commandCode);
Expand Down
4 changes: 2 additions & 2 deletions Model/Source/Steps.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

class Steps implements \Magento\Framework\Option\ArrayInterface
{
const ONE_STEP = 1;
const TWO_STEP = 2;
public const ONE_STEP = 1;
public const TWO_STEP = 2;

/**
* One/Two factor payment
Expand Down
16 changes: 10 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mygento/module-payment",
"type": "magento2-module",
"version": "2.4.0-RC1",
"version": "2.4.0",
"license": "OSL-3.0",
"homepage": "https://github.com/mygento/module-payment",
"description": "Mygento Payment Base",
Expand All @@ -23,13 +23,11 @@
],
"require": {
"magento/module-payment": "100.*",
"mygento/module-base": "~2.4.0-RC1"
"mygento/module-base": "~2.4.0"
},
"require-dev": {
"mygento/coding-standard": "~2.14.0-beta3"
"mygento/coding-standard": "~2.14.0"
},
"minimum-stability": "RC",
"prefer-stable": true,
"autoload": {
"files": [
"registration.php"
Expand All @@ -41,5 +39,11 @@
"repositories": [{
"type": "composer",
"url": "https://repo.magento.com"
}]
}],
"config": {
"allow-plugins": {
"magento/composer-dependency-version-audit-plugin": false,
"phpro/grumphp": true
}
}
}
4 changes: 2 additions & 2 deletions grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ grumphp:
- "exit;"
phplint:
phpcsfixer:
config: '.php_cs'
config: '.php-cs-fixer.php'
phpmd:
ruleset: ['vendor/mygento/coding-standard/Mygento-Mage2/phpmd.xml']
phpcs:
warning_severity: null
warning_severity: 0
xmllint:
phpstan:
autoload_file: 'vendor/mygento/coding-standard/stan/autoload.php'
Expand Down
3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ includes:
- vendor/mygento/coding-standard/stan/extension.neon

parameters:
bootstrap: 'vendor/mygento/coding-standard/stan/autoload.php'
bootstrapFiles:
- 'vendor/mygento/coding-standard/stan/autoload.php'
57 changes: 0 additions & 57 deletions psalm.xml

This file was deleted.

0 comments on commit a2fe8c3

Please sign in to comment.