Fixed null handling.
This commit is contained in:
parent
8df1d32304
commit
d99562db16
3 changed files with 18 additions and 7 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
0.2503.211818
|
0.2503.221959
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// Dependencies.php
|
// Dependencies.php
|
||||||
// Created: 2025-01-18
|
// Created: 2025-01-18
|
||||||
// Updated: 2025-03-21
|
// Updated: 2025-03-22
|
||||||
|
|
||||||
namespace Index;
|
namespace Index;
|
||||||
|
|
||||||
|
@ -68,10 +68,8 @@ class Dependencies {
|
||||||
|
|
||||||
if($value === null) {
|
if($value === null) {
|
||||||
if(count($seqArgs) > 0) {
|
if(count($seqArgs) > 0) {
|
||||||
$value = $seqArgs[array_key_first($seqArgs)];
|
$value = array_shift($seqArgs);
|
||||||
if($typeInfo instanceof ReflectionNamedType && (!$typeInfo->isBuiltin() || $typeInfo->getName() === gettype($value)))
|
if(!$typeInfo instanceof ReflectionNamedType || !(!$typeInfo->isBuiltin() || $typeInfo->getName() === gettype($value)))
|
||||||
array_shift($seqArgs);
|
|
||||||
else
|
|
||||||
$value = null;
|
$value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
// RouterTest.php
|
// RouterTest.php
|
||||||
// Created: 2022-01-20
|
// Created: 2022-01-20
|
||||||
// Updated: 2025-03-21
|
// Updated: 2025-03-22
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
@ -120,6 +120,15 @@ final class RouterTest extends TestCase {
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[PatternRoute('GET', '/uploads/([A-Za-z0-9]+|[A-Za-z0-9\-_]{32})(?:-([a-z0-9]+))?(?:\.([A-Za-z0-9\-_]+))?')]
|
||||||
|
public function getEepromEdgeCase(
|
||||||
|
string $uploadId,
|
||||||
|
string $variant = '',
|
||||||
|
string $extension = ''
|
||||||
|
): string {
|
||||||
|
return sprintf('%s//%s//%s', $uploadId, $variant, $extension);
|
||||||
|
}
|
||||||
|
|
||||||
public function hasNoAttr(): string {
|
public function hasNoAttr(): string {
|
||||||
return 'not a route';
|
return 'not a route';
|
||||||
}
|
}
|
||||||
|
@ -138,6 +147,10 @@ final class RouterTest extends TestCase {
|
||||||
$this->assertSame('empty', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/announce.php'))->getBody());
|
$this->assertSame('empty', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/announce.php'))->getBody());
|
||||||
$this->assertSame('Z643QANLgGNkF4D4h4qvFpyeXjx4TcDE', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/announce/Z643QANLgGNkF4D4h4qvFpyeXjx4TcDE'))->getBody());
|
$this->assertSame('Z643QANLgGNkF4D4h4qvFpyeXjx4TcDE', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/announce/Z643QANLgGNkF4D4h4qvFpyeXjx4TcDE'))->getBody());
|
||||||
$this->assertSame('1aKq8VaGyHohNUUR7RzU1W57Z3hQ6m0YMazAkr2IoiSPsvQJ6QoQutywwiOBlNka', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/announce.php/1aKq8VaGyHohNUUR7RzU1W57Z3hQ6m0YMazAkr2IoiSPsvQJ6QoQutywwiOBlNka'))->getBody());
|
$this->assertSame('1aKq8VaGyHohNUUR7RzU1W57Z3hQ6m0YMazAkr2IoiSPsvQJ6QoQutywwiOBlNka', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/announce.php/1aKq8VaGyHohNUUR7RzU1W57Z3hQ6m0YMazAkr2IoiSPsvQJ6QoQutywwiOBlNka'))->getBody());
|
||||||
|
$this->assertSame('1RJNSRYmxrvXUr////', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/uploads/1RJNSRYmxrvXUr'))->getBody());
|
||||||
|
$this->assertSame('1RJNSRYmxrvXUr//thumb//', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/uploads/1RJNSRYmxrvXUr-thumb'))->getBody());
|
||||||
|
$this->assertSame('1RJNSRYmxrvXUr//thumb//jpg', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/uploads/1RJNSRYmxrvXUr-thumb.jpg'))->getBody());
|
||||||
|
$this->assertSame('1RJNSRYmxrvXUr////jpg', (string)$router->handle(HttpRequest::createRequestWithoutBody('GET', '/uploads/1RJNSRYmxrvXUr.jpg'))->getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEEPROMSituation(): void {
|
public function testEEPROMSituation(): void {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue