Skip to content

Commit 5556a4a

Browse files
committed
Fix return types for PHP 8.1
1 parent 7016057 commit 5556a4a

File tree

7 files changed

+16
-5
lines changed

7 files changed

+16
-5
lines changed

File/Stream.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Stream extends File
2323
*
2424
* @return int|false
2525
*/
26+
#[\ReturnTypeWillChange]
2627
public function getSize()
2728
{
2829
return false;

HeaderBag.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ public function removeCacheControlDirective($key)
279279
*
280280
* @return \ArrayIterator An \ArrayIterator instance
281281
*/
282+
#[\ReturnTypeWillChange]
282283
public function getIterator()
283284
{
284285
return new \ArrayIterator($this->headers);
@@ -289,6 +290,7 @@ public function getIterator()
289290
*
290291
* @return int The number of headers
291292
*/
293+
#[\ReturnTypeWillChange]
292294
public function count()
293295
{
294296
return \count($this->headers);

ParameterBag.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public function filter($key, $default = null, $filter = \FILTER_DEFAULT, $option
210210
*
211211
* @return \ArrayIterator An \ArrayIterator instance
212212
*/
213+
#[\ReturnTypeWillChange]
213214
public function getIterator()
214215
{
215216
return new \ArrayIterator($this->parameters);
@@ -220,6 +221,7 @@ public function getIterator()
220221
*
221222
* @return int The number of parameters
222223
*/
224+
#[\ReturnTypeWillChange]
223225
public function count()
224226
{
225227
return \count($this->parameters);

Session/Attribute/AttributeBag.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public function clear()
131131
*
132132
* @return \ArrayIterator An \ArrayIterator instance
133133
*/
134+
#[\ReturnTypeWillChange]
134135
public function getIterator()
135136
{
136137
return new \ArrayIterator($this->attributes);
@@ -141,6 +142,7 @@ public function getIterator()
141142
*
142143
* @return int The number of attributes
143144
*/
145+
#[\ReturnTypeWillChange]
144146
public function count()
145147
{
146148
return \count($this->attributes);

Session/Session.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function isStarted()
126126
*
127127
* @return \ArrayIterator An \ArrayIterator instance
128128
*/
129+
#[\ReturnTypeWillChange]
129130
public function getIterator()
130131
{
131132
return new \ArrayIterator($this->getAttributeBag()->all());
@@ -136,6 +137,7 @@ public function getIterator()
136137
*
137138
* @return int
138139
*/
140+
#[\ReturnTypeWillChange]
139141
public function count()
140142
{
141143
return \count($this->getAttributeBag()->all());

Session/Storage/Handler/MemcachedSessionHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public function __construct(\Memcached $memcached, array $options = [])
5757
/**
5858
* @return bool
5959
*/
60+
#[\ReturnTypeWillChange]
6061
public function close()
6162
{
6263
return $this->memcached->quit();
@@ -73,6 +74,7 @@ protected function doRead($sessionId)
7374
/**
7475
* @return bool
7576
*/
77+
#[\ReturnTypeWillChange]
7678
public function updateTimestamp($sessionId, $data)
7779
{
7880
$this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl);

Tests/File/FakeFile.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ class FakeFile extends OrigFile
1717
{
1818
private $realpath;
1919

20-
public function __construct($realpath, $path)
20+
public function __construct(string $realpath, string $path)
2121
{
2222
$this->realpath = $realpath;
2323
parent::__construct($path, false);
2424
}
2525

26-
public function isReadable()
26+
public function isReadable(): bool
2727
{
2828
return true;
2929
}
3030

31-
public function getRealpath()
31+
public function getRealpath(): string
3232
{
3333
return $this->realpath;
3434
}
3535

36-
public function getSize()
36+
public function getSize(): int
3737
{
3838
return 42;
3939
}
4040

41-
public function getMTime()
41+
public function getMTime(): int
4242
{
4343
return time();
4444
}

0 commit comments

Comments
 (0)