Skip to content

Commit 180d5b6

Browse files
Merge pull request php-vcr#357 from php-vcr/php8
Adding support for PHP8, dropping support for PHP7
2 parents e8154b5 + e22c1d6 commit 180d5b6

File tree

112 files changed

+805
-2223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+805
-2223
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: "Setup PHP"
1818
uses: "shivammathur/setup-php@v2"
1919
with:
20-
php-version: "7.3"
20+
php-version: "8.0"
2121
extensions: "curl, soap"
2222
tools: "composer:v2"
2323

@@ -40,7 +40,7 @@ jobs:
4040
- name: "Setup PHP"
4141
uses: "shivammathur/setup-php@v2"
4242
with:
43-
php-version: "7.3"
43+
php-version: "8.0"
4444
extensions: "curl, soap"
4545
tools: "composer:v2"
4646

@@ -57,7 +57,7 @@ jobs:
5757
strategy:
5858
fail-fast: true
5959
matrix:
60-
php: ["7.3", "7.4"]
60+
php: ["8.0"]
6161
composer_flags: ["", "--prefer-lowest"]
6262

6363
name: "Tests PHP ${{ matrix.php }} ${{ matrix.composer_flags}}"
@@ -85,71 +85,7 @@ jobs:
8585
- name: "Execute tests"
8686
run: "vendor/bin/phpunit --coverage-clover=coverage.clover"
8787

88-
- name: "Upload code coverage"
89-
run: "wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover"
90-
91-
guzzle:
92-
strategy:
93-
fail-fast: true
94-
matrix:
95-
guzzle: ["3", "5", "6"]
96-
97-
name: "Integration test for Guzzle ${{ matrix.guzzle }}"
98-
99-
runs-on: "ubuntu-latest"
100-
101-
steps:
102-
- name: "Checkout code"
103-
uses: "actions/checkout@v2"
104-
105-
- name: "Setup PHP"
106-
uses: "shivammathur/setup-php@v2"
107-
with:
108-
php-version: "7.3"
109-
extensions: "curl, soap"
110-
tools: "composer:v2"
111-
coverage: "pcov"
112-
113-
- name: "Check Composer configuration"
114-
run: "composer validate --strict"
115-
116-
- name: "Install dependencies"
117-
run: "composer update --prefer-dist --no-interaction --no-progress"
118-
119-
- name: "Execute tests"
120-
run: "cd tests/integration/guzzle/${{ matrix.guzzle }}/ && composer update --prefer-dist --no-interaction --no-progress && ../../../../vendor/bin/phpunit --coverage-clover=coverage.clover"
121-
122-
- name: "Upload code coverage"
123-
run: "wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover"
124-
125-
soap:
126-
strategy:
127-
fail-fast: true
128-
129-
name: "SOAP integration test"
130-
131-
runs-on: "ubuntu-latest"
132-
133-
steps:
134-
- name: "Checkout code"
135-
uses: "actions/checkout@v2"
136-
137-
- name: "Setup PHP"
138-
uses: "shivammathur/setup-php@v2"
88+
- name: Upload Scrutinizer coverage
89+
uses: sudo-bot/action-scrutinizer@latest
13990
with:
140-
php-version: "7.3"
141-
extensions: "curl, soap"
142-
tools: "composer:v2"
143-
coverage: "pcov"
144-
145-
- name: "Check Composer configuration"
146-
run: "composer validate --strict"
147-
148-
- name: "Install dependencies"
149-
run: "composer update --prefer-dist --no-interaction --no-progress"
150-
151-
- name: "Execute tests"
152-
run: "cd tests/integration/soap/ && composer update --prefer-dist --no-interaction --no-progress && ../../../vendor/bin/phpunit --coverage-clover=coverage.clover"
153-
154-
- name: "Upload code coverage"
155-
run: "wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover"
91+
cli-args: "--format=php-clover coverage.clover"

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
*.idea*
2-
*.sublime-*
31
**/vendor/*
42
coverage/*
53
notes.md
64
tests/fixtures/cassette*
7-
/.php_cs.cache
85
/.php_cs
96
composer.lock
107
.phpunit.result.cache
8+
.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
'@PSR12' => true,
66
'@Symfony' => true,
77
'@Symfony:risky' => true,
8-
'@PHP73Migration' => true,
9-
'@PHP71Migration:risky' => true,
8+
'@PHP80Migration' => true,
9+
'@PHP80Migration:risky' => true,
1010
'@PHPUnit84Migration:risky' => true,
11-
// Causes too much problems for now, fix later
12-
'declare_strict_types' => false,
1311
])
1412
->setFinder(
1513
PhpCsFixer\Finder::create()

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ $ composer require --dev php-vcr/php-vcr
9797

9898
PHP-VCR depends on:
9999

100-
* PHP 7.2+
100+
* PHP 8
101101
* Curl extension
102102
* [symfony/event-dispatcher](https://github.com/symfony/event-dispatcher)
103103
* [symfony/yaml](https://github.com/symfony/yaml)

composer.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "./vendor/bin/phpunit",
77
"lint": "./vendor/bin/php-cs-fixer fix --verbose --diff --dry-run",
88
"fix": "./vendor/bin/php-cs-fixer fix --verbose --diff",
9-
"phpstan": "phpstan analyse -c phpstan.neon --no-progress -vvv"
9+
"phpstan": "php -d memory_limit=-1 vendor/bin/phpstan analyse -c phpstan.neon --no-progress -vvv"
1010
},
1111
"authors": [
1212
{
@@ -15,29 +15,31 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=7.3",
18+
"php": "^8.0",
1919
"ext-curl": "*",
2020
"beberlei/assert": "^3.2.5",
21-
"symfony/yaml": "~2.1|^3.0|^4.0|^5.0",
22-
"symfony/event-dispatcher": "^2.4|^3.0|^4.0|^5.0"
21+
"symfony/yaml": "^3.0|^4.0|^5.0",
22+
"symfony/event-dispatcher": "^5.0"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^8.4.0",
26-
"mikey179/vfsstream": "^1.6",
27-
"phpstan/phpstan": "^0.12",
25+
"guzzlehttp/guzzle": "^7.0",
26+
"phpunit/phpunit": "^9.5.0",
27+
"mikey179/vfsstream": "^1.6.10",
28+
"phpstan/phpstan": "^0.12.92",
2829
"phpstan/phpstan-beberlei-assert": "^0.12.0",
2930
"thecodingmachine/phpstan-strict-rules": "^0.12",
30-
"sebastian/version": "^1.0.3|^2.0",
31-
"friendsofphp/php-cs-fixer": "^2.16"
31+
"friendsofphp/php-cs-fixer": "^3.0",
32+
"phpstan/phpstan-phpunit": "^0.12.22",
33+
"phpstan/extension-installer": "^1.1"
3234
},
3335
"autoload": {
3436
"psr-4": {
3537
"VCR\\": "src/VCR/"
3638
}
3739
},
3840
"autoload-dev": {
39-
"classmap": [
40-
"tests/"
41-
]
41+
"psr-4": {
42+
"VCR\\Tests\\": "tests"
43+
}
4244
}
4345
}

phpstan-baseline.neon

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Access to an undefined property object\\:\\:\\$data\\.$#"
5+
count: 2
6+
path: src/VCR/CodeTransform/AbstractCodeTransform.php
7+
8+
-
9+
message: "#^Access to an undefined property object\\:\\:\\$datalen\\.$#"
10+
count: 1
11+
path: src/VCR/CodeTransform/AbstractCodeTransform.php
12+
13+
-
14+
message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#"
15+
count: 1
16+
path: src/VCR/Util/HttpUtil.php
17+
18+
-
19+
message: "#^Cannot call method record\\(\\) on VCR\\\\Cassette\\|null\\.$#"
20+
count: 1
21+
path: src/VCR/Videorecorder.php
22+
23+
-
24+
message: "#^Parameter \\#3 \\$cassette of class VCR\\\\Event\\\\BeforeRecordEvent constructor expects VCR\\\\Cassette, VCR\\\\Cassette\\|null given\\.$#"
25+
count: 1
26+
path: src/VCR/Videorecorder.php
27+

phpstan.neon

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
14
parameters:
2-
level: 7
5+
level: max
36
paths:
47
- src
5-
- tests/VCR
6-
ignoreErrors:
7-
# This part of PHP is not very well documented, resulting PHPStan's definitions not being accurate
8-
- "#Access to an undefined property object::\\$data\\.#"
9-
- "#Access to an undefined property object::\\$datalen\\.#"
10-
# PHPStan cannot detect that strrpos will succeed (because of Assertion above) in HttpUtil::parseStatus
11-
- '#Parameter .* \$str(ing)? of function substr expects string, string\|false given.#'
12-
# The EventDispatcherInterface::dispatch signature is different (!) between Symfony <4.3 and >=4.3
13-
- '/Parameter #1 \$event of method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) expects object, string\|null given./'
14-
- '/Parameter #2 \$eventName of method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) expects string\|null, VCR\\Event\\Event given./'
15-
- '#Call to an undefined method org\\bovigo\\vfs\\vfsStreamContent::hasChild\(\)\.#'
16-
includes:
17-
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
18-
- vendor/phpstan/phpstan-beberlei-assert/extension.neon
8+
- tests

phpunit.xml.dist

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
5-
backupGlobals="false"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
colors="true"
10-
bootstrap="tests/bootstrap.php"
11-
>
12-
13-
<testsuites>
14-
<testsuite name="VCR Test Suit">
15-
<directory>./tests/VCR</directory>
16-
</testsuite>
17-
</testsuites>
18-
19-
<filter>
20-
<whitelist processUncoveredFilesFromWhitelist="true">
21-
<directory suffix=".php">src</directory>
22-
</whitelist>
23-
</filter>
24-
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" colors="true" bootstrap="tests/bootstrap.php">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Unit">
10+
<directory>./tests/Unit</directory>
11+
</testsuite>
12+
<testsuite name="Integration">
13+
<directory>./tests/Integration</directory>
14+
</testsuite>
15+
</testsuites>
2516
</phpunit>

resources/docker/workspace/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.3-cli-alpine
1+
FROM php:8.0-cli-alpine
22

33
ARG PUID=1000
44
ARG PGID=1000

0 commit comments

Comments
 (0)