diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 530a6aa..b054dc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,21 +1,49 @@ name: CI -on: ['push', 'pull_request'] +on: + push: + branches: [main] + pull_request: + branches: [main] jobs: pest: runs-on: ubuntu-latest - container: - image: kirschbaumdevelopment/laravel-test-runner:8.3 - + strategy: + fail-fast: false + matrix: + php: ['8.3', '8.4', '8.5'] + name: Pest (PHP ${{ matrix.php }}) steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 with: - fetch-depth: 1 + php-version: ${{ matrix.php }} + coverage: none - name: Install composer dependencies - run: | - composer install --no-scripts + run: composer install --no-interaction --prefer-dist - name: Run Testsuite - run: vendor/bin/pest \ No newline at end of file + run: vendor/bin/pest + + quality: + runs-on: ubuntu-latest + name: Quality (PHPStan + Pint) + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: none + + - name: Install composer dependencies + run: composer install --no-interaction --prefer-dist + + - name: Run PHPStan + run: vendor/bin/phpstan analyse + + - name: Run Pint + run: vendor/bin/pint --test diff --git a/README.md b/README.md index 9b49b16..8ca15f2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## 👋 Introduction This package allows FakerPHP to generate fake IDs which have the same structure you can expect to be returned from Stripe. The wonderful [Pest](https://pestphp.com/) is used to run tests contained within this package, which requires -a minimum PHP Version of 8.2. +a minimum PHP Version of 8.3. This package is listed on the [official FakerPHP website](https://fakerphp.org/third-party/) as a third party library. diff --git a/composer.json b/composer.json index 487f420..130c3a4 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,9 @@ }, "require-dev": { "pestphp/pest": "^v4.0", - "pestphp/pest-plugin-faker": "^v4.0" + "pestphp/pest-plugin-faker": "^v4.0", + "phpstan/phpstan": "^2.2", + "laravel/pint": "^1.30" }, "autoload": { "psr-4": { @@ -33,5 +35,11 @@ "allow-plugins": { "pestphp/pest-plugin": true } + }, + "scripts": { + "test": "pest", + "phpstan": "phpstan analyse", + "pint": "pint", + "pint:test": "pint --test" } } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..776ccd8 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + level: max + paths: + - src diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..ea5e72c --- /dev/null +++ b/pint.json @@ -0,0 +1,3 @@ +{ + "preset": "psr12" +} diff --git a/src/Stripe.php b/src/Stripe.php index d41eb93..c9fa920 100644 --- a/src/Stripe.php +++ b/src/Stripe.php @@ -4,7 +4,7 @@ class Stripe extends Base { - private function generateRandomString($length = 24, $numericOnly = false): string + private function generateRandomString(int $length = 24, bool $numericOnly = false): string { if ($numericOnly) { $characters = '0123456789'; diff --git a/tests/ArchitectureTest.php b/tests/ArchitectureTest.php index f2ed00a..b62f15e 100644 --- a/tests/ArchitectureTest.php +++ b/tests/ArchitectureTest.php @@ -6,4 +6,4 @@ test('provider') ->expect(Stripe::class) ->toExtend(Base::class) - ->toOnlyUse(Base::class); \ No newline at end of file + ->toOnlyUse(Base::class); diff --git a/tests/StripeTest.php b/tests/StripeTest.php index b0f67ad..a1fcaa9 100644 --- a/tests/StripeTest.php +++ b/tests/StripeTest.php @@ -1,6 +1,7 @@