Skip to content

Commit dffba86

Browse files
Merge pull request #12 from sascha-egerer/feature/phpstan-0-11-compatibility
Add PHPStan 0.11 compatibility and add CI tests
2 parents bd61028 + 1902fa9 commit dffba86

18 files changed

+633
-494
lines changed

.editorconfig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
9+
[*.{php,phpt}]
10+
indent_style = tab
11+
indent_size = 4
12+
13+
[*.xml]
14+
indent_style = tab
15+
indent_size = 4
16+
17+
[*.neon]
18+
indent_style = tab
19+
indent_size = 4
20+
21+
[*.{yaml,yml}]
22+
indent_style = space
23+
indent_size = 2
24+
25+
[composer.json]
26+
indent_style = tab
27+
indent_size = 4

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
/vendor
21
/composer.lock
2+
/vendor
3+
/typo3
4+
/.idea
5+
/index.php

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: php
2+
php:
3+
- 7.1
4+
- 7.2
5+
- 7.3
6+
env:
7+
- dependencies=lowest
8+
- dependencies=highest
9+
matrix:
10+
exclude:
11+
- php: 7.2
12+
env: dependencies=lowest
13+
- php: 7.3
14+
env: dependencies=lowest
15+
before_script:
16+
- composer self-update
17+
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --no-interaction; fi;
18+
- if [ "$dependencies" = "highest" ]; then composer update --no-interaction; fi;
19+
script:
20+
- vendor/bin/phing

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ Put this into your phpstan.neon config:
88
```
99
includes:
1010
- vendor/saschaegerer/phpstan-typo3/extension.neon
11+
```
12+
13+
If you do use constants of TYPO3 core you may have to
14+
bootstrap TYPO3 first. This can be done by using the
15+
unit testing bootstrap of the testing-framework
16+
17+
```
1118
parameters:
12-
bootstrap: %rootDir%/../../saschaegerer/phpstan-typo3/src/PhpstanTypo3Bootstrap.php
19+
autoload_files:
20+
- %rootDir%/../../typo3/testing-framework/Resources/Core/Build/UnitTestsBootstrap.php
1321
```

build.xml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<project name="PHPStan TYPO3 extensions" default="check">
3+
<target name="check" depends="
4+
composer,
5+
lint,
6+
cs,
7+
phpstan
8+
"/>
9+
10+
<target name="composer">
11+
<exec
12+
executable="composer"
13+
logoutput="true"
14+
passthru="true"
15+
checkreturn="true"
16+
>
17+
<arg value="install"/>
18+
</exec>
19+
</target>
20+
21+
<target name="lint">
22+
<exec
23+
executable="vendor/bin/parallel-lint"
24+
logoutput="true"
25+
passthru="true"
26+
checkreturn="true"
27+
>
28+
<arg path="src" />
29+
</exec>
30+
</target>
31+
32+
<target name="cs">
33+
<exec
34+
executable="vendor/bin/phpcs"
35+
logoutput="true"
36+
passthru="true"
37+
checkreturn="true"
38+
>
39+
<arg value="--extensions=php"/>
40+
<arg value="--encoding=utf-8"/>
41+
<arg value="--tab-width=4"/>
42+
<arg value="-sp"/>
43+
<arg path="src"/>
44+
</exec>
45+
</target>
46+
47+
<target name="cs-fix">
48+
<exec
49+
executable="vendor/bin/phpcbf"
50+
logoutput="true"
51+
passthru="true"
52+
checkreturn="true"
53+
>
54+
<arg value="--extensions=php"/>
55+
<arg value="--encoding=utf-8"/>
56+
<arg value="--tab-width=4"/>
57+
<arg value="-sp"/>
58+
<arg path="src"/>
59+
</exec>
60+
</target>
61+
62+
<target name="phpstan">
63+
<exec
64+
executable="vendor/bin/phpstan"
65+
logoutput="true"
66+
passthru="true"
67+
checkreturn="true"
68+
>
69+
<arg value="analyse"/>
70+
<arg value="-l"/>
71+
<arg value="7"/>
72+
<arg value="-c"/>
73+
<arg path="phpstan.neon"/>
74+
<arg path="src"/>
75+
</exec>
76+
</target>
77+
</project>

composer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@
77
"prefer-stable": true,
88
"require": {
99
"php": "~7.1",
10-
"phpstan/phpstan": "^0.10",
11-
"typo3/cms-core": "^8.7 || ^9.5",
12-
"typo3/cms-extbase": "^8.7 || ^9.5"
10+
"phpstan/phpstan": "^0.10 || ^0.11",
11+
"typo3/cms-core": "^8.7 || ^9.5 || ^10.0",
12+
"typo3/cms-extbase": "^8.7 || ^9.5 || ^10.0"
13+
},
14+
"require-dev": {
15+
"consistence/coding-standard": "^3.8",
16+
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
17+
"jakub-onderka/php-parallel-lint": "^1.0",
18+
"phing/phing": "^2.16.0",
19+
"phpstan/phpstan-strict-rules": "^0.11"
1320
},
1421
"suggest": {
1522
"typo3/testing-framework": "Testing framework is used in the bootstrap (src/PhpStanTypo3Bootstrap.php). In most cases you need this package but you may also use your custom bootstrap (e.g. if you use nimut/testing-framework)"

phpcs.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHPStan Doctrine">
3+
<rule ref="vendor/consistence/coding-standard/Consistence/ruleset.xml">
4+
<exclude name="Squiz.Functions.GlobalFunction.Found"/>
5+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword"/>
6+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
7+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions"/>
8+
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
9+
<exclude name="Consistence.Exceptions.ExceptionDeclaration"/>
10+
</rule>
11+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
12+
<properties>
13+
<property name="caseSensitive" value="false"/>
14+
</properties>
15+
</rule>
16+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
17+
<properties>
18+
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
19+
</properties>
20+
</rule>
21+
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration">
22+
<properties>
23+
<property name="enableObjectTypeHint" value="false"/>
24+
</properties>
25+
</rule>
26+
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
27+
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
28+
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
29+
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
30+
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
31+
</ruleset>

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
parameters:
2-
bootstrap: src/PhpStanTypo3Bootstrap.php
1+
includes:
2+
- vendor/phpstan/phpstan-strict-rules/rules.neon

src/PhpstanTypo3Bootstrap.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)