diff --git a/.gitattributes b/.gitattributes index 60463e5..0370c1f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,8 +7,7 @@ /.travis.yml export-ignore /Makefile export-ignore /phpstan-baseline.neon export-ignore -/phpstan.src.neon.dist export-ignore -/phpstan.tests.neon.dist export-ignore +/phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore /psalm.xml export-ignore /README.md export-ignore diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 2ee01b2..3fb0712 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -5,18 +5,18 @@ on: pull_request: jobs: - phpstan_src: - name: PHPStan Source + phpstan: + name: PHPStan runs-on: ubuntu-22.04 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: '8.3' tools: composer:v2 coverage: none env: @@ -37,41 +37,7 @@ jobs: command: composer bin phpstan update --no-interaction --no-progress - name: Execute PHPStan - run: vendor/bin/phpstan analyze src -c phpstan.src.neon.dist --no-progress - - phpstan_tests: - name: PHPStan Tests - runs-on: ubuntu-22.04 - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.2' - tools: composer:v2 - coverage: none - env: - update: true - - - name: Install Dependencies - uses: nick-invision/retry@v2 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer update --no-interaction --no-progress - - - name: Install PHPStan - uses: nick-invision/retry@v2 - with: - timeout_minutes: 5 - max_attempts: 5 - command: composer bin phpstan update --no-interaction --no-progress - - - name: Execute PHPStan - run: vendor/bin/phpstan analyze tests -c phpstan.tests.neon.dist --no-progress + run: vendor/bin/phpstan analyze --no-progress psalm: name: Psalm @@ -79,12 +45,12 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: '8.3' tools: composer:v2 coverage: none env: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef924d3..c7bf82b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,11 +11,11 @@ jobs: strategy: matrix: - php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] steps: - name: Checkout Code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/Makefile b/Makefile index 8779cd4..07abb41 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,26 @@ install: - @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.2-base update - @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.2-base bin all update + @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.3-base update + @docker run -it -w /data -v ${PWD}:/data:delegated -v ~/.composer:/root/.composer:delegated --entrypoint composer --rm registry.gitlab.com/grahamcampbell/php:8.3-base bin all update phpunit: - @rm -f bootstrap/cache/*.php && docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.2-cli + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpunit --rm registry.gitlab.com/grahamcampbell/php:8.3-cli -phpstan-analyze-src: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze src -c phpstan.src.neon.dist - -phpstan-analyze-tests: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze tests -c phpstan.tests.neon.dist +phpstan-analyze: + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.3-cli analyze phpstan-baseline: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.2-cli analyze src -c phpstan.src.neon.dist --generate-baseline + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/phpstan --rm registry.gitlab.com/grahamcampbell/php:8.3-cli analyze --generate-baseline psalm-analyze: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.2-cli + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.3-cli + +psalm-baseline: + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.3-cli --set-baseline=psalm-baseline.xml psalm-show-info: - @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm .phar--rm registry.gitlab.com/grahamcampbell/php:8.2-cli --show-info=true + @docker run -it -w /data -v ${PWD}:/data:delegated --entrypoint vendor/bin/psalm.phar --rm registry.gitlab.com/grahamcampbell/php:8.3-cli --show-info=true -test: phpunit phpstan-analyze-src phpstan-analyze-tests psalm-analyze +test: phpunit phpstan-analyze psalm-analyze clean: @rm -rf .phpunit.result.cache composer.lock vendor vendor-bin/*/composer.lock vendor-bin/*/vendor diff --git a/composer.json b/composer.json index 82a8300..77f50a3 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.32 || ^9.6.3 || ^10.0.12" + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" }, "autoload": { "psr-4": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ceab6cc..dda1b4a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,6 +5,11 @@ parameters: count: 1 path: src/PhpOption/Option.php + - + message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#" + count: 1 + path: src/PhpOption/Option.php + - message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) should return PhpOption\\\\LazyOption\\ but returns PhpOption\\\\LazyOption\\\\.$#" count: 1 diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..fd7a646 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,8 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: max + paths: + - src + checkGenericClassInNonGenericObjectType: false diff --git a/phpstan.src.neon.dist b/phpstan.src.neon.dist deleted file mode 100644 index 214571a..0000000 --- a/phpstan.src.neon.dist +++ /dev/null @@ -1,11 +0,0 @@ -includes: - - phpstan-baseline.neon - -parameters: - level: max - checkGenericClassInNonGenericObjectType: false - ignoreErrors: - - - message: "#^Method PhpOption\\\\Option\\:\\:fromReturn\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#" - count: 1 - path: src/PhpOption/Option.php diff --git a/phpstan.tests.neon.dist b/phpstan.tests.neon.dist deleted file mode 100644 index 090a41a..0000000 --- a/phpstan.tests.neon.dist +++ /dev/null @@ -1,57 +0,0 @@ -parameters: - level: 5 - ignoreErrors: - - - message: "#^Parameter \\#1 \\$callable of method PhpOption\\\\LazyOption\\\\:\\:getOrCall\\(\\) expects callable\\(\\)\\: S, 'does_not_exist' given\\.$#" - count: 4 - path: tests/PhpOption/Tests/LazyOptionTest.php - - - - message: "#^Call to an undefined method PhpOption\\\\Tests\\\\LazyOptionTest\\:\\:setExpectedException\\(\\)\\.$#" - count: 4 - path: tests/PhpOption/Tests/LazyOptionTest.php - - - - message: "#^Parameter \\#1 \\$callback of class PhpOption\\\\LazyOption constructor expects callable\\(\\.\\.\\.mixed\\)\\: PhpOption\\\\Option\\, 'invalidCallback' given\\.$#" - count: 1 - path: tests/PhpOption/Tests/LazyOptionTest.php - - - - message: "#^Parameter \\#1 \\$callback of static method PhpOption\\\\LazyOption\\\\:\\:create\\(\\) expects callable\\(\\.\\.\\.mixed\\)\\: PhpOption\\\\Option\\, 'invalidCallback' given\\.$#" - count: 1 - path: tests/PhpOption/Tests/LazyOptionTest.php - - - - message: "#^Call to an undefined method PhpOption\\\\Tests\\\\NoneTest\\:\\:setExpectedException\\(\\)\\.$#" - count: 2 - path: tests/PhpOption/Tests/NoneTest.php - - - - message: "#^Result of method PhpOption\\\\None\\:\\:ifDefined\\(\\) \\(void\\) is used\\.$#" - count: 1 - path: tests/PhpOption/Tests/NoneTest.php - - - - message: "#^Parameter \\#1 \\$array of static method PhpOption\\\\Option\\\\:\\:fromArraysValue\\(\\) expects array\\\\|ArrayAccess\\\\|null, 'foo' given\\.$#" - count: 1 - path: tests/PhpOption/Tests/OptionTest.php - - - - message: "#^Parameter \\#1 \\$callable of method PhpOption\\\\Some\\\\:\\:getOrCall\\(\\) expects callable\\(\\)\\: S, 'does_not_exist' given\\.$#" - count: 2 - path: tests/PhpOption/Tests/SomeTest.php - - - - message: "#^Parameter \\#1 \\$value of method PhpOption\\\\Some\\\\:\\:select\\(\\) expects string, true given\\.$#" - count: 1 - path: tests/PhpOption/Tests/SomeTest.php - - - - message: "#^Parameter \\#1 \\$value of method PhpOption\\\\Some\\\\:\\:reject\\(\\) expects string, null given\\.$#" - count: 1 - path: tests/PhpOption/Tests/SomeTest.php - - - - message: "#^Parameter \\#1 \\$value of method PhpOption\\\\Some\\\\:\\:reject\\(\\) expects string, true given\\.$#" - count: 1 - path: tests/PhpOption/Tests/SomeTest.php diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index 882ab86..d572d14 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -1,6 +1,6 @@ { "require": { - "phpstan/phpstan": "1.10.3" + "phpstan/phpstan": "1.10.41" }, "config": { "preferred-install": "dist" diff --git a/vendor-bin/psalm/composer.json b/vendor-bin/psalm/composer.json index 489700e..c87e133 100644 --- a/vendor-bin/psalm/composer.json +++ b/vendor-bin/psalm/composer.json @@ -1,6 +1,6 @@ { "require": { - "psalm/phar": "5.7.6" + "psalm/phar": "5.15.0" }, "config": { "preferred-install": "dist"