diff --git a/.editorconfig b/.editorconfig index 3faf149..5e5b915 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,6 +11,6 @@ indent_style = tab indent_size = tab tab_width = 4 -[{*.json, *.yaml, *.yml, *.md}] +[*.{json,yaml,yml,md}] indent_style = space indent_size = 2 diff --git a/.gitattributes b/.gitattributes index d3424bb..aad8529 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,10 @@ +.docs export-ignore +.editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore -tests/ export-ignore +.travis.yml export-ignore +Makefile export-ignore +README.md export-ignore +phpstan.neon export-ignore +ruleset.xml export-ignore +tests export-ignore diff --git a/.github/.kodiak.toml b/.github/.kodiak.toml deleted file mode 100644 index 60c34b6..0000000 --- a/.github/.kodiak.toml +++ /dev/null @@ -1,10 +0,0 @@ -version = 1 - -[merge] -automerge_label = "automerge" -blacklist_title_regex = "^WIP.*" -blacklist_labels = ["WIP"] -method = "rebase" -delete_branch_on_merge = true -notify_on_conflict = true -optimistic_updates = false diff --git a/.github/workflows/codesniffer.yml b/.github/workflows/codesniffer.yml index dfc76ff..590394f 100644 --- a/.github/workflows/codesniffer.yml +++ b/.github/workflows/codesniffer.yml @@ -2,6 +2,7 @@ name: "Codesniffer" on: pull_request: + workflow_dispatch: push: branches: ["*"] @@ -12,4 +13,6 @@ on: jobs: codesniffer: name: "Codesniffer" - uses: contributte/.github/.github/workflows/codesniffer.yml@v1 + uses: contributte/.github/.github/workflows/codesniffer.yml@master + with: + php: "8.4" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 121f718..c51c356 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -2,14 +2,17 @@ name: "Coverage" on: pull_request: + workflow_dispatch: push: branches: ["*"] schedule: - - cron: "0 8 * * 1" + - cron: "0 9 * * 1" jobs: coverage: name: "Nette Tester" - uses: contributte/.github/.github/workflows/nette-tester-coverage.yml@v1 + uses: contributte/.github/.github/workflows/nette-tester-coverage-v2.yml@master + with: + php: "8.4" diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index db3ad34..cd37eba 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,14 +2,17 @@ name: "Phpstan" on: pull_request: + workflow_dispatch: push: branches: ["*"] schedule: - - cron: "0 8 * * 1" + - cron: "0 10 * * 1" jobs: phpstan: name: "Phpstan" - uses: contributte/.github/.github/workflows/phpstan.yml@v1 + uses: contributte/.github/.github/workflows/phpstan.yml@master + with: + php: "8.4" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5da2688..96bcc1e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,29 +2,42 @@ name: "Nette Tester" on: pull_request: + workflow_dispatch: push: branches: ["*"] schedule: - - cron: "0 8 * * 1" + - cron: "0 10 * * 1" jobs: - test82: + test85: name: "Nette Tester" - uses: contributte/.github/.github/workflows/nette-tester.yml@v1 + uses: contributte/.github/.github/workflows/nette-tester.yml@master with: - php: "8.2" + php: "8.5" + + test84: + name: "Nette Tester" + uses: contributte/.github/.github/workflows/nette-tester.yml@master + with: + php: "8.4" - test81: + test83: name: "Nette Tester" - uses: contributte/.github/.github/workflows/nette-tester.yml@v1 + uses: contributte/.github/.github/workflows/nette-tester.yml@master with: - php: "8.1" + php: "8.3" + + test82: + name: "Nette Tester" + uses: contributte/.github/.github/workflows/nette-tester.yml@master + with: + php: "8.2" testlowest: name: "Nette Tester" - uses: contributte/.github/.github/workflows/nette-tester.yml@v1 + uses: contributte/.github/.github/workflows/nette-tester.yml@master with: - php: "8.1" + php: "8.2" composer: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable --prefer-lowest" diff --git a/.gitignore b/.gitignore index 5fc020f..f0b3670 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,14 @@ -/vendor/ -/.idea/ +# IDE +/.idea + +# Composer +/vendor /composer.lock -*.iml + +# Tests +/tests/tmp +/coverage.* +/tests/**/*.log +/tests/**/*.html +/tests/**/*.expected +/tests/**/*.actual diff --git a/Makefile b/Makefile index b232d62..33bc117 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ -.PHONY: install qa cs csf phpstan tests coverage - +.PHONY: install install: composer update +.PHONY: qa qa: phpstan cs +.PHONY: cs cs: ifdef GITHUB_ACTION vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp -q --report=checkstyle src tests | cs2pr @@ -12,15 +13,19 @@ else vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp src tests endif +.PHONY: csf csf: - vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --colors -nsp src tests + vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp src tests +.PHONY: phpstan phpstan: vendor/bin/phpstan analyse -c phpstan.neon +.PHONY: tests tests: vendor/bin/tester -s -p php --colors 1 -C tests/Cases +.PHONY: coverage coverage: ifdef GITHUB_ACTION vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/Cases diff --git a/composer.json b/composer.json index fd729e4..791f201 100644 --- a/composer.json +++ b/composer.json @@ -33,16 +33,16 @@ } ], "require": { - "php": ">=8.1", + "php": ">=8.2", "mpdf/mpdf": "^8.1.0", "nette/application": "^3.1.0", "nette/http": "^3.2.0" }, "require-dev": { + "contributte/phpstan": "^0.2.0", + "contributte/qa": "^0.4.0", + "contributte/tester": "^0.3.0", "nette/di": "^3.1.2", - "contributte/qa": "^0.4", - "contributte/tester": "^0.3", - "contributte/phpstan": "^0.1", "symfony/css-selector": "^6.3.0", "symfony/dom-crawler": "^6.3.0" }, @@ -58,6 +58,11 @@ "Contributte\\PdfResponse\\": "src/" } }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests" + } + }, "minimum-stability": "dev", "prefer-stable": true, "config": { diff --git a/phpstan.neon b/phpstan.neon index 8debc4b..cd64186 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,7 +3,7 @@ includes: parameters: level: 9 - phpVersion: 80100 + phpVersion: 80200 scanDirectories: - src @@ -14,8 +14,3 @@ parameters: paths: - src - .docs - - excludePaths: - - src/DI/SentryExtension24.php - - ignoreErrors: diff --git a/ruleset.xml b/ruleset.xml index 489ef79..9d2237c 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -1,6 +1,6 @@ - + diff --git a/src/PdfResponse.php b/src/PdfResponse.php index cb5951b..57259b9 100644 --- a/src/PdfResponse.php +++ b/src/PdfResponse.php @@ -31,7 +31,7 @@ * @link http://addons.nette.org/cs/pdfresponse2 * @property string $saveMode * @property string $pageOrientation - * @property string|array $pageFormat + * @property string|array $pageFormat * @property string $pageMargins * @property string $documentAuthor * @property string $documentTitle @@ -104,7 +104,7 @@ class PdfResponse implements Response private bool $multiLanguage = false; - /** @var bool, REQUIRES symfony/dom-crawler package */ + /** @var bool REQUIRES symfony/dom-crawler package */ private bool $ignoreStylesInHTMLDocument = false; private string|Template $source; @@ -502,8 +502,7 @@ private function build(): Mpdf if ($this->source instanceof Template) { try { - /** @noinspection PhpMethodParametersCountMismatchInspection */ - $html = $this->source->__toString(true); + $html = $this->source->__toString(); } catch (Throwable $e) { throw new InvalidStateException('Template rendering failed', 0, $e); } diff --git a/tests/.coveralls.yml b/tests/.coveralls.yml deleted file mode 100644 index 8450382..0000000 --- a/tests/.coveralls.yml +++ /dev/null @@ -1,4 +0,0 @@ -# for php-coveralls -service_name: github-actions -coverage_clover: coverage.xml -json_path: coverage.json