Skip to content

Commit

Permalink
Bump minimum version of PHP to 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas authored and fabpot committed Feb 25, 2022
1 parent 87350a2 commit 2622bc7
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, callable $usageReporter = null)
{
$this->storage = $storage ?? new NativeSessionStorage();
$this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter);
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);

$attributes ??= new AttributeBag();
$this->attributeName = $attributes->getName();
Expand Down
2 changes: 1 addition & 1 deletion Session/SessionBagProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(SessionBagInterface $bag, array &$data, ?int &$usage
$this->bag = $bag;
$this->data = &$data;
$this->usageIndex = &$usageIndex;
$this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter);
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
}

public function getBag(): SessionBagInterface
Expand Down
2 changes: 1 addition & 1 deletion Session/SessionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(RequestStack $requestStack, SessionStorageFactoryInt
{
$this->requestStack = $requestStack;
$this->storageFactory = $storageFactory;
$this->usageReporter = $usageReporter instanceof \Closure || !\is_callable($usageReporter) ? $usageReporter : \Closure::fromCallable($usageReporter);
$this->usageReporter = null === $usageReporter ? null : $usageReporter(...);
}

public function createSession(): SessionInterface
Expand Down
1 change: 0 additions & 1 deletion Tests/BinaryFileResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ public function testXAccelMapping($realpath, $mapping, $virtual)
$response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']);
$reflection = new \ReflectionObject($response);
$property = $reflection->getProperty('file');
$property->setAccessible(true);
$property->setValue($response, $file);

$response->prepare($request);
Expand Down
2 changes: 0 additions & 2 deletions Tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,6 @@ public function testUrlencodedStringPrefix($string, $prefix, $expect)
$request = new Request();

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

$this->assertSame($expect, $me->invoke($request, $string, $prefix));
}
Expand All @@ -1861,7 +1860,6 @@ private function disableHttpMethodParameterOverride()
{
$class = new \ReflectionClass(Request::class);
$property = $class->getProperty('httpMethodParameterOverride');
$property->setAccessible(true);
$property->setValue(false);
}

Expand Down
1 change: 0 additions & 1 deletion Tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,6 @@ public function testSetStatusCode($code, $text, $expectedText)
$response->setStatusCode($code, $text);

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

$this->assertEquals($expectedText, $statusText->getValue($response));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ public function getOptionFixtures()
public function testGetConnection()
{
$method = new \ReflectionMethod($this->storage, 'getMemcached');
$method->setAccessible(true);

$this->assertInstanceOf(\Memcached::class, $method->invoke($this->storage));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ public function testGc()
public function testGetConnection()
{
$method = new \ReflectionMethod($this->storage, 'getMongo');
$method->setAccessible(true);

$this->assertInstanceOf(Client::class, $method->invoke($this->storage));
}
Expand Down
3 changes: 0 additions & 3 deletions Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ public function testGetConnection()
$storage = new PdoSessionHandler($this->getMemorySqlitePdo());

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

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

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

$this->assertInstanceOf(\PDO::class, $method->invoke($storage));
}
Expand All @@ -324,7 +322,6 @@ public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPa
continue;
}
$property = $reflection->getProperty($property);
$property->setAccessible(true);
$this->assertSame($expectedValue, $property->getValue($storage));
}
}
Expand Down
2 changes: 0 additions & 2 deletions Tests/Session/Storage/Handler/SessionHandlerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ public function testCreateRedisHandlerFromDsn()
$reflection = new \ReflectionObject($handler);

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

$ttlProperty = $reflection->getProperty('ttl');
$ttlProperty->setAccessible(true);
$this->assertSame(3600, $ttlProperty->getValue($handler));
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": ">=8.0.2",
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-mbstring": "~1.1"
},
Expand Down

0 comments on commit 2622bc7

Please sign in to comment.