diff --git a/.gitignore b/.gitignore index 14f4019..e58b8bd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ vendor composer.lock .phpunit.result.cache +.php_cs.cache diff --git a/.php_cs b/.php_cs index 05be562..300c9da 100644 --- a/.php_cs +++ b/.php_cs @@ -1,35 +1,58 @@ setUsingCache(false) + ->setUsingCache(true) + ->setCacheFile(__DIR__ . '/.php_cs.cache') ->setRules([ '@PSR2' => true, + 'align_multiline_comment' => true, + 'array_indentation' => true, 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => true, - 'no_whitespace_in_blank_line' => true, - 'no_unused_imports' => true, - 'blank_line_before_return' => true, 'binary_operator_spaces' => true, + 'blank_line_before_statement' => ['statements' => ['return']], 'cast_spaces' => true, + 'concat_space' => ['spacing' => 'one'], + 'constant_case' => true, 'declare_equal_normalize' => true, + 'lowercase_cast' => true, 'method_argument_space' => true, 'method_separation' => true, + 'no_empty_statement' => true, + 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_multiline_whitespace_around_double_arrow' => true, + 'no_multiline_whitespace_before_semicolons' => true, + 'no_unused_imports' => true, 'no_whitespace_before_comma_in_array' => true, - 'trim_array_spaces' => true, + 'no_whitespace_in_blank_line' => true, + 'ordered_imports' => true, 'phpdoc_add_missing_param_annotation' => true, 'phpdoc_align' => true, - 'phpdoc_scalar' => true, + 'phpdoc_annotation_without_dot' => true, 'phpdoc_indent' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_useless_inheritdoc' => true, 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, 'phpdoc_separation' => true, - 'no_empty_statement' => true, - 'concat_space' => ['spacing' => 'one'], - 'no_multiline_whitespace_before_semicolons' => true, - 'no_leading_import_slash' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types_order' => true, + 'phpdoc_var_annotation_correct_order' => true, + 'phpdoc_var_without_name' => true, + 'single_quote' => true, + 'short_scalar_cast' => true, + 'standardize_not_equals' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_null_coalescing' => true, + 'trim_array_spaces' => true, + 'visibility_required' => ['elements' => ['property', 'method', 'const']], + 'yoda_style' => false, ]) ->setFinder( PhpCsFixer\Finder::create() + ->exclude('db') ->in(__DIR__) ); diff --git a/.travis.yml b/.travis.yml index dedbc4e..2e93b90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: php php: - 7.2 - 7.3 + - 7.4 install: - travis_retry composer self-update diff --git a/composer.json b/composer.json index 34b3434..6136869 100644 --- a/composer.json +++ b/composer.json @@ -3,19 +3,22 @@ "description": "PHP bank cards IIN/BIN database. Get bank info by card number", "license": "MIT", "keywords": ["bin", "card", "creditcard", "iin", "issuer identification numbers"], - "homepage": "https://github.com/chekalskiy/php-banks-db", + "homepage": "https://github.com/chekalsky/php-banks-db", "authors": [ { - "name": "Ilya Chekalskiy", - "email": "ilya@chekalskiy.ru", - "homepage": "http://chekalskiy.ru" + "name": "Ilya Chekalsky", + "email": "ilya@chekalsky.com", + "homepage": "https://chekalsky.com" } ], "require": { "php": ">=7.2" }, "require-dev": { - "phpunit/phpunit": "^8" + "ext-json": "*", + "friendsofphp/php-cs-fixer": "^2.16", + "phpunit/phpunit": "^8", + "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "psr-4": { @@ -26,6 +29,10 @@ "test": [ "vendor/bin/phpunit --coverage-clover=coverage.xml" ], + "lint": [ + "vendor/bin/php-cs-fixer fix --config=.php_cs", + "vendor/bin/phpcbf -w" + ], "rebuild": [ "php parse.php" ] diff --git a/parse.php b/parse.php index 7075edf..7ebadf7 100644 --- a/parse.php +++ b/parse.php @@ -1,4 +1,7 @@ + + + + + + + + + + + + parse.php + src/ + tests/ + + diff --git a/src/BankDb.php b/src/BankDb.php index 4f229af..45f86da 100644 --- a/src/BankDb.php +++ b/src/BankDb.php @@ -1,4 +1,5 @@