Skip to content

Commit 6d462b7

Browse files
authored
Merge pull request #19 from Tiime-Software/remove-legacy-code
Remove legacy code
2 parents 683ea44 + bc08ee0 commit 6d462b7

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/RouteStorage/FileRouteStorage.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ public function getRoutes(): array
4040
foreach ($routes as $route) {
4141
$parts = explode('|', $route);
4242

43+
if (2 !== \count($parts)) {
44+
throw new \RuntimeException("It looks like the given file ({$this->file}) does not contains valid data. Consider removing it.");
45+
}
46+
4347
$name = $parts[0];
44-
// In order to avoid BC break, we consider a route without a status code as a 200 OK.
45-
// To be removed in 2.0
46-
$statusCode = (int) ($parts[1] ?? 200);
48+
$statusCode = (int) $parts[1];
4749

4850
if (!\array_key_exists($name, $filteredRoutes)) {
4951
$filteredRoutes[$name] = [$statusCode];

tests/RouteStorage/FileRouteStorageTest.php

-11
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,4 @@ public function testStorage(): void
2424
'route3' => [403],
2525
], $storage->getRoutes());
2626
}
27-
28-
public function testWithStorageWithoutStatusCode(): void
29-
{
30-
$storage = new FileRouteStorage(__DIR__.'/../Fixtures/file_containing_one_route_per_row_with_duplicates');
31-
32-
$this->assertSame([
33-
'route1' => [200, 200],
34-
'route2' => [200, 200, 200],
35-
'route3' => [200, 200],
36-
], $storage->getRoutes());
37-
}
3827
}

0 commit comments

Comments
 (0)