From fe48863b27b4ae66072c65f07236817e877638f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Vil=C3=A0?= Date: Sat, 29 Oct 2022 10:50:35 +0200 Subject: [PATCH] Updates (#18) --- .appveyor.yml | 4 +++- .github/workflows/build.yml | 5 +---- .github/workflows/pull_request.yml | 5 +---- .gitignore | 4 ++-- composer.json | 4 ---- index.php | 2 ++ phpdoccheck.yml | 4 ---- src/Algorithm.php | 4 +++- src/Seed.php | 4 +++- src/System.php | 14 +++++++------- vercel.json | 2 +- 11 files changed, 23 insertions(+), 29 deletions(-) delete mode 100644 phpdoccheck.yml diff --git a/.appveyor.yml b/.appveyor.yml index 664b206..0e4eeb9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -5,6 +5,8 @@ clone_folder: C:\projects\app environment: matrix: + - php_ver: 8.1 + - php_ver: 8.0 - php_ver: 7.4 - php_ver: 7.3 - php_ver: 7.2 @@ -33,7 +35,7 @@ install: - echo extension=php_mbstring.dll >> php.ini - echo extension=php_sqlite3.dll >> php.ini - echo extension=php_pdo_sqlite.dll >> php.ini - - IF NOT EXIST C:\tools\composer.phar (cd C:\tools && appveyor DownloadFile https://getcomposer.org/download/2.0.7/composer.phar) + - IF NOT EXIST C:\tools\composer.phar (cd C:\tools && appveyor DownloadFile https://getcomposer.org/download/2.0.14/composer.phar) - php C:\tools\composer.phar --version - cd C:\projects\app diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c5e423..588fbcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - php: [8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0'] name: PHP ${{ matrix.php }} - ${{ matrix.os }} @@ -27,9 +27,6 @@ jobs: extensions: zip, curl, xdebug coverage: xdebug - - name: Update composer - run: composer selfupdate - - name: Install dependencies run: composer update --prefer-dist --no-interaction diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a66a798..84de97d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - php: [8.0, 7.4, 7.3, 7.2, 7.1, 7.0] + php: ['8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0'] name: PHP ${{ matrix.php }} - ${{ matrix.os }} @@ -24,9 +24,6 @@ jobs: extensions: zip, curl, xdebug coverage: xdebug - - name: Update composer - run: composer selfupdate - - name: Install dependencies run: composer update --prefer-dist --no-interaction diff --git a/.gitignore b/.gitignore index 5d6f3ea..604e277 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ sonar* junit-logfile.xml clover.xml composer.lock -.phpunit.result.cache .phpdoc* -.php_cs.cache +*.cache +.idea diff --git a/composer.json b/composer.json index eff67b3..51c392f 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,6 @@ "php": "^7.0|^8.0" }, "require-dev": { - "dancryer/php-docblock-checker": "^1.10", - "phpstan/phpstan": "0.*.*", "phpunit/phpunit": "^6.0|^7.0|^8.0|^9.0", "rogervila/php-sonarqube-scanner": "^1.0" }, @@ -41,8 +39,6 @@ "scripts": { "test": [ "composer validate", - "vendor/bin/phpdoccheck", - "vendor/bin/phpstan analyse --level 7 src tests", "vendor/bin/phpunit" ] } diff --git a/index.php b/index.php index 5b3ce4c..781f317 100644 --- a/index.php +++ b/index.php @@ -77,5 +77,7 @@ + + diff --git a/phpdoccheck.yml b/phpdoccheck.yml deleted file mode 100644 index 9865fbf..0000000 --- a/phpdoccheck.yml +++ /dev/null @@ -1,4 +0,0 @@ -directory: src -cache-file: .phpdoccheck -options: - - skip-classes diff --git a/src/Algorithm.php b/src/Algorithm.php index 4943ddc..e7375eb 100644 --- a/src/Algorithm.php +++ b/src/Algorithm.php @@ -12,6 +12,8 @@ class Algorithm implements AlgorithmInterface /** * @param string $value + * + * @throws InvalidAlgorithmException */ public function __construct(string $value) { @@ -21,7 +23,7 @@ public function __construct(string $value) } /** - * @throws \ProvablyFair\Exceptions\InvalidAlgorithmException + * @throws InvalidAlgorithmException * * @return void */ diff --git a/src/Seed.php b/src/Seed.php index d9ae334..a2d3ccd 100644 --- a/src/Seed.php +++ b/src/Seed.php @@ -17,6 +17,8 @@ class Seed implements SeedInterface /** * @param string $value + * + * @throws InvalidSeedException */ public function __construct(string $value) { @@ -26,7 +28,7 @@ public function __construct(string $value) } /** - * @throws \ProvablyFair\Exceptions\InvalidSeedException + * @throws InvalidSeedException * * @return void */ diff --git a/src/System.php b/src/System.php index c8b9fae..1b1ad80 100644 --- a/src/System.php +++ b/src/System.php @@ -9,12 +9,12 @@ class System implements SystemInterface { /** - * @var \ProvablyFair\Contracts\AlgorithmInterface + * @var AlgorithmInterface */ private $algorithm; /** - * @param \ProvablyFair\Contracts\AlgorithmInterface $algorithm + * @param AlgorithmInterface $algorithm */ public function __construct(AlgorithmInterface $algorithm) { @@ -22,9 +22,9 @@ public function __construct(AlgorithmInterface $algorithm) } /** - * @param \ProvablyFair\Contracts\SeedInterface $seed + * @param SeedInterface $seed * - * @return \ProvablyFair\Contracts\SeedInterface + * @return SeedInterface */ public function generateServerSeed(SeedInterface $seed): SeedInterface { @@ -63,15 +63,15 @@ private static function divisible(string $hash, int $mod): bool $index = $hash_mod > 0 ? $hash_mod - 4 : 0; for ($index; $index < $hash_length; $index += 4) { - $value = (($value << 16) + intval(substr($hash, $index, $index + 4), 16)) % $mod; + $value = intval(intval($value << 16) + intval(substr($hash, $index, $index + 4), 16)) % $mod; } return $value === 0; } /** - * @param \ProvablyFair\Contracts\SeedInterface $serverSeed - * @param \ProvablyFair\Contracts\SeedInterface $clientSeed + * @param SeedInterface $serverSeed + * @param SeedInterface $clientSeed * * @return float */ diff --git a/vercel.json b/vercel.json index 7dd1243..ab11b8f 100644 --- a/vercel.json +++ b/vercel.json @@ -1,7 +1,7 @@ { "version": 2, "functions": { - "api/index.php": { "runtime": "vercel-php@0.3.1" } + "api/index.php": { "runtime": "vercel-php@0.5.2" } }, "routes": [{ "src": "/(.*)",