Skip to content

Commit 42f933e

Browse files
committed
FIX compatibility issues with PSR library
1 parent 560f0b2 commit 42f933e

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

dev/Stream.php

+14-13
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ public function __construct(string $content = '')
1414
$this->content = $content;
1515
}
1616

17-
public function __toString()
17+
public function __toString(): string
1818
{
1919
return $this->content;
2020
}
2121

22-
public function close()
22+
public function close(): void
2323
{
2424
}
2525

@@ -28,27 +28,27 @@ public function detach()
2828
return null;
2929
}
3030

31-
public function getSize()
31+
public function getSize(): ?int
3232
{
3333
return strlen($this->content);
3434
}
3535

36-
public function tell()
36+
public function tell(): int
3737
{
3838
return $this->pointer;
3939
}
4040

41-
public function eof()
41+
public function eof(): bool
4242
{
4343
return $this->tell() >= $this->getSize();
4444
}
4545

46-
public function isSeekable()
46+
public function isSeekable(): bool
4747
{
4848
return true;
4949
}
5050

51-
public function seek($offset, $whence = SEEK_SET)
51+
public function seek($offset, $whence = SEEK_SET): void
5252
{
5353
switch ($whence) {
5454
case SEEK_SET:
@@ -63,34 +63,35 @@ public function seek($offset, $whence = SEEK_SET)
6363
}
6464
}
6565

66-
public function rewind()
66+
public function rewind(): void
6767
{
6868
$this->seek(0);
6969
}
7070

71-
public function isWritable()
71+
public function isWritable(): bool
7272
{
7373
return false;
7474
}
7575

76-
public function write($string)
76+
public function write($string): int
7777
{
78+
return 0;
7879
}
7980

80-
public function isReadable()
81+
public function isReadable(): bool
8182
{
8283
return true;
8384
}
8485

85-
public function read($length)
86+
public function read($length): string
8687
{
8788
$bytes = substr($this->content, $this->pointer, $length);
8889
$this->pointer += $length;
8990
$this->pointer = min($this->pointer, $this->getSize());
9091
return $bytes;
9192
}
9293

93-
public function getContents()
94+
public function getContents(): string
9495
{
9596
return $this->content;
9697
}

src/utils/StreamWrapper.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -14,72 +14,72 @@ public function __construct(StreamInterface $stream)
1414
$this->stream = $stream;
1515
}
1616

17-
public function __toString()
17+
public function __toString(): string
1818
{
1919
return $this->stream->__toString();
2020
}
2121

22-
public function close()
22+
public function close(): void
2323
{
24-
return $this->stream->close();
24+
$this->stream->close();
2525
}
2626

2727
public function detach()
2828
{
2929
return $this->stream->detach();
3030
}
3131

32-
public function getSize()
32+
public function getSize(): ?int
3333
{
3434
return $this->stream->getSize();
3535
}
3636

37-
public function tell()
37+
public function tell(): int
3838
{
3939
return $this->stream->tell();
4040
}
4141

42-
public function eof()
42+
public function eof(): bool
4343
{
4444
return $this->stream->eof();
4545
}
4646

47-
public function isSeekable()
47+
public function isSeekable(): bool
4848
{
4949
return $this->stream->isSeekable();
5050
}
5151

52-
public function seek($offset, $whence = SEEK_SET)
52+
public function seek($offset, $whence = SEEK_SET): void
5353
{
54-
return $this->stream->seek($offset, $whence);
54+
$this->stream->seek($offset, $whence);
5555
}
5656

57-
public function rewind()
57+
public function rewind(): void
5858
{
59-
return $this->stream->rewind();
59+
$this->stream->rewind();
6060
}
6161

62-
public function isWritable()
62+
public function isWritable(): bool
6363
{
6464
return $this->stream->isWritable();
6565
}
6666

67-
public function write($string)
67+
public function write($string): int
6868
{
6969
return $this->stream->write($string);
7070
}
7171

72-
public function isReadable()
72+
public function isReadable(): bool
7373
{
7474
return $this->stream->isReadable();
7575
}
7676

77-
public function read($length)
77+
public function read($length): string
7878
{
7979
return $this->stream->read($length);
8080
}
8181

82-
public function getContents()
82+
public function getContents(): string
8383
{
8484
return $this->stream->getContents();
8585
}

0 commit comments

Comments
 (0)