Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.docs export-ignore
tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.github export-ignore
Makefile export-ignore
README.md export-ignore
phpstan.lowest.neon export-ignore
phpstan.neon export-ignore
readme.md export-ignore
ruleset.xml export-ignore
tests export-ignore
51 changes: 36 additions & 15 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "8.0"
php-version: "8.2"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

Expand All @@ -42,9 +42,9 @@ jobs:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.2"
extensions: "${{ env.extensions }}"
tools: "composer"
tools: "composer, cs2pr"

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "8.1"
php-version: "8.2"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

Expand All @@ -104,9 +104,9 @@ jobs:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
php-version: "8.2"
extensions: "${{ env.extensions }}"
tools: "composer"
tools: "composer, cs2pr"

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
Expand Down Expand Up @@ -148,12 +148,10 @@ jobs:

strategy:
matrix:
php-version: [ "8.0", "8.1", "8.2", "8.3", "8.4", "8.5" ]
php-version: [ "8.2", "8.3", "8.4", "8.5" ]
composer-args: [ "" ]
include:
- php-version: "8.0"
composer-args: "--prefer-lowest"
- php-version: "8.1"
- php-version: "8.2"
composer-args: "--prefer-lowest"
fail-fast: false

Expand Down Expand Up @@ -181,7 +179,7 @@ jobs:
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer"
tools: "composer, cs2pr"

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
Expand All @@ -204,7 +202,30 @@ jobs:
run: 'echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"'

- name: "Tests"
run: "make tests"
run: "make tests 2>&1 | tee tester.out"

- name: "Surface test failure"
if: failure() && matrix.php-version == '8.4' && matrix.composer-args == ''
env:
GH_TOKEN: ${{ github.token }}
run: |
{
echo '<details><summary>tester output (PHP ${{ matrix.php-version }})</summary>'
echo
echo '```'
sed -E 's/\x1b\[[0-9;]*m//g' tester.out | tail -200
echo '```'
for f in $(find tests -name '*.actual' 2>/dev/null); do
echo
echo "**$f**"
echo
echo '```'
cat "$f"
echo '```'
done
echo '</details>'
} > comment.md
gh pr comment ${{ github.event.pull_request.number }} --body-file comment.md

tests-code-coverage:
if: "github.event_name == 'push'"
Expand Down Expand Up @@ -232,7 +253,7 @@ jobs:
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "8.0"
php-version: "8.2"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

Expand All @@ -246,10 +267,10 @@ jobs:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.2"
coverage: "xdebug"
extensions: "${{ env.extensions }}"
tools: "composer"
tools: "composer, cs2pr"

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'
Expand Down
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# IDE
/.idea
/temp

# Composer
/vendor
/composer.lock

# Tests
/temp
/tests/tmp
/coverage.*
/tests/**/*.log
/tests/**/*.html
/tests/**/*.expected
/tests/**/*.actual
64 changes: 36 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
.PHONY: qa lint cs csf phpstan tests coverage

all:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs

vendor: composer.json composer.lock
composer install

qa: lint phpstan cs

lint: vendor
vendor/bin/linter src tests

cs: vendor
vendor/bin/codesniffer src tests

csf: vendor
vendor/bin/codefixer src tests

phpstan: vendor
vendor/bin/phpstan analyse -l max -c phpstan.neon src

phpstan-lowest: vendor
vendor/bin/phpstan analyse -l max -c phpstan.lowest.neon src

tests: vendor
.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
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 --extensions="php,phpt" --colors -nsp src tests

.PHONY: phpstan
phpstan:
vendor/bin/phpstan analyse -c phpstan.neon

.PHONY: phpstan-lowest
phpstan-lowest:
vendor/bin/phpstan analyse -c phpstan.lowest.neon

.PHONY: tests
tests:
vendor/bin/tester -s -p php --colors 1 -C tests/Tests

coverage: vendor
vendor/bin/tester -s --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/Tests
.PHONY: coverage
coverage:
ifdef GITHUB_ACTION
vendor/bin/tester -s -p php --colors 1 -C --coverage coverage.xml --coverage-src src tests/Tests
else
vendor/bin/tester -s -p php --colors 1 -C --coverage coverage.html --coverage-src src tests/Tests
endif
13 changes: 5 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
}
],
"require": {
"php": "^8.0.2",
"latte/latte": "^2.6|^3.0.25",
"php": "^8.2",
"latte/latte": "^3.0.25",
"nette/di": "^3.0.6",
"nette/http": "^3.0.7",
"nette/neon": "^3.3.1",
Expand All @@ -27,19 +27,16 @@
"symfony/config": "^6.0|^7.0|^8.0"
},
"require-dev": {
"contributte/phpstan": "^0.3.1",
"contributte/qa": "^0.4.0",
"contributte/tester": "^0.4.1",
"doctrine/orm": "^2.8",
"mockery/mockery": "^1.4",
"nette/application": "^3.1.0",
"nette/bootstrap": "^3.2.1",
"nette/database": "^3.1.1",
"nette/robot-loader": "^3.4.0|^4.0.0",
"nette/tester": "^2.3.1",
"ninjify/nunjuck": "^0.4.0",
"ninjify/qa": "^0.13",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-nette": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"psr/log": "^1.1|^2.0|^3.0",
"tracy/tracy": "^2.8"
},
Expand Down
56 changes: 1 addition & 55 deletions phpstan.lowest.neon
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
includes:
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/phpstan/phpstan-nette/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/contributte/phpstan/phpstan.neon

parameters:
level: max
paths:
- src
- tests
excludePaths:
- src/Latte/TranslatorExtension.php
- src/Latte/Nodes/*
Expand All @@ -18,53 +14,3 @@ parameters:
count: 2
message: '#^Variable property access on object\.$#'
path: 'src/Loaders/Doctrine.php'

# -------------------------------------------------------------------
# for back compatibility with old packages - will be remove in future
# -------------------------------------------------------------------

-
message: """
#^Fetching class constant class of deprecated (class|interface) Nette\\\\Localization\\\\ITranslator\\:
use Nette\\\\Localization\\\\Translator$#
"""
path: src/DI/TranslationExtension.php

-
count: 1
message: """
#^Parameter \\$translator of method Contributte\\\\Translation\\\\Latte\\\\Filters\\:\\:__construct\\(\\) has typehint with deprecated interface Nette\\\\Localization\\\\ITranslator\\:
use Nette\\\\Localization\\\\Translator$#
"""
path: src/Latte/Filters.php

-
count: 1
message: """
#^Parameter \\$translator of method Contributte\\\\Translation\\\\Latte\\\\TranslatorExtension\\:\\:__construct\\(\\) has typehint with deprecated interface Nette\\\\Localization\\\\ITranslator\\:
use Nette\\\\Localization\\\\Translator$#
"""
path: src/Latte/TranslatorExtension.php

-
count: 1
message: """
#^Class Contributte\\\\Translation\\\\PrefixedTranslator implements deprecated interface Nette\\\\Localization\\\\ITranslator\\:
use Nette\\\\Localization\\\\Translator$#
"""
path: src/PrefixedTranslator.php

-
count: 1
message: """
#^Class Contributte\\\\Translation\\\\Translator implements deprecated interface Nette\\\\Localization\\\\ITranslator\\:
use Nette\\\\Localization\\\\Translator$#
"""
path: src/Translator.php

-
message: """
#^Fetching class constant class of deprecated (class|interface) Nette\\\\Bridges\\\\ApplicationLatte\\\\ILatteFactory\\:
use Nette\\\\Bridges\\\\ApplicationLatte\\\\LatteFactory$#
"""
path: src/DI/TranslationExtension.php
Loading
Loading