Skip to content

Commit

Permalink
Use explicit typehinting
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed May 7, 2024
1 parent de3b6b1 commit 363a145
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions classes/template/PKPTemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ public function initialize($request)
$page = $router->getRequestedPage($request);
$op = $router->getRequestedOp($request);
$path = $router->getRequestedArgs($request);
$url = fn (string $locale = ""): string => $router->url($request, null, $page, $op, $path, urlLocaleForPage: $locale);
$url = fn (string $locale = ''): string => $router->url($request, null, $page, $op, $path, urlLocaleForPage: $locale);
collect($supportedLocales)
->each(fn (string $l) => $this->addHeader("language-$l", "<link rel='alternate' hreflang='" . str_replace(['_', '@cyrillic', '@latin'], ['-', '-Cyrl', '-Latn'], $l) . "' href='" . $url($l) . "' />"));
$this->addHeader("language-xdefault", "<link rel='alternate' hreflang='x-default' href='" . $url() . "' />");
->each(fn (string $l) => $this->addHeader("language-{$l}", "<link rel='alternate' hreflang='" . str_replace(['_', '@cyrillic', '@latin'], ['-', '-Cyrl', '-Latn'], $l) . "' href='" . $url($l) . "' />"));
$this->addHeader('language-xdefault', "<link rel='alternate' hreflang='x-default' href='" . $url() . "' />");
})();
}
}
Expand Down Expand Up @@ -1374,16 +1374,14 @@ public function clearThemeTemplateCache($hookName, $args)
*
* @return TemplateManager the template manager object
*/
public static function &getManager($request = null)
public static function &getManager(?PKPRequest $request = null): TemplateManager
{
if (!isset($request)) {
$request = Registry::get('request');
if (Config::getVar('debug', 'deprecation_warnings')) {
throw new Exception('Deprecated call without request object.');
}
}
assert($request instanceof PKPRequest);

$instance = &Registry::get('templateManager', true, null); // Reference required

if ($instance === null) {
Expand Down

0 comments on commit 363a145

Please sign in to comment.