diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php new file mode 100644 index 0000000..2ed7926 --- /dev/null +++ b/.phpstorm.meta.php @@ -0,0 +1,8 @@ +|string $id + * @return ( + * $id is class-string + * ? T + * : mixed + * ) + */ + public function get(string $id): mixed; + } +} \ No newline at end of file diff --git a/config/container.php b/config/container.php index ec8cb42..117b945 100644 --- a/config/container.php +++ b/config/container.php @@ -6,7 +6,9 @@ // Retrieve configuration $appConfig = require __DIR__ . '/application.config.php'; if (file_exists(__DIR__ . '/development.config.php')) { - $appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/development.config.php'); + /** @var array $devConfig */ + $devConfig = require __DIR__ . '/development.config.php'; + $appConfig = ArrayUtils::merge($appConfig, $devConfig); } return Application::init($appConfig) diff --git a/module/Application/test/ModuleTest.php b/module/Application/test/ModuleTest.php new file mode 100644 index 0000000..d4368d6 --- /dev/null +++ b/module/Application/test/ModuleTest.php @@ -0,0 +1,23 @@ +getConfig(); + + self::assertArrayHasKey('router', $config); + self::assertArrayHasKey('controllers', $config); + } +} diff --git a/psalm.xml b/psalm.xml index dec1ac3..c9e2e08 100644 --- a/psalm.xml +++ b/psalm.xml @@ -37,6 +37,10 @@ + + + + diff --git a/public/index.php b/public/index.php index d5bb012..6bd404c 100644 --- a/public/index.php +++ b/public/index.php @@ -12,7 +12,7 @@ // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server') { - $path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); + $path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH)); if (is_string($path) && __FILE__ !== $path && is_file($path)) { return false; } @@ -32,5 +32,6 @@ $container = require __DIR__ . '/../config/container.php'; // Run the application! -$container->get('Application') - ->run(); +/** @var Application $app */ +$app = $container->get('Application'); +$app->run();