From 10fd42de940dbef7a7fbb13b8381c0c3996198cf Mon Sep 17 00:00:00 2001 From: ytake Date: Mon, 18 Oct 2021 23:24:24 +0900 Subject: [PATCH 1/3] removed config --- .gitattributes | 12 +++++++++++ .github/workflows/php.yml | 43 ++++++++++++++++----------------------- .gitignore | 2 +- .scrutinizer.yml | 14 ------------- .sensiolabs.yml | 3 --- .travis.yml | 19 ----------------- composer.json | 3 +-- 7 files changed, 32 insertions(+), 64 deletions(-) create mode 100644 .gitattributes delete mode 100644 .scrutinizer.yml delete mode 100644 .sensiolabs.yml delete mode 100644 .travis.yml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ffb6571 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +/.gitattributes export-ignore +/.gitignore export-ignore +/.github/ export-ignore +/.styleci.yml export-ignore +/.scrutinizer.yml export-ignore +/.sensiolabs.yml export-ignore +/nitpick.json export-ignore +/composer.lock export-ignore +/tests/ export-ignore +/phpunit.xml export-ignore +/phpstan.neon export-ignore +/phpcs.xml export-ignore diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ef9138b..2bc757b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,4 +1,4 @@ -name: PHP Composer +name: tests on: push: @@ -8,29 +8,22 @@ on: jobs: build: - runs-on: ubuntu-latest - + strategy: + matrix: + php-versions: ['7.0', '7.1', '7.2', '7.3', '7.4'] + name: PHP ${{ matrix.php-versions }} Test steps: - - uses: actions/checkout@v2 - - - name: Validate composer.json and composer.lock - run: composer validate --strict - - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" - # Docs: https://getcomposer.org/doc/articles/scripts.md - - # - name: Run test suite - # run: composer run-script test + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: xdebug + - name: Validate composer.json and composer.lock + run: composer validate + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + - name: Run test suite + run: vendor/bin/phpunit --coverage-clover tests/logs/clover.xml diff --git a/.gitignore b/.gitignore index 3665b9e..89e0972 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ /phpunit.xml /vendor/ *.cache - +.phpcs-cache diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index a29a0ca..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,14 +0,0 @@ -tools: - php_code_sniffer: true - php_cpd: true - php_loc: true - php_mess_detector: true - php_pdepend: true - php_analyzer: true - sensiolabs_security_checker: true -filter: - paths: [src/*] -checks: - php: - code_rating: true - duplication: true diff --git a/.sensiolabs.yml b/.sensiolabs.yml deleted file mode 100644 index 6b5d571..0000000 --- a/.sensiolabs.yml +++ /dev/null @@ -1,3 +0,0 @@ -global_exclude_dirs: - - vendor - - tests diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f33728d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php - -sudo: false - -php: - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -before_script: - - composer self-update - - composer install --prefer-dist --no-interaction -script: - - chmod -R 777 tests/build - - ./vendor/bin/phpunit --coverage-clover tests/logs/clover.xml -after_script: - - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then php ./vendor/bin/php-coveralls -v; fi diff --git a/composer.json b/composer.json index 322bca3..8ea19e4 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,7 @@ "squizlabs/php_codesniffer": "~2.7", "sebastian/phpcpd": "*", "phploc/phploc": "*", - "pdepend/pdepend" : "^2.2.4", - "sensiolabs/security-checker": "^4.0.0" + "pdepend/pdepend" : "^2.2.4" }, "autoload": { "psr-4": { From 12ef0121db762fda2a21cf2f45da08f3d0e48099 Mon Sep 17 00:00:00 2001 From: ytake Date: Mon, 18 Oct 2021 23:53:48 +0900 Subject: [PATCH 2/3] added --- phpunit.xml.dist | 1 - src/Geography/Latitude.php | 4 ++-- tests/Number/ComplexTest.php | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 86bba7a..242bb2a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="vendor/autoload.php" > diff --git a/src/Geography/Latitude.php b/src/Geography/Latitude.php index bff509a..3376e36 100644 --- a/src/Geography/Latitude.php +++ b/src/Geography/Latitude.php @@ -28,11 +28,11 @@ class Latitude extends Real /** * Returns a new Latitude object. * - * @param float $value + * @param float|string $value * * @throws InvalidNativeArgumentException */ - public function __construct(float $value) + public function __construct($value) { // normalization process through Coordinate object $coordinate = new BaseCoordinate([$value, 0]); diff --git a/tests/Number/ComplexTest.php b/tests/Number/ComplexTest.php index 30c015c..338f774 100644 --- a/tests/Number/ComplexTest.php +++ b/tests/Number/ComplexTest.php @@ -103,7 +103,7 @@ public function testDifferentLocaleWithDifferentDecimalCharacter() $this->testGetIm(); $this->testGetModulus(); $this->testGetArgument(); - $this->testToString('2,034 - 1,4i'); + $this->testToString('2.034 - 1.4i'); $this->testNotSameValue(); } } From b9a48658bf4b4ce917c88b5081bf8fc7b48d5f0c Mon Sep 17 00:00:00 2001 From: ytake Date: Mon, 18 Oct 2021 23:57:57 +0900 Subject: [PATCH 3/3] removed float type --- src/Geography/Longitude.php | 4 ++-- tests/Number/RealTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Geography/Longitude.php b/src/Geography/Longitude.php index 574da2f..0768b1b 100644 --- a/src/Geography/Longitude.php +++ b/src/Geography/Longitude.php @@ -28,11 +28,11 @@ class Longitude extends Real /** * Returns a new Longitude object. * - * @param float $value + * @param float|string $value * * @throws InvalidNativeArgumentException */ - public function __construct(float $value) + public function __construct($value) { // normalization process through Coordinate object $coordinate = new BaseCoordinate([0, $value]); diff --git a/tests/Number/RealTest.php b/tests/Number/RealTest.php index 366d69b..9f18a0a 100644 --- a/tests/Number/RealTest.php +++ b/tests/Number/RealTest.php @@ -85,6 +85,6 @@ public function testDifferentLocaleWithDifferentDecimalCharacter() $this->testSameValueAs(); $this->testToInteger(); $this->testToNatural(); - $this->testToString('0,7'); + $this->testToString('0.7'); } }