Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Nov 13, 2024
1 parent 41ac20e commit 5cc4709
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"knplabs/knp-menu-bundle": "^3.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpdoc-parser": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class BaseBreadcrumbMenuBlockService extends AbstractMenuBlockService i
{
public function __construct(
Environment $twig,
private FactoryInterface $factory
private FactoryInterface $factory,
) {
parent::__construct($twig);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Command/SitemapGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class SitemapGeneratorCommand extends Command
public function __construct(
private RouterInterface $router,
private SourceManager $sitemapManager,
private Filesystem $filesystem
private Filesystem $filesystem,
) {
parent::__construct();
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Generating sitemap - this can take a while');
$this->generateSitemap($tempDir, $scheme, $host, $appendPath);

$output->writeln(sprintf('Moving temporary file to %s ...', $permanentDir));
$output->writeln(\sprintf('Moving temporary file to %s ...', $permanentDir));
$this->moveTemporaryFile($tempDir, $permanentDir);

$output->writeln('Cleanup ...');
Expand All @@ -111,7 +111,7 @@ private function createTempDir(OutputInterface $output): ?string
{
$tempDir = sys_get_temp_dir().'/sonata_sitemap_'.md5(__DIR__);

$output->writeln(sprintf('Creating temporary directory: %s', $tempDir));
$output->writeln(\sprintf('Creating temporary directory: %s', $tempDir));

if ($this->filesystem->exists($tempDir)) {
return null;
Expand Down Expand Up @@ -148,7 +148,7 @@ private function generateSitemap(string $dir, string $scheme, string $host, stri
// generate global sitemap index
SitemapWriter::generateSitemapIndex(
$dir,
sprintf('%s://%s%s', $scheme, $host, $appendPath),
\sprintf('%s://%s%s', $scheme, $host, $appendPath),
'sitemap*.xml',
'sitemap.xml'
);
Expand All @@ -161,7 +161,7 @@ private function moveTemporaryFile(string $tempDir, string $permanentDir): void
$pathname = $file->getRealPath();

if (false === $pathname) {
throw new \LogicException(sprintf('File %s does not exist', (string) $file));
throw new \LogicException(\sprintf('File %s does not exist', (string) $file));
}

$this->filesystem->remove($pathname);
Expand All @@ -172,10 +172,10 @@ private function moveTemporaryFile(string $tempDir, string $permanentDir): void
$pathname = $file->getRealPath();

if (false === $pathname) {
throw new \LogicException(sprintf('File %s does not exist', (string) $file));
throw new \LogicException(\sprintf('File %s does not exist', (string) $file));
}

$this->filesystem->rename($pathname, sprintf('%s/%s', $permanentDir, $file->getFilename()));
$this->filesystem->rename($pathname, \sprintf('%s/%s', $permanentDir, $file->getFilename()));
}
}
}
18 changes: 9 additions & 9 deletions src/Twig/Extension/SeoExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class SeoExtension extends AbstractExtension
{
public function __construct(
private SeoPageInterface $page,
private string $encoding
private string $encoding,
) {
}

Expand Down Expand Up @@ -51,7 +51,7 @@ public function getName(): string

public function getTitle(): string
{
return sprintf('<title>%s</title>', strip_tags($this->page->getTitle()));
return \sprintf('<title>%s</title>', strip_tags($this->page->getTitle()));
}

public function getTitleText(): string
Expand All @@ -67,14 +67,14 @@ public function getMetadatas(): string
[$content, $extras] = $meta;

if ('' !== $content) {
$html .= sprintf(
$html .= \sprintf(
"<meta %s=\"%s\" content=\"%s\" />\n",
$type,
$this->normalize($name),
$this->normalize((string) $content)
);
} else {
$html .= sprintf(
$html .= \sprintf(
"<meta %s=\"%s\" />\n",
$type,
$this->normalize($name)
Expand All @@ -90,7 +90,7 @@ public function getHtmlAttributes(): string
{
$attributes = '';
foreach ($this->page->getHtmlAttributes() as $name => $value) {
$attributes .= sprintf('%s="%s" ', $name, $value);
$attributes .= \sprintf('%s="%s" ', $name, $value);
}

return rtrim($attributes);
Expand All @@ -100,7 +100,7 @@ public function getHeadAttributes(): string
{
$attributes = '';
foreach ($this->page->getHeadAttributes() as $name => $value) {
$attributes .= sprintf('%s="%s" ', $name, $value);
$attributes .= \sprintf('%s="%s" ', $name, $value);
}

return rtrim($attributes);
Expand All @@ -109,7 +109,7 @@ public function getHeadAttributes(): string
public function getLinkCanonical(): string
{
if ('' !== $this->page->getLinkCanonical()) {
return sprintf("<link rel=\"canonical\" href=\"%s\"/>\n", $this->page->getLinkCanonical());
return \sprintf("<link rel=\"canonical\" href=\"%s\"/>\n", $this->page->getLinkCanonical());
}

return '';
Expand All @@ -119,7 +119,7 @@ public function getLangAlternates(): string
{
$html = '';
foreach ($this->page->getLangAlternates() as $href => $hrefLang) {
$html .= sprintf("<link rel=\"alternate\" href=\"%s\" hreflang=\"%s\"/>\n", $href, $hrefLang);
$html .= \sprintf("<link rel=\"alternate\" href=\"%s\" hreflang=\"%s\"/>\n", $href, $hrefLang);
}

return $html;
Expand All @@ -129,7 +129,7 @@ public function getOembedLinks(): string
{
$html = '';
foreach ($this->page->getOEmbedLinks() as $title => $link) {
$html .= sprintf("<link rel=\"alternate\" type=\"application/json+oembed\" href=\"%s\" title=\"%s\" />\n", $link, $title);
$html .= \sprintf("<link rel=\"alternate\" type=\"application/json+oembed\" href=\"%s\" title=\"%s\" />\n", $link, $title);
}

return $html;
Expand Down

0 comments on commit 5cc4709

Please sign in to comment.