Skip to content

Commit 8b2b609

Browse files
committed
Remove php 7.4 and 8.0 from CI
1 parent 5448ff2 commit 8b2b609

10 files changed

+17
-100
lines changed

composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"require-dev": {
2929
"phpunit/phpunit": "^10.5|^11.0",
3030
"psr/http-message": "^1.0|^2.0",
31-
"httpsoft/http-message": "^1.1",
3231
"phpstan/extension-installer": "^1.4",
3332
"phpstan/phpstan": "^1.11",
3433
"phpstan/phpstan-strict-rules": "^1.6"

src/Exception/NotCreatableException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static function fromInvalidType(mixed $source): self
2222
{
2323
$message = \vsprintf('Cannot create %s instance from %s', [
2424
ReadableInterface::class,
25-
\get_debug_type($source)
25+
\get_debug_type($source),
2626
]);
2727

2828
return new static($message, self::CODE_INVALID_TYPE);

src/MemoizableInterface.php

-13
This file was deleted.

src/Provider/PsrStreamSourceProvider.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,9 @@
1010

1111
final class PsrStreamSourceProvider implements SourceProviderInterface
1212
{
13-
/**
14-
* @readonly
15-
*/
16-
private SourceFactory $parent;
17-
18-
public function __construct(SourceFactory $parent)
19-
{
20-
$this->parent = $parent;
21-
}
13+
public function __construct(
14+
private readonly SourceFactory $parent,
15+
) {}
2216

2317
public function create(mixed $source): ?ReadableInterface
2418
{

src/Provider/SplFileInfoSourceProvider.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@
99

1010
final class SplFileInfoSourceProvider implements SourceProviderInterface
1111
{
12-
/**
13-
* @readonly
14-
*/
15-
private SourceFactory $parent;
16-
17-
public function __construct(SourceFactory $parent)
18-
{
19-
$this->parent = $parent;
20-
}
12+
public function __construct(
13+
private readonly SourceFactory $parent,
14+
) {}
2115

2216
public function create(mixed $source): ?ReadableInterface
2317
{

src/Provider/StreamSourceProvider.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@
99

1010
final class StreamSourceProvider implements SourceProviderInterface
1111
{
12-
/**
13-
* @readonly
14-
*/
15-
private SourceFactory $parent;
16-
17-
public function __construct(SourceFactory $parent)
18-
{
19-
$this->parent = $parent;
20-
}
12+
public function __construct(
13+
private readonly SourceFactory $parent,
14+
) {}
2115

2216
public function create(mixed $source): ?ReadableInterface
2317
{

src/Provider/TextSourceProvider.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@
99

1010
final class TextSourceProvider implements SourceProviderInterface
1111
{
12-
/**
13-
* @readonly
14-
*/
15-
private SourceFactory $parent;
16-
17-
public function __construct(SourceFactory $parent)
18-
{
19-
$this->parent = $parent;
20-
}
12+
public function __construct(
13+
private readonly SourceFactory $parent,
14+
) {}
2115

2216
public function create(mixed $source): ?ReadableInterface
2317
{

src/Source.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ class Source extends Readable implements PreferContentReadingInterface
2121
*/
2222
private $stream;
2323

24-
/**
25-
* @psalm-readonly-allow-private-mutation
26-
*/
27-
private string $content;
28-
2924
/**
3025
* @var non-empty-string
3126
*
@@ -47,7 +42,10 @@ class Source extends Readable implements PreferContentReadingInterface
4742
* used as a resource during the reading of the source
4843
*/
4944
public function __construct(
50-
string $content,
45+
/**
46+
* @psalm-readonly-allow-private-mutation
47+
*/
48+
private string $content,
5149
string $algo = SourceFactory::DEFAULT_HASH_ALGO,
5250
string $temp = SourceFactory::DEFAULT_TEMP_STREAM
5351
) {
@@ -56,7 +54,6 @@ public function __construct(
5654

5755
$this->temp = $temp;
5856
$this->algo = $algo;
59-
$this->content = $content;
6057
}
6158

6259
public function getContents(): string

src/SourceFactoryTrait.php

-25
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Phplrt\Contracts\Source\ReadableInterface;
99
use Phplrt\Contracts\Source\SourceExceptionInterface;
1010
use Phplrt\Contracts\Source\SourceFactoryInterface;
11-
use Psr\Http\Message\StreamInterface;
1211

1312
trait SourceFactoryTrait
1413
{
@@ -37,10 +36,6 @@ public static function getSourceFactory(): SourceFactoryInterface
3736
*/
3837
public static function new(mixed $source): ReadableInterface
3938
{
40-
if ($source instanceof StreamInterface) {
41-
return static::fromPsrStream($source);
42-
}
43-
4439
$factory = self::getSourceFactory();
4540

4641
return $factory->create($source);
@@ -51,7 +46,6 @@ public static function new(mixed $source): ReadableInterface
5146
* @param non-empty-string|null $pathname
5247
*
5348
* @return ($pathname is null ? ReadableInterface : FileInterface)
54-
* @throws SourceExceptionInterface
5549
*/
5650
public static function empty(?string $pathname = null): ReadableInterface
5751
{
@@ -63,7 +57,6 @@ public static function empty(?string $pathname = null): ReadableInterface
6357
* @param non-empty-string|null $pathname
6458
*
6559
* @return ($pathname is null ? ReadableInterface : FileInterface)
66-
* @throws SourceExceptionInterface
6760
*/
6861
public static function fromSources(string $sources, ?string $pathname = null): ReadableInterface
6962
{
@@ -104,24 +97,6 @@ public static function fromPathname(string $pathname): FileInterface
10497
return new File($pathname);
10598
}
10699

107-
/**
108-
* @param non-empty-string|null $pathname
109-
*
110-
* @return ($pathname is null ? ReadableInterface : FileInterface)
111-
* @throws SourceExceptionInterface
112-
*
113-
* @deprecated since phplrt 3.4 and will be removed in 4.0, use {@see fromResource()} instead.
114-
*/
115-
public static function fromPsrStream(StreamInterface $stream, ?string $pathname = null): ReadableInterface
116-
{
117-
trigger_deprecation('phplrt/source', '3.4', <<<'MSG'
118-
Using "%s::fromPsrStream($stream)" with %s argument is deprecated,
119-
use "%1$s::fromResource($stream->detach())" instead.
120-
MSG, static::class, \get_class($stream));
121-
122-
return static::fromResource($stream->detach(), $pathname);
123-
}
124-
125100
/**
126101
* @param resource $resource
127102
* @param non-empty-string|null $pathname

tests/Unit/TestCase.php

-17
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44

55
namespace Phplrt\Source\Tests\Unit;
66

7-
use HttpSoft\Message\StreamFactory;
87
use Phplrt\Source\File;
98
use Phplrt\Source\Tests\TestCase as UnitTestCase;
109

1110
abstract class TestCase extends UnitTestCase
1211
{
1312
public static function provider(): array
1413
{
15-
$factory = new StreamFactory();
16-
1714
return [
1815
'File::fromSources + filename' => [
1916
function () {
@@ -35,20 +32,6 @@ function () {
3532
return File::fromSplFileInfo(new \SplFileInfo(static::getPathname()));
3633
},
3734
],
38-
'File::fromPsrStream + filename' => [
39-
function () use ($factory) {
40-
$stream = $factory->createStreamFromFile(static::getPathname());
41-
42-
return File::fromPsrStream($stream, static::getPathname());
43-
},
44-
],
45-
'File::fromPsrStream' => [
46-
function () use ($factory) {
47-
$stream = $factory->createStreamFromFile(static::getPathname());
48-
49-
return File::fromPsrStream($stream);
50-
},
51-
],
5235
'File::fromResource + filename' => [
5336
function () {
5437
$resource = \fopen(static::getPathname(), 'rb');

0 commit comments

Comments
 (0)