Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Use tpay-com/coding-standards (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Aug 21, 2023
1 parent ff0b608 commit c4ae94d
Show file tree
Hide file tree
Showing 19 changed files with 185 additions and 350 deletions.
84 changes: 9 additions & 75 deletions .dev-tools/.php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,82 +1,16 @@
<?php

require __DIR__.'/vendor/kubawerlos/php-cs-fixer-custom-fixers/bootstrap.php';
require __DIR__.'/vendor/autoload.php';

use PhpCsFixerCustomFixers\Fixer;

return (new PhpCsFixer\Config())
->registerCustomFixers(new \PhpCsFixerCustomFixers\Fixers())
$config = Tpay\CodingStandards\PhpCsFixerConfigFactory::createWithLegacyRules()
->setFinder(
PhpCsFixer\Finder::create()
->ignoreDotFiles(false)
->in(__DIR__.'/..')
)
->setRules([
'@PSR12' => true,
'array_indentation' => true,
'array_syntax' => true,
'binary_operator_spaces' => true,
'cast_spaces' => ['space' => 'none'],
'class_attributes_separation' => [
'elements' => [
'const' => 'none',
'method' => 'one',
'property' => 'none',
'trait_import' => 'none',
],
],
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'space_before_parenthesis' => true,
],
'concat_space' => true,
'header_comment' => ['header' => ''],
'multiline_whitespace_before_semicolons' => true,
'no_alias_language_construct_call' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_extra_blank_lines' => ['tokens' => ['attribute', 'break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use']],
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_trailing_whitespace' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_concat_operator' => true,
'no_useless_else' => true,
'operator_linebreak' => true,
'ordered_imports' => true,
'phpdoc_align' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_param_order' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types_order' => true,
'phpdoc_var_annotation_correct_order' => true,
'return_assignment' => true,
'simplified_if_return' => true,
'single_quote' => true,
'single_space_around_construct' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'trim_array_spaces' => true,
'visibility_required' => ['elements' => ['method']],
'yoda_style' => true,
Fixer\CommentSurroundedBySpacesFixer::name() => true,
Fixer\NoCommentedOutCodeFixer::name() => true,
Fixer\NoPhpStormGeneratedCommentFixer::name() => true,
Fixer\NoSuperfluousConcatenationFixer::name() => true,
Fixer\NoTrailingCommaInSinglelineFixer::name() => true,
Fixer\NoUselessCommentFixer::name() => true,
Fixer\NoUselessDirnameCallFixer::name() => true,
Fixer\NoUselessParenthesisFixer::name() => true,
Fixer\PhpdocArrayStyleFixer::name() => true,
Fixer\PhpdocNoIncorrectVarAnnotationFixer::name() => true,
Fixer\PhpdocNoSuperfluousParamFixer::name() => true,
Fixer\PhpdocParamTypeFixer::name() => true,
Fixer\PhpdocSelfAccessorFixer::name() => true,
Fixer\PhpdocTypesCommaSpacesFixer::name() => true,
Fixer\PhpdocTypesTrimFixer::name() => true,
]);
);

$rules = $config->getRules();

$rules['nullable_type_declaration_for_default_null_value'] = false;

return $config->setRules($rules);
7 changes: 4 additions & 3 deletions .dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"require": {
"ergebnis/composer-normalize": "^2.35",
"kubawerlos/composer-smaller-lock": "^1.0.1",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.16.2",
"magento/magento2ce": "^2.4",
"php-cs-fixer/shim": "^3.23",
"phpstan/phpstan": "^1.10.29",
"tpay-com/coding-standards": "^1.0",
"tpay-com/tpay-php": "^2.3.4",
"vimeo/psalm": "^5.14.1"
"vimeo/psalm": "^5.15.0"
},
"repositories": [
{
Expand All @@ -21,6 +21,7 @@
"kubawerlos/composer-smaller-lock": true,
"magento/composer-dependency-version-audit-plugin": false,
"magento/magento-composer-installer": false
}
},
"prepend-autoloader": false
}
}
47 changes: 38 additions & 9 deletions .dev-tools/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 13 additions & 27 deletions Api/TpayCardsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,22 @@ interface TpayCardsInterface
*/
public function getTpayFormData($orderId = null);

/**
* @return string
*/
/** @return string */
public function getApiPassword();

/**
* @return string
*/
/** @return string */
public function getApiKey();

/**
* @return string
*/
/** @return string */
public function getVerificationCode();

/**
* @return string
*/
/** @return string */
public function getRSAKey();

/**
* @return string
*/
/** @return string */
public function getHashType();

/**
* @return string
*/
/** @return string */
public function getMidType();

/**
Expand All @@ -67,27 +55,25 @@ public function getPaymentRedirectUrl();
public function getInvoiceSendMail();

/**
* @param mixed $orderId
*
* @return string
*/
public function getCustomerId($orderId);

/**
* @param mixed $orderId
*
* @return bool
*/
public function isCustomerGuest($orderId);

/**
* @return bool
*/
/** @return bool */
public function isCustomerLoggedIn();

/**
* @return null|int
*/
/** @return null|int */
public function getCheckoutCustomerId();

/**
* @return bool
*/
/** @return bool */
public function getCardSaveEnabled();
}
16 changes: 4 additions & 12 deletions Controller/CardsTpaycom.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,16 @@ abstract class CardsTpaycom extends \Magento\Framework\App\Action\Action
// STR EMPTY
const STR_EMPTY = '';

/**
* @var \Magento\Customer\Model\Session
*/
/** @var \Magento\Customer\Model\Session */
protected $_customerSession;

/**
* @var \Magento\Checkout\Model\Session
*/
/** @var \Magento\Checkout\Model\Session */
protected $_checkoutSession;

/**
* @var \Magento\Sales\Model\OrderFactory
*/
/** @var \Magento\Sales\Model\OrderFactory */
protected $_orderFactory;

/**
* @var \tpaycom\magento2cards\Model\TpayCards
*/
/** @var \tpaycom\magento2cards\Model\TpayCards */
protected $_model;

/**
Expand Down

0 comments on commit c4ae94d

Please sign in to comment.