Skip to content

Commit 2622bc7

Browse files
nicolas-grekasfabpot
authored andcommitted
Bump minimum version of PHP to 8.1
1 parent 87350a2 commit 2622bc7

11 files changed

+4
-15
lines changed

Session/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
4343
public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, callable $usageReporter = null)
4444
{
4545
$this->storage = $storage ?? new NativeSessionStorage();
46-
$this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter);
46+
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
4747

4848
$attributes ??= new AttributeBag();
4949
$this->attributeName = $attributes->getName();

Session/SessionBagProxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(SessionBagInterface $bag, array &$data, ?int &$usage
2828
$this->bag = $bag;
2929
$this->data = &$data;
3030
$this->usageIndex = &$usageIndex;
31-
$this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter);
31+
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
3232
}
3333

3434
public function getBag(): SessionBagInterface

Session/SessionFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(RequestStack $requestStack, SessionStorageFactoryInt
3030
{
3131
$this->requestStack = $requestStack;
3232
$this->storageFactory = $storageFactory;
33-
$this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter);
33+
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
3434
}
3535

3636
public function createSession(): SessionInterface

Tests/BinaryFileResponseTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ public function testXAccelMapping($realpath, $mapping, $virtual)
310310
$response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']);
311311
$reflection = new \ReflectionObject($response);
312312
$property = $reflection->getProperty('file');
313-
$property->setAccessible(true);
314313
$property->setValue($response, $file);
315314

316315
$response->prepare($request);

Tests/RequestTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,7 +1838,6 @@ public function testUrlencodedStringPrefix($string, $prefix, $expect)
18381838
$request = new Request();
18391839

18401840
$me = new \ReflectionMethod($request, 'getUrlencodedPrefix');
1841-
$me->setAccessible(true);
18421841

18431842
$this->assertSame($expect, $me->invoke($request, $string, $prefix));
18441843
}
@@ -1861,7 +1860,6 @@ private function disableHttpMethodParameterOverride()
18611860
{
18621861
$class = new \ReflectionClass(Request::class);
18631862
$property = $class->getProperty('httpMethodParameterOverride');
1864-
$property->setAccessible(true);
18651863
$property->setValue(false);
18661864
}
18671865

Tests/ResponseTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,6 @@ public function testSetStatusCode($code, $text, $expectedText)
832832
$response->setStatusCode($code, $text);
833833

834834
$statusText = new \ReflectionProperty($response, 'statusText');
835-
$statusText->setAccessible(true);
836835

837836
$this->assertEquals($expectedText, $statusText->getValue($response));
838837
}

Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ public function getOptionFixtures()
142142
public function testGetConnection()
143143
{
144144
$method = new \ReflectionMethod($this->storage, 'getMemcached');
145-
$method->setAccessible(true);
146145

147146
$this->assertInstanceOf(\Memcached::class, $method->invoke($this->storage));
148147
}

Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ public function testGc()
198198
public function testGetConnection()
199199
{
200200
$method = new \ReflectionMethod($this->storage, 'getMongo');
201-
$method->setAccessible(true);
202201

203202
$this->assertInstanceOf(Client::class, $method->invoke($this->storage));
204203
}

Tests/Session/Storage/Handler/PdoSessionHandlerTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ public function testGetConnection()
296296
$storage = new PdoSessionHandler($this->getMemorySqlitePdo());
297297

298298
$method = new \ReflectionMethod($storage, 'getConnection');
299-
$method->setAccessible(true);
300299

301300
$this->assertInstanceOf(\PDO::class, $method->invoke($storage));
302301
}
@@ -306,7 +305,6 @@ public function testGetConnectionConnectsIfNeeded()
306305
$storage = new PdoSessionHandler('sqlite::memory:');
307306

308307
$method = new \ReflectionMethod($storage, 'getConnection');
309-
$method->setAccessible(true);
310308

311309
$this->assertInstanceOf(\PDO::class, $method->invoke($storage));
312310
}
@@ -324,7 +322,6 @@ public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPa
324322
continue;
325323
}
326324
$property = $reflection->getProperty($property);
327-
$property->setAccessible(true);
328325
$this->assertSame($expectedValue, $property->getValue($storage));
329326
}
330327
}

Tests/Session/Storage/Handler/SessionHandlerFactoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ public function testCreateRedisHandlerFromDsn()
6767
$reflection = new \ReflectionObject($handler);
6868

6969
$prefixProperty = $reflection->getProperty('prefix');
70-
$prefixProperty->setAccessible(true);
7170
$this->assertSame('foo', $prefixProperty->getValue($handler));
7271

7372
$ttlProperty = $reflection->getProperty('ttl');
74-
$ttlProperty->setAccessible(true);
7573
$this->assertSame(3600, $ttlProperty->getValue($handler));
7674
}
7775
}

0 commit comments

Comments
 (0)