Skip to content

Commit 4bc1231

Browse files
claudef3l1x
authored andcommitted
Modernize tooling to match contributte standards
- Update Makefile with GitHub Actions detection - Use contributte/phpstan for PHPStan configuration - Use contributte/qa for CodeSniffer ruleset - Update composer.json: - Require PHP 8.2+ - Add contributte/qa and contributte/phpstan dev dependencies - Fix ruleset.xml element syntax for rootNamespaces
1 parent 4bc6974 commit 4bc1231

File tree

4 files changed

+39
-30
lines changed

4 files changed

+39
-30
lines changed

Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
.PHONY: install qa cs csf phpstan tests coverage-clover coverage-html
1+
.PHONY: install qa cs csf phpstan tests coverage
22

33
install:
44
composer update
55

66
qa: phpstan cs
77

88
cs:
9-
vendor/bin/codesniffer src tests
9+
ifdef GITHUB_ACTION
10+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp -q --report=checkstyle src tests | cs2pr
11+
else
12+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp src tests
13+
endif
1014

1115
csf:
12-
vendor/bin/codefixer src tests
16+
vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp src tests
1317

1418
phpstan:
15-
vendor/bin/phpstan analyse -l 8 -c phpstan.neon src
19+
vendor/bin/phpstan analyse -c phpstan.neon
1620

1721
tests:
1822
vendor/bin/tester -s -p php --colors 1 -C tests/cases
1923

20-
coverage-clover:
24+
coverage:
25+
ifdef GITHUB_ACTION
2126
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases
22-
23-
coverage-html:
27+
else
2428
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.html --coverage-src ./src tests/cases
29+
endif

composer.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@
1919
}
2020
],
2121
"require": {
22-
"php": ">=7.2",
23-
"nette/http": "^3.0.1"
22+
"php": ">=8.2",
23+
"nette/http": "^3.3"
2424
},
2525
"require-dev": {
26-
"nette/di": "^3.0.0",
26+
"contributte/phpstan": "^0.1",
27+
"contributte/qa": "^0.4",
28+
"nette/di": "^3.2",
2729
"ninjify/nunjuck": "^0.4",
28-
"ninjify/qa": "^0.12",
29-
"phpstan/phpstan": "^1.0",
30-
"phpstan/phpstan-deprecation-rules": "^1.0",
31-
"phpstan/phpstan-nette": "^1.0",
32-
"phpstan/phpstan-strict-rules": "^1.0",
33-
"tracy/tracy": "^2.5.1"
30+
"tracy/tracy": "^2.10"
3431
},
3532
"suggest": {
3633
"nette/di": "to use CompilerExtensions"
@@ -50,7 +47,7 @@
5047
},
5148
"extra": {
5249
"branch-alias": {
53-
"dev-master": "0.5.x-dev"
50+
"dev-master": "0.6.x-dev"
5451
}
5552
}
5653
}

phpstan.neon

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
includes:
2-
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
3-
- vendor/phpstan/phpstan-nette/extension.neon
4-
- vendor/phpstan/phpstan-nette/rules.neon
5-
- vendor/phpstan/phpstan-strict-rules/rules.neon
2+
- vendor/contributte/phpstan/phpstan.neon
63

74
parameters:
5+
level: 9
6+
phpVersion: 80200
7+
8+
scanDirectories:
9+
- src
10+
11+
fileExtensions:
12+
- php
13+
14+
paths:
15+
- src
16+
- .docs
17+
818
ignoreErrors:
9-
- '#Parameter \#1 \$body of method Contributte\\Http\\Curl\\ResponseFactory::setBody\(\) expects string, bool\|string given.#'

ruleset.xml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<?xml version="1.0"?>
22
<ruleset>
33
<!-- Contributte Coding Standard -->
4-
<rule ref="./vendor/ninjify/coding-standard/contributte.xml">
5-
<exclude name="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn.UselessIfCondition"/>
6-
</rule>
4+
<rule ref="./vendor/contributte/qa/ruleset-8.2.xml"/>
75

86
<!-- Specific rules -->
97
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
108
<properties>
11-
<property name="rootNamespaces" type="array" value="
12-
src=>Contributte\Http
13-
"/>
9+
<property name="rootNamespaces" type="array">
10+
<element key="src" value="Contributte\Http"/>
11+
<element key="tests" value="Tests"/>
12+
</property>
1413
</properties>
1514
</rule>
1615

17-
<!--Exclude folders -->
16+
<!-- Exclude folders -->
1817
<exclude-pattern>/tests/tmp</exclude-pattern>
1918
</ruleset>
20-

0 commit comments

Comments
 (0)