Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Mar 20, 2023
1 parent 123a782 commit a228eba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Expand Up @@ -117,7 +117,8 @@ public function getIntro(): string

public function getToc(bool $html = true): ItemInterface|string
{
$content = explode('<!--end-toc-->', $this->originalContent);
$content = str_replace('<!--stop-toc-->', '<!--end-toc-->', $this->originalContent);

Check failure on line 120 in packages/core/src/Component/EntityFilter/Filter/MainContentSplitter.php

View workflow job for this annotation

GitHub Actions / psalm

UnusedVariable

packages/core/src/Component/EntityFilter/Filter/MainContentSplitter.php:120:9: UnusedVariable: $content is never referenced or the value is not used (see https://psalm.dev/077)
$content = explode('<!--end-toc-->', $this->originalContent, 2);
$content = $content[0];

return $html ? (new TocGenerator())->getHtmlMenu($content, 2)
Expand Down
Expand Up @@ -22,7 +22,7 @@ protected function manageRedirection(): void
{
$content = $this->getMainContent();
$code = 301; // default symfony is 302...
if ('Location:' == substr($content, 0, 9)) {
if (str_starts_with($content, 'Location:')) {
$url = trim(substr($content, 9));
if (1 === \Safe\preg_match('/ [1-5][0-9]{2}$/', $url, $match)) {
$code = (int) trim((string) $match[0]);
Expand Down
Expand Up @@ -33,6 +33,7 @@ protected function generateErrorPage(?string $locale = null, string $uri = '404.
if (null !== $locale) {
$request->setLocale($locale);
}

$this->requestStack->push($request);

$filepath = $this->getStaticDir().(null !== $locale ? '/'.$locale : '').'/'.$uri;
Expand Down

0 comments on commit a228eba

Please sign in to comment.