Skip to content

Commit 107a20d

Browse files
authored
Merge pull request php-vcr#376 from php-vcr/360-php-81-compatibility
360 php 81 compatibility
2 parents d85a1c6 + 483c3aa commit 107a20d

File tree

11 files changed

+65
-13
lines changed

11 files changed

+65
-13
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ jobs:
6161

6262
tests:
6363
strategy:
64-
fail-fast: true
64+
fail-fast: false
6565
matrix:
6666
php:
6767
- "8.0"
68+
- "8.1"
6869
stability:
6970
- "stable"
7071
dependencies:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"symfony/event-dispatcher-contracts": "^1|^2|^3"
2424
},
2525
"require-dev": {
26-
"guzzlehttp/guzzle": "^7.0",
27-
"phpunit/phpunit": "^9.5.0",
26+
"guzzlehttp/guzzle": "^7",
27+
"phpunit/phpunit": "^9.5.10",
2828
"mikey179/vfsstream": "^1.6.10",
2929
"phpstan/phpstan": "^1",
3030
"phpstan/phpstan-beberlei-assert": "^1",

docker-compose.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
version: "3.8"
22
services:
3-
workspace:
3+
workspace80:
44
tty: true
55
build:
6-
context: resources/docker/workspace
6+
context: resources/docker/workspace/8.0
7+
args:
8+
PUID: "${PUID:-1000}"
9+
PGID: "${PGID:-1000}"
10+
volumes:
11+
- .:/var/www/html
12+
- ~/.composer:/home/user/.composer
13+
workspace81:
14+
tty: true
15+
build:
16+
context: resources/docker/workspace/8.1
717
args:
818
PUID: "${PUID:-1000}"
919
PGID: "${PGID:-1000}"
File renamed without changes.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM php:8.1-cli-alpine
2+
3+
ARG PUID=1000
4+
ARG PGID=1000
5+
6+
RUN apk add --no-cache --virtual .build-deps \
7+
# for extensions
8+
$PHPIZE_DEPS \
9+
# for soap
10+
libxml2-dev \
11+
# for xdebug \
12+
linux-headers \
13+
&& \
14+
apk add --no-cache \
15+
bash \
16+
# for soap
17+
libxml2 \
18+
# for composer
19+
unzip \
20+
&& \
21+
docker-php-ext-install soap \
22+
&& \
23+
pecl install \
24+
# pcov for coverage runs
25+
pcov && docker-php-ext-enable pcov \
26+
&& \
27+
# for debugging
28+
pecl install xdebug && docker-php-ext-enable xdebug \
29+
&& \
30+
apk del .build-deps
31+
32+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
33+
34+
WORKDIR /var/www/html
35+
36+
# Add a non-root user to prevent files being created with root permissions on host machine.
37+
RUN addgroup -g ${PGID} user && \
38+
adduser -u ${PUID} -G user -D user
39+
40+
USER user

src/VCR/CodeTransform/AbstractCodeTransform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function register(): void
3636
*
3737
* @see http://www.php.net/manual/en/php-user-filter.filter.php
3838
*/
39-
public function filter($in, $out, &$consumed, $closing)
39+
public function filter($in, $out, &$consumed, $closing): int
4040
{
4141
while ($bucket = stream_bucket_make_writeable($in)) {
4242
$bucket->data = $this->transformCode($bucket->data);

src/VCR/Storage/AbstractStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(string $cassettePath, string $cassetteName, string $
6868
*
6969
* @return array<string,mixed>|null parsed current record
7070
*/
71-
public function current()
71+
public function current(): ?array
7272
{
7373
return $this->current;
7474
}

src/VCR/Storage/Blackhole.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ public function key(): int
3535
throw new \BadMethodCallException('Not implemented');
3636
}
3737

38-
/** @return array<mixed>|null */
39-
public function next(): ?array
38+
public function next(): void
4039
{
41-
return null;
4240
}
4341

4442
public function rewind(): void

src/VCR/Storage/Yaml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function rewind(): void
8888
$this->position = 0;
8989
}
9090

91-
public function valid()
91+
public function valid(): bool
9292
{
9393
if (null === $this->current) {
9494
$this->next();

tests/Unit/Storage/AbstractStorageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function next(): void
5151
{
5252
}
5353

54-
public function valid()
54+
public function valid(): bool
5555
{
5656
return (bool) $this->position;
5757
}

0 commit comments

Comments
 (0)