Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
simbera committed Mar 19, 2024
1 parent c1b826e commit 3ac96ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,7 @@ public static function create(string $uri, string $method = 'GET', array $parame
*/
public static function setFactory(?callable $callable): void
{
if(null === $callable) {
self::$requestFactory = null;
return;
}

self::$requestFactory = $callable(...);
self::$requestFactory = null === $callable ? null : $callable(...);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2199,14 +2199,14 @@ public function testFactory()

public function testFactoryCallable()
{
$request_factory = new class {
public function createRequest(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null): Request
$requestFactory = new class {
public function createRequest(): Request
{
return new NewRequest();
}
};

Request::setFactory([$request_factory, 'createRequest']);
Request::setFactory([$requestFactory, 'createRequest']);

$this->assertEquals('foo', Request::create('/')->getFoo());

Expand Down

0 comments on commit 3ac96ef

Please sign in to comment.