Skip to content

Commit ae6db76

Browse files
committed
Add PHP 8.4 tests support
1 parent b600b85 commit ae6db76

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
19+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
2020
os: [ ubuntu-latest, macos-latest, windows-latest ]
2121
stability: [ prefer-lowest, prefer-stable ]
2222
steps:

src/ReadableInterface.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@ interface ReadableInterface
99
/**
1010
* Returns the resource stream of the source.
1111
*
12-
* @return resource Returns the streaming contents of a file.
13-
*
14-
* @throws SourceExceptionInterface May occur during the inability to
15-
* open or some operations with the resource stream.
12+
* @return resource returns the streaming contents of a file
13+
* @throws SourceExceptionInterface may occur during the inability to
14+
* open or some operations with the resource stream
1615
*/
1716
public function getStream();
1817

1918
/**
2019
* Returns the contents of the source.
2120
*
22-
* @return string Returns the string contents of a file.
23-
*
24-
* @throws SourceExceptionInterface May occur when it is not possible to
25-
* read source's data and/or convert it to a string.
21+
* @return string returns the string contents of a file
22+
* @throws SourceExceptionInterface may occur when it is not possible to
23+
* read source's data and/or convert it to a string
2624
*/
2725
public function getContents(): string;
2826

@@ -32,10 +30,9 @@ public function getContents(): string;
3230
* If the value of the source content changes, the hash value will
3331
* also be changed.
3432
*
35-
* @return non-empty-string Returns hash of a file.
36-
*
37-
* @throws SourceExceptionInterface May occur when it is not possible to
38-
* convert object state information into a hash.
33+
* @return non-empty-string returns hash of a file
34+
* @throws SourceExceptionInterface may occur when it is not possible to
35+
* convert object state information into a hash
3936
*/
4037
public function getHash(): string;
4138
}

src/SourceFactoryInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
interface SourceFactoryInterface
88
{
99
/**
10-
* @param mixed $source Arbitrary source reference from which you can
11-
* create a {@see ReadableInterface} instance.
10+
* @param mixed $source arbitrary source reference from which you can
11+
* create a {@see ReadableInterface} instance
1212
*
13-
* @throws SourceExceptionInterface In case of an error in creating the
14-
* source object.
13+
* @throws SourceExceptionInterface in case of an error in creating the
14+
* source object
1515
*/
1616
public function create($source): ReadableInterface;
1717
}

tests/CompatibilityTest.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ public function testFileCompatibility(): void
2323
public function getPathname(): string {}
2424

2525
public function getStream() {}
26+
2627
public function getContents(): string {}
28+
2729
public function getHash(): string {}
2830
};
2931
}
@@ -39,7 +41,9 @@ public function testFileWithMixedCompatibility(): void
3941
public function getPathname(): string {}
4042

4143
public function getStream(): mixed {}
44+
4245
public function getContents(): string {}
46+
4347
public function getHash(): string {}
4448
};
4549
}
@@ -50,7 +54,9 @@ public function testReadableCompatibility(): void
5054

5155
new class () implements ReadableInterface {
5256
public function getStream() {}
57+
5358
public function getContents(): string {}
59+
5460
public function getHash(): string {}
5561
};
5662
}
@@ -64,7 +70,9 @@ public function testReadableWithMixedCompatibility(): void
6470

6571
new class () implements ReadableInterface {
6672
public function getStream(): mixed {}
73+
6774
public function getContents(): string {}
75+
6876
public function getHash(): string {}
6977
};
7078
}
@@ -82,9 +90,12 @@ public function testSourceFactoryCompatibility(): void
8290

8391
new class () implements SourceFactoryInterface {
8492
public function create($source): ReadableInterface {}
85-
public function createFromString(string $content = '', string $name = null): ReadableInterface {}
93+
94+
public function createFromString(string $content = '', ?string $name = null): ReadableInterface {}
95+
8696
public function createFromFile(string $filename): FileInterface {}
87-
public function createFromStream($stream, string $name = null): ReadableInterface {}
97+
98+
public function createFromStream($stream, ?string $name = null): ReadableInterface {}
8899
};
89100
}
90101

@@ -97,9 +108,12 @@ public function testSourceFactoryWithMixedCompatibility(): void
97108

98109
new class () implements SourceFactoryInterface {
99110
public function create(mixed $source): ReadableInterface {}
100-
public function createFromString(string $content = '', string $name = null): ReadableInterface {}
111+
112+
public function createFromString(string $content = '', ?string $name = null): ReadableInterface {}
113+
101114
public function createFromFile(string $filename): FileInterface {}
102-
public function createFromStream(mixed $stream, string $name = null): ReadableInterface {}
115+
116+
public function createFromStream(mixed $stream, ?string $name = null): ReadableInterface {}
103117
};
104118
}
105119
}

0 commit comments

Comments
 (0)