diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..4454cf9 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,30 @@ +name: Tests + +on: push + +permissions: + contents: read + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + + - name: Validate composer.json and composer.lock + run: make composerValidate + + - name: Install dependencies + run: | + cd ./src + composer install --prefer-dist --no-progress + + - name: Run phpstan + run: make phpstan diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b1f2b3c --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONE composerValidate: +composerValidate: + cd ./src && composer validate --strict + +.PHONE phpstan: +phpstan: + cd ./src && composer phpstan \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..7a9bac7 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,14 @@ +parameters: + level: 5 + + paths: + - ./src/app + - ./src/www + +includes: + - ./src/vendor/phpstan/phpstan-deprecation-rules/rules.neon + - ./src/vendor/phpstan/phpstan-dibi/extension.neon + - ./src/vendor/phpstan/phpstan-nette/extension.neon + - ./src/vendor/phpstan/phpstan-strict-rules/rules.neon + - ./src/vendor/spaze/phpstan-disallowed-calls/extension.neon + - phar://phpstan.phar/conf/bleedingEdge.neon diff --git a/src/composer.json b/src/composer.json index 3e61bc4..45ba3d9 100644 --- a/src/composer.json +++ b/src/composer.json @@ -22,7 +22,11 @@ }, "require-dev": { "nette/tester": "^2.5", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-dibi": "^2.0", "phpstan/phpstan-nette": "^2", + "phpstan/phpstan-strict-rules": "^2.0", + "spaze/phpstan-disallowed-calls": "^4.6", "symfony/thanks": "^1" }, "autoload": { @@ -31,13 +35,17 @@ } }, "scripts": { - "phpstan": "phpstan analyse", + "phpstan": "phpstan analyse -c ../phpstan.neon", "tester": "tester tests -s" }, "minimum-stability": "stable", "config": { "allow-plugins": { "symfony/thanks": true - } + }, + "platform": { + "php": "8.3" + }, + "sort-packages": true } } diff --git a/src/composer.lock b/src/composer.lock index 507f3e5..eeb804d 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "540527a09710ac4f0ffcd5d700801d8d", + "content-hash": "ed24e22e05daeaa8f7f7ef0c04598c18", "packages": [ { "name": "latte/latte", @@ -1574,6 +1574,105 @@ ], "time": "2025-08-04T19:17:37+00:00" }, + { + "name": "phpstan/phpstan-deprecation-rules", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", + "reference": "468e02c9176891cc901143da118f09dc9505fc2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/468e02c9176891cc901143da118f09dc9505fc2f", + "reference": "468e02c9176891cc901143da118f09dc9505fc2f", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.1.15" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", + "support": { + "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/2.0.3" + }, + "time": "2025-05-14T10:56:57+00:00" + }, + { + "name": "phpstan/phpstan-dibi", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-dibi.git", + "reference": "80c582d7a4687e6d071d1fe70a12664b9f44555a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-dibi/zipball/80c582d7a4687e6d071d1fe70a12664b9f44555a", + "reference": "80c582d7a4687e6d071d1fe70a12664b9f44555a", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" + }, + "conflict": { + "dibi/dibi": "<3.0" + }, + "require-dev": { + "dibi/dibi": "~4.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Dibi class reflection extension for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-dibi/issues", + "source": "https://github.com/phpstan/phpstan-dibi/tree/2.0.0" + }, + "time": "2024-10-04T12:01:58+00:00" + }, { "name": "phpstan/phpstan-nette", "version": "2.0.4", @@ -1636,6 +1735,122 @@ }, "time": "2025-06-17T13:26:39+00:00" }, + { + "name": "phpstan/phpstan-strict-rules", + "version": "2.0.6", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-strict-rules.git", + "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/f9f77efa9de31992a832ff77ea52eb42d675b094", + "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0.4" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Extra strict and opinionated rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.6" + }, + "time": "2025-07-21T12:19:29+00:00" + }, + { + "name": "spaze/phpstan-disallowed-calls", + "version": "v4.6.0", + "source": { + "type": "git", + "url": "https://github.com/spaze/phpstan-disallowed-calls.git", + "reference": "d77ea1351ac2cc16c00a389ea0db87fc11072b80" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spaze/phpstan-disallowed-calls/zipball/d77ea1351ac2cc16c00a389ea0db87fc11072b80", + "reference": "d77ea1351ac2cc16c00a389ea0db87fc11072b80", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^1.12.6 || ^2.0" + }, + "require-dev": { + "nette/neon": "^3.3.1", + "nikic/php-parser": "^4.13.2 || ^5.0", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-deprecation-rules": "^1.2 || ^2.0", + "phpunit/phpunit": "^8.5.14 || ^10.1 || ^11.0 || ^12.0", + "shipmonk/dead-code-detector": "^0.12", + "spaze/coding-standard": "^1.8" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "Spaze\\PHPStan\\Rules\\Disallowed\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michal Špaček", + "email": "mail@michalspacek.cz", + "homepage": "https://www.michalspacek.cz" + } + ], + "description": "PHPStan rules to detect disallowed method & function calls, constant, namespace, attribute & superglobal usages, with powerful rules to re-allow a call or a usage in places where it should be allowed.", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/spaze/phpstan-disallowed-calls/issues", + "source": "https://github.com/spaze/phpstan-disallowed-calls/tree/v4.6.0" + }, + "funding": [ + { + "url": "https://github.com/spaze", + "type": "github" + } + ], + "time": "2025-07-11T18:17:33+00:00" + }, { "name": "symfony/thanks", "version": "v1.4.0", @@ -1707,5 +1922,8 @@ "php": ">= 8.3" }, "platform-dev": {}, + "platform-overrides": { + "php": "8.3" + }, "plugin-api-version": "2.6.0" } diff --git a/src/phpstan.neon b/src/phpstan.neon deleted file mode 100644 index 6a3b774..0000000 --- a/src/phpstan.neon +++ /dev/null @@ -1,10 +0,0 @@ -parameters: - level: 5 - - paths: - - src - - bin - - tests - -includes: - - vendor/phpstan/phpstan-nette/extension.neon