Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8b2ee31

Browse filesBrowse files
Merge branch '4.4' into 5.2
* 4.4: [Config] fix tracking attributes in ReflectionClassResource [Process] Fix incorrect parameter type [HttpFoundation] Handle tentative return types
2 parents a04effa + 0fa07c6 commit 8b2ee31
Copy full SHA for 8b2ee31

File tree

10 files changed

+84
-10
lines changed
Filter options

10 files changed

+84
-10
lines changed

‎src/Symfony/Component/Config/Resource/ReflectionClassResource.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Resource/ReflectionClassResource.php
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ private function computeHash(): string
121121

122122
private function generateSignature(\ReflectionClass $class): iterable
123123
{
124+
if (\PHP_VERSION_ID >= 80000) {
125+
$attributes = [];
126+
foreach ($class->getAttributes() as $a) {
127+
$attributes[] = [$a->getName(), $a->getArguments()];
128+
}
129+
yield print_r($attributes, true);
130+
$attributes = [];
131+
}
132+
124133
yield $class->getDocComment();
125134
yield (int) $class->isFinal();
126135
yield (int) $class->isAbstract();
@@ -137,6 +146,14 @@ private function generateSignature(\ReflectionClass $class): iterable
137146
$defaults = $class->getDefaultProperties();
138147

139148
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
149+
if (\PHP_VERSION_ID >= 80000) {
150+
foreach ($p->getAttributes() as $a) {
151+
$attributes[] = [$a->getName(), $a->getArguments()];
152+
}
153+
yield print_r($attributes, true);
154+
$attributes = [];
155+
}
156+
140157
yield $p->getDocComment();
141158
yield $p->isDefault() ? '<default>' : '';
142159
yield $p->isPublic() ? 'public' : 'protected';
@@ -147,9 +164,25 @@ private function generateSignature(\ReflectionClass $class): iterable
147164
}
148165

149166
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
167+
if (\PHP_VERSION_ID >= 80000) {
168+
foreach ($m->getAttributes() as $a) {
169+
$attributes[] = [$a->getName(), $a->getArguments()];
170+
}
171+
yield print_r($attributes, true);
172+
$attributes = [];
173+
}
174+
150175
$defaults = [];
151176
$parametersWithUndefinedConstants = [];
152177
foreach ($m->getParameters() as $p) {
178+
if (\PHP_VERSION_ID >= 80000) {
179+
foreach ($p->getAttributes() as $a) {
180+
$attributes[] = [$a->getName(), $a->getArguments()];
181+
}
182+
yield print_r($attributes, true);
183+
$attributes = [];
184+
}
185+
153186
if (!$p->isDefaultValueAvailable()) {
154187
$defaults[$p->name] = null;
155188

‎src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ public function provideHashedSignature(): iterable
121121
{
122122
yield [false, 0, "// line change\n\n"];
123123
yield [true, 0, '/** class docblock */'];
124+
125+
if (\PHP_VERSION_ID >= 80000) {
126+
yield [true, 0, '#[Foo]'];
127+
}
128+
124129
yield [true, 1, 'abstract class %s'];
125130
yield [true, 1, 'final class %s'];
126131
yield [true, 1, 'class %s extends Exception'];
@@ -140,6 +145,12 @@ public function provideHashedSignature(): iterable
140145
yield [false, 11, "public function pub(\$arg = null) {\nreturn 123;\n}"];
141146
yield [true, 12, '/** prot docblock */'];
142147
yield [true, 13, 'protected function prot($a = [123]) {}'];
148+
149+
if (\PHP_VERSION_ID >= 80000) {
150+
yield [true, 13, '#[Foo] protected function prot($a = []) {}'];
151+
yield [true, 13, 'protected function prot(#[Foo] $a = []) {}'];
152+
}
153+
143154
yield [false, 14, '/** priv docblock */'];
144155
yield [false, 15, ''];
145156

‎src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MigratingSessionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MigratingSessionHandler.php
+8Lines changed: 8 additions & 0 deletions
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);

‎src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php
+4Lines changed: 4 additions & 0 deletions
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;

‎src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
+5Lines changed: 5 additions & 0 deletions
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();

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MigratingSessionHandlerTest.php
+2-3Lines changed: 2 additions & 3 deletions
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()

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ public function __construct(string $driverName = null, int $errorMode = null)
371371
$this->errorMode = null !== $errorMode ?: \PDO::ERRMODE_EXCEPTION;
372372
}
373373

374+
/**
375+
* @return mixed
376+
*/
377+
#[\ReturnTypeWillChange]
374378
public function getAttribute($attribute)
375379
{
376380
if (\PDO::ATTR_ERRMODE === $attribute) {
@@ -384,18 +388,24 @@ public function getAttribute($attribute)
384388
return parent::getAttribute($attribute);
385389
}
386390

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

394-
public function beginTransaction()
402+
public function beginTransaction(): bool
395403
{
404+
return true;
396405
}
397406

398-
public function rollBack()
407+
public function rollBack(): bool
399408
{
409+
return true;
400410
}
401411
}

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php
+2-2Lines changed: 2 additions & 2 deletions
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
}

‎src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+6-2Lines changed: 6 additions & 2 deletions
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
}

‎src/Symfony/Component/Process/Pipes/WindowsPipes.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Pipes/WindowsPipes.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct($input, bool $haveReadSupport)
7171
}
7272
$this->lockHandles[$pipe] = $h;
7373

74-
if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
74+
if (!($h = fopen($file, 'w')) || !fclose($h) || !$h = fopen($file, 'r')) {
7575
flock($this->lockHandles[$pipe], \LOCK_UN);
7676
fclose($this->lockHandles[$pipe]);
7777
unset($this->lockHandles[$pipe]);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.