From c60a05db8b2c49a3a44ecac77571067b56d81823 Mon Sep 17 00:00:00 2001 From: The Exakat cobbler Date: Thu, 24 Feb 2022 13:28:00 +0000 Subject: [PATCH] Exakat cobbler for Functions/SetTypehints --- .../Command/ContentCreateCommand.php | 2 +- .../DependencyInjection/Configuration.php | 6 +++--- .../Bundle/MarkdownBundle/MarkdownConverter.php | 4 ++-- .../MarkdownTwigCompatBundle/ConvertListener.php | 6 +++--- .../PaginationBundle/PaginationGenerator.php | 6 +++--- .../Command/ContainerDebugCommand.php | 8 ++++---- .../SculpinBundle/Command/GenerateCommand.php | 2 +- .../Bundle/SculpinBundle/Console/Application.php | 4 ++-- .../Compiler/CustomMimeTypesRepositoryPass.php | 2 +- .../Compiler/PathConfiguratorPass.php | 4 ++-- .../SculpinBundle/HttpKernel/AbstractKernel.php | 2 +- .../Bundle/SculpinBundle/HttpServer/HttpServer.php | 8 ++++---- .../Bundle/TextileBundle/TextileConverter.php | 4 ++-- src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php | 2 +- .../Bundle/ThemeBundle/ThemeTwigExtension.php | 4 ++-- src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php | 2 +- .../FlexibleExtensionFilesystemLoader.php | 14 +++++++------- src/Sculpin/Bundle/TwigBundle/TemplateResetter.php | 2 +- src/Sculpin/Bundle/TwigBundle/TwigFormatter.php | 6 +++--- .../Bundle/TwigBundle/WebpackEncoreHelper.php | 2 +- .../ProxySourceCollection.php | 6 +++--- .../ProxySourceCollectionDataProvider.php | 4 ++-- .../ProxySourceCollection/ProxySourceItem.php | 4 ++-- .../SimpleProxySourceItemFactory.php | 2 +- .../ProxySourceCollection/Sorter/MetaSorter.php | 2 +- .../PermalinkStrategy/ToyRocketStrategy.php | 2 +- .../Taxonomy/ProxySourceTaxonomyDataProvider.php | 6 +++--- .../Taxonomy/ProxySourceTaxonomyIndexGenerator.php | 6 +++--- src/Sculpin/Core/Configuration/Configuration.php | 14 +++++++------- src/Sculpin/Core/Converter/ConverterManager.php | 6 +++--- .../Core/Converter/SourceConverterContext.php | 2 +- .../Core/DataProvider/DataProviderManager.php | 2 +- src/Sculpin/Core/Event/ConvertEvent.php | 6 +++--- src/Sculpin/Core/Event/FormatEvent.php | 2 +- src/Sculpin/Core/Event/SourceSetEvent.php | 2 +- src/Sculpin/Core/Formatter/FormatContext.php | 6 +++--- src/Sculpin/Core/Formatter/FormatterManager.php | 8 ++++---- src/Sculpin/Core/Generator/GeneratorManager.php | 6 +++--- src/Sculpin/Core/Io/ConsoleIo.php | 6 +++--- src/Sculpin/Core/Output/FilesystemWriter.php | 4 ++-- src/Sculpin/Core/Output/SourceOutput.php | 2 +- src/Sculpin/Core/Permalink/Permalink.php | 4 ++-- .../Core/Permalink/SourcePermalinkFactory.php | 2 +- src/Sculpin/Core/Sculpin.php | 14 +++++++------- .../SiteConfiguration/SiteConfigurationFactory.php | 4 ++-- src/Sculpin/Core/Source/AbstractSource.php | 8 ++++---- src/Sculpin/Core/Source/CompositeDataSource.php | 4 ++-- .../Core/Source/ConfigFilesystemDataSource.php | 8 ++++---- src/Sculpin/Core/Source/FileSource.php | 2 +- src/Sculpin/Core/Source/FilesystemDataSource.php | 10 +++++----- src/Sculpin/Core/Source/Filter/AntPathFilter.php | 4 ++-- src/Sculpin/Core/Source/Filter/ChainFilter.php | 2 +- src/Sculpin/Core/Source/Map/ChainMap.php | 2 +- src/Sculpin/Core/Source/Map/DefaultDataMap.php | 2 +- src/Sculpin/Core/Source/ProxySource.php | 2 +- src/Sculpin/Core/Source/SourceSet.php | 6 +++--- .../Tests/Permalink/SourcePermalinkFactoryTest.php | 6 +++--- .../Core/Tests/Source/CompositeDataSourceTest.php | 2 +- src/Sculpin/Core/Tests/Source/FileSourceTest.php | 8 ++++---- .../Map/CalculatedDateFromFilenameMapTest.php | 6 +++--- src/Sculpin/Core/Tests/Source/SourceSetTest.php | 2 +- .../Core/Util/DirectorySeparatorNormalizer.php | 4 ++-- .../EventListenerTestFixtureBundle/Listener.php | 2 +- .../Tests/Functional/FunctionalTestCase.php | 2 +- src/Sculpin/Tests/Functional/InitCommandTest.php | 4 ++-- 65 files changed, 149 insertions(+), 149 deletions(-) diff --git a/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php b/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php index 2aff0ce7..f6438fda 100644 --- a/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php +++ b/src/Sculpin/Bundle/ContentTypesBundle/Command/ContentCreateCommand.php @@ -210,7 +210,7 @@ private function getOutputMessage(string $type, string $singularType, array $tax } private function getIndexTemplate(string $plural, string $singular) - { + : string { $title = ucfirst($plural); return <<ifString() - ->then(function ($v) { + ->then(function ($v) : array { return [$v]; }) ->end() @@ -61,14 +61,14 @@ public function getConfigTreeBuilder(): TreeBuilder // Default case is we want the user to specify just one // taxonomy but we can allow for multiple if they want to. ->ifString() - ->then(function ($v) { + ->then(function ($v) : array { return [['name' => $v]]; }) ->end() ->prototype('array') ->beforeNormalization() ->ifString() - ->then(function ($v) { + ->then(function ($v) : array { return ['name' => $v]; }) ->end() diff --git a/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php b/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php index 3b4efa63..1389a5c8 100644 --- a/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php +++ b/src/Sculpin/Bundle/MarkdownBundle/MarkdownConverter.php @@ -32,14 +32,14 @@ final class MarkdownConverter implements ConverterInterface, EventSubscriberInte /** * @var ParserInterface */ - private $markdown; + private ParserInterface $markdown; /** * File name extensions that are handled as markdown. * * @var string[] */ - private $extensions = []; + private array $extensions = []; /** * Constructor. diff --git a/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php b/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php index cf7a4a5a..b8d9101e 100644 --- a/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php +++ b/src/Sculpin/Bundle/MarkdownTwigCompatBundle/ConvertListener.php @@ -31,7 +31,7 @@ final class ConvertListener implements EventSubscriberInterface * * @var array */ - private static $addPlaceholderRe = [ + private static array $addPlaceholderRe = [ '/^({%\s+block\s+(\w+).+?%})$/m', // {% %} style code '/^({%\s+endblock\s+%})$/m', // {% %} style code '/^({{.+?}})$/m', // {{ }} style code @@ -42,14 +42,14 @@ final class ConvertListener implements EventSubscriberInterface * * @var string */ - private static $placeholder = "\n
$1
\n"; + private static string $placeholder = "\n
$1
\n"; /** * Regex used to remove placeholder * * @var string */ - private static $removePlaceholderRe = "/(\n?
|<\/div>\n|\n?<div><!-- sculpin-hidden -->|<!-- \/sculpin-hidden --><\/div>\n)/m"; // @codingStandardsIgnoreLine + private static string $removePlaceholderRe = "/(\n?
|<\/div>\n|\n?<div><!-- sculpin-hidden -->|<!-- \/sculpin-hidden --><\/div>\n)/m"; // @codingStandardsIgnoreLine /** * {@inheritdoc} diff --git a/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php b/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php index 013c1b40..664f0c5e 100644 --- a/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php +++ b/src/Sculpin/Bundle/PaginationBundle/PaginationGenerator.php @@ -28,19 +28,19 @@ final class PaginationGenerator implements GeneratorInterface /** * @var DataProviderManager */ - private $dataProviderManager; + private DataProviderManager $dataProviderManager; /** * @var SourcePermalinkFactory */ - private $permalinkFactory; + private SourcePermalinkFactory $permalinkFactory; /** * Max per page (default) * * @var int */ - private $maxPerPage; + private int $maxPerPage; public function __construct( DataProviderManager $dataProviderManager, diff --git a/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php b/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php index 46c4d476..8f69e750 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php +++ b/src/Sculpin/Bundle/SculpinBundle/Command/ContainerDebugCommand.php @@ -191,7 +191,7 @@ private function validateInput(InputInterface $input) private function outputServices( OutputInterface $output, $serviceIds, - $showPrivate = false, + bool $showPrivate = false, $showTagAttributes = null ): void { // set the label to specify public or public+private @@ -239,14 +239,14 @@ private function outputServices( } } $format = '%-'.$maxName.'s '; - $format .= implode("", array_map(function ($length) { + $format .= implode("", array_map(function (string $length) : string { return "%-{$length}s "; }, $maxTags)); $format .= '%s'; // the title field needs extra space to make up for comment tags $format1 = '%-'.($maxName + 19).'s '; - $format1 .= implode("", array_map(function ($length) { + $format1 .= implode("", array_map(function (int $length) : string { return '%-'.($length + 19).'s '; }, $maxTags)); $format1 .= '%s'; @@ -308,7 +308,7 @@ private function outputServices( } } - private function buildArgumentsArray($serviceId, $className, array $tagAttributes = []): array + private function buildArgumentsArray(string $serviceId, string $className, array $tagAttributes = []): array { $arguments = [$serviceId]; foreach ($tagAttributes as $tagAttribute) { diff --git a/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php b/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php index fe0cdd14..181aeb94 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php +++ b/src/Sculpin/Bundle/SculpinBundle/Command/GenerateCommand.php @@ -191,7 +191,7 @@ protected function runSculpin( IoInterface $io ) { $messages = []; - $errPrint = function (\Throwable $e) { + $errPrint = function (\Throwable $e) : string { return $e->getMessage().PHP_EOL.' at '.str_replace(getcwd().DIRECTORY_SEPARATOR, '', $e->getFile()); }; diff --git a/src/Sculpin/Bundle/SculpinBundle/Console/Application.php b/src/Sculpin/Bundle/SculpinBundle/Console/Application.php index 45e149a0..40f3edfd 100644 --- a/src/Sculpin/Bundle/SculpinBundle/Console/Application.php +++ b/src/Sculpin/Bundle/SculpinBundle/Console/Application.php @@ -35,12 +35,12 @@ final class Application extends BaseApplication /** * @var KernelInterface */ - private $kernel; + private KernelInterface $kernel; /** * @var \Throwable[] */ - private $registrationErrors = []; + private array $registrationErrors = []; public function __construct(KernelInterface $kernel) { diff --git a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/CustomMimeTypesRepositoryPass.php b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/CustomMimeTypesRepositoryPass.php index d70de85d..3cd0d230 100644 --- a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/CustomMimeTypesRepositoryPass.php +++ b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/CustomMimeTypesRepositoryPass.php @@ -52,7 +52,7 @@ public function process(ContainerBuilder $container) } foreach ($data as $type => $extensions) { - $data[$type] = array_filter($extensions, function ($var) { + $data[$type] = array_filter($extensions, function ($var) : bool { return strlen($var) > 0; }); } diff --git a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/PathConfiguratorPass.php b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/PathConfiguratorPass.php index a4936908..77cb9462 100644 --- a/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/PathConfiguratorPass.php +++ b/src/Sculpin/Bundle/SculpinBundle/DependencyInjection/Compiler/PathConfiguratorPass.php @@ -29,7 +29,7 @@ class PathConfiguratorPass implements CompilerPassInterface * * @var AntPathMatcher */ - protected $matcher; + protected AntPathMatcher $matcher; /** * Constructor. @@ -73,7 +73,7 @@ protected function antify($paths) $matcher = $this->matcher; return array_map( - function ($path) use ($matcher) { + function (string $path) use ($matcher) : string { if ($matcher->isPattern($path)) { return $path; } diff --git a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php index c2d904ef..9f9e7313 100644 --- a/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php +++ b/src/Sculpin/Bundle/SculpinBundle/HttpKernel/AbstractKernel.php @@ -24,7 +24,7 @@ */ abstract class AbstractKernel extends Kernel { - protected $missingSculpinBundles = []; + protected array $missingSculpinBundles = []; protected $outputDir; protected $projectDir; protected $sourceDir; diff --git a/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php b/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php index 4c63152c..a630d48a 100644 --- a/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php +++ b/src/Sculpin/Bundle/SculpinBundle/HttpServer/HttpServer.php @@ -29,22 +29,22 @@ final class HttpServer /** * @var bool */ - private $debug; + private bool $debug; /** * @var string */ - private $env; + private string $env; /** * @var StreamSelectLoop */ - private $loop; + private StreamSelectLoop $loop; /** * @var OutputInterface */ - private $output; + private OutputInterface $output; /** * @var int diff --git a/src/Sculpin/Bundle/TextileBundle/TextileConverter.php b/src/Sculpin/Bundle/TextileBundle/TextileConverter.php index bcd79fd3..0c8931f5 100644 --- a/src/Sculpin/Bundle/TextileBundle/TextileConverter.php +++ b/src/Sculpin/Bundle/TextileBundle/TextileConverter.php @@ -29,14 +29,14 @@ final class TextileConverter implements ConverterInterface, EventSubscriberInter /** * @var Parser */ - private $textileParser; + private Parser $textileParser; /** * File name extensions that are handled as textile. * * @var string[] */ - private $extensions = []; + private array $extensions = []; /** * @param string[] $extensions file name extensions that are handled as markdown diff --git a/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php b/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php index 34f17196..e9946c3c 100644 --- a/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php +++ b/src/Sculpin/Bundle/ThemeBundle/ThemeRegistry.php @@ -19,7 +19,7 @@ class ThemeRegistry { private $finderFactory; - private $directory; + private string $directory; private $activeTheme; public function __construct($finderFactory, string $directory, ?string $activeTheme = null) diff --git a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php index ead57131..67227354 100644 --- a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php +++ b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigExtension.php @@ -17,12 +17,12 @@ class ThemeTwigExtension extends AbstractExtension /** * @var string */ - private $sourceDirectory; + private string $sourceDirectory; /** * @var string */ - private $themeDirectory; + private string $themeDirectory; public function __construct(ThemeRegistry $themeRegistry, string $sourceDirectory, string $themeDirectory) { diff --git a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php index c34ecfd5..d57c8903 100644 --- a/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php +++ b/src/Sculpin/Bundle/ThemeBundle/ThemeTwigLoader.php @@ -22,7 +22,7 @@ class ThemeTwigLoader implements LoaderInterface /** * @var ChainLoader */ - private $chainLoader; + private ChainLoader $chainLoader; public function __construct(ThemeRegistry $themeRegistry, array $extensions) { diff --git a/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php b/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php index ce8dfe30..14b28d10 100644 --- a/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php +++ b/src/Sculpin/Bundle/TwigBundle/FlexibleExtensionFilesystemLoader.php @@ -28,26 +28,26 @@ final class FlexibleExtensionFilesystemLoader implements LoaderInterface, EventS /** * @var FilesystemLoader */ - private $filesystemLoader; + private FilesystemLoader $filesystemLoader; /** * @var string[] */ - private $cachedCacheKey = []; + private array $cachedCacheKey = []; /** * @var string[] */ - private $cachedCacheKeyExtension = []; + private array $cachedCacheKeyExtension = []; /** * @var \Throwable[] */ - private $cachedCacheKeyException = []; + private array $cachedCacheKeyException = []; /** * @var string[] */ - private $extensions = []; + private array $extensions = []; /** * @param string[] $sourcePaths @@ -56,7 +56,7 @@ final class FlexibleExtensionFilesystemLoader implements LoaderInterface, EventS */ public function __construct(string $sourceDir, array $sourcePaths, array $paths, array $extensions) { - $mappedSourcePaths = array_map(function ($path) use ($sourceDir) { + $mappedSourcePaths = array_map(function (string $path) use ($sourceDir) : string { return $sourceDir.'/'.$path; }, $sourcePaths); @@ -66,7 +66,7 @@ public function __construct(string $sourceDir, array $sourcePaths, array $paths, ); $this->filesystemLoader = new FilesystemLoader($allPaths); - $this->extensions = array_map(function ($ext) { + $this->extensions = array_map(function (string $ext) : string { return $ext?'.'.$ext:$ext; }, $extensions); } diff --git a/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php b/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php index 44fb9aa6..9301d1d4 100644 --- a/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php +++ b/src/Sculpin/Bundle/TwigBundle/TemplateResetter.php @@ -22,7 +22,7 @@ */ final class TemplateResetter implements EventSubscriberInterface { - private $twig; + private Environment $twig; public function __construct(Environment $twig) { diff --git a/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php b/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php index 106ef04b..9f491964 100644 --- a/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php +++ b/src/Sculpin/Bundle/TwigBundle/TwigFormatter.php @@ -27,12 +27,12 @@ final class TwigFormatter implements FormatterInterface /** * @var Environment */ - private $twig; + private Environment $twig; /** * @var ArrayLoader */ - private $arrayLoader; + private ArrayLoader $arrayLoader; public function __construct(Environment $twig, ArrayLoader $arrayLoader) { @@ -101,7 +101,7 @@ public function reset() } private function massageTemplate(FormatContext $formatContext) - { + : string { $template = $formatContext->template(); if ($layout = $formatContext->data()->get('layout')) { // Completely remove anything in verbatim sections so that any blocks defined in there will diff --git a/src/Sculpin/Bundle/TwigBundle/WebpackEncoreHelper.php b/src/Sculpin/Bundle/TwigBundle/WebpackEncoreHelper.php index 1a69ba2c..78b6bbe4 100644 --- a/src/Sculpin/Bundle/TwigBundle/WebpackEncoreHelper.php +++ b/src/Sculpin/Bundle/TwigBundle/WebpackEncoreHelper.php @@ -9,7 +9,7 @@ class WebpackEncoreHelper extends AbstractExtension implements GlobalsInterface { - protected $sourceDir; + protected string $sourceDir; protected $manifest; public function __construct(string $sourceDir, ?string $manifest) diff --git a/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollection.php b/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollection.php index 51b71725..7ea3dfa3 100644 --- a/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollection.php +++ b/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollection.php @@ -22,7 +22,7 @@ class ProxySourceCollection implements \ArrayAccess, \Iterator, \Countable /** * @var $items ProxySourceItem[] */ - protected $items = []; + protected array $items = []; protected $sorter; public function __construct(array $items = [], SorterInterface $sorter = null) @@ -76,7 +76,7 @@ public function next() } public function valid() - { + : bool { return $this->current() !== false; } @@ -130,7 +130,7 @@ public function sort() } unset($item); - uasort($this->items, function ($a, $b) use ($comparator) { + uasort($this->items, function ($a, $b) use ($comparator) : int { $result = $comparator($a[1], $b[1]); // use the index to prevent undefined behaviour when comparator reports items are "equal" diff --git a/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollectionDataProvider.php b/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollectionDataProvider.php index 38686eb3..9542b5f9 100644 --- a/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollectionDataProvider.php +++ b/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceCollectionDataProvider.php @@ -27,7 +27,7 @@ class ProxySourceCollectionDataProvider implements DataProviderInterface, EventSubscriberInterface { - private $formatterManager; + private FormatterManager $formatterManager; private $dataProviderName; private $dataSingularName; private $collection; @@ -59,7 +59,7 @@ public function provideData(): array } public static function getSubscribedEvents() - { + : array { return [ Sculpin::EVENT_BEFORE_RUN => [ ['beforeRun', 0], diff --git a/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceItem.php b/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceItem.php index 0ecc5e40..c71f2f62 100644 --- a/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceItem.php +++ b/src/Sculpin/Contrib/ProxySourceCollection/ProxySourceItem.php @@ -22,7 +22,7 @@ class ProxySourceItem extends ProxySource implements \ArrayAccess private $nextItem; public function id() - { + : string { return $this->sourceId(); } @@ -128,7 +128,7 @@ public function offsetSet($offset, $value) } public function offsetExists($offset) - { + : bool { return ! method_exists($this, $offset) && null !== $this->data()->get($offset); } diff --git a/src/Sculpin/Contrib/ProxySourceCollection/SimpleProxySourceItemFactory.php b/src/Sculpin/Contrib/ProxySourceCollection/SimpleProxySourceItemFactory.php index 1228bf34..6dacd8c9 100644 --- a/src/Sculpin/Contrib/ProxySourceCollection/SimpleProxySourceItemFactory.php +++ b/src/Sculpin/Contrib/ProxySourceCollection/SimpleProxySourceItemFactory.php @@ -17,7 +17,7 @@ class SimpleProxySourceItemFactory implements ProxySourceItemFactoryInterface { - private $reflectionClass; + private \ReflectionClass $reflectionClass; public function __construct($class = null) { diff --git a/src/Sculpin/Contrib/ProxySourceCollection/Sorter/MetaSorter.php b/src/Sculpin/Contrib/ProxySourceCollection/Sorter/MetaSorter.php index 38dfa16a..e7dbb8c4 100644 --- a/src/Sculpin/Contrib/ProxySourceCollection/Sorter/MetaSorter.php +++ b/src/Sculpin/Contrib/ProxySourceCollection/Sorter/MetaSorter.php @@ -18,7 +18,7 @@ class MetaSorter implements SorterInterface { private $key; - private $reversed; + private bool $reversed; public function __construct($key = null, $direction = 'desc') { diff --git a/src/Sculpin/Contrib/Taxonomy/PermalinkStrategy/ToyRocketStrategy.php b/src/Sculpin/Contrib/Taxonomy/PermalinkStrategy/ToyRocketStrategy.php index 5e3ff005..75d4db42 100644 --- a/src/Sculpin/Contrib/Taxonomy/PermalinkStrategy/ToyRocketStrategy.php +++ b/src/Sculpin/Contrib/Taxonomy/PermalinkStrategy/ToyRocketStrategy.php @@ -16,7 +16,7 @@ class ToyRocketStrategy implements PermalinkStrategyInterface { public function process($str) - { + : string { return '∙∙∙∙∙·▫▫ᵒᴼᵒ▫ₒₒ▫ᵒᴼᵒ▫ₒₒ▫ᵒᴼᵒ☼)==' . $str . '==>'; } } diff --git a/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyDataProvider.php b/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyDataProvider.php index fafb76d4..32bc12f2 100644 --- a/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyDataProvider.php +++ b/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyDataProvider.php @@ -21,8 +21,8 @@ class ProxySourceTaxonomyDataProvider implements DataProviderInterface, EventSubscriberInterface { - private $taxons = []; - private $dataProviderManager; + private array $taxons = []; + private DataProviderManager $dataProviderManager; private $dataProviderName; private $taxonomyKey; @@ -42,7 +42,7 @@ public function provideData(): array } public static function getSubscribedEvents() - { + : array { return [ Sculpin::EVENT_BEFORE_RUN => 'beforeRun', ]; diff --git a/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyIndexGenerator.php b/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyIndexGenerator.php index 152b1e31..ee7ea467 100644 --- a/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyIndexGenerator.php +++ b/src/Sculpin/Contrib/Taxonomy/ProxySourceTaxonomyIndexGenerator.php @@ -19,11 +19,11 @@ class ProxySourceTaxonomyIndexGenerator implements GeneratorInterface { - private $dataProviderManager; + private DataProviderManager $dataProviderManager; private $dataProviderName; private $injectedTaxonKey; - private $injectedTaxonItemsKey; - private $permalinkStrategyCollection; + private string $injectedTaxonItemsKey; + private PermalinkStrategyCollection $permalinkStrategyCollection; public function __construct( DataProviderManager $dataProviderManager, diff --git a/src/Sculpin/Core/Configuration/Configuration.php b/src/Sculpin/Core/Configuration/Configuration.php index 202e6aa6..2e7567b0 100644 --- a/src/Sculpin/Core/Configuration/Configuration.php +++ b/src/Sculpin/Core/Configuration/Configuration.php @@ -25,49 +25,49 @@ class Configuration extends BaseConfiguration * * @var array */ - private $excludes = []; + private array $excludes = []; /** * Ignore patterns * * @var array */ - private $ignores = []; + private array $ignores = []; /** * Raw patterns * * @var array */ - private $raws = []; + private array $raws = []; /** * Source directory * * @var string */ - private $sourceDir; + private string $sourceDir; /** * Output directory * * @var string */ - private $outputDir; + private string $outputDir; /** * Default permalink * * @var string */ - private $permalink; + private string $permalink; /** * Default formatter * * @var string */ - private $defaultFormatter; + private string $defaultFormatter; /** * Set excludes diff --git a/src/Sculpin/Core/Converter/ConverterManager.php b/src/Sculpin/Core/Converter/ConverterManager.php index a17392b5..5df9f1b7 100644 --- a/src/Sculpin/Core/Converter/ConverterManager.php +++ b/src/Sculpin/Core/Converter/ConverterManager.php @@ -31,19 +31,19 @@ final class ConverterManager * * @var EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; /** * Used to know the default formatter name. * * @var FormatterManager */ - private $formatterManager; + private FormatterManager $formatterManager; /** * @var ConverterInterface[] */ - private $converters = []; + private array $converters = []; public function __construct(EventDispatcherInterface $eventDispatcher, FormatterManager $formatterManager) { diff --git a/src/Sculpin/Core/Converter/SourceConverterContext.php b/src/Sculpin/Core/Converter/SourceConverterContext.php index cacd00d0..4f263c0a 100644 --- a/src/Sculpin/Core/Converter/SourceConverterContext.php +++ b/src/Sculpin/Core/Converter/SourceConverterContext.php @@ -25,7 +25,7 @@ class SourceConverterContext implements ConverterContextInterface /** * @var SourceInterface */ - private $source; + private SourceInterface $source; public function __construct(SourceInterface $source) { diff --git a/src/Sculpin/Core/DataProvider/DataProviderManager.php b/src/Sculpin/Core/DataProvider/DataProviderManager.php index 6cb6ef4c..aca79153 100644 --- a/src/Sculpin/Core/DataProvider/DataProviderManager.php +++ b/src/Sculpin/Core/DataProvider/DataProviderManager.php @@ -23,7 +23,7 @@ class DataProviderManager * * @var array */ - protected $dataProviders = []; + protected array $dataProviders = []; public function registerDataProvider(string $name, DataProviderInterface $dataProvider): void { diff --git a/src/Sculpin/Core/Event/ConvertEvent.php b/src/Sculpin/Core/Event/ConvertEvent.php index 4d11dc27..b158cfd9 100644 --- a/src/Sculpin/Core/Event/ConvertEvent.php +++ b/src/Sculpin/Core/Event/ConvertEvent.php @@ -25,17 +25,17 @@ final class ConvertEvent extends Event /** * @var SourceInterface */ - private $source; + private SourceInterface $source; /** * @var string */ - private $converter; + private string $converter; /** * @var string */ - private $defaultFormatter; + private string $defaultFormatter; public function __construct(SourceInterface $source, string $converter, string $defaultFormatter) { diff --git a/src/Sculpin/Core/Event/FormatEvent.php b/src/Sculpin/Core/Event/FormatEvent.php index ac571b32..60d088f2 100644 --- a/src/Sculpin/Core/Event/FormatEvent.php +++ b/src/Sculpin/Core/Event/FormatEvent.php @@ -23,7 +23,7 @@ class FormatEvent extends Event /** * @var FormatContext */ - protected $formatContext; + protected FormatContext $formatContext; public function __construct(FormatContext $formatContext) { diff --git a/src/Sculpin/Core/Event/SourceSetEvent.php b/src/Sculpin/Core/Event/SourceSetEvent.php index 66c8974a..2e3c4e0b 100644 --- a/src/Sculpin/Core/Event/SourceSetEvent.php +++ b/src/Sculpin/Core/Event/SourceSetEvent.php @@ -24,7 +24,7 @@ final class SourceSetEvent extends Event /** * @var SourceSet */ - private $sourceSet; + private SourceSet $sourceSet; public function __construct(SourceSet $sourceSet) { diff --git a/src/Sculpin/Core/Formatter/FormatContext.php b/src/Sculpin/Core/Formatter/FormatContext.php index 203f6f99..77693fa0 100644 --- a/src/Sculpin/Core/Formatter/FormatContext.php +++ b/src/Sculpin/Core/Formatter/FormatContext.php @@ -23,17 +23,17 @@ final class FormatContext /** * @var string */ - private $templateId; + private string $templateId; /** * @var string */ - private $template; + private string $template; /** * @var Data */ - private $data; + private Data $data; public function __construct(string $templateId, string $template, array $data) { diff --git a/src/Sculpin/Core/Formatter/FormatterManager.php b/src/Sculpin/Core/Formatter/FormatterManager.php index 6540631d..6b6456ce 100644 --- a/src/Sculpin/Core/Formatter/FormatterManager.php +++ b/src/Sculpin/Core/Formatter/FormatterManager.php @@ -28,12 +28,12 @@ class FormatterManager /** * @var EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; /** * @var Configuration */ - protected $siteConfiguration; + protected Configuration $siteConfiguration; /** * @var DataProviderManager @@ -43,12 +43,12 @@ class FormatterManager /** * @var array */ - protected $formatters = []; + protected array $formatters = []; /** * @var string */ - protected $defaultFormatter; + protected string $defaultFormatter; public function __construct( EventDispatcherInterface $eventDispatcher, diff --git a/src/Sculpin/Core/Generator/GeneratorManager.php b/src/Sculpin/Core/Generator/GeneratorManager.php index 33306105..3c20af11 100644 --- a/src/Sculpin/Core/Generator/GeneratorManager.php +++ b/src/Sculpin/Core/Generator/GeneratorManager.php @@ -27,12 +27,12 @@ class GeneratorManager /** * @var EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; /** * @var Configuration */ - protected $siteConfiguration; + protected Configuration $siteConfiguration; /** * @var DataProviderManager @@ -42,7 +42,7 @@ class GeneratorManager /** * @var array */ - protected $generators = []; + protected array $generators = []; public function __construct( EventDispatcherInterface $eventDispatcher, diff --git a/src/Sculpin/Core/Io/ConsoleIo.php b/src/Sculpin/Core/Io/ConsoleIo.php index d1eedb42..2f590051 100644 --- a/src/Sculpin/Core/Io/ConsoleIo.php +++ b/src/Sculpin/Core/Io/ConsoleIo.php @@ -28,12 +28,12 @@ final class ConsoleIo implements IoInterface /** * @var InputInterface */ - private $input; + private InputInterface $input; /** * @var OutputInterface */ - private $output; + private OutputInterface $output; /** * The last message that has been output, to be able to overwrite it. @@ -47,7 +47,7 @@ final class ConsoleIo implements IoInterface * * @var float */ - private $startTime; + private int $startTime; public function __construct(InputInterface $input, OutputInterface $output) { diff --git a/src/Sculpin/Core/Output/FilesystemWriter.php b/src/Sculpin/Core/Output/FilesystemWriter.php index 8b778afc..5a92a81c 100644 --- a/src/Sculpin/Core/Output/FilesystemWriter.php +++ b/src/Sculpin/Core/Output/FilesystemWriter.php @@ -24,12 +24,12 @@ final class FilesystemWriter implements WriterInterface /** * @var Filesystem */ - private $filesystem; + private Filesystem $filesystem; /** * @var string */ - private $outputDir; + private string $outputDir; public function __construct(Filesystem $filesystem, string $outputDir) { diff --git a/src/Sculpin/Core/Output/SourceOutput.php b/src/Sculpin/Core/Output/SourceOutput.php index f7c93852..ade6deed 100644 --- a/src/Sculpin/Core/Output/SourceOutput.php +++ b/src/Sculpin/Core/Output/SourceOutput.php @@ -24,7 +24,7 @@ class SourceOutput implements OutputInterface /** * @var SourceInterface */ - protected $source; + protected SourceInterface $source; public function __construct(SourceInterface $source) { diff --git a/src/Sculpin/Core/Permalink/Permalink.php b/src/Sculpin/Core/Permalink/Permalink.php index bed96b73..70ca6ab0 100644 --- a/src/Sculpin/Core/Permalink/Permalink.php +++ b/src/Sculpin/Core/Permalink/Permalink.php @@ -21,12 +21,12 @@ class Permalink implements PermalinkInterface /** * @var string */ - private $relativeFilePath; + private string $relativeFilePath; /** * @var string */ - private $relativeUrlPath; + private string $relativeUrlPath; public function __construct(string $relativeFilePath, string $relativeUrlPath) { diff --git a/src/Sculpin/Core/Permalink/SourcePermalinkFactory.php b/src/Sculpin/Core/Permalink/SourcePermalinkFactory.php index 63022f3b..6f046ac8 100644 --- a/src/Sculpin/Core/Permalink/SourcePermalinkFactory.php +++ b/src/Sculpin/Core/Permalink/SourcePermalinkFactory.php @@ -25,7 +25,7 @@ class SourcePermalinkFactory implements SourcePermalinkFactoryInterface * * @var string */ - protected $defaultPermalink; + protected string $defaultPermalink; public function __construct(string $defaultPermalink) { diff --git a/src/Sculpin/Core/Sculpin.php b/src/Sculpin/Core/Sculpin.php index 8cd8f2dd..7322570f 100644 --- a/src/Sculpin/Core/Sculpin.php +++ b/src/Sculpin/Core/Sculpin.php @@ -47,37 +47,37 @@ final class Sculpin /** * @var Configuration */ - private $siteConfiguration; + private Configuration $siteConfiguration; /** * @var EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; /** * @var SourcePermalinkFactoryInterface */ - private $permalinkFactory; + private SourcePermalinkFactoryInterface $permalinkFactory; /** * @var WriterInterface */ - private $writer; + private WriterInterface $writer; /** * @var GeneratorManager */ - private $generatorManager; + private GeneratorManager $generatorManager; /** * @var FormatterManager */ - private $formatterManager; + private FormatterManager $formatterManager; /** * @var ConverterManager */ - private $converterManager; + private ConverterManager $converterManager; public function __construct( Configuration $siteConfiguration, diff --git a/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php b/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php index 8a5a3754..0180fbcf 100644 --- a/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php +++ b/src/Sculpin/Core/SiteConfiguration/SiteConfigurationFactory.php @@ -25,12 +25,12 @@ final class SiteConfigurationFactory /** * @var string */ - private $rootDir; + private string $rootDir; /** * @var string */ - private $environment; + private string $environment; public function __construct(string $rootDir, string $environment) { diff --git a/src/Sculpin/Core/Source/AbstractSource.php b/src/Sculpin/Core/Source/AbstractSource.php index b6f6386a..c7cddce2 100644 --- a/src/Sculpin/Core/Source/AbstractSource.php +++ b/src/Sculpin/Core/Source/AbstractSource.php @@ -55,7 +55,7 @@ abstract class AbstractSource implements SourceInterface /** * @var PermalinkInterface */ - protected $permalink; + protected PermalinkInterface $permalink; /** * @var \SplFileInfo @@ -85,17 +85,17 @@ abstract class AbstractSource implements SourceInterface /** * @var boolean */ - protected $isGenerator = false; + protected bool $isGenerator = false; /** * @var boolean */ - protected $isGenerated = false; + protected bool $isGenerated = false; /** * @var boolean */ - protected $shouldBeSkipped = false; + protected bool $shouldBeSkipped = false; protected function init(bool $hasChanged = false) { diff --git a/src/Sculpin/Core/Source/CompositeDataSource.php b/src/Sculpin/Core/Source/CompositeDataSource.php index 0aaa387f..61e61385 100644 --- a/src/Sculpin/Core/Source/CompositeDataSource.php +++ b/src/Sculpin/Core/Source/CompositeDataSource.php @@ -21,7 +21,7 @@ class CompositeDataSource implements DataSourceInterface /** * @var DataSourceInterface[] */ - private $dataSources = []; + private array $dataSources = []; /** * @param DataSourceInterface[] $dataSources @@ -53,7 +53,7 @@ public function dataSources(): array */ public function dataSourceId(): string { - return 'CompositeDataSource('.implode(',', array_map(function (DataSourceInterface $dataSource) { + return 'CompositeDataSource('.implode(',', array_map(function (DataSourceInterface $dataSource) : string { return $dataSource->dataSourceId(); }, $this->dataSources)); } diff --git a/src/Sculpin/Core/Source/ConfigFilesystemDataSource.php b/src/Sculpin/Core/Source/ConfigFilesystemDataSource.php index b2080a37..4729483f 100644 --- a/src/Sculpin/Core/Source/ConfigFilesystemDataSource.php +++ b/src/Sculpin/Core/Source/ConfigFilesystemDataSource.php @@ -27,17 +27,17 @@ final class ConfigFilesystemDataSource implements DataSourceInterface /** * @var string */ - private $sourceDir; + private string $sourceDir; /** * @var ConfigurationInterface */ - private $siteConfiguration; + private ConfigurationInterface $siteConfiguration; /** * @var SiteConfigurationFactory */ - private $siteConfigurationFactory; + private SiteConfigurationFactory $siteConfigurationFactory; /** * @var AntPathMatcher @@ -47,7 +47,7 @@ final class ConfigFilesystemDataSource implements DataSourceInterface /** * @var string */ - private $sinceTime; + private string $sinceTime; public function __construct( string $sourceDir, diff --git a/src/Sculpin/Core/Source/FileSource.php b/src/Sculpin/Core/Source/FileSource.php index ecdc1871..10632447 100644 --- a/src/Sculpin/Core/Source/FileSource.php +++ b/src/Sculpin/Core/Source/FileSource.php @@ -27,7 +27,7 @@ final class FileSource extends AbstractSource /** * @var Analyzer */ - private $analyzer; + private Analyzer $analyzer; /** * @var InternetMediaTypeInterface diff --git a/src/Sculpin/Core/Source/FilesystemDataSource.php b/src/Sculpin/Core/Source/FilesystemDataSource.php index 959f7e1b..0fe96fe9 100644 --- a/src/Sculpin/Core/Source/FilesystemDataSource.php +++ b/src/Sculpin/Core/Source/FilesystemDataSource.php @@ -27,22 +27,22 @@ final class FilesystemDataSource implements DataSourceInterface /** * @var string */ - private $sourceDir; + private string $sourceDir; /** * @var string[] */ - private $excludePaths; + private array $excludePaths; /** * @var string[] */ - private $ignorePaths; + private array $ignorePaths; /** * @var string[] */ - private $rawPaths; + private array $rawPaths; /** * @var AntPathMatcher @@ -62,7 +62,7 @@ final class FilesystemDataSource implements DataSourceInterface /** * @var string */ - private $sinceTime; + private string $sinceTime; /** * @param string[] $excludePaths Exclude paths diff --git a/src/Sculpin/Core/Source/Filter/AntPathFilter.php b/src/Sculpin/Core/Source/Filter/AntPathFilter.php index dfd18f61..15062089 100644 --- a/src/Sculpin/Core/Source/Filter/AntPathFilter.php +++ b/src/Sculpin/Core/Source/Filter/AntPathFilter.php @@ -20,7 +20,7 @@ class AntPathFilter implements FilterInterface { private $antPathMatcher; - private $patterns; + private iterable $patterns; /** * @var DirectorySeparatorNormalizer */ @@ -34,7 +34,7 @@ public function __construct( if (null === $antPathMatcher) { $antPathMatcher = new AntPathMatcher; } - $this->patterns = array_map(function ($path) use ($antPathMatcher) { + $this->patterns = array_map(function (string $path) use ($antPathMatcher) : string { return $antPathMatcher->isPattern($path) ? $path : $path.'/**'; }, $paths); $this->antPathMatcher = $antPathMatcher; diff --git a/src/Sculpin/Core/Source/Filter/ChainFilter.php b/src/Sculpin/Core/Source/Filter/ChainFilter.php index 785b0199..363e7467 100644 --- a/src/Sculpin/Core/Source/Filter/ChainFilter.php +++ b/src/Sculpin/Core/Source/Filter/ChainFilter.php @@ -17,7 +17,7 @@ class ChainFilter implements FilterInterface { - private $filters = []; + private array $filters = []; private $or; public function __construct(array $filters = [], $or = false) diff --git a/src/Sculpin/Core/Source/Map/ChainMap.php b/src/Sculpin/Core/Source/Map/ChainMap.php index 27bd152b..335feb61 100644 --- a/src/Sculpin/Core/Source/Map/ChainMap.php +++ b/src/Sculpin/Core/Source/Map/ChainMap.php @@ -17,7 +17,7 @@ class ChainMap implements MapInterface { - private $maps = []; + private array $maps = []; public function __construct(array $maps = []) { diff --git a/src/Sculpin/Core/Source/Map/DefaultDataMap.php b/src/Sculpin/Core/Source/Map/DefaultDataMap.php index 94992fd7..1b654ae0 100644 --- a/src/Sculpin/Core/Source/Map/DefaultDataMap.php +++ b/src/Sculpin/Core/Source/Map/DefaultDataMap.php @@ -17,7 +17,7 @@ class DefaultDataMap implements MapInterface { - private $defaults; + private array $defaults; public function __construct(array $defaults = []) { diff --git a/src/Sculpin/Core/Source/ProxySource.php b/src/Sculpin/Core/Source/ProxySource.php index ea3268e8..d511adcc 100644 --- a/src/Sculpin/Core/Source/ProxySource.php +++ b/src/Sculpin/Core/Source/ProxySource.php @@ -24,7 +24,7 @@ class ProxySource implements SourceInterface /** * @var SourceInterface */ - protected $source; + protected SourceInterface $source; public function __construct(SourceInterface $source) { diff --git a/src/Sculpin/Core/Source/SourceSet.php b/src/Sculpin/Core/Source/SourceSet.php index d7e27a8a..816e1589 100644 --- a/src/Sculpin/Core/Source/SourceSet.php +++ b/src/Sculpin/Core/Source/SourceSet.php @@ -21,12 +21,12 @@ class SourceSet /** * @var SourceInterface[] */ - protected $sources = []; + protected array $sources = []; /** * @var SourceInterface[] */ - protected $newSources = []; + protected array $newSources = []; /** * @param SourceInterface[] $sources @@ -73,7 +73,7 @@ public function allSources(): array */ public function updatedSources(): array { - return array_filter($this->sources, function (SourceInterface $source) { + return array_filter($this->sources, function (SourceInterface $source) : bool { return $source->hasChanged(); }); } diff --git a/src/Sculpin/Core/Tests/Permalink/SourcePermalinkFactoryTest.php b/src/Sculpin/Core/Tests/Permalink/SourcePermalinkFactoryTest.php index 4fd5b020..70333811 100644 --- a/src/Sculpin/Core/Tests/Permalink/SourcePermalinkFactoryTest.php +++ b/src/Sculpin/Core/Tests/Permalink/SourcePermalinkFactoryTest.php @@ -30,7 +30,7 @@ public function testCreate(string $defaultPermalink, SourceInterface $source, Pe } public function provideCreateData() - { + : array { return [ 'none setting for permalink' => [ 'none', @@ -199,8 +199,8 @@ public function provideCreateData() ]; } - private static function makeTestSource($relativePathname, array $configurationData = []) - { + private static function makeTestSource(string $relativePathname, array $configurationData = []) + : MemorySource { $configuration = new Configuration($configurationData); return new MemorySource( diff --git a/src/Sculpin/Core/Tests/Source/CompositeDataSourceTest.php b/src/Sculpin/Core/Tests/Source/CompositeDataSourceTest.php index 9ecf884f..099ddaf2 100644 --- a/src/Sculpin/Core/Tests/Source/CompositeDataSourceTest.php +++ b/src/Sculpin/Core/Tests/Source/CompositeDataSourceTest.php @@ -20,7 +20,7 @@ class CompositeDataSourceTest extends TestCase { - public function makeDataSource($dataSourceId) + public function makeDataSource(string $dataSourceId) { $dataSource = $this->createMock(DataSourceInterface::class); diff --git a/src/Sculpin/Core/Tests/Source/FileSourceTest.php b/src/Sculpin/Core/Tests/Source/FileSourceTest.php index 8383fe77..7ecea490 100644 --- a/src/Sculpin/Core/Tests/Source/FileSourceTest.php +++ b/src/Sculpin/Core/Tests/Source/FileSourceTest.php @@ -17,7 +17,7 @@ class FileSourceTest extends TestCase * mock analyzer for detectFromFilename, should return text/html */ - public function makeTestSource($filename, $hasChanged = true) + public function makeTestSource($filename, bool $hasChanged = true) { $source = new FileSource( $this->makeTestAnalyzer(), @@ -99,7 +99,7 @@ public function testParseYaml($filename, $msg) } public function provideTestParseYaml() - { + : array { return [ [__DIR__ . '/../Fixtures/valid/no-end-frontmatter.yml', ''], [__DIR__ . '/../Fixtures/valid/frontmatter-nocontent.yml', ''], @@ -119,8 +119,8 @@ public function provideTestParseYaml() ]; } - public function getErrorMessage($filename, $msg) - { + public function getErrorMessage(string $filename, string $msg) + : string { if ($msg == '') { return ''; } diff --git a/src/Sculpin/Core/Tests/Source/Map/CalculatedDateFromFilenameMapTest.php b/src/Sculpin/Core/Tests/Source/Map/CalculatedDateFromFilenameMapTest.php index dc7b8da0..a33e0afc 100644 --- a/src/Sculpin/Core/Tests/Source/Map/CalculatedDateFromFilenameMapTest.php +++ b/src/Sculpin/Core/Tests/Source/Map/CalculatedDateFromFilenameMapTest.php @@ -23,7 +23,7 @@ class CalculatedDateFromFilenameMapTest extends TestCase /** * @var CalculatedDateFromFilenameMap */ - private $map; + private CalculatedDateFromFilenameMap $map; protected function setUp() { @@ -88,8 +88,8 @@ protected function getSourceWithCalculatedDate($timestamp) ); } - protected function getSourceWithoutCalculatedDateAndPathname($path) - { + protected function getSourceWithoutCalculatedDateAndPathname(string $path) + : MemorySource { return new MemorySource( uniqid(), new Data(), diff --git a/src/Sculpin/Core/Tests/Source/SourceSetTest.php b/src/Sculpin/Core/Tests/Source/SourceSetTest.php index a0a53b45..0b1374ce 100644 --- a/src/Sculpin/Core/Tests/Source/SourceSetTest.php +++ b/src/Sculpin/Core/Tests/Source/SourceSetTest.php @@ -19,7 +19,7 @@ class SourceSetTest extends TestCase { - public function makeTestSource($sourceId, $hasChanged = true) + public function makeTestSource(string $sourceId, bool $hasChanged = true) { $source = $this->createMock(SourceInterface::class); diff --git a/src/Sculpin/Core/Util/DirectorySeparatorNormalizer.php b/src/Sculpin/Core/Util/DirectorySeparatorNormalizer.php index c06b1ce8..dc299816 100644 --- a/src/Sculpin/Core/Util/DirectorySeparatorNormalizer.php +++ b/src/Sculpin/Core/Util/DirectorySeparatorNormalizer.php @@ -21,12 +21,12 @@ final class DirectorySeparatorNormalizer /** * @var string */ - private $preferredDirectorySeparator; + private string $preferredDirectorySeparator; /** * @var string */ - private $directorySeparator; + private string $directorySeparator; public function __construct(string $preferredDirectorySeparator = '/') { diff --git a/src/Sculpin/Tests/Functional/EventListenerTestFixtureBundle/Listener.php b/src/Sculpin/Tests/Functional/EventListenerTestFixtureBundle/Listener.php index 508c3e96..28d1eb7d 100644 --- a/src/Sculpin/Tests/Functional/EventListenerTestFixtureBundle/Listener.php +++ b/src/Sculpin/Tests/Functional/EventListenerTestFixtureBundle/Listener.php @@ -22,7 +22,7 @@ public static function getSubscribedEvents(): array ]; } - public function createSuccessFile(SourceSetEvent $event, $eventName): void + public function createSuccessFile(SourceSetEvent $event, string $eventName): void { file_put_contents($this->outputDir . '/' . $eventName . '.event', $eventName); } diff --git a/src/Sculpin/Tests/Functional/FunctionalTestCase.php b/src/Sculpin/Tests/Functional/FunctionalTestCase.php index 3935f921..c06a8fa5 100644 --- a/src/Sculpin/Tests/Functional/FunctionalTestCase.php +++ b/src/Sculpin/Tests/Functional/FunctionalTestCase.php @@ -71,7 +71,7 @@ protected function tearDownTestProject(): void * Execute a command against the sculpin binary * @param string $command */ - protected function executeSculpin($command): void + protected function executeSculpin(string $command): void { $binPath = __DIR__ . '/../../../../bin'; $projectDir = static::projectDir(); diff --git a/src/Sculpin/Tests/Functional/InitCommandTest.php b/src/Sculpin/Tests/Functional/InitCommandTest.php index eb5cb5c4..93ba2634 100644 --- a/src/Sculpin/Tests/Functional/InitCommandTest.php +++ b/src/Sculpin/Tests/Functional/InitCommandTest.php @@ -13,7 +13,7 @@ class InitCommandTest extends FunctionalTestCase protected const PROJECT_DIR = '/__BlankSculpinProject__'; /** @var Finder */ - protected $finder; + protected Finder $finder; public function setUp(): void { @@ -84,7 +84,7 @@ protected function assertProjectEmpty($projectDir): void ); } - protected function assertProjectInitialized($projectDir): void + protected function assertProjectInitialized(string $projectDir): void { $files = $this->finder->in($projectDir);