Skip to content

Commit c47da5c

Browse files
committed
Maintenance: codesniffer, phpstan, make
1 parent 832b06b commit c47da5c

6 files changed

+45
-29
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ indent_style = tab
1111
indent_size = tab
1212
tab_width = 4
1313

14-
[{*.json, *.yaml, *.yml, *.md}]
14+
[*.{json,yaml,yml,md}]
1515
indent_style = space
1616
indent_size = 2

.gitattributes

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# Not archived
21
.docs export-ignore
3-
tests export-ignore
2+
.github export-ignore
43
.editorconfig export-ignore
54
.gitattributes export-ignore
65
.gitignore export-ignore
7-
.travis.yml export-ignore
86
Makefile export-ignore
9-
phpstan.neon export-ignore
107
README.md export-ignore
8+
phpstan.neon export-ignore
119
ruleset.xml export-ignore
10+
tests export-ignore

.gitignore

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
/composer.lock
77

88
# Tests
9-
/temp
10-
/coverage.html
11-
/coverage.xml
9+
/tests/tmp
10+
/coverage.*
11+
/tests/**/*.log
12+
/tests/**/*.html
13+
/tests/**/*.expected
14+
/tests/**/*.actual

Makefile

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
.PHONY: install qa cs csf phpstan tests coverage
2-
1+
.PHONY: install
32
install:
43
composer update
54

5+
.PHONY: qa
66
qa: phpstan cs
77

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

16+
.PHONY: csf
1517
csf:
16-
vendor/bin/codefixer src tests
18+
vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --extensions="php,phpt" --colors -nsp src tests
1719

20+
.PHONY: phpstan
1821
phpstan:
1922
vendor/bin/phpstan analyse -c phpstan.neon
2023

24+
.PHONY: tests
2125
tests:
22-
vendor/bin/tester -s -p php --colors 1 -C tests/cases
26+
vendor/bin/tester -s -p php --colors 1 -C tests/Cases
2327

28+
.PHONY: coverage
2429
coverage:
2530
ifdef GITHUB_ACTION
26-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/cases
31+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/Cases
2732
else
28-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.html --coverage-src src tests/cases
33+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.html --coverage-src src tests/Cases
2934
endif

phpstan.neon

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +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:
85
level: 9
6+
phpVersion: 80100
7+
8+
scanDirectories:
9+
- src
10+
11+
fileExtensions:
12+
- php
13+
914
paths:
1015
- src
16+
- .docs
17+
1118
ignoreErrors:
12-
- '#^Parameter \#1 \$callback of function call_user_func expects callable\(\): mixed, array\{string\|null, .+\} given\.$#'

ruleset.xml

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
<?xml version="1.0"?>
2-
<ruleset>
3-
<!-- Contributte Coding Standard -->
4-
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="Contributte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
3+
<!-- Rulesets -->
4+
<rule ref="./vendor/contributte/qa/ruleset-8.0.xml"/>
55

6-
<!-- Specific rules -->
6+
<!-- Rules -->
77
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
88
<properties>
99
<property name="rootNamespaces" type="array">
1010
<element key="src" value="Contributte\Console"/>
11-
<element key="tests/cases" value="Tests\Cases"/>
12-
<element key="tests/fixtures" value="Tests\Fixtures"/>
11+
<element key="tests" value="Tests"/>
12+
</property>
13+
<property name="extensions" type="array">
14+
<element key="php" value="php"/>
15+
<element key="phpt" value="phpt"/>
1316
</property>
1417
</properties>
1518
</rule>
1619

17-
<!-- Exclude folders -->
20+
<!-- Excludes -->
1821
<exclude-pattern>/tests/tmp</exclude-pattern>
1922
</ruleset>

0 commit comments

Comments
 (0)