Skip to content

Commit 9d7c3bd

Browse files
committed
Add PHP8 testing support
- Also upgrade psalm - Add missing rulesets for PHPCS - Upgrade PHPCS rules
1 parent 02e24c5 commit 9d7c3bd

File tree

7 files changed

+43
-14
lines changed

7 files changed

+43
-14
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ env:
22
global:
33
- CC_TEST_REPORTER_ID=300652b345e59425b0203fd817ea93f39a436ef531b5731f0378b5ec3c755d33
44
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
5+
- XDEBUG_MODE=coverage
56
language: php
67
php:
78
- '7.2'
89
- '7.3'
910
- '7.4'
11+
- '8.0'
1012

1113
before_script:
1214
- composer self-update

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
},
2323
"require-dev": {
2424
"bamarni/composer-bin-plugin": "^1.3",
25-
"captainhook/plugin-composer": "^5.0"
25+
"captainhook/plugin-composer": "^5.0",
26+
"phpunit/phpunit": "^8.0|^9.0"
2627
},
2728
"config": {
2829
"sort-packages": false,
@@ -42,14 +43,14 @@
4243
},
4344
"scripts": {
4445
"phpstan": "vendor/bin/phpstan analyse",
46+
"phpstan_full": "vendor/bin/phpstan clear-result-cache && vendor/bin/phpstan analyse",
4547
"phpstan_base": "vendor/bin/phpstan analyse --generate-baseline",
46-
"phpstan_clear": "vendor/bin/phpstan clear-result-cache",
47-
"psalm": "vendor/bin/psalm --show-info=false --diff",
48-
"psalm_full": "vendor/bin/psalm --show-info=false",
48+
"psalm": "vendor/bin/psalm --show-info=false",
49+
"psalm_full": "vendor/bin/psalm --clear-cache && vendor/bin/psalm --show-info=false",
4950
"psalm_base": "vendor/bin/psalm --set-baseline=psalm-baseline.xml",
5051
"phpunit": "vendor/bin/phpunit --colors=always",
5152
"phpunit_clover": "vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml",
52-
"codecoverage": "vendor/bin/phpunit --coverage-html tests/_reports",
53+
"coverage": "vendor/bin/phpunit --coverage-html tests/_reports",
5354
"phpcs": "vendor/bin/phpcs --standard=ruleset.xml --extensions=php --cache=.phpcs-cache --colors src tests",
5455
"phpcsfix": "vendor/bin/phpcbf --standard=ruleset.xml --extensions=php --cache=.phpcs-cache src tests",
5556
"binupdate": "@composer bin all update --ansi",

psalm-baseline.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="3.11.2@d470903722cfcbc1cd04744c5491d3e6d13ec3d9">
2+
<files psalm-version="4.3.1@2feba22a005a18bf31d4c7b9bdb9252c73897476">
3+
<file src="src/PhpSyntaxExtension.php">
4+
<InternalClass occurrences="4">
5+
<code>ExpressionParser::OPERATOR_LEFT</code>
6+
<code>ExpressionParser::OPERATOR_LEFT</code>
7+
<code>ExpressionParser::OPERATOR_LEFT</code>
8+
<code>ExpressionParser::OPERATOR_LEFT</code>
9+
</InternalClass>
10+
</file>
311
<file src="src/TokenParser/BreakOrContinueTokenParser.php">
412
<InternalMethod occurrences="3">
513
<code>getSourceContext</code>
614
<code>getSourceContext</code>
715
<code>getSourceContext</code>
816
</InternalMethod>
17+
<UnsafeInstantiation occurrences="1">
18+
<code>new $nodeClass($loopNumber, $lineno, $this-&gt;getTag())</code>
19+
</UnsafeInstantiation>
920
</file>
1021
<file src="src/TokenParser/ForeachTokenParser.php">
1122
<InternalMethod occurrences="2">
12-
<code>parseExpression</code>
1323
<code>getSourceContext</code>
24+
<code>parseExpression</code>
1425
</InternalMethod>
1526
</file>
1627
</files>

ruleset.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,24 @@
3737
</properties>
3838
</rule>
3939
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment"/>
40+
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
41+
<rule ref="SlevomatCodingStandard.Functions.StrictCall"/>
42+
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
43+
<rule ref="SlevomatCodingStandard.PHP.DisallowReference"/>
44+
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
45+
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable"/>
46+
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
47+
<rule ref="SlevomatCodingStandard.Functions.DisallowEmptyFunction"/>
48+
<!--<rule ref="SlevomatCodingStandard.Functions.TrailingCommaInCall"/>-->
49+
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
50+
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
51+
<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
52+
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
53+
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
54+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
55+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing"/>
56+
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
57+
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
58+
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants"/>
59+
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding"/>
4060
</ruleset>

vendor-bin/phpcs/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
33
"squizlabs/php_codesniffer": "^3.5",
4-
"slevomat/coding-standard": "^5.0"
4+
"slevomat/coding-standard": "^6.0"
55
}
66
}

vendor-bin/phpunit/composer.json

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

vendor-bin/psalm/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"vimeo/psalm": "^3.7"
3+
"vimeo/psalm": "^4.0"
44
}
55
}

0 commit comments

Comments
 (0)