From c35170cfaa3f2d92b0f8c9ca9b999f3e3c6d7961 Mon Sep 17 00:00:00 2001 From: mscherer Date: Fri, 3 Apr 2020 00:03:47 +0200 Subject: [PATCH] Fix CS. --- .editorconfig | 4 +--- .gitattributes | 18 ++---------------- .gitignore | 2 +- .travis.yml | 14 +++++++------- README.md | 10 +++++----- src/Validation/ItValidation.php | 2 +- src/Validation/TwValidation.php | 2 +- tests/TestCase/IntegrationTest.php | 4 ++-- tests/TestCase/Validation/RuValidationTest.php | 1 + 9 files changed, 21 insertions(+), 36 deletions(-) diff --git a/.editorconfig b/.editorconfig index 70619017..6e4a9119 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,5 @@ ; This file is for unifying the coding style for different editors and IDEs. -; More information at http://editorconfig.org - +; More information at https://editorconfig.org root = true [*] @@ -14,5 +13,4 @@ trim_trailing_whitespace = true end_of_line = crlf [*.yml] -indent_style = space indent_size = 2 diff --git a/.gitattributes b/.gitattributes index 7ff9965d..5fe90dad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,20 +1,6 @@ # Define the line ending behavior of the different file extensions -# Set default behaviour, in case users don't have core.autocrlf set. -* text=auto -* text eol=lf - -# Explicitly declare text files we want to always be normalized and converted -# to native line endings on checkout. -*.php text -*.default text -*.ctp text -*.md text -*.po text -*.js text -*.css text -*.ini text -*.txt text -*.xml text +# Set default behavior, in case users don't have core.autocrlf set. +* text text=auto eol=lf # Declare files that will always have CRLF line endings on checkout. *.bat eol=crlf diff --git a/.gitignore b/.gitignore index fab8667a..6c0987d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /composer.lock /phpunit.phar /vendor/ -.idea \ No newline at end of file +/.idea/ diff --git a/.travis.yml b/.travis.yml index 8b178b7c..06ec3b20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,17 +2,13 @@ language: php php: - 5.6 - - 7.0 - - 7.1 - - 7.2 - -sudo: false + - 7.4 matrix: fast_finish: true include: - - php: 7.1 + - php: 7.4 env: PHPCS=1 - php: 5.6 @@ -24,7 +20,11 @@ install: script: - sh -c "if [ '$PHPCS' != '1' ]; then vendor/bin/phpunit; fi" - - sh -c "if [ '$PHPCS' = '1' ]; then ./vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi" + - sh -c "if [ '$PHPCS' = '1' ]; then ./vendor/bin/phpcs -n -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/; fi" + +cache: + directories: + - $HOME/.composer/cache notifications: email: false diff --git a/README.md b/README.md index d7796170..c56159fd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # CakePHP Localized plugin -[![Build Status](https://secure.travis-ci.org/cakephp/localized.svg?branch=master)](http://travis-ci.org/cakephp/localized) +[![Build Status](https://travis-ci.org/cakephp/localized.svg?branch=master)](http://travis-ci.org/cakephp/localized) [![License](https://poser.pugx.org/cakephp/localized/license.svg)](https://packagist.org/packages/cakephp/localized) [![Total Downloads](https://poser.pugx.org/cakephp/localized/d/total.svg)](https://packagist.org/packages/cakephp/localized) @@ -9,12 +9,12 @@ This plugin contains various localized validation classes for specific countries The master branch has the following requirements: -* CakePHP 3.1.0 or greater. -* PHP 5.4.16 or greater. +* CakePHP 3.5+. +* PHP 5.6+. ## Installation -You can install this plugin into your CakePHP application using [composer](http://getcomposer.org). +You can install this plugin into your CakePHP application using [composer](https://getcomposer.org). The recommended way to install composer packages is: @@ -43,7 +43,7 @@ class PostsTable extends Table { public function validationDefault(Validator $validator) { - $validator->provider('fr', FrValidation::class); + $validator->setProvider('fr', FrValidation::class); $validator->add('phoneField', 'myCustomRuleNameForPhone', [ 'rule' => 'phone', 'provider' => 'fr' diff --git a/src/Validation/ItValidation.php b/src/Validation/ItValidation.php index fc91a156..3b478c93 100644 --- a/src/Validation/ItValidation.php +++ b/src/Validation/ItValidation.php @@ -73,7 +73,7 @@ public static function cf($check) 'G' => 15, 'H' => 17, 'I' => 19, 'J' => 21, 'K' => 2, 'L' => 4, 'M' => 18, 'N' => 20, 'O' => 11, 'P' => 3, 'Q' => 6, 'R' => 8, 'S' => 12, 'T' => 14, 'U' => 16, 'V' => 10, 'W' => 22, 'X' => 25, - 'Y' => 24, 'Z' => 23 + 'Y' => 24, 'Z' => 23, ]; $sum = 0; diff --git a/src/Validation/TwValidation.php b/src/Validation/TwValidation.php index c745efee..6e63c341 100644 --- a/src/Validation/TwValidation.php +++ b/src/Validation/TwValidation.php @@ -63,7 +63,7 @@ public static function personId($check) 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 34, 'J' => 18, 'K' => 19, 'L' => 20, 'M' => 21, 'N' => 22, 'O' => 35, 'P' => 23, 'Q' => 24, 'R' => 25, 'S' => 26, 'T' => 27, 'U' => 28, 'V' => 29, 'W' => 32, 'X' => 30, - 'Y' => 31, 'Z' => 33 + 'Y' => 31, 'Z' => 33, ]; $n1 = $keyTable[$check[0]]; $checksum = intval($n1 / 10) + ($n1 % 10) * 9; diff --git a/tests/TestCase/IntegrationTest.php b/tests/TestCase/IntegrationTest.php index 9525113b..f0ce2f59 100644 --- a/tests/TestCase/IntegrationTest.php +++ b/tests/TestCase/IntegrationTest.php @@ -32,7 +32,7 @@ class IntegrationTest extends TestCase */ public function testLocalizedProviderIntegration() { - $validator = new Validator; + $validator = new Validator(); $validator->setProvider('fr', FrValidation::class); $validator->add('phoneField', 'myCustomRuleNameForPhone', [ 'rule' => 'phone', @@ -46,7 +46,7 @@ public function testLocalizedProviderIntegration() $this->assertCount(2, $validator); $this->assertEmpty($validator->errors([ 'phoneField' => '05 24 22 72 27', - 'postalField' => '93000' + 'postalField' => '93000', ])); $errors = $validator->errors(['phoneField' => '924.227.227', 'postalField' => '0000']); diff --git a/tests/TestCase/Validation/RuValidationTest.php b/tests/TestCase/Validation/RuValidationTest.php index 6dd1ce09..683b2eb3 100644 --- a/tests/TestCase/Validation/RuValidationTest.php +++ b/tests/TestCase/Validation/RuValidationTest.php @@ -75,6 +75,7 @@ public function testPassport() $this->assertFalse(RuValidation::passport('1234123456')); $this->assertFalse(RuValidation::passport('1234 1x3456')); } + /** * test vatin method of RuValidation *