diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index e90af93..9c71b7b 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -10,8 +10,8 @@ jobs: tests: strategy: matrix: - php: [ '7.4','8.0','8.1' ] - runs-on: ubuntu-22.04 + php: [ '7.4','8.0','8.1','8.2','8.3','8.4' ] + runs-on: ubuntu-24.04 steps: - name: Setup PHP @@ -20,40 +20,37 @@ jobs: php-version: ${{ matrix.php }} extensions: mbstring, intl coverage: xdebug - tools: composer:v2 + tools: phing:v3 - uses: actions/checkout@v2 - - name: Download phing - run: mkdir bin && curl -L -C - -s -S -o bin/phing https://github.com/phingofficial/phing/releases/download/3.0.0-RC3/phing-3.0.0-RC3.phar && chmod +x bin/phing - - name: Phing setup - run: bin/phing setup + run: phing setup - name: lint php - run: bin/phing php:lint + run: phing php:lint - name: validate composer - run: bin/phing composer:validate + run: phing composer:validate - name: behat - run: bin/phing behat:run + run: phing behat:run - - name: psalm - run: bin/phing psalm:run +# - name: psalm +# run: phing psalm:run - name: phpstan - run: bin/phing phpstan:analyse + run: phing phpstan:analyse - name: CC before build - run: bin/phing cc:before-build + run: phing cc:before-build env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - name: PHPUnit - run: bin/phing phpunit:run + run: phing phpunit:run - name: CC after build - run: bin/phing cc:after-build + run: phing cc:after-build env: CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} diff --git a/README.md b/README.md index cc1cd35..172a320 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Contributing - If you liked this project, ⭐ star it on GitHub. [![GitHub Repo stars](https://img.shields.io/github/stars/jawira/case-converter?style=social)](https://github.com/jawira/case-converter) -- Or follow me on Twitter. +- Or follow me on X. [![Twitter Follow](https://img.shields.io/twitter/follow/jawira?style=social)](https://twitter.com/jawira) License diff --git a/composer.json b/composer.json index 6643d8d..24a3f65 100644 --- a/composer.json +++ b/composer.json @@ -31,9 +31,8 @@ }, "require-dev": { "behat/behat": "^3.0", - "phpstan/phpstan": "^1.0", - "phpunit/phpunit": "^9.0", - "vimeo/psalm": "^4.0" + "phpstan/phpstan": "^v2", + "phpunit/phpunit": "^9.0" }, "suggest": { "pds/skeleton": "PHP Package Development Standards", diff --git a/psalm.xml b/psalm.xml index 81e5982..68220c0 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,8 @@ diff --git a/src/Glue/Gluer.php b/src/Glue/Gluer.php index 99a1763..9148c9c 100644 --- a/src/Glue/Gluer.php +++ b/src/Glue/Gluer.php @@ -80,7 +80,7 @@ protected function glueUsingRules(string $glue, int $wordsMode, ?int $firstWordM { $convertedWords = $this->changeWordsCase($this->words, $wordsMode); - if ($firstWordMode) { + if (is_int($firstWordMode)) { $convertedWords = $this->changeFirstWordCase($convertedWords, $firstWordMode); } diff --git a/src/Split/Splitter.php b/src/Split/Splitter.php index 46119ba..cd4bf65 100644 --- a/src/Split/Splitter.php +++ b/src/Split/Splitter.php @@ -41,6 +41,10 @@ abstract public function split(): array; */ protected function splitUsingPattern(string $inputString, string $pattern): array { + if (empty($pattern)) { + throw new CaseConverterException('Pattern must not be empty.'); // @codeCoverageIgnore + } + $words = preg_split($pattern, $inputString, 0, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if ($words === false) {