Skip to content

Commit fa8d7dc

Browse files
committed
Code: modernize (codesniffer, phpstan, gitignore, editorconfig)
1 parent 5a4f9ae commit fa8d7dc

5 files changed

Lines changed: 30 additions & 27 deletions

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
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,*.yml,*.yaml,*.md}]
1515
indent_style = space
1616
indent_size = 2

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@
66
/composer.lock
77

88
# Tests
9-
/temp
10-
/coverage.html
119
/coverage.xml

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ qa: phpstan cs
77

88
cs:
99
ifdef GITHUB_ACTION
10-
vendor/bin/codesniffer -q --report=checkstyle src tests | cs2pr
10+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --colors -nsp -q --report=checkstyle src tests | cs2pr
1111
else
12-
vendor/bin/codesniffer src tests
12+
vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --colors -nsp src tests
1313
endif
1414

1515
csf:
16-
vendor/bin/codefixer src tests
16+
vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --colors -nsp src tests
1717

1818
phpstan:
1919
vendor/bin/phpstan analyse -c phpstan.neon
2020

2121
tests:
22-
vendor/bin/tester -s -p php --colors 1 -C tests/cases
22+
vendor/bin/tester -s -p php --colors 1 -C tests/Cases
2323

2424
coverage:
2525
ifdef GITHUB_ACTION
26-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/cases
26+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.xml --coverage-src src tests/Cases
2727
else
28-
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.html --coverage-src src tests/cases
28+
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage coverage.html --coverage-src src tests/Cases
2929
endif

phpstan.neon

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ includes:
66

77
parameters:
88
level: 9
9+
phpVersion: 80000
10+
11+
scanDirectories:
12+
- src
13+
14+
fileExtensions:
15+
- php
16+
917
paths:
1018
- src
19+
1120
ignoreErrors:
12-
- '#^Return type \(string\|null\) of method Contributte\\Guzzlette\\Tracy\\Panel::getPanel\(\) should be covariant with return type \(string\) of method Tracy\\IBarPanel::getPanel\(\)$#'

ruleset.xml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
<?xml version="1.0"?>
2-
<ruleset>
3-
<!-- Contributte Coding Standard -->
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 -->
44
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>
55

6-
<!-- Specific rules -->
7-
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
8-
<properties>
9-
<property name="rootNamespaces" type="array" value="
10-
src=>Contributte\Guzzlette,
11-
"/>
12-
<property name="ignoredNamespaces" type="array" value="
13-
Tests\Contributte\Guzzlette
14-
"/>
15-
</properties>
16-
</rule>
6+
<!-- Rules -->
7+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
8+
<properties>
9+
<property name="rootNamespaces" type="array">
10+
<element key="src" value="Contributte\Guzzlette"/>
11+
<element key="tests" value="Tests"/>
12+
</property>
13+
</properties>
14+
</rule>
1715

18-
<!--Exclude folders -->
19-
<exclude-pattern>/tests/tmp</exclude-pattern>
16+
<!-- Excludes -->
17+
<exclude-pattern>/tests/tmp</exclude-pattern>
2018
</ruleset>
21-

0 commit comments

Comments
 (0)