Small corrections

This commit is contained in:
Sebastian Meyer 2024-07-18 14:10:36 +02:00
parent c6193ede07
commit fb823d6033
4 changed files with 14 additions and 7 deletions

View File

@ -24,7 +24,7 @@
"support": { "support": {
"issues": "https://github.com/opencultureconsulting/oai-pmh2/issues", "issues": "https://github.com/opencultureconsulting/oai-pmh2/issues",
"source": "https://github.com/opencultureconsulting/oai-pmh2", "source": "https://github.com/opencultureconsulting/oai-pmh2",
"docs": "https://github.com/opencultureconsulting/oai-pmh2/blob/main/README.md" "docs": "https://opencultureconsulting.github.io/oai-pmh2/"
}, },
"require": { "require": {
"php": "^8.1", "php": "^8.1",
@ -61,8 +61,8 @@
}, },
"scripts": { "scripts": {
"pre-install-cmd": [ "pre-install-cmd": [
"@php -r \"!is_dir('./data') && mkdir('./data', 0775);\"", "@php -r \"if (!is_dir('./data')) { mkdir('./data', 0775); }\"",
"@php -r \"!file_exists('./config/config.yml') && copy('./config/config.dist.yml', './config/config.yml');\"" "@php -r \"if (!file_exists('./config/config.yml')) { copy('./config/config.dist.yml', './config/config.yml'); }\""
], ],
"post-install-cmd": [ "post-install-cmd": [
"@doctrine:clear-cache --quiet", "@doctrine:clear-cache --quiet",

View File

@ -24,5 +24,4 @@ namespace OCC\OaiPmh2;
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
$app = new App(); (new App())->run();
$app->run();

View File

@ -77,4 +77,11 @@ abstract class Middleware extends AbstractMiddleware
} }
return $response; return $response;
} }
final public function __construct()
{
// Make constructor final to avoid issues in dispatcher.
// @see https://psalm.dev/229
}
} }

View File

@ -88,9 +88,10 @@ class Dispatcher extends AbstractMiddleware
if (!ErrorHandler::getInstance()->hasErrors()) { if (!ErrorHandler::getInstance()->hasErrors()) {
/** @var string */ /** @var string */
$verb = $request->getAttribute('verb'); $verb = $request->getAttribute('verb');
/** @var Middleware $middleware */
$middleware = __NAMESPACE__ . '\\' . $verb; $middleware = __NAMESPACE__ . '\\' . $verb;
$this->requestHandler->queue->enqueue(new $middleware()); if (is_a($middleware, Middleware::class, true)) {
$this->requestHandler->queue->enqueue(new $middleware());
}
} }
$this->requestHandler->queue->enqueue(ErrorHandler::getInstance()); $this->requestHandler->queue->enqueue(ErrorHandler::getInstance());
return $request; return $request;