Skip to content

Commit 042ed2e

Browse files
loks0nclaude
andcommitted
Make Http::setRoute private
Only the framework itself called setRoute (internal cache plumbing in match() and the wildcard branch). Drop it from the public API and the self-referential test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6a86d7e commit 042ed2e

2 files changed

Lines changed: 1 addition & 15 deletions

File tree

src/Http/Http.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,9 @@ public function getRoute(): ?Route
461461
return $container->has('route') ? $container->get('route') : null;
462462
}
463463

464-
/**
465-
* Set the current route
466-
*/
467-
public function setRoute(?Route $route): self
464+
private function setRoute(?Route $route): void
468465
{
469466
$this->server->getContainer()->set('route', fn() => $route);
470-
471-
return $this;
472467
}
473468

474469
/**

tests/HttpTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,6 @@ public function testCanHookThrowExceptions(): void
366366
$this->assertSame('(init)-y-def-x-def-(shutdown)', $result);
367367
}
368368

369-
public function testCanSetRoute(): void
370-
{
371-
$route = new Route('GET', '/path');
372-
373-
$this->assertNull($this->http->getRoute());
374-
$this->http->setRoute($route);
375-
$this->assertSame($route, $this->http->getRoute());
376-
}
377-
378369
/**
379370
* @return \Iterator<string, array<int, string>>
380371
*/

0 commit comments

Comments
 (0)