diff --git a/app/services.php b/app/services.php index 993d5e7f97..99cbaa5814 100644 --- a/app/services.php +++ b/app/services.php @@ -19,8 +19,8 @@ use PhpMyAdmin\Database\Events; use PhpMyAdmin\Database\Routines; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\DbTableExists; -use PhpMyAdmin\ErrorHandler; -use PhpMyAdmin\ErrorReport; +use PhpMyAdmin\Error\ErrorHandler; +use PhpMyAdmin\Error\ErrorReport; use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\Options; use PhpMyAdmin\Export\TemplateModel; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 4a29209940..59dce4d35e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -7908,167 +7908,167 @@ parameters: - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" count: 3 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset 'args' on mixed\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset 'class' on mixed\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset 'class'\\|'function'\\|'line'\\|'type' on mixed\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset 'file' on mixed\\.$#" count: 2 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset 'function' on mixed\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset 'line' on mixed\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset 'type' on mixed\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Cannot access offset mixed on mixed\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Match expression does not handle remaining values\\: 3\\|int\\\\|int\\<5, 7\\>\\|int\\<9, 15\\>\\|int\\<17, 31\\>\\|int\\<33, 63\\>\\|int\\<65, 127\\>\\|int\\<129, 255\\>\\|int\\<257, 511\\>\\|int\\<513, 1023\\>\\|int\\<1025, 2047\\>\\|int\\<2049, 4095\\>\\|int\\<4097, 8191\\>\\|int\\<8193, 16383\\>\\|int\\<16385, max\\>$#" count: 2 - path: src/Error.php + path: src/Error/Error.php - message: "#^Only booleans are allowed in \\|\\|, int\\<0, 18176\\> given on the right side\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - - message: "#^Parameter \\#1 \\$path of static method PhpMyAdmin\\\\Error\\:\\:relPath\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$path of static method PhpMyAdmin\\\\Error\\\\Error\\:\\:relPath\\(\\) expects string, mixed given\\.$#" count: 3 - path: src/Error.php + path: src/Error/Error.php - - message: "#^Parameter \\#1 \\$step of static method PhpMyAdmin\\\\Error\\:\\:getFunctionCall\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$step of static method PhpMyAdmin\\\\Error\\\\Error\\:\\:getFunctionCall\\(\\) expects array, mixed given\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" count: 2 - path: src/Error.php + path: src/Error/Error.php - - message: "#^Parameter \\#2 \\$function of static method PhpMyAdmin\\\\Error\\:\\:getArg\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#2 \\$function of static method PhpMyAdmin\\\\Error\\\\Error\\:\\:getArg\\(\\) expects string, mixed given\\.$#" count: 1 - path: src/Error.php + path: src/Error/Error.php - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" count: 1 - path: src/ErrorHandler.php + path: src/Error/ErrorHandler.php - message: "#^Cannot access offset \\(int\\|string\\) on mixed\\.$#" count: 1 - path: src/ErrorHandler.php + path: src/Error/ErrorHandler.php - message: "#^Cannot access offset string on mixed\\.$#" count: 1 - path: src/ErrorHandler.php + path: src/Error/ErrorHandler.php - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" count: 1 - path: src/ErrorHandler.php + path: src/Error/ErrorHandler.php - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" count: 2 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Cannot access offset 'context' on mixed\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Cannot access offset 'scriptname' on mixed\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Cannot access offset 'stack' on mixed\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Cannot access offset 'uri' on mixed\\.$#" count: 3 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Cannot access offset 'url' on mixed\\.$#" count: 4 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 2 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Only booleans are allowed in &&, int\\|false given on the right side\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Only booleans are allowed in a negated boolean, int given\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Only booleans are allowed in a negated boolean, string given\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - - message: "#^Parameter \\#1 \\$stack of method PhpMyAdmin\\\\ErrorReport\\:\\:translateStacktrace\\(\\) expects array, mixed given\\.$#" + message: "#^Parameter \\#1 \\$stack of method PhpMyAdmin\\\\Error\\\\ErrorReport\\:\\:translateStacktrace\\(\\) expects array, mixed given\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Parameter \\#1 \\$string of function mb_strlen expects string, mixed given\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Parameter \\#1 \\$string of function mb_substr expects string, mixed given\\.$#" count: 1 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - - message: "#^Parameter \\#1 \\$url of method PhpMyAdmin\\\\ErrorReport\\:\\:sanitizeUrl\\(\\) expects string, mixed given\\.$#" + message: "#^Parameter \\#1 \\$url of method PhpMyAdmin\\\\Error\\\\ErrorReport\\:\\:sanitizeUrl\\(\\) expects string, mixed given\\.$#" count: 3 - path: src/ErrorReport.php + path: src/Error/ErrorReport.php - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" @@ -17098,7 +17098,7 @@ parameters: - message: "#^Property PhpMyAdmin\\\\Config\\:\\:\\$settings \\(array\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\) does not accept array\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\.$#" count: 1 - path: tests/classes/ErrorHandlerTest.php + path: tests/classes/Error/ErrorHandlerTest.php - message: "#^Property PhpMyAdmin\\\\Config\\:\\:\\$settings \\(array\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\) does not accept array\\{PmaAbsoluteUri\\: string, AuthLog\\: string, AuthLogSuccess\\: bool, PmaNoRelation_DisableWarning\\: bool, SuhosinDisableWarning\\: bool, LoginCookieValidityDisableWarning\\: bool, ReservedWordDisableWarning\\: bool, TranslationWarningThreshold\\: int, \\.\\.\\.\\}\\.$#" diff --git a/psalm-baseline.xml b/psalm-baseline.xml index cc77f41958..10b5aab3aa 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -5639,7 +5639,7 @@ getPageDocumentation - + $arg $step @@ -5679,7 +5679,7 @@ - + Config::getInstance() Config::getInstance() @@ -5703,7 +5703,7 @@ $hash - + $line @@ -13958,7 +13958,7 @@ providerFortTestResolveTypeSize - + Config::getInstance() Config::getInstance() @@ -13975,7 +13975,7 @@ settings]]> - + Config::getInstance() Config::getInstance() @@ -13992,7 +13992,7 @@ urlsToSanitize - + filePathProvider diff --git a/src/Application.php b/src/Application.php index 7e1003005f..d4ad7e43a0 100644 --- a/src/Application.php +++ b/src/Application.php @@ -8,6 +8,7 @@ use Fig\Http\Message\StatusCodeInterface; use Laminas\HttpHandlerRunner\Emitter\SapiEmitter; use Laminas\HttpHandlerRunner\RequestHandlerRunner; use PhpMyAdmin\Container\ContainerBuilder; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Http\Factory\ResponseFactory; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Http\Handler\ApplicationHandler; diff --git a/src/Controllers/ErrorReportController.php b/src/Controllers/ErrorReportController.php index a145279419..235c7c37b2 100644 --- a/src/Controllers/ErrorReportController.php +++ b/src/Controllers/ErrorReportController.php @@ -10,8 +10,8 @@ namespace PhpMyAdmin\Controllers; use PhpMyAdmin\Config; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\DatabaseInterface; -use PhpMyAdmin\ErrorHandler; -use PhpMyAdmin\ErrorReport; +use PhpMyAdmin\Error\ErrorHandler; +use PhpMyAdmin\Error\ErrorReport; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Message; use PhpMyAdmin\ResponseRenderer; diff --git a/src/Core.php b/src/Core.php index 9da5233879..7708f0709d 100644 --- a/src/Core.php +++ b/src/Core.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace PhpMyAdmin; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\MissingExtensionException; use PhpMyAdmin\Http\ServerRequest; diff --git a/src/DatabaseInterface.php b/src/DatabaseInterface.php index 9aa7379218..4ddee37c72 100644 --- a/src/DatabaseInterface.php +++ b/src/DatabaseInterface.php @@ -14,6 +14,7 @@ use PhpMyAdmin\Dbal\DbiMysqli; use PhpMyAdmin\Dbal\ResultInterface; use PhpMyAdmin\Dbal\Statement; use PhpMyAdmin\Dbal\Warning; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Html\Generator; use PhpMyAdmin\Identifiers\DatabaseName; use PhpMyAdmin\Query\Cache; diff --git a/src/Error.php b/src/Error/Error.php similarity index 94% rename from src/Error.php rename to src/Error/Error.php index 4ccf5e7957..2646643c45 100644 --- a/src/Error.php +++ b/src/Error/Error.php @@ -2,8 +2,10 @@ declare(strict_types=1); -namespace PhpMyAdmin; +namespace PhpMyAdmin\Error; +use PhpMyAdmin\Message; +use PhpMyAdmin\Template; use Throwable; use function array_pop; @@ -153,7 +155,7 @@ class Error extends Message } /** - * sets PhpMyAdmin\Error::$_backtrace + * sets PhpMyAdmin\Error\Error::$_backtrace * * We don't store full arguments to avoid wakeup or memory problems. * @@ -165,7 +167,7 @@ class Error extends Message } /** - * sets PhpMyAdmin\Error::$_line + * sets PhpMyAdmin\Error\Error::$_line * * @param int $line the line */ @@ -175,7 +177,7 @@ class Error extends Message } /** - * sets PhpMyAdmin\Error::$_file + * sets PhpMyAdmin\Error\Error::$_file * * @param string $file the file */ @@ -185,9 +187,9 @@ class Error extends Message } /** - * returns unique PhpMyAdmin\Error::$hash, if not exists it will be created + * returns unique PhpMyAdmin\Error\Error::$hash, if not exists it will be created * - * @return string PhpMyAdmin\Error::$hash + * @return string PhpMyAdmin\Error\Error::$hash */ public function getHash(): string { @@ -211,13 +213,13 @@ class Error extends Message } /** - * returns PhpMyAdmin\Error::$_backtrace for first $count frames + * returns PhpMyAdmin\Error\Error::$_backtrace for first $count frames * pass $count = -1 to get full backtrace. * The same can be done by not passing $count at all. * * @param int $count Number of stack frames. * - * @return mixed[] PhpMyAdmin\Error::$_backtrace + * @return mixed[] PhpMyAdmin\Error\Error::$_backtrace */ public function getBacktrace(int $count = -1): array { @@ -229,9 +231,9 @@ class Error extends Message } /** - * returns PhpMyAdmin\Error::$file + * returns PhpMyAdmin\Error\Error::$file * - * @return string PhpMyAdmin\Error::$file + * @return string PhpMyAdmin\Error\Error::$file */ public function getFile(): string { @@ -239,9 +241,9 @@ class Error extends Message } /** - * returns PhpMyAdmin\Error::$line + * returns PhpMyAdmin\Error\Error::$line * - * @return int PhpMyAdmin\Error::$line + * @return int PhpMyAdmin\Error\Error::$line */ public function getLine(): int { @@ -485,7 +487,7 @@ class Error extends Message $hereParts = explode( DIRECTORY_SEPARATOR, - (string) realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'), + (string) realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'), ); $destParts = explode(DIRECTORY_SEPARATOR, $dest); @@ -494,7 +496,7 @@ class Error extends Message while (implode(DIRECTORY_SEPARATOR, $destParts) !== implode(DIRECTORY_SEPARATOR, $hereParts)) { if (count($hereParts) > count($destParts)) { array_pop($hereParts); - $result .= DIRECTORY_SEPARATOR . '..'; + $result .= DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'; } else { array_pop($destParts); } diff --git a/src/ErrorHandler.php b/src/Error/ErrorHandler.php similarity index 99% rename from src/ErrorHandler.php rename to src/Error/ErrorHandler.php index b362b003df..88116bf2e9 100644 --- a/src/ErrorHandler.php +++ b/src/Error/ErrorHandler.php @@ -2,13 +2,17 @@ declare(strict_types=1); -namespace PhpMyAdmin; +namespace PhpMyAdmin\Error; use ErrorException; use Fig\Http\Message\StatusCodeInterface; use Laminas\HttpHandlerRunner\Emitter\SapiEmitter; +use PhpMyAdmin\Config; +use PhpMyAdmin\Current; use PhpMyAdmin\Exceptions\ExitException; use PhpMyAdmin\Http\Factory\ResponseFactory; +use PhpMyAdmin\ResponseRenderer; +use PhpMyAdmin\Url; use Throwable; use function __; diff --git a/src/ErrorReport.php b/src/Error/ErrorReport.php similarity index 98% rename from src/ErrorReport.php rename to src/Error/ErrorReport.php index 1388991a62..8b44e83386 100644 --- a/src/ErrorReport.php +++ b/src/Error/ErrorReport.php @@ -2,10 +2,14 @@ declare(strict_types=1); -namespace PhpMyAdmin; +namespace PhpMyAdmin\Error; +use PhpMyAdmin\Config; use PhpMyAdmin\ConfigStorage\Relation; +use PhpMyAdmin\Template; +use PhpMyAdmin\Url; use PhpMyAdmin\Utils\HttpRequest; +use PhpMyAdmin\Version; use function count; use function http_build_query; diff --git a/src/Footer.php b/src/Footer.php index 0137bec468..735f0e5d6d 100644 --- a/src/Footer.php +++ b/src/Footer.php @@ -8,6 +8,7 @@ declare(strict_types=1); namespace PhpMyAdmin; use PhpMyAdmin\ConfigStorage\Relation; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Routing\Routing; use Traversable; diff --git a/src/Http/Middleware/ErrorHandling.php b/src/Http/Middleware/ErrorHandling.php index 35846b8922..256fc850fe 100644 --- a/src/Http/Middleware/ErrorHandling.php +++ b/src/Http/Middleware/ErrorHandling.php @@ -4,7 +4,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Http\Middleware; -use PhpMyAdmin\ErrorHandler; +use PhpMyAdmin\Error\ErrorHandler; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; diff --git a/src/Http/Middleware/SessionHandling.php b/src/Http/Middleware/SessionHandling.php index ea5dc2d300..328e0999cd 100644 --- a/src/Http/Middleware/SessionHandling.php +++ b/src/Http/Middleware/SessionHandling.php @@ -6,7 +6,7 @@ namespace PhpMyAdmin\Http\Middleware; use Fig\Http\Message\StatusCodeInterface; use PhpMyAdmin\Config; -use PhpMyAdmin\ErrorHandler; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\SessionHandlerException; use PhpMyAdmin\Http\Factory\ResponseFactory; use PhpMyAdmin\LanguageManager; diff --git a/src/Plugins/Auth/AuthenticationConfig.php b/src/Plugins/Auth/AuthenticationConfig.php index 5ccb45fd46..44b9080d06 100644 --- a/src/Plugins/Auth/AuthenticationConfig.php +++ b/src/Plugins/Auth/AuthenticationConfig.php @@ -9,7 +9,7 @@ namespace PhpMyAdmin\Plugins\Auth; use PhpMyAdmin\Config; use PhpMyAdmin\DatabaseInterface; -use PhpMyAdmin\ErrorHandler; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Html\Generator; use PhpMyAdmin\Plugins\AuthenticationPlugin; use PhpMyAdmin\ResponseRenderer; diff --git a/src/Plugins/Auth/AuthenticationCookie.php b/src/Plugins/Auth/AuthenticationCookie.php index 67fc790686..d41b85f3c4 100644 --- a/src/Plugins/Auth/AuthenticationCookie.php +++ b/src/Plugins/Auth/AuthenticationCookie.php @@ -10,7 +10,7 @@ namespace PhpMyAdmin\Plugins\Auth; use PhpMyAdmin\Config; use PhpMyAdmin\Core; use PhpMyAdmin\Current; -use PhpMyAdmin\ErrorHandler; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\SessionHandlerException; use PhpMyAdmin\LanguageManager; use PhpMyAdmin\Message; diff --git a/src/Query/Utilities.php b/src/Query/Utilities.php index 4369687bb5..31e75971b3 100644 --- a/src/Query/Utilities.php +++ b/src/Query/Utilities.php @@ -6,7 +6,7 @@ namespace PhpMyAdmin\Query; use PhpMyAdmin\Config; use PhpMyAdmin\Dbal\ResultInterface; -use PhpMyAdmin\Error; +use PhpMyAdmin\Error\Error; use PhpMyAdmin\Url; use function __; diff --git a/src/ResponseRenderer.php b/src/ResponseRenderer.php index 6ab81fcc0c..77a9a7fef5 100644 --- a/src/ResponseRenderer.php +++ b/src/ResponseRenderer.php @@ -10,6 +10,7 @@ namespace PhpMyAdmin; use Fig\Http\Message\StatusCodeInterface; use PhpMyAdmin\Bookmarks\BookmarkRepository; use PhpMyAdmin\ConfigStorage\Relation; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\ExitException; use PhpMyAdmin\Http\Factory\ResponseFactory; use PhpMyAdmin\Http\Response; diff --git a/src/Session.php b/src/Session.php index 637619586f..3382d4b96e 100644 --- a/src/Session.php +++ b/src/Session.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace PhpMyAdmin; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\SessionHandlerException; use function htmlspecialchars; @@ -72,7 +73,7 @@ class Session /** * Session failed function * - * @param mixed[] $errors PhpMyAdmin\ErrorHandler array + * @param mixed[] $errors PhpMyAdmin\Error\ErrorHandler array * * @throws SessionHandlerException */ diff --git a/tests/classes/ApplicationTest.php b/tests/classes/ApplicationTest.php index a2f49ee91b..c16b9ac0c9 100644 --- a/tests/classes/ApplicationTest.php +++ b/tests/classes/ApplicationTest.php @@ -7,7 +7,7 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Application; use PhpMyAdmin\Config; use PhpMyAdmin\Container\ContainerBuilder; -use PhpMyAdmin\ErrorHandler; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\ConfigException; use PhpMyAdmin\Http\Factory\ResponseFactory; use PhpMyAdmin\Template; diff --git a/tests/classes/ErrorHandlerTest.php b/tests/classes/Error/ErrorHandlerTest.php similarity index 98% rename from tests/classes/ErrorHandlerTest.php rename to tests/classes/Error/ErrorHandlerTest.php index 17004389af..03d7078e92 100644 --- a/tests/classes/ErrorHandlerTest.php +++ b/tests/classes/Error/ErrorHandlerTest.php @@ -2,14 +2,15 @@ declare(strict_types=1); -namespace PhpMyAdmin\Tests; +namespace PhpMyAdmin\Tests\Error; use Exception; use PhpMyAdmin\Config; use PhpMyAdmin\DatabaseInterface; -use PhpMyAdmin\Error; -use PhpMyAdmin\ErrorHandler; +use PhpMyAdmin\Error\Error; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\ExitException; +use PhpMyAdmin\Tests\AbstractTestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; diff --git a/tests/classes/ErrorReportTest.php b/tests/classes/Error/ErrorReportTest.php similarity index 98% rename from tests/classes/ErrorReportTest.php rename to tests/classes/Error/ErrorReportTest.php index fb4df15008..28892fa149 100644 --- a/tests/classes/ErrorReportTest.php +++ b/tests/classes/Error/ErrorReportTest.php @@ -2,14 +2,15 @@ declare(strict_types=1); -namespace PhpMyAdmin\Tests; +namespace PhpMyAdmin\Tests\Error; use PhpMyAdmin\Config; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\DatabaseInterface; -use PhpMyAdmin\Error; -use PhpMyAdmin\ErrorReport; +use PhpMyAdmin\Error\Error; +use PhpMyAdmin\Error\ErrorReport; use PhpMyAdmin\Template; +use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Tests\Stubs\DbiDummy; use PhpMyAdmin\Utils\HttpRequest; use PhpMyAdmin\Version; diff --git a/tests/classes/ErrorTest.php b/tests/classes/Error/ErrorTest.php similarity index 91% rename from tests/classes/ErrorTest.php rename to tests/classes/Error/ErrorTest.php index 247e04c3b3..603389d8a2 100644 --- a/tests/classes/ErrorTest.php +++ b/tests/classes/Error/ErrorTest.php @@ -2,9 +2,10 @@ declare(strict_types=1); -namespace PhpMyAdmin\Tests; +namespace PhpMyAdmin\Tests\Error; -use PhpMyAdmin\Error; +use PhpMyAdmin\Error\Error; +use PhpMyAdmin\Tests\AbstractTestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; @@ -46,7 +47,7 @@ class ErrorTest extends AbstractTestCase { $bt = [['file' => 'bt1', 'line' => 2, 'function' => 'bar', 'args' => ['foo' => $this]]]; $this->object->setBacktrace($bt); - $bt[0]['args']['foo'] = ''; + $bt[0]['args']['foo'] = ''; $this->assertEquals($bt, $this->object->getBacktrace()); } @@ -84,7 +85,7 @@ class ErrorTest extends AbstractTestCase [ __FILE__, '.' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR - . 'classes' . DIRECTORY_SEPARATOR . 'ErrorTest.php', + . 'classes' . DIRECTORY_SEPARATOR . 'Error' . DIRECTORY_SEPARATOR . 'ErrorTest.php', ], ['./NONEXISTING', 'NONEXISTING'], ]; @@ -107,7 +108,7 @@ class ErrorTest extends AbstractTestCase public function testGetBacktraceDisplay(): void { $this->assertStringContainsString( - 'PHPUnit\Framework\TestRunner->run()', + 'PHPUnit\Framework\TestRunner->run()', $this->object->getBacktraceDisplay(), ); } @@ -125,7 +126,8 @@ class ErrorTest extends AbstractTestCase $actual, ); $this->assertStringContainsString( - 'PHPUnit\Framework\TestRunner->run()
  • ', + 'PHPUnit\Framework\TestRunner->run()
  • ' + . '
  • ', $actual, ); $this->assertStringEndsWith('
  • ' . "\n", $actual); diff --git a/tests/classes/Plugins/Auth/AuthenticationCookieTest.php b/tests/classes/Plugins/Auth/AuthenticationCookieTest.php index 5d7493416f..2d571d0377 100644 --- a/tests/classes/Plugins/Auth/AuthenticationCookieTest.php +++ b/tests/classes/Plugins/Auth/AuthenticationCookieTest.php @@ -7,7 +7,7 @@ namespace PhpMyAdmin\Tests\Plugins\Auth; use PhpMyAdmin\Config; use PhpMyAdmin\Current; use PhpMyAdmin\DatabaseInterface; -use PhpMyAdmin\ErrorHandler; +use PhpMyAdmin\Error\ErrorHandler; use PhpMyAdmin\Exceptions\ExitException; use PhpMyAdmin\Plugins\Auth\AuthenticationCookie; use PhpMyAdmin\ResponseRenderer;