PHPCBF fixes

This commit is contained in:
Ferdinand Kuhl 2022-07-31 23:51:35 +02:00
parent 0ae4ab9269
commit 7c13ff8e71
2 changed files with 10 additions and 11 deletions

View file

@ -14,7 +14,6 @@ use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Component\Lock\Key; use Symfony\Component\Lock\Key;
use Symfony\Component\Lock\LockFactory; use Symfony\Component\Lock\LockFactory;
class SessionLockRequestMiddleware implements MiddlewareInterface class SessionLockRequestMiddleware implements MiddlewareInterface
{ {
public const PARAMETER_NAME = 'sessionLock'; public const PARAMETER_NAME = 'sessionLock';

View file

@ -43,16 +43,16 @@ class SessionLockRequestComponentTest extends FunctionalTestCase
function ($allRequests, $oneRequest) { function ($allRequests, $oneRequest) {
self::assertGreaterThan(ExampleController::CONTROLLER_TIME, $oneRequest * 1000); self::assertGreaterThan(ExampleController::CONTROLLER_TIME, $oneRequest * 1000);
self::assertGreaterThan(ExampleController::CONTROLLER_TIME * 4, $allRequests * 1000); self::assertGreaterThan(ExampleController::CONTROLLER_TIME * 4, $allRequests * 1000);
} },
], ],
[ [
'http://localhost/test/sessionlock/unprotectedbyannotation', 'http://localhost/test/sessionlock/unprotectedbyannotation',
$parallelChecker $parallelChecker,
], ],
[ [
'http://localhost/test/sessionlock/unprotectedbyconfiguration', 'http://localhost/test/sessionlock/unprotectedbyconfiguration',
$parallelChecker $parallelChecker,
] ],
]; ];
} }
@ -64,16 +64,16 @@ class SessionLockRequestComponentTest extends FunctionalTestCase
{ {
$request = $this->serverRequestFactory $request = $this->serverRequestFactory
->createServerRequest('GET', new Uri($url)); ->createServerRequest('GET', new Uri($url));
$start = microtime(true); $start = \microtime(true);
$response = $this->browser->sendRequest($request); $response = $this->browser->sendRequest($request);
$neededForOne = microtime(true) - $start; $neededForOne = \microtime(true) - $start;
$sessionCookies = array_map(static function ($cookie) { $sessionCookies = \array_map(static function ($cookie) {
return Cookie::createFromRawSetCookieHeader($cookie); return Cookie::createFromRawSetCookieHeader($cookie);
}, $response->getHeader('Set-Cookie')); }, $response->getHeader('Set-Cookie'));
self::assertNotEmpty($sessionCookies); self::assertNotEmpty($sessionCookies);
$cookies = array_reduce($sessionCookies, static function ($out, $cookie) { $cookies = \array_reduce($sessionCookies, static function ($out, $cookie) {
$out[$cookie->getName()] = $cookie->getValue(); $out[$cookie->getName()] = $cookie->getValue();
return $out; return $out;
}, []); }, []);
@ -81,7 +81,7 @@ class SessionLockRequestComponentTest extends FunctionalTestCase
->createServerRequest('GET', new Uri($url)) ->createServerRequest('GET', new Uri($url))
->withCookieParams($cookies); ->withCookieParams($cookies);
$childs = []; $childs = [];
$start = microtime(true); $start = \microtime(true);
for ($i = 0; $i < 4; $i++) { for ($i = 0; $i < 4; $i++) {
$child = \pcntl_fork(); $child = \pcntl_fork();
if ($child === 0) { if ($child === 0) {
@ -93,7 +93,7 @@ class SessionLockRequestComponentTest extends FunctionalTestCase
foreach ($childs as $child) { foreach ($childs as $child) {
\pcntl_waitpid($child, $status); \pcntl_waitpid($child, $status);
} }
$neededForAll = microtime(true) - $start; $neededForAll = \microtime(true) - $start;
$checker($neededForAll, $neededForOne); $checker($neededForAll, $neededForOne);
} }