Skip to content

Commit 7b6dd71

Browse files
Merge branch '5.2' into 5.3
* 5.2: [HttpClient] fix compat with cURL <= 7.37 Remove Debug component from patch-types.php [Config] fix tracking attributes in ReflectionClassResource [Process] Fix incorrect parameter type [HttpFoundation] Handle tentative return types
2 parents d8037fe + a424d70 commit 7b6dd71

7 files changed

+39
-9
lines changed

Session/Storage/Handler/MigratingSessionHandler.php

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function __construct(\SessionHandlerInterface $currentHandler, \SessionHa
4141
/**
4242
* @return bool
4343
*/
44+
#[\ReturnTypeWillChange]
4445
public function close()
4546
{
4647
$result = $this->currentHandler->close();
@@ -52,6 +53,7 @@ public function close()
5253
/**
5354
* @return bool
5455
*/
56+
#[\ReturnTypeWillChange]
5557
public function destroy($sessionId)
5658
{
5759
$result = $this->currentHandler->destroy($sessionId);
@@ -63,6 +65,7 @@ public function destroy($sessionId)
6365
/**
6466
* @return bool
6567
*/
68+
#[\ReturnTypeWillChange]
6669
public function gc($maxlifetime)
6770
{
6871
$result = $this->currentHandler->gc($maxlifetime);
@@ -74,6 +77,7 @@ public function gc($maxlifetime)
7477
/**
7578
* @return bool
7679
*/
80+
#[\ReturnTypeWillChange]
7781
public function open($savePath, $sessionName)
7882
{
7983
$result = $this->currentHandler->open($savePath, $sessionName);
@@ -85,6 +89,7 @@ public function open($savePath, $sessionName)
8589
/**
8690
* @return string
8791
*/
92+
#[\ReturnTypeWillChange]
8893
public function read($sessionId)
8994
{
9095
// No reading from new handler until switch-over
@@ -94,6 +99,7 @@ public function read($sessionId)
9499
/**
95100
* @return bool
96101
*/
102+
#[\ReturnTypeWillChange]
97103
public function write($sessionId, $sessionData)
98104
{
99105
$result = $this->currentHandler->write($sessionId, $sessionData);
@@ -105,6 +111,7 @@ public function write($sessionId, $sessionData)
105111
/**
106112
* @return bool
107113
*/
114+
#[\ReturnTypeWillChange]
108115
public function validateId($sessionId)
109116
{
110117
// No reading from new handler until switch-over
@@ -114,6 +121,7 @@ public function validateId($sessionId)
114121
/**
115122
* @return bool
116123
*/
124+
#[\ReturnTypeWillChange]
117125
public function updateTimestamp($sessionId, $sessionData)
118126
{
119127
$result = $this->currentHandler->updateTimestamp($sessionId, $sessionData);

Session/Storage/Handler/NullSessionHandler.php

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class NullSessionHandler extends AbstractSessionHandler
2121
/**
2222
* @return bool
2323
*/
24+
#[\ReturnTypeWillChange]
2425
public function close()
2526
{
2627
return true;
@@ -29,6 +30,7 @@ public function close()
2930
/**
3031
* @return bool
3132
*/
33+
#[\ReturnTypeWillChange]
3234
public function validateId($sessionId)
3335
{
3436
return true;
@@ -45,6 +47,7 @@ protected function doRead(string $sessionId)
4547
/**
4648
* @return bool
4749
*/
50+
#[\ReturnTypeWillChange]
4851
public function updateTimestamp($sessionId, $data)
4952
{
5053
return true;
@@ -69,6 +72,7 @@ protected function doDestroy(string $sessionId)
6972
/**
7073
* @return bool
7174
*/
75+
#[\ReturnTypeWillChange]
7276
public function gc($maxlifetime)
7377
{
7478
return true;

Session/Storage/Handler/PdoSessionHandler.php

+5
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ public function isSessionExpired()
262262
/**
263263
* @return bool
264264
*/
265+
#[\ReturnTypeWillChange]
265266
public function open($savePath, $sessionName)
266267
{
267268
$this->sessionExpired = false;
@@ -276,6 +277,7 @@ public function open($savePath, $sessionName)
276277
/**
277278
* @return string
278279
*/
280+
#[\ReturnTypeWillChange]
279281
public function read($sessionId)
280282
{
281283
try {
@@ -290,6 +292,7 @@ public function read($sessionId)
290292
/**
291293
* @return bool
292294
*/
295+
#[\ReturnTypeWillChange]
293296
public function gc($maxlifetime)
294297
{
295298
// We delay gc() to close() so that it is executed outside the transactional and blocking read-write process.
@@ -369,6 +372,7 @@ protected function doWrite(string $sessionId, string $data)
369372
/**
370373
* @return bool
371374
*/
375+
#[\ReturnTypeWillChange]
372376
public function updateTimestamp($sessionId, $data)
373377
{
374378
$expiry = time() + (int) ini_get('session.gc_maxlifetime');
@@ -393,6 +397,7 @@ public function updateTimestamp($sessionId, $data)
393397
/**
394398
* @return bool
395399
*/
400+
#[\ReturnTypeWillChange]
396401
public function close()
397402
{
398403
$this->commit();

Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,14 @@ public function testGc()
7575
$this->currentHandler->expects($this->once())
7676
->method('gc')
7777
->with($maxlifetime)
78-
->willReturn(true);
78+
->willReturn(1);
7979

8080
$this->writeOnlyHandler->expects($this->once())
8181
->method('gc')
8282
->with($maxlifetime)
8383
->willReturn(false);
8484

85-
$result = $this->dualHandler->gc($maxlifetime);
86-
$this->assertTrue($result);
85+
$this->assertSame(1, $this->dualHandler->gc($maxlifetime));
8786
}
8887

8988
public function testOpen()

Tests/Session/Storage/Handler/PdoSessionHandlerTest.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ public function __construct(string $driverName = null, int $errorMode = null)
373373
$this->errorMode = null !== $errorMode ?: \PDO::ERRMODE_EXCEPTION;
374374
}
375375

376+
/**
377+
* @return mixed
378+
*/
379+
#[\ReturnTypeWillChange]
376380
public function getAttribute($attribute)
377381
{
378382
if (\PDO::ATTR_ERRMODE === $attribute) {
@@ -386,18 +390,24 @@ public function getAttribute($attribute)
386390
return parent::getAttribute($attribute);
387391
}
388392

393+
/**
394+
* @return false|\PDOStatement
395+
*/
396+
#[\ReturnTypeWillChange]
389397
public function prepare($statement, $driverOptions = [])
390398
{
391399
return \is_callable($this->prepareResult)
392400
? ($this->prepareResult)($statement, $driverOptions)
393401
: $this->prepareResult;
394402
}
395403

396-
public function beginTransaction()
404+
public function beginTransaction(): bool
397405
{
406+
return true;
398407
}
399408

400-
public function rollBack()
409+
public function rollBack(): bool
401410
{
411+
return true;
402412
}
403413
}

Tests/Session/Storage/Handler/StrictSessionHandlerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ public function testGc()
181181
{
182182
$handler = $this->createMock(\SessionHandlerInterface::class);
183183
$handler->expects($this->once())->method('gc')
184-
->with(123)->willReturn(true);
184+
->with(123)->willReturn(1);
185185
$proxy = new StrictSessionHandler($handler);
186186

187-
$this->assertTrue($proxy->gc(123));
187+
$this->assertSame(1, $proxy->gc(123));
188188
}
189189
}

Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ public function testCloseFalse()
9393
public function testRead()
9494
{
9595
$this->mock->expects($this->once())
96-
->method('read');
96+
->method('read')
97+
->willReturn('foo')
98+
;
9799

98100
$this->proxy->read('id');
99101
}
@@ -117,7 +119,9 @@ public function testDestroy()
117119
public function testGc()
118120
{
119121
$this->mock->expects($this->once())
120-
->method('gc');
122+
->method('gc')
123+
->willReturn(1)
124+
;
121125

122126
$this->proxy->gc(86400);
123127
}

0 commit comments

Comments
 (0)