Skip to content

Commit 1d80cde

Browse files
committed
add tests
1 parent b316443 commit 1d80cde

9 files changed

+1700
-0
lines changed

.travis.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
language: php
2+
php:
3+
- 7.0
4+
- 7.1
5+
- 7.2
6+
- master
7+
8+
matrix:
9+
include:
10+
- php: 7.0
11+
env: dependencies=lowest
12+
- php: 7.0
13+
env: dependencies=highest
14+
- php: 7.1
15+
env: dependencies=lowest
16+
- php: 7.1
17+
env: dependencies=highest
18+
- php: 7.2
19+
env: dependencies=lowest
20+
- php: 7.2
21+
env: dependencies=highest
22+
- php: master
23+
env: dependencies=lowest
24+
- php: master
25+
env: dependencies=highest
26+
allow_failures:
27+
- php: master
28+
- php: master
29+
env: dependencies=lowest
30+
- php: master
31+
env: dependencies=highest
32+
33+
before_script:
34+
- composer self-update
35+
- if [ -z "$dependencies" ]; then composer install; fi;
36+
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest -n; fi;
37+
- if [ "$dependencies" = "highest" ]; then composer update -n; fi;
38+
39+
script:
40+
- vendor/bin/phing

build.xml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<project name="PHPStan PHPDoc Parser" default="check">
3+
4+
<target name="check" depends="
5+
composer-validate,
6+
composer-install,
7+
lint,
8+
cs,
9+
tests
10+
"/>
11+
12+
<target name="composer-validate">
13+
<exec
14+
executable="composer"
15+
logoutput="true"
16+
passthru="true"
17+
checkreturn="true"
18+
>
19+
<arg value="validate"/>
20+
</exec>
21+
</target>
22+
23+
<target name="composer-install">
24+
<exec
25+
executable="composer"
26+
logoutput="true"
27+
passthru="true"
28+
checkreturn="true"
29+
>
30+
<arg value="install"/>
31+
</exec>
32+
</target>
33+
34+
<target name="lint">
35+
<exec
36+
executable="vendor/bin/parallel-lint"
37+
logoutput="true"
38+
passthru="true"
39+
checkreturn="true"
40+
>
41+
<arg value="--exclude"/>
42+
<arg path="tests/PHPStan/Analyser/data"/>
43+
<arg value="--exclude"/>
44+
<arg path="tests/PHPStan/Rules/Methods/data"/>
45+
<arg value="--exclude"/>
46+
<arg path="tests/PHPStan/Rules/Functions/data"/>
47+
<arg path="src" />
48+
<arg path="tests" />
49+
</exec>
50+
</target>
51+
52+
<target name="cs">
53+
<exec
54+
executable="vendor/bin/phpcs"
55+
logoutput="true"
56+
passthru="true"
57+
checkreturn="true"
58+
>
59+
<arg value="--extensions=php"/>
60+
<arg value="--encoding=utf-8"/>
61+
<arg value="--tab-width=4"/>
62+
<arg value="--ignore=tests/*/data,tests/*/traits"/>
63+
<arg value="-sp"/>
64+
<arg path="src"/>
65+
<arg path="tests"/>
66+
</exec>
67+
</target>
68+
69+
<target name="cs-fix">
70+
<exec
71+
executable="vendor/bin/phpcbf"
72+
logoutput="true"
73+
passthru="true"
74+
checkreturn="true"
75+
>
76+
<arg value="--extensions=php"/>
77+
<arg value="--encoding=utf-8"/>
78+
<arg value="--tab-width=4"/>
79+
<arg value="--ignore=tests/*/data,tests/*/traits"/>
80+
<arg value="-sp"/>
81+
<arg path="src"/>
82+
<arg path="tests"/>
83+
</exec>
84+
</target>
85+
86+
<target name="tests">
87+
<exec
88+
executable="vendor/bin/phpunit"
89+
logoutput="true"
90+
passthru="true"
91+
checkreturn="true"
92+
>
93+
<arg value="-c"/>
94+
<arg value="tests/phpunit.xml"/>
95+
<arg path="tests"/>
96+
</exec>
97+
</target>
98+
</project>

composer.json

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
"require": {
55
"php": "~7.0"
66
},
7+
"require-dev": {
8+
"consistence/coding-standard": "^2.0.0",
9+
"jakub-onderka/php-parallel-lint": "^0.9.2",
10+
"phing/phing": "^2.16.0",
11+
"phpunit/phpunit": "^6.3",
12+
"slevomat/coding-standard": "^3.3.0"
13+
},
714
"autoload": {
815
"psr-4": {"PHPStan\\PhpDocParser\\": ["src/"]}
916
}

phpcs.xml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PHPStan PHPDoc Parser">
3+
<rule ref="vendor/consistence/coding-standard/Consistence/ruleset.xml">
4+
<exclude name="Squiz.Functions.GlobalFunction.Found"/>
5+
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
6+
</rule>
7+
<rule ref="vendor/slevomat/coding-standard/SlevomatCodingStandard/ruleset.xml">
8+
<exclude name="SlevomatCodingStandard.Classes.ClassConstantVisibility.MissingConstantVisibility"/>
9+
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName"/>
10+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword"/>
11+
<exclude name="SlevomatCodingStandard.Namespaces.UseOnlyWhitelistedNamespaces"/>
12+
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
13+
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableParameterTypeHintSpecification"/>
14+
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableReturnTypeHintSpecification"/>
15+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation.NonFullyQualifiedClassName"/>
16+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants"/>
17+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions"/>
18+
<exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
19+
</rule>
20+
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
21+
<properties>
22+
<property name="caseSensitive" value="false"/>
23+
</properties>
24+
</rule>
25+
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
26+
<properties>
27+
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
28+
</properties>
29+
</rule>
30+
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration">
31+
<properties>
32+
<property name="usefulAnnotations" type="array" value="
33+
@dataProvider,
34+
@requires,
35+
@throws
36+
"/>
37+
<property name="enableNullableTypeHints" type="false" />
38+
<property name="enableVoidTypeHint" type="false" />
39+
</properties>
40+
</rule>
41+
</ruleset>

0 commit comments

Comments
 (0)