diff --git a/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php b/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php index 0fd3bb58..9546463d 100644 --- a/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php +++ b/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php @@ -28,12 +28,12 @@ */ class ContentCreateCommand extends AbstractCommand { - const DIRECTORY_FLAG = '_directory_'; + private const DIRECTORY_FLAG = '_directory_'; /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $prefix = $this->isStandaloneSculpin() ? '' : 'sculpin:'; @@ -72,7 +72,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $pluralType = $input->getArgument('type'); $singularType = Inflector::singularize($pluralType); @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - protected function generateBoilerplateManifest($plural, $singular, array $taxonomies = []): array + protected function generateBoilerplateManifest(string $plural, string $singular, array $taxonomies = []): array { $app = $this->getApplication(); if (!$app instanceof Application) { @@ -153,7 +153,7 @@ protected function generateBoilerplateManifest($plural, $singular, array $taxono return $manifest; } - protected function getOutputMessage($type, $singularType, $taxonomies = []) + protected function getOutputMessage(string $type, string $singularType, array $taxonomies = []): string { $outputMessage = <<getParameter($typesId); @@ -41,12 +41,12 @@ public function process(ContainerBuilder $container) } } - private static function generateId($value) + private static function generateId(string $value): string { return implode('.', ['sculpin_content_types', $value]); } - private static function generateTypesId($type, $value) + private static function generateTypesId(string $type, string $value): string { return implode('.', ['sculpin_content_types.types', $type, $value]); } diff --git a/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/Configuration.php index af7671bc..6219e9f9 100644 --- a/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder(); diff --git a/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/SculpinContentTypesExtension.php b/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/SculpinContentTypesExtension.php index 375e6182..d1726bcc 100644 --- a/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/SculpinContentTypesExtension.php +++ b/src/Sculpin/Bundle/ContentTypesBundle/DependencyInjection/SculpinContentTypesExtension.php @@ -273,17 +273,17 @@ public function load(array $configs, ContainerBuilder $container) } } - private static function generatePlaceholder($value) + private static function generatePlaceholder(string $value): string { return '%'.$value.'%'; } - private static function generateId($value) + private static function generateId(string $value): string { return implode('.', ['sculpin_content_types', $value]); } - private static function generateTypesId($type, $value) + private static function generateTypesId(string $type, string $value) { return implode('.', ['sculpin_content_types.types', $type, $value]); } diff --git a/src/Sculpin/Bundle/ContentTypesBundle/SculpinContentTypesBundle.php b/src/Sculpin/Bundle/ContentTypesBundle/SculpinContentTypesBundle.php index bed0d2fb..18f97617 100644 --- a/src/Sculpin/Bundle/ContentTypesBundle/SculpinContentTypesBundle.php +++ b/src/Sculpin/Bundle/ContentTypesBundle/SculpinContentTypesBundle.php @@ -27,7 +27,7 @@ class SculpinContentTypesBundle extends Bundle /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new MapPass); } diff --git a/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/Configuration.php index acb76886..3f7e6d70 100644 --- a/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder; diff --git a/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/SculpinMarkdownExtension.php b/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/SculpinMarkdownExtension.php index c77aeb77..21ce1403 100644 --- a/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/SculpinMarkdownExtension.php +++ b/src/Sculpin/Bundle/MarkdownBundle/DependencyInjection/SculpinMarkdownExtension.php @@ -28,7 +28,7 @@ class SculpinMarkdownExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration; $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php b/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php index 05a0f2ad..fcec0ebe 100644 --- a/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php +++ b/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php @@ -18,6 +18,7 @@ use Sculpin\Core\Converter\ParserInterface; use Sculpin\Core\Event\SourceSetEvent; use Sculpin\Core\Sculpin; +use Sculpin\Core\Source\SourceInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Michelf\Markdown; @@ -68,7 +69,7 @@ public function convert(ConverterContextInterface $converterContext): void /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ Sculpin::EVENT_BEFORE_RUN => 'beforeRun', @@ -80,8 +81,9 @@ public static function getSubscribedEvents() * * @param SourceSetEvent $sourceSetEvent Source Set Event */ - public function beforeRun(SourceSetEvent $sourceSetEvent) + public function beforeRun(SourceSetEvent $sourceSetEvent): void { + /** @var SourceInterface $source */ foreach ($sourceSetEvent->updatedSources() as $source) { foreach ($this->extensions as $extension) { if (fnmatch("*.{$extension}", $source->filename())) { @@ -99,7 +101,7 @@ public function beforeRun(SourceSetEvent $sourceSetEvent) * @param string $headerText raw markdown input for the header name * @return string */ - public function generateHeaderId($headerText) + public function generateHeaderId(string $headerText): string { // $headerText is completely raw markdown input. We need to strip it diff --git a/src/Sculpin/Bundle/MarkdownBundle/SculpinMarkdownBundle.php b/src/Sculpin/Bundle/MarkdownBundle/SculpinMarkdownBundle.php index 3d0fd79c..406572b0 100644 --- a/src/Sculpin/Bundle/MarkdownBundle/SculpinMarkdownBundle.php +++ b/src/Sculpin/Bundle/MarkdownBundle/SculpinMarkdownBundle.php @@ -22,5 +22,5 @@ */ class SculpinMarkdownBundle extends Bundle { - const CONVERTER_NAME = 'markdown'; + public const CONVERTER_NAME = 'markdown'; } diff --git a/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php b/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php index f0e09d9d..3e82064a 100644 --- a/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php +++ b/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php @@ -54,7 +54,7 @@ class ConvertListener implements EventSubscriberInterface /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ Sculpin::EVENT_BEFORE_CONVERT => 'beforeConvert', @@ -67,7 +67,7 @@ public static function getSubscribedEvents() * * @param ConvertEvent $convertEvent Convert Event */ - public function beforeConvert(ConvertEvent $convertEvent) + public function beforeConvert(ConvertEvent $convertEvent): void { if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) { $content = $convertEvent->source()->content(); @@ -88,7 +88,7 @@ public function beforeConvert(ConvertEvent $convertEvent) * * @param ConvertEvent $convertEvent Convert event */ - public function afterConvert(ConvertEvent $convertEvent) + public function afterConvert(ConvertEvent $convertEvent): void { if ($convertEvent->isHandledBy(SculpinMarkdownBundle::CONVERTER_NAME, SculpinTwigBundle::FORMATTER_NAME)) { $content = $convertEvent->source()->content(); diff --git a/src/Sculpin/Bundle/MarkdownTwigCompatBundle/DependencyInjection/SculpinMarkdownTwigCompatExtension.php b/src/Sculpin/Bundle/MarkdownTwigCompatBundle/DependencyInjection/SculpinMarkdownTwigCompatExtension.php index e5ff88f9..304cf00d 100644 --- a/src/Sculpin/Bundle/MarkdownTwigCompatBundle/DependencyInjection/SculpinMarkdownTwigCompatExtension.php +++ b/src/Sculpin/Bundle/MarkdownTwigCompatBundle/DependencyInjection/SculpinMarkdownTwigCompatExtension.php @@ -28,7 +28,7 @@ class SculpinMarkdownTwigCompatExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); diff --git a/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/Configuration.php index 7e68602f..00b0fc14 100644 --- a/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder; diff --git a/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/SculpinPaginationExtension.php b/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/SculpinPaginationExtension.php index 9980e88f..0d700e09 100644 --- a/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/SculpinPaginationExtension.php +++ b/src/Sculpin/Bundle/PaginationBundle/DependencyInjection/SculpinPaginationExtension.php @@ -28,7 +28,7 @@ class SculpinPaginationExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration; $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php b/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php index 73c3d27b..d550605e 100644 --- a/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php +++ b/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php @@ -56,7 +56,7 @@ class PaginationGenerator implements GeneratorInterface public function __construct( DataProviderManager $dataProviderManager, SourcePermalinkFactory $permalinkFactory, - $maxPerPage + int $maxPerPage ) { $this->dataProviderManager = $dataProviderManager; $this->permalinkFactory = $permalinkFactory; diff --git a/src/Sculpin/Bundle/PostsBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/PostsBundle/DependencyInjection/Configuration.php index 00d4e393..7c2ce2f3 100644 --- a/src/Sculpin/Bundle/PostsBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/PostsBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder; diff --git a/src/Sculpin/Bundle/PostsBundle/DependencyInjection/SculpinPostsExtension.php b/src/Sculpin/Bundle/PostsBundle/DependencyInjection/SculpinPostsExtension.php index 64af5994..245e8919 100644 --- a/src/Sculpin/Bundle/PostsBundle/DependencyInjection/SculpinPostsExtension.php +++ b/src/Sculpin/Bundle/PostsBundle/DependencyInjection/SculpinPostsExtension.php @@ -27,7 +27,7 @@ class SculpinPostsExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration; $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Sculpin/Bundle/SculpinBundle/Command/AbstractCommand.php b/src/Sculpin/Bundle/SculpinBundle/Command/AbstractCommand.php index d011b717..7420a4be 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Command/AbstractCommand.php +++ b/src/Sculpin/Bundle/SculpinBundle/Command/AbstractCommand.php @@ -27,7 +27,7 @@ abstract class AbstractCommand extends ContainerAwareCommand * * @return bool */ - protected function isStandaloneSculpin() + protected function isStandaloneSculpin(): bool { return class_exists('Sculpin\\Bundle\\StandaloneBundle\\SculpinStandaloneBundle', false); } diff --git a/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php b/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php index 2afa3f56..2226cffb 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php +++ b/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php @@ -50,7 +50,7 @@ class ContainerDebugCommand extends ContainerAwareCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $this ->setName('container:debug') @@ -127,7 +127,7 @@ protected function configure() * * @throws \LogicException */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $this->validateInput($input); @@ -207,7 +207,7 @@ protected function outputServices( $serviceIds, $showPrivate = false, $showTagAttributes = null - ) { + ): void { // set the label to specify public or public+private if ($showPrivate) { $label = 'Public and private services'; @@ -322,7 +322,7 @@ protected function outputServices( } } - protected function buildArgumentsArray($serviceId, $className, array $tagAttributes = []) + protected function buildArgumentsArray($serviceId, $className, array $tagAttributes = []): array { $arguments = [$serviceId]; foreach ($tagAttributes as $tagAttribute) { @@ -336,7 +336,7 @@ protected function buildArgumentsArray($serviceId, $className, array $tagAttribu /** * Renders detailed service information about one service */ - protected function outputService(OutputInterface $output, $serviceId) + protected function outputService(OutputInterface $output, string $serviceId) { $definition = $this->resolveServiceDefinition($serviceId); @@ -389,7 +389,7 @@ function ($key, $value) { } } - protected function outputParameters(OutputInterface $output, $parameters) + protected function outputParameters(OutputInterface $output, array $parameters): void { $output->writeln($this->getHelper('formatter')->formatSection('container', 'List of parameters')); @@ -437,6 +437,7 @@ protected function outputParameters(OutputInterface $output, $parameters) * @param string $serviceId The service id to resolve * * @return Definition|Alias + * @throws \Exception */ protected function resolveServiceDefinition($serviceId) { @@ -460,9 +461,11 @@ protected function resolveServiceDefinition($serviceId) * Renders list of tagged services grouped by tag * * @param OutputInterface $output - * @param bool $showPrivate + * @param bool $showPrivate + * + * @throws \Exception */ - protected function outputTags(OutputInterface $output, $showPrivate = false) + protected function outputTags(OutputInterface $output, bool $showPrivate = false): void { $container = $this->getContainer(); if (! $container instanceof ContainerBuilder) { diff --git a/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php b/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php index 56e84b6d..8dfce12a 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php +++ b/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php @@ -32,7 +32,7 @@ class GenerateCommand extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $prefix = $this->isStandaloneSculpin() ? '' : 'sculpin:'; @@ -72,7 +72,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $application = $this->getApplication(); if ($application instanceof Application) { @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $docroot, $kernel->getEnvironment(), $kernel->isDebug(), - $input->getOption('port') + (int) $input->getOption('port') ); if ($watch) { @@ -142,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output) * @param OutputInterface $output An OutputInterface instance * @param string $dir The directory to remove */ - protected function clean(InputInterface $input, OutputInterface $output, $dir) + protected function clean(InputInterface $input, OutputInterface $output, string $dir): void { $fileSystem = $this->getContainer()->get('filesystem'); if ($fileSystem->exists($dir)) { diff --git a/src/Sculpin/Bundle/SculpinBundle/Command/ServeCommand.php b/src/Sculpin/Bundle/SculpinBundle/Command/ServeCommand.php index e03607d5..0dcdef79 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Command/ServeCommand.php +++ b/src/Sculpin/Bundle/SculpinBundle/Command/ServeCommand.php @@ -28,7 +28,7 @@ class ServeCommand extends AbstractCommand /** * {@inheritdoc} */ - protected function configure() + protected function configure(): void { $prefix = $this->isStandaloneSculpin() ? '' : 'sculpin:'; @@ -48,7 +48,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $docroot = $this->getContainer()->getParameter('sculpin.output_dir'); $kernel = $this->getContainer()->get('kernel'); @@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $docroot, $kernel->getEnvironment(), $kernel->isDebug(), - $input->getOption('port') + (int) $input->getOption('port') ); $httpServer->run(); diff --git a/src/Sculpin/Bundle/SculpinBundle/Console/Application.php b/src/Sculpin/Bundle/SculpinBundle/Console/Application.php index d603bd3b..8bd45ecc 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Console/Application.php +++ b/src/Sculpin/Bundle/SculpinBundle/Console/Application.php @@ -94,7 +94,7 @@ public function __construct(KernelInterface $kernel) /** * {@inheritDoc} */ - public function run(InputInterface $input = null, OutputInterface $output = null) + public function run(InputInterface $input = null, OutputInterface $output = null): int { if (null === $output) { $styles = [ @@ -111,7 +111,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null /** * {@inheritdoc} */ - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { if ($input->hasParameterOption('--git-version')) { $output->writeln(Sculpin::GIT_VERSION); @@ -137,7 +137,7 @@ public function doRun(InputInterface $input, OutputInterface $output) return $exitCode; } - public function getMissingSculpinBundlesMessages() + public function getMissingSculpinBundlesMessages(): array { $messages = []; @@ -159,12 +159,12 @@ public function getMissingSculpinBundlesMessages() * * @return KernelInterface */ - public function getKernel() + public function getKernel(): KernelInterface { return $this->kernel; } - protected function registerCommands() + protected function registerCommands(): void { $this->kernel->boot(); @@ -201,7 +201,7 @@ protected function registerCommands() } } - private function renderRegistrationErrors(InputInterface $input, OutputInterface $output) + private function renderRegistrationErrors(InputInterface $input, OutputInterface $output): void { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); diff --git a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Configuration.php index 1e3c02fb..e2961df9 100644 --- a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder; diff --git a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/SculpinExtension.php b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/SculpinExtension.php index 18cbc720..78a00034 100644 --- a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/SculpinExtension.php +++ b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/SculpinExtension.php @@ -28,7 +28,7 @@ class SculpinExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration; $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php index 0189474a..4c41c562 100644 --- a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php +++ b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php @@ -15,6 +15,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\Kernel; @@ -32,7 +33,7 @@ abstract class AbstractKernel extends Kernel /** * {@inheritdoc} */ - public function __construct($environment, $debug, $overrides = null) + public function __construct(string $environment, bool $debug, ?array $overrides = []) { $projectDir = $overrides['projectDir'] ?? null; if (null !== $projectDir) { @@ -51,7 +52,7 @@ public function __construct($environment, $debug, $overrides = null) /** * {@inheritdoc} */ - protected function getKernelParameters() + protected function getKernelParameters(): array { if (null === $this->projectDir) { $this->projectDir = dirname($this->rootDir); @@ -66,7 +67,7 @@ protected function getKernelParameters() /** * {@inheritdoc} */ - public function registerBundles() + public function registerBundles(): array { $bundles = [ new \Sculpin\Bundle\StandaloneBundle\SculpinStandaloneBundle, @@ -110,7 +111,7 @@ public function registerContainerConfiguration(LoaderInterface $loader) /** * {@inheritdoc} */ - public function boot() + public function boot(): void { if (true === $this->booted) { return; @@ -124,7 +125,7 @@ public function boot() /** * {@inheritdoc} */ - protected function buildContainer() + protected function buildContainer(): ContainerBuilder { $container = $this->getContainerBuilder(); $container->addObjectResource($this); @@ -145,7 +146,7 @@ protected function buildContainer() /** * {@inheritdoc} */ - protected function initializeContainer() + protected function initializeContainer(): void { $container = $this->buildContainer(); $container->set('kernel', $this); @@ -163,7 +164,7 @@ protected function initializeContainer() * * @return array */ - public function getMissingSculpinBundles() + public function getMissingSculpinBundles(): array { return $this->missingSculpinBundles; } @@ -173,5 +174,5 @@ public function getMissingSculpinBundles() * * @return array */ - abstract protected function getAdditionalSculpinBundles(); + abstract protected function getAdditionalSculpinBundles(): array; } diff --git a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/DefaultKernel.php b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/DefaultKernel.php index 2612b787..db74b00d 100644 --- a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/DefaultKernel.php +++ b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/DefaultKernel.php @@ -23,7 +23,7 @@ class DefaultKernel extends AbstractKernel /** * {@inheritdoc} */ - protected function getAdditionalSculpinBundles() + protected function getAdditionalSculpinBundles(): array { return []; } diff --git a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/KernelFactory.php b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/KernelFactory.php index 02a6ce05..f561abe5 100644 --- a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/KernelFactory.php +++ b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/KernelFactory.php @@ -14,6 +14,7 @@ namespace Sculpin\Bundle\SculpinBundle\HttpKernel; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\HttpKernel\Kernel; /** * Kernel Factory @@ -27,9 +28,9 @@ class KernelFactory * * @param InputInterface $input Input * - * @return \Symfony\Component\HttpKernel\Kernel + * @return Kernel */ - public static function create(InputInterface $input) + public static function create(InputInterface $input): Kernel { $env = $input->getParameterOption(['--env', '-e'], getenv('SCULPIN_DEBUG') ?: 'dev'); $debug = ( diff --git a/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php b/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php index f005702e..99545a64 100644 --- a/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php +++ b/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php @@ -43,7 +43,7 @@ class HttpServer * @param bool $debug Debug * @param int $port Port */ - public function __construct(OutputInterface $output, $docroot, $env, $debug, $port = null) + public function __construct(OutputInterface $output, string $docroot, string $env, bool $debug, ?int $port = null) { $repository = new PhpRepository; @@ -103,7 +103,7 @@ public function __construct(OutputInterface $output, $docroot, $env, $debug, $po * @param int $interval Interval * @param callable $callback Callback */ - public function addPeriodicTimer($interval, $callback) + public function addPeriodicTimer(int $interval, callable $callback): void { $this->loop->addPeriodicTimer($interval, $callback); } @@ -111,7 +111,7 @@ public function addPeriodicTimer($interval, $callback) /** * Run server */ - public function run() + public function run(): void { $this->output->writeln(sprintf( 'Starting Sculpin server for the %s environment with debug %s', @@ -132,10 +132,10 @@ public function run() * Log a request * * @param OutputInterface $output Output - * @param string $responseCode Response code + * @param int $responseCode Response code * @param ServerRequestInterface $request Request */ - public static function logRequest(OutputInterface $output, $responseCode, ServerRequestInterface $request) + public static function logRequest(OutputInterface $output, int $responseCode, ServerRequestInterface $request): void { $wrapOpen = ''; $wrapClose = ''; diff --git a/src/Sculpin/Bundle/SculpinBundle/SculpinBundle.php b/src/Sculpin/Bundle/SculpinBundle/SculpinBundle.php index a975f75d..9a5ac239 100644 --- a/src/Sculpin/Bundle/SculpinBundle/SculpinBundle.php +++ b/src/Sculpin/Bundle/SculpinBundle/SculpinBundle.php @@ -35,7 +35,7 @@ class SculpinBundle extends Bundle /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new ConverterManagerPass); $container->addCompilerPass(new DataProviderManagerPass); diff --git a/src/Sculpin/Bundle/StandaloneBundle/Command/CacheClearCommand.php b/src/Sculpin/Bundle/StandaloneBundle/Command/CacheClearCommand.php index 2f802f71..345eebee 100644 --- a/src/Sculpin/Bundle/StandaloneBundle/Command/CacheClearCommand.php +++ b/src/Sculpin/Bundle/StandaloneBundle/Command/CacheClearCommand.php @@ -51,7 +51,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $cacheDir = $this->getContainer()->getParameter('kernel.cache_dir'); $filesystem = $this->getContainer()->get('filesystem'); diff --git a/src/Sculpin/Bundle/StandaloneBundle/DependencyInjection/SculpinStandaloneExtension.php b/src/Sculpin/Bundle/StandaloneBundle/DependencyInjection/SculpinStandaloneExtension.php index e06843e4..e07d7dd0 100644 --- a/src/Sculpin/Bundle/StandaloneBundle/DependencyInjection/SculpinStandaloneExtension.php +++ b/src/Sculpin/Bundle/StandaloneBundle/DependencyInjection/SculpinStandaloneExtension.php @@ -28,7 +28,7 @@ class SculpinStandaloneExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); diff --git a/src/Sculpin/Bundle/StandaloneBundle/SculpinStandaloneBundle.php b/src/Sculpin/Bundle/StandaloneBundle/SculpinStandaloneBundle.php index a56a9b91..d1bd8ca4 100644 --- a/src/Sculpin/Bundle/StandaloneBundle/SculpinStandaloneBundle.php +++ b/src/Sculpin/Bundle/StandaloneBundle/SculpinStandaloneBundle.php @@ -25,7 +25,7 @@ */ class SculpinStandaloneBundle extends Bundle { - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new RegisterListenersPass, PassConfig::TYPE_AFTER_REMOVING); } diff --git a/src/Sculpin/Bundle/TextileBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/TextileBundle/DependencyInjection/Configuration.php index 29a6f98b..e8f8d1f1 100644 --- a/src/Sculpin/Bundle/TextileBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/TextileBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder; diff --git a/src/Sculpin/Bundle/TextileBundle/DependencyInjection/SculpinTextileExtension.php b/src/Sculpin/Bundle/TextileBundle/DependencyInjection/SculpinTextileExtension.php index ef6cee6f..b459562b 100644 --- a/src/Sculpin/Bundle/TextileBundle/DependencyInjection/SculpinTextileExtension.php +++ b/src/Sculpin/Bundle/TextileBundle/DependencyInjection/SculpinTextileExtension.php @@ -28,7 +28,7 @@ class SculpinTextileExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration; $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Sculpin/Bundle/TextileBundle/SculpinTextileBundle.php b/src/Sculpin/Bundle/TextileBundle/SculpinTextileBundle.php index 99ec897a..e00add65 100644 --- a/src/Sculpin/Bundle/TextileBundle/SculpinTextileBundle.php +++ b/src/Sculpin/Bundle/TextileBundle/SculpinTextileBundle.php @@ -22,5 +22,5 @@ */ class SculpinTextileBundle extends Bundle { - const CONVERTER_NAME = 'textile'; + public const CONVERTER_NAME = 'textile'; } diff --git a/src/Sculpin/Bundle/TextileBundle/TextileConverter.php b/src/Sculpin/Bundle/TextileBundle/TextileConverter.php index 76983bd0..ad796c9a 100644 --- a/src/Sculpin/Bundle/TextileBundle/TextileConverter.php +++ b/src/Sculpin/Bundle/TextileBundle/TextileConverter.php @@ -18,6 +18,7 @@ use Sculpin\Core\Converter\ConverterInterface; use Sculpin\Core\Event\SourceSetEvent; use Sculpin\Core\Sculpin; +use Sculpin\Core\Source\SourceInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -64,7 +65,7 @@ public function convert(ConverterContextInterface $converterContext): void /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ Sculpin::EVENT_BEFORE_RUN => 'beforeRun', @@ -76,8 +77,9 @@ public static function getSubscribedEvents() * * @param SourceSetEvent $sourceSetEvent Source Set Event */ - public function beforeRun(SourceSetEvent $sourceSetEvent) + public function beforeRun(SourceSetEvent $sourceSetEvent): void { + /** @var SourceInterface $source */ foreach ($sourceSetEvent->updatedSources() as $source) { foreach ($this->extensions as $extension) { if (fnmatch("*.{$extension}", $source->filename())) { diff --git a/src/Sculpin/Bundle/ThemeBundle/Command/ListCommand.php b/src/Sculpin/Bundle/ThemeBundle/Command/ListCommand.php index a629d3d1..15ea272d 100644 --- a/src/Sculpin/Bundle/ThemeBundle/Command/ListCommand.php +++ b/src/Sculpin/Bundle/ThemeBundle/Command/ListCommand.php @@ -42,7 +42,7 @@ protected function configure() /** * {@inheritdoc} */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): void { $themeRegistry = $this->getContainer()->get('sculpin_theme.theme_registry'); $activeTheme = $themeRegistry->findActiveTheme(); diff --git a/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/Configuration.php index 14f82279..83de4358 100644 --- a/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder; diff --git a/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/SculpinThemeExtension.php b/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/SculpinThemeExtension.php index 5702b9e5..b7725c5b 100644 --- a/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/SculpinThemeExtension.php +++ b/src/Sculpin/Bundle/ThemeBundle/DependencyInjection/SculpinThemeExtension.php @@ -28,7 +28,7 @@ class SculpinThemeExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration; $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php b/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php index 3298b0e5..f4998844 100644 --- a/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php +++ b/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php @@ -13,7 +13,6 @@ namespace Sculpin\Bundle\ThemeBundle; -use Dflydev\Symfony\FinderFactory\FinderFactoryInterface; use Symfony\Component\Finder\Finder; use Symfony\Component\Yaml\Yaml; @@ -23,14 +22,14 @@ class ThemeRegistry private $directory; private $activeTheme; - public function __construct($finderFactory, $directory, $activeTheme = null) + public function __construct($finderFactory, string $directory, ?string $activeTheme = null) { $this->finderFactory = $finderFactory; $this->directory = $directory; $this->activeTheme = $activeTheme; } - public function listThemes() + public function listThemes(): array { if (! file_exists($this->directory)) { return []; @@ -44,6 +43,7 @@ public function listThemes() $themes = []; + /** @var \SplFileInfo $directory */ foreach ($directories as $directory) { $name = basename(dirname($directory->getRealPath())).'/'.basename($directory->getRealPath()); $theme = ['name' => $name, 'path' => $directory]; @@ -56,7 +56,7 @@ public function listThemes() return $themes; } - public function findActiveTheme() + public function findActiveTheme(): ?array { $themes = $this->listThemes(); @@ -80,5 +80,7 @@ public function findActiveTheme() return $theme; } + + return null; } } diff --git a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php index eb6d3f0a..21e84ef6 100644 --- a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php +++ b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php @@ -20,7 +20,7 @@ public function __construct(ThemeRegistry $themeRegistry, $sourceDir, $directory /** * {@inheritdoc} */ - public function getFunctions() + public function getFunctions(): array { return [ new \Twig_SimpleFunction('theme_path', [$this, 'themePath']), @@ -32,7 +32,7 @@ public function getFunctions() /** * {@inheritdoc} */ - public function getName() + public function getName(): string { return 'theme'; } @@ -47,7 +47,7 @@ public function getName() * * @return string */ - public function themePath($resource) + public function themePath(string $resource): string { if (null === $this->theme) { return $resource; @@ -79,7 +79,7 @@ public function themePath($resource) * * @return bool */ - public function themePathExists($resource) + public function themePathExists(string $resource): bool { if (file_exists($this->sourceDir.'/'.$resource)) { return true; @@ -113,7 +113,7 @@ public function themePathExists($resource) * * @return array */ - public function themePaths($resource) + public function themePaths(string $resource): array { $paths = []; @@ -140,7 +140,7 @@ public function themePaths($resource) return array_reverse($paths); } - private function findThemeResource($theme, $resource) + private function findThemeResource(array $theme, string $resource): string { if (file_exists($theme['path'].'/'.$resource)) { return $this->directory.'/'.$theme['name'].'/'.$resource; diff --git a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php index 9056b2ce..0e37c5e7 100644 --- a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php +++ b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php @@ -39,7 +39,7 @@ public function __construct(ThemeRegistry $themeRegistry, array $extensions) $this->chainLoader = new \Twig_Loader_Chain($loaders); } - private function findPaths($theme, array $paths = []) + private function findPaths(array $theme, array $paths = []): array { foreach (['_views', '_layouts', '_includes', '_partials'] as $type) { if (is_dir($viewPath = $theme['path'].'/'.$type)) { @@ -61,7 +61,7 @@ public function getSourceContext($name) /** * {@inheritdoc} */ - public function exists($name) + public function exists($name): bool { return $this->chainLoader->exists($name); } @@ -69,7 +69,7 @@ public function exists($name) /** * {@inheritdoc} */ - public function getCacheKey($name) + public function getCacheKey($name): string { return $this->chainLoader->getCacheKey($name); } @@ -77,7 +77,7 @@ public function getCacheKey($name) /** * {@inheritdoc} */ - public function isFresh($name, $time) + public function isFresh($name, $time): bool { return $this->chainLoader->isFresh($name, $time); } diff --git a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php index e1259564..7cf42ebc 100644 --- a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php +++ b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigEnvironmentPass.php @@ -28,7 +28,7 @@ class TwigEnvironmentPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasDefinition('sculpin_twig.twig')) { return; diff --git a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php index b971841b..0699d3ae 100644 --- a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php +++ b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Compiler/TwigLoaderPass.php @@ -28,7 +28,7 @@ class TwigLoaderPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (false === $container->hasDefinition('sculpin_twig.loader')) { return; diff --git a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Configuration.php index 2351bfb5..911ae865 100644 --- a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface /** * {@inheritdoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder; diff --git a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/SculpinTwigExtension.php b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/SculpinTwigExtension.php index 173acb3a..36b8e24f 100644 --- a/src/Sculpin/Bundle/TwigBundle/DependencyInjection/SculpinTwigExtension.php +++ b/src/Sculpin/Bundle/TwigBundle/DependencyInjection/SculpinTwigExtension.php @@ -28,7 +28,7 @@ class SculpinTwigExtension extends Extension /** * {@inheritdoc} */ - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration; $config = $this->processConfiguration($configuration, $configs); diff --git a/src/Sculpin/Bundle/TwigBundle/Environment.php b/src/Sculpin/Bundle/TwigBundle/Environment.php index 05831636..7545592b 100644 --- a/src/Sculpin/Bundle/TwigBundle/Environment.php +++ b/src/Sculpin/Bundle/TwigBundle/Environment.php @@ -23,7 +23,7 @@ class Environment extends \Twig_Environment * * Hacky workaround to expose invalidation. */ - public function invalidateLoadedTemplates() + public function invalidateLoadedTemplates(): void { try { $me = new \ReflectionClass($this); diff --git a/src/Sculpin/Bundle/TwigBundle/FilesystemLoader.php b/src/Sculpin/Bundle/TwigBundle/FilesystemLoader.php index 0e794f6d..1d20dd2e 100644 --- a/src/Sculpin/Bundle/TwigBundle/FilesystemLoader.php +++ b/src/Sculpin/Bundle/TwigBundle/FilesystemLoader.php @@ -23,7 +23,7 @@ class FilesystemLoader extends \Twig_Loader_Filesystem /** * {@inheritdoc} */ - public function getCacheKey($name) + public function getCacheKey($name): string { $filename = $this->findTemplate($name); diff --git a/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php b/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php index f87e897e..4f9f9b01 100644 --- a/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php +++ b/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php @@ -44,7 +44,7 @@ class FlexibleExtensionFilesystemLoader implements \Twig_LoaderInterface, EventS * @param string[] $paths * @param string[] $extensions */ - public function __construct($sourceDir, array $sourcePaths, array $paths, array $extensions) + public function __construct(string $sourceDir, array $sourcePaths, array $paths, array $extensions) { $mappedSourcePaths = array_map(function ($path) use ($sourceDir) { return $sourceDir.'/'.$path; @@ -68,7 +68,7 @@ public function __construct($sourceDir, array $sourcePaths, array $paths, array /** * {@inheritdoc} */ - public function getSourceContext($name) + public function getSourceContext($name): \Twig_Source { $this->getCacheKey($name); @@ -122,7 +122,7 @@ public function isFresh($name, $time) /** * {@inheritdoc} */ - public function exists($name) + public function exists($name): bool { try { $this->getCacheKey($name); @@ -138,14 +138,14 @@ public function exists($name) /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ Sculpin::EVENT_BEFORE_RUN => 'beforeRun', ]; } - public function beforeRun(SourceSetEvent $sourceSetEvent) + public function beforeRun(SourceSetEvent $sourceSetEvent): void { if ($sourceSetEvent->sourceSet()->newSources()) { $this->cachedCacheKey = []; diff --git a/src/Sculpin/Bundle/TwigBundle/SculpinTwigBundle.php b/src/Sculpin/Bundle/TwigBundle/SculpinTwigBundle.php index 3492e258..1a41958a 100644 --- a/src/Sculpin/Bundle/TwigBundle/SculpinTwigBundle.php +++ b/src/Sculpin/Bundle/TwigBundle/SculpinTwigBundle.php @@ -25,12 +25,12 @@ */ class SculpinTwigBundle extends Bundle { - const FORMATTER_NAME = 'twig'; + public const FORMATTER_NAME = 'twig'; /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new TwigEnvironmentPass); $container->addCompilerPass(new TwigLoaderPass); diff --git a/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php b/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php index 4b44f22a..31689b5a 100644 --- a/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php +++ b/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php @@ -39,7 +39,7 @@ public function __construct(Environment $twig) /** * {@inheritdoc} */ - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ Sculpin::EVENT_BEFORE_RUN => 'beforeRun', @@ -51,7 +51,7 @@ public static function getSubscribedEvents() * * @param SourceSetEvent $sourceSetEvent Source Set Event */ - public function beforeRun(SourceSetEvent $sourceSetEvent) + public function beforeRun(SourceSetEvent $sourceSetEvent): void { $updated = $sourceSetEvent->updatedSources(); if ($updated) { diff --git a/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php b/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php index c48c41b9..3f3af056 100644 --- a/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php +++ b/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php @@ -77,7 +77,7 @@ public function formatBlocks(FormatContext $formatContext): array } } - public function findAllBlocks(\Twig_Template $template, array $context) + public function findAllBlocks(\Twig_Template $template, array $context): array { return $template->getBlockNames($context); } diff --git a/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php b/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php index 29ebb7f5..0180ebfe 100644 --- a/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php +++ b/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php @@ -56,9 +56,9 @@ private function getConfigFile(string $configFile): ConfigurationInterface /** * Create Site Configuration * - * @return Configuration + * @return ConfigurationInterface */ - public function create(): Configuration + public function create(): ConfigurationInterface { $config = $this->detectConfig(); $config->set('env', $this->environment);