Skip to content

Commit f0c35ef

Browse files
authored
Merge pull request #21 from wmde/php8
Add PHP 8 to CI
2 parents fa76a8b + 410780d commit f0c35ef

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

.phpcs.xml

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,39 @@
11
<?xml version="1.0"?>
22
<ruleset>
3-
<rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase">
4-
<exclude name="Wikibase.Commenting.ClassLevelDocumentation" />
3+
4+
<!-- This rule set includes all rules from the MediaWiki rule set, see
5+
https://github.com/wikimedia/mediawiki-tools-codesniffer/blob/master/MediaWiki/ruleset.xml
6+
-->
7+
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
8+
9+
<!-- The function comment sniff is way to rigorous about way to many details that need
10+
exceptions:
11+
* It complains about missing documentation on fully self-explanatory function headers
12+
with strict type hints.
13+
* It complains about missing documentation if there is a proper @see tag.
14+
* It complains about duplicate spaces in "@param <type> $<var>", but removing these
15+
doesn't make the code easier to read.
16+
* It does not understand "@param <type> [$optional,…]. -->
17+
<exclude name="MediaWiki.Commenting.FunctionComment" />
18+
19+
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
20+
21+
<!-- Even if we encourage to use spaces in comments, we don't think this sniff should block
22+
patches from being merged. -->
23+
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment" />
524
</rule>
625

26+
<!-- Metrics are intentionally not part of the base Wikibase CodeSniffer rule set. -->
27+
<rule ref="Generic.Metrics.CyclomaticComplexity" />
28+
<rule ref="Generic.Metrics.NestingLevel" />
29+
730
<rule ref="Generic.Files.LineLength">
831
<properties>
932
<property name="lineLimit" value="120" />
1033
</properties>
1134
</rule>
1235

1336
<file>.</file>
37+
<arg name="extensions" value="php" />
38+
<arg name="encoding" value="UTF-8" />
1439
</ruleset>

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
language: php
22

3+
dist: xenial
4+
35
php:
46
- 7.2
57
- 7.3
68
- 7.4
9+
- 8.0
710

811
sudo: false
912

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"require-dev": {
2020
"phpunit/phpunit": "^8.5.3",
21-
"wikibase/wikibase-codesniffer": "^1.2.0"
21+
"mediawiki/mediawiki-codesniffer": "34.0.0"
2222
},
2323
"autoload-dev": {
2424
"psr-4": {

src/Component.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ public function render( array $data ) {
6767
* @return DOMDocument
6868
*/
6969
private function parseHtml( $html ) {
70-
$entityLoaderDisabled = libxml_disable_entity_loader( true );
70+
if ( LIBXML_VERSION < 20900 ) {
71+
$entityLoaderDisabled = libxml_disable_entity_loader( true );
72+
}
7173
$internalErrors = libxml_use_internal_errors( true );
7274
$document = new DOMDocument( '1.0', 'UTF-8' );
7375

@@ -84,7 +86,9 @@ private function parseHtml( $html ) {
8486

8587
// Restore previous state
8688
libxml_use_internal_errors( $internalErrors );
87-
libxml_disable_entity_loader( $entityLoaderDisabled );
89+
if ( LIBXML_VERSION < 20900 ) {
90+
libxml_disable_entity_loader( $entityLoaderDisabled );
91+
}
8892

8993
foreach ( $errors as $error ) {
9094
//TODO html5 tags can fail parsing

src/FilterExpressionParsing/FilterParser.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class FilterParser {
2020
*
2121
* @return ParseResult
2222
*/
23+
// phpcs:ignore Generic.Metrics.CyclomaticComplexity
2324
public function parse( $exp ) {
2425
$inSingle = false;
2526
$inDouble = false;

0 commit comments

Comments
 (0)