Skip to content

Commit 3dd2c7a

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 d331a5c commit 3dd2c7a

File tree

179 files changed

+20751
-2
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

+20751
-2
lines changed

.phive/phars.xml

-1
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.70" 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.1" installed="2.1.8" location="./tools/phpstan" copy="true"/>
65
</phive>

build.xml

+19-1
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,28 @@
3232
</target>
3333

3434
<target name="update-tools">
35-
<exec executable="phive" taskname="phive">
35+
<exec executable="${basedir}/tools/phive">
36+
<arg value="--no-progress"/>
37+
<arg value="self-update"/>
38+
</exec>
39+
40+
<exec executable="${basedir}/tools/phive">
3641
<arg value="--no-progress"/>
3742
<arg value="update"/>
3843
</exec>
44+
45+
<exec executable="${basedir}/tools/composer" dir="${basedir}/tools/.phpstan" taskname="composer">
46+
<arg value="update"/>
47+
<arg value="--no-interaction"/>
48+
<arg value="--no-progress"/>
49+
<arg value="--no-ansi"/>
50+
</exec>
51+
52+
<exec executable="${basedir}/tools/composer" dir="${basedir}/tools/.phpstan" taskname="composer">
53+
<arg value="bump"/>
54+
<arg value="--no-interaction"/>
55+
<arg value="--no-ansi"/>
56+
</exec>
3957
</target>
4058
</project>
4159

phpstan.neon

+42
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,53 @@ parameters:
55
- tests/tests
66
- tests/bootstrap.php
77

8+
checkTooWideReturnTypesInProtectedAndPublicMethods: true
9+
reportAlwaysTrueInLastCondition: true
10+
reportPossiblyNonexistentConstantArrayOffset: true
11+
reportPossiblyNonexistentGeneralArrayOffset: true
812
treatPhpDocTypesAsCertain: false
913

14+
strictRules:
15+
allRules: false
16+
booleansInConditions: true
17+
closureUsesThis: true
18+
disallowedBacktick: true
19+
disallowedEmpty: true
20+
disallowedImplicitArrayCreation: true
21+
disallowedLooseComparison: true
22+
disallowedShortTernary: true
23+
illegalConstructorMethodCall: true
24+
matchingInheritedMethodNames: true
25+
noVariableVariables: true
26+
numericOperandsInArithmeticOperators: true
27+
overwriteVariablesWithLoop: true
28+
requireParentConstructorCall: true
29+
strictArrayFilter: true
30+
strictFunctionCalls: true
31+
switchConditionsMatchingType: true
32+
uselessCast: true
33+
34+
ergebnis:
35+
allRules: false
36+
final:
37+
enabled: true
38+
classesNotRequiredToBeAbstractOrFinal:
39+
- SebastianBergmann\CodeCoverage\Report\Xml\File
40+
41+
type_coverage:
42+
declare: 100
43+
return: 100
44+
param: 100
45+
property: 100
46+
constant: 100
47+
1048
ignoreErrors:
1149
# Ignore errors caused by defensive programming
1250
- '#Call to function assert\(\) with true will always evaluate to true.#'
1351
- '#Call to method .* will always evaluate to true.#'
1452
- '#Call to method .* will always evaluate to false.#'
1553
- '#Instanceof between .* and .* will always evaluate to true.#'
54+
- '#SebastianBergmann\\CodeCoverage\\Node\\Iterator::current\(\) should be covariant with return type#'
55+
56+
includes:
57+
- phar://phpstan.phar/conf/bleedingEdge.neon

tools/.phpstan/composer.json

+14
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)