Skip to content

Commit d6e59b5

Browse files
authored
Merge pull request #20 from PHP-DI/v2
PHP 8 support
2 parents 15678f7 + 8388130 commit d6e59b5

17 files changed

+386
-315
lines changed

.github/workflows/ci.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
pull_request:
7+
branches: ['*']
8+
schedule:
9+
- cron: '0 0 * * *'
10+
11+
jobs:
12+
13+
tests:
14+
name: Tests - PHP ${{ matrix.php }} ${{ matrix.dependency-version }}
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 15
17+
strategy:
18+
matrix:
19+
php: [ '7.2', '7.3', '7.4', '8.0' ]
20+
dependency-version: [ '' ]
21+
include:
22+
- php: '7.2'
23+
dependency-version: '--prefer-lowest'
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
tools: composer:v2
32+
coverage: none
33+
- name: Cache Composer dependencies
34+
uses: actions/cache@v2
35+
with:
36+
path: ~/.composer/cache
37+
key: php-${{ matrix.php }}-composer-locked-${{ hashFiles('composer.lock') }}
38+
restore-keys: php-${{ matrix.php }}-composer-locked-
39+
- name: Install PHP dependencies
40+
run: composer update ${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress --no-suggest
41+
- name: PHPUnit
42+
run: vendor/bin/phpunit
43+
44+
cs:
45+
name: Coding standards
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v2
50+
- name: Setup PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: 7.4
54+
tools: composer:v2, cs2pr
55+
coverage: none
56+
- name: Cache Composer dependencies
57+
uses: actions/cache@v2
58+
with:
59+
path: ~/.composer/cache
60+
key: php-74-composer-locked-${{ hashFiles('composer.lock') }}
61+
restore-keys: php-74-composer-locked-
62+
- name: Install PHP dependencies
63+
run: composer install --no-interaction --no-progress --no-suggest
64+
- name: PHP CodeSniffer
65+
run: vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
vendor/*
44
composer.phar
55
composer.lock
6+
.phpcs-cache
7+
.phpunit.result.cache

.phpcs.xml.dist

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<arg name="basepath" value="."/>
4+
<arg name="extensions" value="php"/>
5+
<arg name="cache" value=".phpcs-cache"/>
6+
<!-- Show sniff names -->
7+
<arg value="s"/>
8+
9+
<file>src</file>
10+
<exclude-pattern>src/PhpDocReader/PhpParser/TokenParser.php</exclude-pattern>
11+
<file>tests</file>
12+
<exclude-pattern>tests/Fixtures</exclude-pattern>
13+
14+
<rule ref="HardMode"/>
15+
16+
<!-- Ignore PhpDocReader\AnnotationException -->
17+
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix">
18+
<severity>0</severity>
19+
</rule>
20+
21+
</ruleset>

.travis.yml

-14
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2015 Matthieu Napoli
1+
Copyright (C) 2019 Matthieu Napoli
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
44
associated documentation files (the "Software"), to deal in the Software without restriction,

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
}
1616
},
1717
"require": {
18-
"php": ">=5.4.0"
18+
"php": ">=7.2.0"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "~4.6"
21+
"phpunit/phpunit": "^8.5|^9.0",
22+
"mnapoli/hard-mode": "~0.3.0"
2223
}
2324
}

phpunit.xml.dist

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.0/phpunit.xsd"
44
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
processIsolation="false"
9-
stopOnFailure="false"
10-
syntaxCheck="false"
115
bootstrap="./vendor/autoload.php">
12-
136
<testsuites>
14-
<testsuite name="PhpDocReader tests">
7+
<testsuite name="Test suite">
158
<directory>./tests/</directory>
169
</testsuite>
1710
</testsuites>
18-
1911
</phpunit>

src/PhpDocReader/AnnotationException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace PhpDocReader;
44

55
/**
6-
* @author Matthieu Napoli <[email protected]>
6+
* We stumbled upon an invalid class/property/method annotation.
77
*/
88
class AnnotationException extends \Exception
99
{

0 commit comments

Comments
 (0)