diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d035279aa808a185be4073a671fe3120a493745..ad1a48dafe2ddb08d6e3bb0a90c55007d4a43a2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [push] +on: [push, pull_request] jobs: old: @@ -8,7 +8,7 @@ jobs: runs-on: ${{ matrix.operating-system }} strategy: matrix: - operating-system: ['ubuntu-16.04'] + operating-system: ['ubuntu-latest'] php-versions: ['7.0'] phpunit-versions: ['6.5.14'] steps: @@ -21,15 +21,13 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: mbstring, intl ini-values: post_max_size=256M, max_execution_time=180 - tools: psalm, phpunit:${{ matrix.phpunit-versions }} + tools: phpunit:${{ matrix.phpunit-versions }} - name: Install dependencies run: composer self-update --1; composer install - name: PHPUnit tests - uses: php-actions/phpunit@v2 - with: - memory_limit: 256M + run: phpunit moderate: name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} @@ -38,7 +36,7 @@ jobs: matrix: operating-system: ['ubuntu-latest'] php-versions: ['7.1', '7.2', '7.3'] - phpunit-versions: ['latest'] + phpunit-versions: ['7.5.20'] steps: - name: Checkout uses: actions/checkout@v2 @@ -49,22 +47,16 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: mbstring, intl, sodium ini-values: post_max_size=256M, max_execution_time=180 - tools: psalm, phpunit:${{ matrix.phpunit-versions }} + tools: psalm:4, phpunit:${{ matrix.phpunit-versions }} - name: Install dependencies run: composer install - - name: Modernize dependencies - run: composer require --dev "phpunit/phpunit:>=4" - - name: PHPUnit tests - uses: php-actions/phpunit@v2 - timeout-minutes: 30 - with: - memory_limit: 256M + run: phpunit - name: Static Analysis - run: vendor/bin/psalm + run: psalm --output-format=github modern: name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} @@ -72,7 +64,7 @@ jobs: strategy: matrix: operating-system: ['ubuntu-latest'] - php-versions: ['7.4', '8.0'] + php-versions: ['7.4', '8.0', '8.1'] phpunit-versions: ['latest'] steps: - name: Checkout @@ -84,15 +76,13 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: mbstring, intl, sodium ini-values: post_max_size=256M, max_execution_time=180 - tools: psalm, phpunit:${{ matrix.phpunit-versions }} + tools: psalm:4, phpunit:${{ matrix.phpunit-versions }} - name: Install dependencies run: composer install + - name: PHPUnit tests - uses: php-actions/phpunit@v2 - timeout-minutes: 30 - with: - memory_limit: 256M + run: phpunit - name: Static Analysis - run: vendor/bin/psalm + run: psalm --output-format=github diff --git a/src/Base32.php b/src/Base32.php index 7784bafbf5e7d5db9a60618616d57f05c5bd1cd5..9d61a60a44f896b2db770a9a2df5fb5824f0a641 100644 --- a/src/Base32.php +++ b/src/Base32.php @@ -60,13 +60,13 @@ abstract class Base32 implements EncoderInterface /** * Encode into Base32 (RFC 4648) * - * @param string $src + * @param string $binString * @return string * @throws \TypeError */ - public static function encode(string $src): string + public static function encode(string $binString): string { - return static::doEncode($src, false, true); + return static::doEncode($binString, false, true); } /** * Encode into Base32 (RFC 4648) diff --git a/src/Base64.php b/src/Base64.php index 4739e4895dde6ee816a280335a2466e996f6e9ef..637bed53ff7dcec4a90810ecbbefdb2fef7661e6 100644 --- a/src/Base64.php +++ b/src/Base64.php @@ -38,13 +38,13 @@ abstract class Base64 implements EncoderInterface * * Base64 character set "[A-Z][a-z][0-9]+/" * - * @param string $src + * @param string $binString * @return string * @throws \TypeError */ - public static function encode(string $src): string + public static function encode(string $binString): string { - return static::doEncode($src, true); + return static::doEncode($binString, true); } /** diff --git a/src/Binary.php b/src/Binary.php index 38dbc4e66076ec94fe5995884b437aea6faa7ea9..97fc268a8244fefe10a0ff515fb6b8804b4e5f5f 100644 --- a/src/Binary.php +++ b/src/Binary.php @@ -46,6 +46,8 @@ abstract class Binary public static function safeStrlen(string $str): int { if (\function_exists('mb_strlen')) { + // mb_strlen in PHP 7.x can return false. + /** @psalm-suppress RedundantCast */ return (int) \mb_strlen($str, '8bit'); } else { return \strlen($str);