Refactor format actions

This commit is contained in:
2024-12-25 11:47:47 +03:00
parent 786efb4503
commit 0ea97e907e
7 changed files with 22 additions and 37 deletions

View File

@ -11,9 +11,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class HtmlPrettierExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

View File

@ -4,21 +4,14 @@ declare(strict_types=1);
namespace Homepage\HtmlPrettierBundle;
use Generator;
use Sculpin\Core\Event\SourceSetEvent;
use Sculpin\Core\Sculpin;
use Sculpin\Core\Source\SourceInterface;
use Sculpin\Core\Source\SourceSet;
use function strlen;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class HtmlPrettier implements EventSubscriberInterface
{
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array
{
return [
@ -47,7 +40,7 @@ class HtmlPrettier implements EventSubscriberInterface
}
}
private function filterSource(SourceSet $sourceSet): Generator
private function filterSource(SourceSet $sourceSet): \Generator
{
/** @var SourceInterface $source */
foreach ($sourceSet->allSources() as $source) {
@ -65,7 +58,7 @@ class HtmlPrettier implements EventSubscriberInterface
private function endsWith($haystack, $needle): bool
{
$length = strlen($needle);
$length = \strlen($needle);
return $length === 0 || (substr($haystack, -$length) === $needle);
}

View File

@ -11,9 +11,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class SiteMapExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

View File

@ -23,9 +23,6 @@ class SiteMapGenerator implements DataProviderInterface, EventSubscriberInterfac
*/
private $sources;
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents(): array
{
return [

View File

@ -11,9 +11,6 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class TwigExtensionExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));