Skip to content

Commit ecfa013

Browse files
* Install PHPStan using Composer in order to be able to use phpstan/phpstan-strict-rules and tomasvotruba/type-coverage
* Configure phpstan/phpstan-strict-rules, tomasvotruba/type-coverage, and ergebnis/phpstan-rules * Update PHPStan configuration * Put Phive binary under version control and manage it through "ant update-tools"
1 parent 9fa4890 commit ecfa013

File tree

179 files changed

+20752
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+20752
-4
lines changed

.phive/phars.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
<phive xmlns="https://phar.io/phive">
33
<phar name="php-cs-fixer" version="^3.64" installed="3.72.0" location="./tools/php-cs-fixer" copy="true"/>
44
<phar name="composer" version="^2.8" installed="2.8.6" location="./tools/composer" copy="true"/>
5-
<phar name="phpstan" version="^2.0" installed="2.1.8" location="./tools/phpstan" copy="true"/>
65
</phive>

build.xml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,27 @@
1717
</target>
1818

1919
<target name="update-tools">
20-
<exec executable="phive" taskname="phive">
20+
<exec executable="${basedir}/tools/phive">
21+
<arg value="--no-progress"/>
22+
<arg value="self-update"/>
23+
</exec>
24+
25+
<exec executable="${basedir}/tools/phive">
2126
<arg value="--no-progress"/>
2227
<arg value="update"/>
23-
<arg value="--force-accept-unsigned"/>
28+
</exec>
29+
30+
<exec executable="${basedir}/tools/composer" dir="${basedir}/tools/.phpstan" taskname="composer">
31+
<arg value="update"/>
32+
<arg value="--no-interaction"/>
33+
<arg value="--no-progress"/>
34+
<arg value="--no-ansi"/>
35+
</exec>
36+
37+
<exec executable="${basedir}/tools/composer" dir="${basedir}/tools/.phpstan" taskname="composer">
38+
<arg value="bump"/>
39+
<arg value="--no-interaction"/>
40+
<arg value="--no-ansi"/>
2441
</exec>
2542
</target>
2643
</project>

phpstan.neon

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,46 @@ parameters:
22
level: 10
33
paths:
44
- src
5-
- tests
5+
- tests/unit
6+
7+
checkTooWideReturnTypesInProtectedAndPublicMethods: true
8+
reportAlwaysTrueInLastCondition: true
9+
reportPossiblyNonexistentConstantArrayOffset: true
10+
reportPossiblyNonexistentGeneralArrayOffset: true
11+
treatPhpDocTypesAsCertain: false
12+
13+
strictRules:
14+
allRules: false
15+
booleansInConditions: true
16+
closureUsesThis: true
17+
disallowedBacktick: true
18+
disallowedEmpty: true
19+
disallowedImplicitArrayCreation: true
20+
disallowedLooseComparison: true
21+
disallowedShortTernary: true
22+
illegalConstructorMethodCall: true
23+
matchingInheritedMethodNames: true
24+
noVariableVariables: true
25+
numericOperandsInArithmeticOperators: true
26+
overwriteVariablesWithLoop: true
27+
requireParentConstructorCall: true
28+
strictFunctionCalls: true
29+
switchConditionsMatchingType: true
30+
uselessCast: true
31+
32+
ergebnis:
33+
allRules: false
34+
final:
35+
enabled: true
36+
privateInFinalClass:
37+
enabled: true
38+
39+
type_coverage:
40+
declare: 100
41+
return: 100
42+
param: 100
43+
property: 100
44+
constant: 100
45+
46+
includes:
47+
- phar://phpstan.phar/conf/bleedingEdge.neon

tools/.phpstan/composer.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"require-dev": {
3+
"phpstan/phpstan": "^2.1.8",
4+
"phpstan/extension-installer": "^1.4.3",
5+
"phpstan/phpstan-strict-rules": "^2.0.3",
6+
"tomasvotruba/type-coverage": "^2.0.2",
7+
"ergebnis/phpstan-rules": "^2.8.0"
8+
},
9+
"config": {
10+
"allow-plugins": {
11+
"phpstan/extension-installer": true
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)