diff --git a/UPGRADE.md b/UPGRADE.md
index 66913ebc92a..7d9e4fc267a 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -86,17 +86,13 @@
* `TranslationInterface::setTranslatable`
* `Archivable::setArchivedAt`
* `SlugAwareInterface::setSlug`
-
+
### Review / ReviewBundle
* The `ReviewInterface::setAuthor` method does not longer have a default null argument and requires one to be explicitly passed.
* The `ReviewFactoryInterface::createForSubjectWithReviewer` method does not longer have a default null value for `$reviewer` argument and requires one to be explicitly passed.
* Default null value of `ReviewFactoryInterface::createForSubjectWithReviewer` was removed. To create a review without reviewer use `createForSubject` method from the same interface instead.
-### Taxonomy / TaxonomyBundle
-
-* `TaxonInterface::getParents` method was renamed to `TaxonInterface::getAncestors`.
-
### ShopBundle
* `ContactController` has been made final, use decoration instead of extending it.
@@ -111,6 +107,14 @@
* `ShipmentUnitInterface::setShipment`
* `ShipmentMethodInterface::setCategory`
+### Taxonomy / TaxonomyBundle
+
+* `TaxonInterface::getParents` method was renamed to `TaxonInterface::getAncestors`.
+
+### ThemeBundle
+
+* `ThemeHierarchyProviderInterface::getThemeHierarchy` does not longer accepts null as the passed argument.
+
# UPGRADE FROM 1.0.0-beta.2 to 1.0.0-beta.3
## Packages:
diff --git a/src/Sylius/Bundle/CoreBundle/Theme/ChannelBasedThemeContext.php b/src/Sylius/Bundle/CoreBundle/Theme/ChannelBasedThemeContext.php
index 83bba7132a7..1add5aefac4 100644
--- a/src/Sylius/Bundle/CoreBundle/Theme/ChannelBasedThemeContext.php
+++ b/src/Sylius/Bundle/CoreBundle/Theme/ChannelBasedThemeContext.php
@@ -14,6 +14,7 @@
namespace Sylius\Bundle\CoreBundle\Theme;
use Sylius\Bundle\ThemeBundle\Context\ThemeContextInterface;
+use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
use Sylius\Bundle\ThemeBundle\Repository\ThemeRepositoryInterface;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Channel\Context\ChannelNotFoundException;
@@ -47,13 +48,18 @@ public function __construct(ChannelContextInterface $channelContext, ThemeReposi
/**
* {@inheritdoc}
*/
- public function getTheme()
+ public function getTheme(): ?ThemeInterface
{
try {
/** @var ChannelInterface $channel */
$channel = $this->channelContext->getChannel();
+ $themeName = $channel->getThemeName();
- return $this->themeRepository->findOneByName($channel->getThemeName());
+ if (null === $themeName) {
+ return null;
+ }
+
+ return $this->themeRepository->findOneByName($themeName);
} catch (ChannelNotFoundException $exception) {
return null;
} catch (\Exception $exception) {
diff --git a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstaller.php b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstaller.php
index 4c93d05f55c..10a62f8eac2 100644
--- a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstaller.php
+++ b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstaller.php
@@ -78,7 +78,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function installAssets($targetDir, $symlinkMask)
+ public function installAssets(string $targetDir, int $symlinkMask): int
{
// Create the bundles directory otherwise symlink will fail.
$targetDir = rtrim($targetDir, '/').'/bundles/';
@@ -95,7 +95,7 @@ public function installAssets($targetDir, $symlinkMask)
/**
* {@inheritdoc}
*/
- public function installBundleAssets(BundleInterface $bundle, $targetDir, $symlinkMask)
+ public function installBundleAssets(BundleInterface $bundle, string $targetDir, int $symlinkMask): int
{
$targetDir .= preg_replace('/bundle$/', '', strtolower($bundle->getName()));
@@ -131,7 +131,7 @@ public function installBundleAssets(BundleInterface $bundle, $targetDir, $symlin
*
* @return int
*/
- private function installThemedBundleAssets(ThemeInterface $theme, $originDir, $targetDir, $symlinkMask)
+ private function installThemedBundleAssets(ThemeInterface $theme, string $originDir, string $targetDir, int $symlinkMask): int
{
$effectiveSymlinkMask = $symlinkMask;
@@ -165,7 +165,7 @@ private function installThemedBundleAssets(ThemeInterface $theme, $originDir, $t
*
* @return int
*/
- private function installVanillaBundleAssets($originDir, $targetDir, $symlinkMask)
+ private function installVanillaBundleAssets(string $originDir, string $targetDir, int $symlinkMask): int
{
return $this->installAsset($originDir, $targetDir, $symlinkMask);
}
@@ -177,7 +177,7 @@ private function installVanillaBundleAssets($originDir, $targetDir, $symlinkMask
*
* @return int
*/
- private function installAsset($origin, $target, $symlinkMask)
+ private function installAsset(string $origin, string $target, int $symlinkMask): int
{
if (AssetsInstallerInterface::RELATIVE_SYMLINK === $symlinkMask) {
try {
@@ -214,7 +214,7 @@ private function installAsset($origin, $target, $symlinkMask)
*
* @throws IOException When failed to make symbolic link, if requested.
*/
- private function doInstallAsset($origin, $target, $symlink)
+ private function doInstallAsset(string $origin, string $target, bool $symlink): void
{
if ($symlink) {
$this->doSymlinkAsset($origin, $target);
@@ -227,11 +227,11 @@ private function doInstallAsset($origin, $target, $symlink)
/**
* @param BundleInterface $bundle
- * @param ThemeInterface[] $themes
+ * @param array|ThemeInterface[] $themes
*
* @return array
*/
- private function findAssetsPaths(BundleInterface $bundle, array $themes = [])
+ private function findAssetsPaths(BundleInterface $bundle, array $themes = []): array
{
$sources = [];
@@ -256,7 +256,7 @@ private function findAssetsPaths(BundleInterface $bundle, array $themes = [])
*
* @throws IOException If symbolic link is broken
*/
- private function doSymlinkAsset($origin, $target)
+ private function doSymlinkAsset(string $origin, string $target): void
{
$this->filesystem->symlink($origin, $target);
@@ -269,7 +269,7 @@ private function doSymlinkAsset($origin, $target)
* @param string $origin
* @param string $target
*/
- private function doCopyAsset($origin, $target)
+ private function doCopyAsset(string $origin, string $target): void
{
if (is_dir($origin)) {
$this->filesystem->mkdir($target, 0777);
diff --git a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstallerInterface.php b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstallerInterface.php
index b3b06885fd9..95c2ba5109b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstallerInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/AssetsInstallerInterface.php
@@ -53,7 +53,7 @@ interface AssetsInstallerInterface
*
* @return int Effective symlink mask (lowest value received from installBundleAssets() method)
*/
- public function installAssets($targetDir, $symlinkMask);
+ public function installAssets(string $targetDir, int $symlinkMask);
/**
* @param BundleInterface $bundle
@@ -62,5 +62,5 @@ public function installAssets($targetDir, $symlinkMask);
*
* @return int Effective symlink mask (lowest value received from installDirAssets() method)
*/
- public function installBundleAssets(BundleInterface $bundle, $targetDir, $symlinkMask);
+ public function installBundleAssets(BundleInterface $bundle, string $targetDir, int $symlinkMask);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareAssetsInstaller.php b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareAssetsInstaller.php
index 3e574fe8fca..9ca2a4303cd 100644
--- a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareAssetsInstaller.php
+++ b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareAssetsInstaller.php
@@ -44,7 +44,7 @@ public function __construct(AssetsInstallerInterface $assetsInstaller)
/**
* {@inheritdoc}
*/
- public function setOutput(OutputInterface $output)
+ public function setOutput(OutputInterface $output): void
{
$this->output = $output;
}
@@ -52,7 +52,7 @@ public function setOutput(OutputInterface $output)
/**
* {@inheritdoc}
*/
- public function installAssets($targetDir, $symlinkMask)
+ public function installAssets(string $targetDir, int $symlinkMask): int
{
$this->output->writeln($this->provideExpectationComment($symlinkMask));
@@ -62,7 +62,7 @@ public function installAssets($targetDir, $symlinkMask)
/**
* {@inheritdoc}
*/
- public function installBundleAssets(BundleInterface $bundle, $targetDir, $symlinkMask)
+ public function installBundleAssets(BundleInterface $bundle, string $targetDir, int $symlinkMask): int
{
$this->output->writeln(sprintf('Installing assets for %s', $bundle->getNamespace(), $targetDir));
@@ -79,7 +79,7 @@ public function installBundleAssets(BundleInterface $bundle, $targetDir, $symlin
*
* @return string
*/
- private function provideResultComment($symlinkMask, $effectiveSymlinkMask)
+ private function provideResultComment(int $symlinkMask, int $effectiveSymlinkMask): string
{
if ($effectiveSymlinkMask === $symlinkMask) {
switch ($symlinkMask) {
@@ -108,7 +108,7 @@ private function provideResultComment($symlinkMask, $effectiveSymlinkMask)
*
* @return string
*/
- private function provideExpectationComment($symlinkMask)
+ private function provideExpectationComment(int $symlinkMask): string
{
if (AssetsInstallerInterface::HARD_COPY === $symlinkMask) {
return 'Installing assets as hard copies.';
diff --git a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareInterface.php b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareInterface.php
index bb908406494..ea8fee9076b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Asset/Installer/OutputAwareInterface.php
@@ -23,5 +23,5 @@ interface OutputAwareInterface
/**
* @param OutputInterface $output
*/
- public function setOutput(OutputInterface $output);
+ public function setOutput(OutputInterface $output): void;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Asset/Package/PathPackage.php b/src/Sylius/Bundle/ThemeBundle/Asset/Package/PathPackage.php
index 14e124a8409..b11d28b75bb 100644
--- a/src/Sylius/Bundle/ThemeBundle/Asset/Package/PathPackage.php
+++ b/src/Sylius/Bundle/ThemeBundle/Asset/Package/PathPackage.php
@@ -44,11 +44,11 @@ class PathPackage extends BasePathPackage
* @param ContextInterface|null $context
*/
public function __construct(
- $basePath,
+ string $basePath,
VersionStrategyInterface $versionStrategy,
ThemeContextInterface $themeContext,
PathResolverInterface $pathResolver,
- ContextInterface $context = null
+ ?ContextInterface $context = null
) {
parent::__construct($basePath, $versionStrategy, $context);
@@ -59,7 +59,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function getUrl($path)
+ public function getUrl($path): string
{
if ($this->isAbsoluteUrl($path)) {
return $path;
diff --git a/src/Sylius/Bundle/ThemeBundle/Asset/PathResolver.php b/src/Sylius/Bundle/ThemeBundle/Asset/PathResolver.php
index 7f13367b515..ea136de1552 100644
--- a/src/Sylius/Bundle/ThemeBundle/Asset/PathResolver.php
+++ b/src/Sylius/Bundle/ThemeBundle/Asset/PathResolver.php
@@ -23,7 +23,7 @@ final class PathResolver implements PathResolverInterface
/**
* {@inheritdoc}
*/
- public function resolve($path, ThemeInterface $theme)
+ public function resolve(string $path, ThemeInterface $theme): string
{
return str_replace('bundles/', 'bundles/_themes/' . $theme->getName() . '/', $path);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Asset/PathResolverInterface.php b/src/Sylius/Bundle/ThemeBundle/Asset/PathResolverInterface.php
index 167a838b8df..b53d27c16ec 100644
--- a/src/Sylius/Bundle/ThemeBundle/Asset/PathResolverInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Asset/PathResolverInterface.php
@@ -29,5 +29,5 @@ interface PathResolverInterface
*
* @return string
*/
- public function resolve($path, ThemeInterface $theme);
+ public function resolve(string $path, ThemeInterface $theme): string;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Collector/ThemeCollector.php b/src/Sylius/Bundle/ThemeBundle/Collector/ThemeCollector.php
index fc525943b50..42af7c13f20 100644
--- a/src/Sylius/Bundle/ThemeBundle/Collector/ThemeCollector.php
+++ b/src/Sylius/Bundle/ThemeBundle/Collector/ThemeCollector.php
@@ -54,20 +54,26 @@ public function __construct(
$this->themeRepository = $themeRepository;
$this->themeContext = $themeContext;
$this->themeHierarchyProvider = $themeHierarchyProvider;
+
+ $this->data = [
+ 'used_theme' => null,
+ 'used_themes' => [],
+ 'themes' => [],
+ ];
}
/**
- * @return ThemeInterface
+ * @return ThemeInterface|null
*/
- public function getUsedTheme()
+ public function getUsedTheme(): ?ThemeInterface
{
return $this->data['used_theme'];
}
/**
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*/
- public function getUsedThemes()
+ public function getUsedThemes(): array
{
return $this->data['used_themes'];
}
@@ -75,7 +81,7 @@ public function getUsedThemes()
/**
* @return ThemeInterface[]
*/
- public function getThemes()
+ public function getThemes(): array
{
return $this->data['themes'];
}
@@ -83,7 +89,7 @@ public function getThemes()
/**
* {@inheritdoc}
*/
- public function collect(Request $request, Response $response, \Exception $exception = null)
+ public function collect(Request $request, Response $response, ?\Exception $exception = null): void
{
$this->data['used_theme'] = $this->themeContext->getTheme();
$this->data['used_themes'] = $this->themeHierarchyProvider->getThemeHierarchy($this->themeContext->getTheme());
@@ -93,7 +99,7 @@ public function collect(Request $request, Response $response, \Exception $except
/**
* {@inheritdoc}
*/
- public function getName()
+ public function getName(): string
{
return 'sylius_theme';
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Command/AssetsInstallCommand.php b/src/Sylius/Bundle/ThemeBundle/Command/AssetsInstallCommand.php
index 8b275c79227..f4c06f22ea0 100644
--- a/src/Sylius/Bundle/ThemeBundle/Command/AssetsInstallCommand.php
+++ b/src/Sylius/Bundle/ThemeBundle/Command/AssetsInstallCommand.php
@@ -32,7 +32,7 @@ final class AssetsInstallCommand extends ContainerAwareCommand
/**
* {@inheritdoc}
*/
- protected function configure()
+ protected function configure(): void
{
$this
->setName('sylius:theme:assets:install')
@@ -51,7 +51,7 @@ protected function configure()
*
* @throws \InvalidArgumentException When the target directory does not exist or symlink cannot be used
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): void
{
$assetsInstaller = $this->getContainer()->get('sylius.theme.asset.assets_installer');
if ($assetsInstaller instanceof OutputAwareInterface) {
@@ -74,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
/**
* @return string
*/
- private function getHelpMessage()
+ private function getHelpMessage(): string
{
return <<%command.name% command installs theme assets into a given
diff --git a/src/Sylius/Bundle/ThemeBundle/Command/ListCommand.php b/src/Sylius/Bundle/ThemeBundle/Command/ListCommand.php
index 45afc668993..a4418327c11 100644
--- a/src/Sylius/Bundle/ThemeBundle/Command/ListCommand.php
+++ b/src/Sylius/Bundle/ThemeBundle/Command/ListCommand.php
@@ -27,7 +27,7 @@ final class ListCommand extends ContainerAwareCommand
/**
* {@inheritdoc}
*/
- protected function configure()
+ protected function configure(): void
{
$this
->setName('sylius:theme:list')
@@ -38,7 +38,7 @@ protected function configure()
/**
* {@inheritdoc}
*/
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): void
{
/** @var ThemeInterface[] $themes */
$themes = $this->getContainer()->get('sylius.repository.theme')->findAll();
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/CompositeConfigurationProvider.php b/src/Sylius/Bundle/ThemeBundle/Configuration/CompositeConfigurationProvider.php
index 2a9161fe558..49fbfd8a5c9 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/CompositeConfigurationProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/CompositeConfigurationProvider.php
@@ -34,7 +34,7 @@ public function __construct(array $configurationProviders)
/**
* {@inheritdoc}
*/
- public function getConfigurations()
+ public function getConfigurations(): array
{
$configurations = [];
foreach ($this->configurationProviders as $configurationProvider) {
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProcessorInterface.php b/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProcessorInterface.php
index 16279affc19..d25a25ad918 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProcessorInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProcessorInterface.php
@@ -23,5 +23,5 @@ interface ConfigurationProcessorInterface
*
* @return array The processed configuration array
*/
- public function process(array $configs);
+ public function process(array $configs): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProviderInterface.php b/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProviderInterface.php
index 8e0da94adb9..a95532e8803 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProviderInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationProviderInterface.php
@@ -21,5 +21,5 @@ interface ConfigurationProviderInterface
/**
* @return array
*/
- public function getConfigurations();
+ public function getConfigurations(): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationSourceFactoryInterface.php b/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationSourceFactoryInterface.php
index 654de964978..eec0794f79d 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationSourceFactoryInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/ConfigurationSourceFactoryInterface.php
@@ -26,7 +26,7 @@ interface ConfigurationSourceFactoryInterface
/**
* @param ArrayNodeDefinition $node
*/
- public function buildConfiguration(ArrayNodeDefinition $node);
+ public function buildConfiguration(ArrayNodeDefinition $node): void;
/**
* @see ConfigurationProviderInterface
@@ -41,5 +41,5 @@ public function initializeSource(ContainerBuilder $container, array $config);
/**
* @return string
*/
- public function getName();
+ public function getName(): string;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ConfigurationLoaderInterface.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ConfigurationLoaderInterface.php
index 792b2df77b7..3bbab9567ce 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ConfigurationLoaderInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ConfigurationLoaderInterface.php
@@ -25,5 +25,5 @@ interface ConfigurationLoaderInterface
*
* @return array
*/
- public function load($identifier);
+ public function load(string $identifier): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationProvider.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationProvider.php
index bacdb497b8d..5b62b5df463 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationProvider.php
@@ -51,7 +51,7 @@ public function __construct(FileLocatorInterface $fileLocator, ConfigurationLoad
/**
* {@inheritdoc}
*/
- public function getConfigurations()
+ public function getConfigurations(): array
{
try {
return array_map(
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationSourceFactory.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationSourceFactory.php
index 815168bcab2..4ce2f089edf 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationSourceFactory.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/FilesystemConfigurationSourceFactory.php
@@ -28,7 +28,7 @@ final class FilesystemConfigurationSourceFactory implements ConfigurationSourceF
/**
* {@inheritdoc}
*/
- public function buildConfiguration(ArrayNodeDefinition $node)
+ public function buildConfiguration(ArrayNodeDefinition $node): void
{
$node
->fixXmlConfig('directory', 'directories')
@@ -46,7 +46,7 @@ public function buildConfiguration(ArrayNodeDefinition $node)
/**
* {@inheritdoc}
*/
- public function initializeSource(ContainerBuilder $container, array $config)
+ public function initializeSource(ContainerBuilder $container, array $config): Definition
{
$recursiveFileLocator = new Definition(RecursiveFileLocator::class, [
new Reference('sylius.theme.finder_factory'),
@@ -72,7 +72,7 @@ public function initializeSource(ContainerBuilder $container, array $config)
/**
* {@inheritdoc}
*/
- public function getName()
+ public function getName(): string
{
return 'filesystem';
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/JsonFileConfigurationLoader.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/JsonFileConfigurationLoader.php
index d85e7e133d8..a2944cfa15b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/JsonFileConfigurationLoader.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/JsonFileConfigurationLoader.php
@@ -36,14 +36,14 @@ public function __construct(FilesystemInterface $filesystem)
/**
* {@inheritdoc}
*/
- public function load($path)
+ public function load(string $identifier): array
{
- $this->assertFileExists($path);
+ $this->assertFileExists($identifier);
- $contents = $this->filesystem->getFileContents($path);
+ $contents = $this->filesystem->getFileContents($identifier);
return array_merge(
- ['path' => dirname($path)],
+ ['path' => dirname($identifier)],
json_decode($contents, true)
);
}
@@ -51,7 +51,7 @@ public function load($path)
/**
* @param string $path
*/
- private function assertFileExists($path)
+ private function assertFileExists(string $path): void
{
if (!$this->filesystem->exists($path)) {
throw new \InvalidArgumentException(sprintf(
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ProcessingConfigurationLoader.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ProcessingConfigurationLoader.php
index 1e3fa509ea4..2fb43c0001c 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ProcessingConfigurationLoader.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Filesystem/ProcessingConfigurationLoader.php
@@ -43,7 +43,7 @@ public function __construct(ConfigurationLoaderInterface $decoratedLoader, Confi
/**
* {@inheritdoc}
*/
- public function load($identifier)
+ public function load(string $identifier): array
{
$rawConfiguration = $this->decoratedLoader->load($identifier);
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/SymfonyConfigurationProcessor.php b/src/Sylius/Bundle/ThemeBundle/Configuration/SymfonyConfigurationProcessor.php
index 8f15a7ed9fe..7029c3f0ede 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/SymfonyConfigurationProcessor.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/SymfonyConfigurationProcessor.php
@@ -44,7 +44,7 @@ public function __construct(ConfigurationInterface $configuration, Processor $pr
/**
* {@inheritdoc}
*/
- public function process(array $configs)
+ public function process(array $configs): array
{
return $this->processor->processConfiguration($this->configuration, $configs);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationProvider.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationProvider.php
index bf21badbdef..b4ed27ac500 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationProvider.php
@@ -36,7 +36,7 @@ public function __construct(TestThemeConfigurationManagerInterface $testThemeCon
/**
* {@inheritdoc}
*/
- public function getConfigurations()
+ public function getConfigurations(): array
{
return $this->testThemeConfigurationManager->findAll();
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationSourceFactory.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationSourceFactory.php
index 5e28cd6c1ab..08bd1cd037b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationSourceFactory.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestConfigurationSourceFactory.php
@@ -28,7 +28,7 @@ final class TestConfigurationSourceFactory implements ConfigurationSourceFactory
/**
* {@inheritdoc}
*/
- public function buildConfiguration(ArrayNodeDefinition $node)
+ public function buildConfiguration(ArrayNodeDefinition $node): void
{
// no configuration
}
@@ -36,7 +36,7 @@ public function buildConfiguration(ArrayNodeDefinition $node)
/**
* {@inheritdoc}
*/
- public function initializeSource(ContainerBuilder $container, array $config)
+ public function initializeSource(ContainerBuilder $container, array $config): Definition
{
$container->setDefinition(
'sylius.theme.test_theme_configuration_manager',
@@ -54,7 +54,7 @@ public function initializeSource(ContainerBuilder $container, array $config)
/**
* {@inheritdoc}
*/
- public function getName()
+ public function getName(): string
{
return 'test';
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManager.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManager.php
index 010b5cc7c2d..52543d0fcfd 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManager.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManager.php
@@ -40,7 +40,7 @@ final class TestThemeConfigurationManager implements TestThemeConfigurationManag
* @param ConfigurationProcessorInterface $configurationProcessor
* @param string $cacheDir
*/
- public function __construct(ConfigurationProcessorInterface $configurationProcessor, $cacheDir)
+ public function __construct(ConfigurationProcessorInterface $configurationProcessor, string $cacheDir)
{
$this->configurationProcessor = $configurationProcessor;
$this->filesystem = new Filesystem();
@@ -50,7 +50,7 @@ public function __construct(ConfigurationProcessorInterface $configurationProces
/**
* {@inheritdoc}
*/
- public function findAll()
+ public function findAll(): array
{
$this->initializeIfNeeded();
@@ -60,7 +60,7 @@ public function findAll()
/**
* {@inheritdoc}
*/
- public function add(array $configuration)
+ public function add(array $configuration): void
{
$this->initializeIfNeeded();
@@ -77,7 +77,7 @@ public function add(array $configuration)
/**
* {@inheritdoc}
*/
- public function remove($themeName)
+ public function remove(string $themeName): void
{
$this->initializeIfNeeded();
@@ -93,7 +93,7 @@ public function remove($themeName)
/**
* {@inheritdoc}
*/
- public function clear()
+ public function clear(): void
{
$configurationsDirectory = dirname($this->configurationsFile);
@@ -105,7 +105,7 @@ public function clear()
/**
* @return array
*/
- private function load()
+ private function load(): array
{
return unserialize(file_get_contents($this->configurationsFile));
}
@@ -113,12 +113,12 @@ private function load()
/**
* @param array $configurations
*/
- private function save(array $configurations)
+ private function save(array $configurations): void
{
file_put_contents($this->configurationsFile, serialize($configurations));
}
- private function initializeIfNeeded()
+ private function initializeIfNeeded(): void
{
if ($this->filesystem->exists($this->configurationsFile)) {
return;
@@ -127,7 +127,7 @@ private function initializeIfNeeded()
$this->initialize();
}
- private function initialize()
+ private function initialize(): void
{
$configurationsDirectory = dirname($this->configurationsFile);
@@ -139,7 +139,7 @@ private function initialize()
/**
* @param string $themeName
*/
- private function initializeTheme($themeName)
+ private function initializeTheme(string $themeName): void
{
$themeDirectory = $this->getThemeDirectory($themeName);
@@ -149,7 +149,7 @@ private function initializeTheme($themeName)
/**
* @param string $themeName
*/
- private function clearTheme($themeName)
+ private function clearTheme(string $themeName): void
{
$themeDirectory = $this->getThemeDirectory($themeName);
@@ -165,7 +165,7 @@ private function clearTheme($themeName)
*
* @return string
*/
- private function getThemeDirectory($themeName)
+ private function getThemeDirectory(string $themeName): string
{
return rtrim(dirname($this->configurationsFile), '/') . '/' . $themeName;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManagerInterface.php b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManagerInterface.php
index 00dd502ad30..640564ad80b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManagerInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/Test/TestThemeConfigurationManagerInterface.php
@@ -21,20 +21,20 @@ interface TestThemeConfigurationManagerInterface
/**
* @return array
*/
- public function findAll();
+ public function findAll(): array;
/**
* @param array $configuration
*/
- public function add(array $configuration);
+ public function add(array $configuration): void;
/**
* @param string $themeName
*/
- public function remove($themeName);
+ public function remove(string $themeName): void;
/**
* Clear currently used configurations storage.
*/
- public function clear();
+ public function clear(): void;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Configuration/ThemeConfiguration.php b/src/Sylius/Bundle/ThemeBundle/Configuration/ThemeConfiguration.php
index 013a4a4e4d6..88a8577a1d5 100644
--- a/src/Sylius/Bundle/ThemeBundle/Configuration/ThemeConfiguration.php
+++ b/src/Sylius/Bundle/ThemeBundle/Configuration/ThemeConfiguration.php
@@ -25,7 +25,7 @@ final class ThemeConfiguration implements ConfigurationInterface
/**
* {@inheritdoc}
*/
- public function getConfigTreeBuilder()
+ public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNodeDefinition = $treeBuilder->root('sylius_theme');
@@ -46,7 +46,7 @@ public function getConfigTreeBuilder()
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
- private function addRequiredNameField(ArrayNodeDefinition $rootNodeDefinition)
+ private function addRequiredNameField(ArrayNodeDefinition $rootNodeDefinition): void
{
$rootNodeDefinition->children()->scalarNode('name')->isRequired()->cannotBeEmpty();
}
@@ -54,7 +54,7 @@ private function addRequiredNameField(ArrayNodeDefinition $rootNodeDefinition)
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
- private function addOptionalTitleField(ArrayNodeDefinition $rootNodeDefinition)
+ private function addOptionalTitleField(ArrayNodeDefinition $rootNodeDefinition): void
{
$rootNodeDefinition->children()->scalarNode('title')->cannotBeEmpty();
}
@@ -62,7 +62,7 @@ private function addOptionalTitleField(ArrayNodeDefinition $rootNodeDefinition)
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
- private function addOptionalDescriptionField(ArrayNodeDefinition $rootNodeDefinition)
+ private function addOptionalDescriptionField(ArrayNodeDefinition $rootNodeDefinition): void
{
$rootNodeDefinition->children()->scalarNode('description')->cannotBeEmpty();
}
@@ -70,7 +70,7 @@ private function addOptionalDescriptionField(ArrayNodeDefinition $rootNodeDefini
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
- private function addOptionalPathField(ArrayNodeDefinition $rootNodeDefinition)
+ private function addOptionalPathField(ArrayNodeDefinition $rootNodeDefinition): void
{
$rootNodeDefinition->children()->scalarNode('path')->cannotBeEmpty();
}
@@ -78,7 +78,7 @@ private function addOptionalPathField(ArrayNodeDefinition $rootNodeDefinition)
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
- private function addOptionalParentsList(ArrayNodeDefinition $rootNodeDefinition)
+ private function addOptionalParentsList(ArrayNodeDefinition $rootNodeDefinition): void
{
$parentsNodeDefinition = $rootNodeDefinition->children()->arrayNode('parents');
$parentsNodeDefinition
@@ -92,7 +92,7 @@ private function addOptionalParentsList(ArrayNodeDefinition $rootNodeDefinition)
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
- private function addOptionalScreenshotsList(ArrayNodeDefinition $rootNodeDefinition)
+ private function addOptionalScreenshotsList(ArrayNodeDefinition $rootNodeDefinition): void
{
$screenshotsNodeDefinition = $rootNodeDefinition->children()->arrayNode('screenshots');
$screenshotsNodeDefinition
@@ -127,7 +127,7 @@ private function addOptionalScreenshotsList(ArrayNodeDefinition $rootNodeDefinit
/**
* @param ArrayNodeDefinition $rootNodeDefinition
*/
- private function addOptionalAuthorsList(ArrayNodeDefinition $rootNodeDefinition)
+ private function addOptionalAuthorsList(ArrayNodeDefinition $rootNodeDefinition): void
{
$authorsNodeDefinition = $rootNodeDefinition->children()->arrayNode('authors');
$authorsNodeDefinition
diff --git a/src/Sylius/Bundle/ThemeBundle/Context/EmptyThemeContext.php b/src/Sylius/Bundle/ThemeBundle/Context/EmptyThemeContext.php
index 5041eadcaac..0f9011a9c5c 100644
--- a/src/Sylius/Bundle/ThemeBundle/Context/EmptyThemeContext.php
+++ b/src/Sylius/Bundle/ThemeBundle/Context/EmptyThemeContext.php
@@ -13,6 +13,8 @@
namespace Sylius\Bundle\ThemeBundle\Context;
+use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
+
/**
* @author Kamil Kokot
*/
@@ -20,10 +22,8 @@ final class EmptyThemeContext implements ThemeContextInterface
{
/**
* {@inheritdoc}
- *
- * @return null
*/
- public function getTheme()
+ public function getTheme(): ?ThemeInterface
{
return null;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Context/SettableThemeContext.php b/src/Sylius/Bundle/ThemeBundle/Context/SettableThemeContext.php
index 6c93f1bf844..6554fd2637e 100644
--- a/src/Sylius/Bundle/ThemeBundle/Context/SettableThemeContext.php
+++ b/src/Sylius/Bundle/ThemeBundle/Context/SettableThemeContext.php
@@ -28,7 +28,7 @@ final class SettableThemeContext implements ThemeContextInterface
/**
* {@inheritdoc}
*/
- public function setTheme(ThemeInterface $theme)
+ public function setTheme(ThemeInterface $theme): void
{
$this->theme = $theme;
}
@@ -36,7 +36,7 @@ public function setTheme(ThemeInterface $theme)
/**
* {@inheritdoc}
*/
- public function getTheme()
+ public function getTheme(): ?ThemeInterface
{
return $this->theme;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Context/ThemeContextInterface.php b/src/Sylius/Bundle/ThemeBundle/Context/ThemeContextInterface.php
index c9d5b5bfa68..e022a7352c1 100644
--- a/src/Sylius/Bundle/ThemeBundle/Context/ThemeContextInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Context/ThemeContextInterface.php
@@ -25,5 +25,5 @@ interface ThemeContextInterface
*
* @return ThemeInterface|null
*/
- public function getTheme();
+ public function getTheme(): ?ThemeInterface;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Controller/ThemeScreenshotController.php b/src/Sylius/Bundle/ThemeBundle/Controller/ThemeScreenshotController.php
index 1c6e467102c..3d8927ee448 100644
--- a/src/Sylius/Bundle/ThemeBundle/Controller/ThemeScreenshotController.php
+++ b/src/Sylius/Bundle/ThemeBundle/Controller/ThemeScreenshotController.php
@@ -17,6 +17,7 @@
use Sylius\Bundle\ThemeBundle\Repository\ThemeRepositoryInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -41,9 +42,9 @@ public function __construct(ThemeRepositoryInterface $themeRepository)
* @param string $themeName
* @param int $screenshotNumber
*
- * @return BinaryFileResponse
+ * @return Response
*/
- public function streamScreenshotAction($themeName, $screenshotNumber)
+ public function streamScreenshotAction(string $themeName, int $screenshotNumber): Response
{
$screenshotPath = $this->getScreenshotPath($this->getTheme($themeName), $screenshotNumber);
@@ -60,7 +61,7 @@ public function streamScreenshotAction($themeName, $screenshotNumber)
*
* @return string
*/
- private function getScreenshotPath(ThemeInterface $theme, $screenshotNumber)
+ private function getScreenshotPath(ThemeInterface $theme, int $screenshotNumber): string
{
$screenshots = $theme->getScreenshots();
@@ -68,7 +69,7 @@ private function getScreenshotPath(ThemeInterface $theme, $screenshotNumber)
throw new NotFoundHttpException(sprintf('Theme "%s" does not have screenshot #%d', $theme->getTitle(), $screenshotNumber));
}
- $screenshotRelativePath = $screenshots[$screenshotNumber];
+ $screenshotRelativePath = $screenshots[$screenshotNumber]->getPath();
return rtrim($theme->getPath(), \DIRECTORY_SEPARATOR) . \DIRECTORY_SEPARATOR . $screenshotRelativePath;
}
@@ -78,7 +79,7 @@ private function getScreenshotPath(ThemeInterface $theme, $screenshotNumber)
*
* @return ThemeInterface
*/
- private function getTheme($themeName)
+ private function getTheme(string $themeName): ThemeInterface
{
$theme = $this->themeRepository->findOneByName($themeName);
if (null === $theme) {
diff --git a/src/Sylius/Bundle/ThemeBundle/DependencyInjection/Configuration.php b/src/Sylius/Bundle/ThemeBundle/DependencyInjection/Configuration.php
index 05485579adc..2bebfc06eae 100644
--- a/src/Sylius/Bundle/ThemeBundle/DependencyInjection/Configuration.php
+++ b/src/Sylius/Bundle/ThemeBundle/DependencyInjection/Configuration.php
@@ -39,7 +39,7 @@ public function __construct(array $configurationSourceFactories = [])
/**
* {@inheritdoc}
*/
- public function getConfigTreeBuilder()
+ public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sylius_theme');
@@ -69,7 +69,7 @@ public function getConfigTreeBuilder()
/**
* @param ArrayNodeDefinition $rootNode
*/
- private function addSourcesConfiguration(ArrayNodeDefinition $rootNode)
+ private function addSourcesConfiguration(ArrayNodeDefinition $rootNode): void
{
$sourcesNodeBuilder = $rootNode
->fixXmlConfig('source')
diff --git a/src/Sylius/Bundle/ThemeBundle/DependencyInjection/SyliusThemeExtension.php b/src/Sylius/Bundle/ThemeBundle/DependencyInjection/SyliusThemeExtension.php
index 7bcb1023228..2353e2e27c4 100644
--- a/src/Sylius/Bundle/ThemeBundle/DependencyInjection/SyliusThemeExtension.php
+++ b/src/Sylius/Bundle/ThemeBundle/DependencyInjection/SyliusThemeExtension.php
@@ -38,7 +38,7 @@ final class SyliusThemeExtension extends Extension implements PrependExtensionIn
*
* {@inheritdoc}
*/
- public function load(array $config, ContainerBuilder $container)
+ public function load(array $config, ContainerBuilder $container): void
{
$config = $this->processConfiguration($this->getConfiguration([], $container), $config);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
@@ -66,7 +66,7 @@ public function load(array $config, ContainerBuilder $container)
*
* {@inheritdoc}
*/
- public function prepend(ContainerBuilder $container)
+ public function prepend(ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
@@ -78,7 +78,7 @@ public function prepend(ContainerBuilder $container)
*
* @param ConfigurationSourceFactoryInterface $configurationSourceFactory
*/
- public function addConfigurationSourceFactory(ConfigurationSourceFactoryInterface $configurationSourceFactory)
+ public function addConfigurationSourceFactory(ConfigurationSourceFactoryInterface $configurationSourceFactory): void
{
$this->configurationSourceFactories[$configurationSourceFactory->getName()] = $configurationSourceFactory;
}
@@ -86,7 +86,7 @@ public function addConfigurationSourceFactory(ConfigurationSourceFactoryInterfac
/**
* {@inheritdoc}
*/
- public function getConfiguration(array $config, ContainerBuilder $container)
+ public function getConfiguration(array $config, ContainerBuilder $container): Configuration
{
$configuration = new Configuration($this->configurationSourceFactories);
@@ -99,7 +99,7 @@ public function getConfiguration(array $config, ContainerBuilder $container)
* @param ContainerBuilder $container
* @param LoaderInterface $loader
*/
- private function prependTwig(ContainerBuilder $container, LoaderInterface $loader)
+ private function prependTwig(ContainerBuilder $container, LoaderInterface $loader): void
{
if (!$container->hasExtension('twig')) {
return;
@@ -111,10 +111,8 @@ private function prependTwig(ContainerBuilder $container, LoaderInterface $loade
/**
* @param ContainerBuilder $container
* @param array $config
- *
- * @return mixed
*/
- private function resolveConfigurationSources(ContainerBuilder $container, array $config)
+ private function resolveConfigurationSources(ContainerBuilder $container, array $config): void
{
$configurationProviders = [];
foreach ($this->configurationSourceFactories as $configurationSourceFactory) {
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactory.php b/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactory.php
index 1044426a3dc..5794c898887 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactory.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactory.php
@@ -23,7 +23,7 @@ final class FinderFactory implements FinderFactoryInterface
/**
* {@inheritdoc}
*/
- public function create()
+ public function create(): Finder
{
return Finder::create();
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactoryInterface.php b/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactoryInterface.php
index e28bd5e5fb9..a7971b1ac71 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactoryInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/FinderFactoryInterface.php
@@ -23,5 +23,5 @@ interface FinderFactoryInterface
/**
* @return Finder
*/
- public function create();
+ public function create(): Finder;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactory.php b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactory.php
index c3f90cd5dd4..23435b11d07 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactory.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactory.php
@@ -23,15 +23,15 @@ final class ThemeAuthorFactory implements ThemeAuthorFactoryInterface
/**
* {@inheritdoc}
*/
- public function createFromArray(array $data)
+ public function createFromArray(array $data): ThemeAuthor
{
/** @var ThemeAuthor $author */
$author = new ThemeAuthor();
- $author->setName(isset($data['name']) ? $data['name'] : null);
- $author->setEmail(isset($data['email']) ? $data['email'] : null);
- $author->setHomepage(isset($data['homepage']) ? $data['homepage'] : null);
- $author->setRole(isset($data['role']) ? $data['role'] : null);
+ $author->setName($data['name'] ?? null);
+ $author->setEmail($data['email'] ?? null);
+ $author->setHomepage($data['homepage'] ?? null);
+ $author->setRole($data['role'] ?? null);
return $author;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactoryInterface.php b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactoryInterface.php
index 1c8612a5fca..7f4ae3f2315 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactoryInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeAuthorFactoryInterface.php
@@ -25,5 +25,5 @@ interface ThemeAuthorFactoryInterface
*
* @return ThemeAuthor
*/
- public function createFromArray(array $data);
+ public function createFromArray(array $data): ThemeAuthor;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactory.php b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactory.php
index c746bdd95e9..79a4ea78d41 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactory.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactory.php
@@ -14,6 +14,7 @@
namespace Sylius\Bundle\ThemeBundle\Factory;
use Sylius\Bundle\ThemeBundle\Model\Theme;
+use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
/**
* @author Kamil Kokot
@@ -23,7 +24,7 @@ final class ThemeFactory implements ThemeFactoryInterface
/**
* {@inheritdoc}
*/
- public function create($name, $path)
+ public function create(string $name, string $path): ThemeInterface
{
return new Theme($name, $path);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactoryInterface.php b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactoryInterface.php
index 9d1d1e2c6f9..d360d94401d 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactoryInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeFactoryInterface.php
@@ -26,5 +26,5 @@ interface ThemeFactoryInterface
*
* @return ThemeInterface
*/
- public function create($name, $path);
+ public function create(string $name, string $path): ThemeInterface;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactory.php b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactory.php
index 87bdbae8642..843e2183016 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactory.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactory.php
@@ -23,21 +23,15 @@ final class ThemeScreenshotFactory implements ThemeScreenshotFactoryInterface
/**
* {@inheritdoc}
*/
- public function createFromArray(array $data)
+ public function createFromArray(array $data): ThemeScreenshot
{
if (!array_key_exists('path', $data)) {
throw new \InvalidArgumentException('Screenshot path is required.');
}
$themeScreenshot = new ThemeScreenshot($data['path']);
-
- if (isset($data['title'])) {
- $themeScreenshot->setTitle($data['title']);
- }
-
- if (isset($data['description'])) {
- $themeScreenshot->setDescription($data['description']);
- }
+ $themeScreenshot->setTitle($data['title'] ?? null);
+ $themeScreenshot->setDescription($data['description'] ?? null);
return $themeScreenshot;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactoryInterface.php b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactoryInterface.php
index 0322b2c49cb..f6fb640e3fe 100644
--- a/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactoryInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Factory/ThemeScreenshotFactoryInterface.php
@@ -25,5 +25,5 @@ interface ThemeScreenshotFactoryInterface
*
* @return ThemeScreenshot
*/
- public function createFromArray(array $data);
+ public function createFromArray(array $data): ThemeScreenshot;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Filesystem/Filesystem.php b/src/Sylius/Bundle/ThemeBundle/Filesystem/Filesystem.php
index c2997696054..abf0ca2f43b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Filesystem/Filesystem.php
+++ b/src/Sylius/Bundle/ThemeBundle/Filesystem/Filesystem.php
@@ -23,7 +23,7 @@ final class Filesystem extends BaseFilesystem implements FilesystemInterface
/**
* {@inheritdoc}
*/
- public function getFileContents($file)
+ public function getFileContents(string $file): string
{
return file_get_contents($file);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Filesystem/FilesystemInterface.php b/src/Sylius/Bundle/ThemeBundle/Filesystem/FilesystemInterface.php
index 7147baaf464..6da5cf31211 100644
--- a/src/Sylius/Bundle/ThemeBundle/Filesystem/FilesystemInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Filesystem/FilesystemInterface.php
@@ -174,5 +174,5 @@ public function isAbsolutePath($file);
*
* @return string
*/
- public function getFileContents($file);
+ public function getFileContents(string $file): string;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeChoiceType.php b/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeChoiceType.php
index 6530c393242..a7c935bed9c 100644
--- a/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeChoiceType.php
+++ b/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeChoiceType.php
@@ -41,13 +41,13 @@ public function __construct(ThemeRepositoryInterface $themeRepository)
/**
* {@inheritdoc}
*/
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
- 'choices' => function (Options $options) {
+ 'choices' => function (Options $options): array {
return $this->themeRepository->findAll();
},
- 'choice_label' => function (ThemeInterface $theme) {
+ 'choice_label' => function (ThemeInterface $theme): string {
return (string) $theme;
},
]);
@@ -56,7 +56,7 @@ public function configureOptions(OptionsResolver $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
+ public function getParent(): string
{
return ChoiceType::class;
}
@@ -64,7 +64,7 @@ public function getParent()
/**
* {@inheritdoc}
*/
- public function getBlockPrefix()
+ public function getBlockPrefix(): string
{
return 'sylius_theme_choice';
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeNameChoiceType.php b/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeNameChoiceType.php
index e1f1509d322..aba5366a443 100644
--- a/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeNameChoiceType.php
+++ b/src/Sylius/Bundle/ThemeBundle/Form/Type/ThemeNameChoiceType.php
@@ -40,10 +40,10 @@ public function __construct(ThemeRepositoryInterface $themeRepository)
/**
* {@inheritdoc}
*/
- public function configureOptions(OptionsResolver $resolver)
+ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
- 'choices' => function (Options $options) {
+ 'choices' => function (Options $options): array {
$themes = $this->themeRepository->findAll();
$choices = [];
@@ -59,7 +59,7 @@ public function configureOptions(OptionsResolver $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
+ public function getParent(): string
{
return ChoiceType::class;
}
@@ -67,7 +67,7 @@ public function getParent()
/**
* {@inheritdoc}
*/
- public function getBlockPrefix()
+ public function getBlockPrefix(): string
{
return 'sylius_theme_name_choice';
}
diff --git a/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/NoopThemeHierarchyProvider.php b/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/NoopThemeHierarchyProvider.php
index f2bf5e1ee8a..e3e155d2924 100644
--- a/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/NoopThemeHierarchyProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/NoopThemeHierarchyProvider.php
@@ -23,12 +23,8 @@ final class NoopThemeHierarchyProvider implements ThemeHierarchyProviderInterfac
/**
* {@inheritdoc}
*/
- public function getThemeHierarchy(ThemeInterface $theme = null)
+ public function getThemeHierarchy(ThemeInterface $theme): array
{
- if (null === $theme) {
- return [];
- }
-
return [$theme];
}
}
diff --git a/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProvider.php b/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProvider.php
index e047e8aa2c7..c67767b2ce5 100644
--- a/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProvider.php
@@ -23,12 +23,8 @@ final class ThemeHierarchyProvider implements ThemeHierarchyProviderInterface
/**
* {@inheritdoc}
*/
- public function getThemeHierarchy(ThemeInterface $theme = null)
+ public function getThemeHierarchy(ThemeInterface $theme): array
{
- if (null === $theme) {
- return [];
- }
-
$parents = [];
foreach ($theme->getParents() as $parent) {
$parents = array_merge(
diff --git a/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProviderInterface.php b/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProviderInterface.php
index 56865568461..91bdbbe7997 100644
--- a/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProviderInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/HierarchyProvider/ThemeHierarchyProviderInterface.php
@@ -23,9 +23,9 @@ interface ThemeHierarchyProviderInterface
/**
* @param ThemeInterface|null $theme
*
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*
* @throws \InvalidArgumentException If dependencies could not be resolved.
*/
- public function getThemeHierarchy(ThemeInterface $theme = null);
+ public function getThemeHierarchy(ThemeInterface $theme): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyChecker.php b/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyChecker.php
index 076221e6220..85ff6bcfc13 100644
--- a/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyChecker.php
+++ b/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyChecker.php
@@ -23,7 +23,7 @@ final class CircularDependencyChecker implements CircularDependencyCheckerInterf
/**
* {@inheritdoc}
*/
- public function check(ThemeInterface $theme, array $previousThemes = [])
+ public function check(ThemeInterface $theme, array $previousThemes = []): void
{
if (0 === count($theme->getParents())) {
return;
diff --git a/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyCheckerInterface.php b/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyCheckerInterface.php
index 61ef2998f03..ccf3c068cc1 100644
--- a/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyCheckerInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyCheckerInterface.php
@@ -25,5 +25,5 @@ interface CircularDependencyCheckerInterface
*
* @throws CircularDependencyFoundException
*/
- public function check(ThemeInterface $theme);
+ public function check(ThemeInterface $theme): void;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyFoundException.php b/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyFoundException.php
index 3e670b3b3f8..a88246a5205 100644
--- a/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyFoundException.php
+++ b/src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyFoundException.php
@@ -24,7 +24,7 @@ final class CircularDependencyFoundException extends \DomainException
* @param ThemeInterface[] $themes
* @param \Exception $previous
*/
- public function __construct(array $themes, \Exception $previous = null)
+ public function __construct(array $themes, ?\Exception $previous = null)
{
$cycle = $this->getCycleFromArray($themes);
@@ -42,7 +42,7 @@ public function __construct(array $themes, \Exception $previous = null)
*
* @return array
*/
- private function getCycleFromArray(array $themes)
+ private function getCycleFromArray(array $themes): array
{
while (reset($themes) !== end($themes) || 1 === count($themes)) {
array_shift($themes);
@@ -60,7 +60,7 @@ private function getCycleFromArray(array $themes)
*
* @return string
*/
- private function formatCycleToString(array $themes)
+ private function formatCycleToString(array $themes): string
{
$themesNames = array_map(function (ThemeInterface $theme) {
return $theme->getName();
diff --git a/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoader.php b/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoader.php
index 4024aad02d4..d50feada886 100644
--- a/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoader.php
+++ b/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoader.php
@@ -84,7 +84,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function load()
+ public function load(): array
{
$configurations = $this->configurationProvider->getConfigurations();
@@ -99,9 +99,9 @@ public function load()
/**
* @param array $configurations
*
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*/
- private function initializeThemes(array $configurations)
+ private function initializeThemes(array $configurations): array
{
$themes = [];
foreach ($configurations as $configuration) {
@@ -114,11 +114,11 @@ private function initializeThemes(array $configurations)
/**
* @param array $configurations
- * @param ThemeInterface[] $themes
+ * @param array|ThemeInterface[] $themes
*
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*/
- private function hydrateThemes(array $configurations, array $themes)
+ private function hydrateThemes(array $configurations, array $themes): array
{
foreach ($configurations as $configuration) {
$themeName = $configuration['name'];
@@ -134,9 +134,9 @@ private function hydrateThemes(array $configurations, array $themes)
}
/**
- * @param ThemeInterface[] $themes
+ * @param array|ThemeInterface[] $themes
*/
- private function checkForCircularDependencies(array $themes)
+ private function checkForCircularDependencies(array $themes): void
{
try {
foreach ($themes as $theme) {
@@ -152,9 +152,9 @@ private function checkForCircularDependencies(array $themes)
* @param array $parentsNames
* @param array $existingThemes
*
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*/
- private function convertParentsNamesToParentsObjects($themeName, array $parentsNames, array $existingThemes)
+ private function convertParentsNamesToParentsObjects(string $themeName, array $parentsNames, array $existingThemes): array
{
return array_map(function ($parentName) use ($themeName, $existingThemes) {
if (!isset($existingThemes[$parentName])) {
@@ -172,9 +172,9 @@ private function convertParentsNamesToParentsObjects($themeName, array $parentsN
/**
* @param array $authorsArrays
*
- * @return ThemeAuthor[]
+ * @return array|ThemeAuthor[]
*/
- private function convertAuthorsArraysToAuthorsObjects(array $authorsArrays)
+ private function convertAuthorsArraysToAuthorsObjects(array $authorsArrays): array
{
return array_map(function (array $authorArray) {
return $this->themeAuthorFactory->createFromArray($authorArray);
@@ -184,9 +184,9 @@ private function convertAuthorsArraysToAuthorsObjects(array $authorsArrays)
/**
* @param array $screenshotsArrays
*
- * @return ThemeScreenshot[]
+ * @return array|ThemeScreenshot[]
*/
- private function convertScreenshotsArraysToScreenshotsObjects(array $screenshotsArrays)
+ private function convertScreenshotsArraysToScreenshotsObjects(array $screenshotsArrays): array
{
return array_map(function (array $screenshotArray) {
return $this->themeScreenshotFactory->createFromArray($screenshotArray);
diff --git a/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoaderInterface.php b/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoaderInterface.php
index 6cbafbe8561..db0efb35e05 100644
--- a/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoaderInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Loader/ThemeLoaderInterface.php
@@ -21,9 +21,9 @@
interface ThemeLoaderInterface
{
/**
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*
* @throws ThemeLoadingFailedException
*/
- public function load();
+ public function load(): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Locator/ApplicationResourceLocator.php b/src/Sylius/Bundle/ThemeBundle/Locator/ApplicationResourceLocator.php
index 2213faa2d09..ffeda8d3909 100644
--- a/src/Sylius/Bundle/ThemeBundle/Locator/ApplicationResourceLocator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Locator/ApplicationResourceLocator.php
@@ -37,7 +37,7 @@ public function __construct(Filesystem $filesystem)
/**
* {@inheritdoc}
*/
- public function locateResource($resourceName, ThemeInterface $theme)
+ public function locateResource(string $resourceName, ThemeInterface $theme): string
{
$path = sprintf('%s/%s', $theme->getPath(), $resourceName);
if (!$this->filesystem->exists($path)) {
diff --git a/src/Sylius/Bundle/ThemeBundle/Locator/BundleResourceLocator.php b/src/Sylius/Bundle/ThemeBundle/Locator/BundleResourceLocator.php
index 3341413ac7f..833a3b672f5 100644
--- a/src/Sylius/Bundle/ThemeBundle/Locator/BundleResourceLocator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Locator/BundleResourceLocator.php
@@ -47,7 +47,7 @@ public function __construct(Filesystem $filesystem, KernelInterface $kernel)
*
* @param string $resourcePath Eg. "@AcmeBundle/Resources/views/template.html.twig"
*/
- public function locateResource($resourcePath, ThemeInterface $theme)
+ public function locateResource(string $resourcePath, ThemeInterface $theme): string
{
$this->assertResourcePathIsValid($resourcePath);
@@ -69,9 +69,9 @@ public function locateResource($resourcePath, ThemeInterface $theme)
/**
* @param string $resourcePath
*/
- private function assertResourcePathIsValid($resourcePath)
+ private function assertResourcePathIsValid(string $resourcePath): void
{
- if ('@' !== substr($resourcePath, 0, 1)) {
+ if (0 !== strpos($resourcePath, '@')) {
throw new \InvalidArgumentException(sprintf('Bundle resource path (given "%s") should start with an "@".', $resourcePath));
}
@@ -89,7 +89,7 @@ private function assertResourcePathIsValid($resourcePath)
*
* @return string
*/
- private function getBundleNameFromResourcePath($resourcePath)
+ private function getBundleNameFromResourcePath(string $resourcePath): string
{
return substr($resourcePath, 1, strpos($resourcePath, '/') - 1);
}
@@ -99,7 +99,7 @@ private function getBundleNameFromResourcePath($resourcePath)
*
* @return string
*/
- private function getResourceNameFromResourcePath($resourcePath)
+ private function getResourceNameFromResourcePath(string $resourcePath): string
{
return substr($resourcePath, strpos($resourcePath, 'Resources/') + strlen('Resources/'));
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Locator/FileLocatorInterface.php b/src/Sylius/Bundle/ThemeBundle/Locator/FileLocatorInterface.php
index dffe1bf7480..dfc9422d80d 100644
--- a/src/Sylius/Bundle/ThemeBundle/Locator/FileLocatorInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Locator/FileLocatorInterface.php
@@ -25,7 +25,7 @@ interface FileLocatorInterface
*
* @throws \InvalidArgumentException If name is not valid or file was not found
*/
- public function locateFileNamed($name);
+ public function locateFileNamed(string $name): string;
/**
* @param string $name
@@ -34,5 +34,5 @@ public function locateFileNamed($name);
*
* @throws \InvalidArgumentException If name is not valid or files were not found
*/
- public function locateFilesNamed($name);
+ public function locateFilesNamed(string $name): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Locator/RecursiveFileLocator.php b/src/Sylius/Bundle/ThemeBundle/Locator/RecursiveFileLocator.php
index 042448354b1..a8f27bf018b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Locator/RecursiveFileLocator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Locator/RecursiveFileLocator.php
@@ -33,7 +33,7 @@ final class RecursiveFileLocator implements FileLocatorInterface
/**
* @param FinderFactoryInterface $finderFactory
- * @param array $paths An array of paths where to look for resources
+ * @param array|string[] $paths An array of paths where to look for resources
*/
public function __construct(FinderFactoryInterface $finderFactory, array $paths)
{
@@ -44,7 +44,7 @@ public function __construct(FinderFactoryInterface $finderFactory, array $paths)
/**
* {@inheritdoc}
*/
- public function locateFileNamed($name)
+ public function locateFileNamed(string $name): string
{
return $this->doLocateFilesNamed($name)->current();
}
@@ -52,7 +52,7 @@ public function locateFileNamed($name)
/**
* {@inheritdoc}
*/
- public function locateFilesNamed($name)
+ public function locateFilesNamed(string $name): array
{
return iterator_to_array($this->doLocateFilesNamed($name));
}
@@ -62,7 +62,7 @@ public function locateFilesNamed($name)
*
* @return \Generator
*/
- private function doLocateFilesNamed($name)
+ private function doLocateFilesNamed(string $name): \Generator
{
$this->assertNameIsNotEmpty($name);
@@ -98,7 +98,7 @@ private function doLocateFilesNamed($name)
/**
* @param string $name
*/
- private function assertNameIsNotEmpty($name)
+ private function assertNameIsNotEmpty(string $name): void
{
if (null === $name || '' === $name) {
throw new \InvalidArgumentException(
diff --git a/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocator.php b/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocator.php
index 6d5a34c48a0..9abfc4b3a57 100644
--- a/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocator.php
@@ -45,7 +45,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function locateResource($resourcePath, ThemeInterface $theme)
+ public function locateResource(string $resourcePath, ThemeInterface $theme): string
{
if (0 === strpos($resourcePath, '@')) {
return $this->bundleResourceLocator->locateResource($resourcePath, $theme);
diff --git a/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocatorInterface.php b/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocatorInterface.php
index 6db5d2131bd..c9f1b4d66ae 100644
--- a/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocatorInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Locator/ResourceLocatorInterface.php
@@ -28,5 +28,5 @@ interface ResourceLocatorInterface
*
* @throws ResourceNotFoundException
*/
- public function locateResource($resourceName, ThemeInterface $theme);
+ public function locateResource(string $resourceName, ThemeInterface $theme): string;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Locator/ResourceNotFoundException.php b/src/Sylius/Bundle/ThemeBundle/Locator/ResourceNotFoundException.php
index 0b38e94e21a..d878ecfc043 100644
--- a/src/Sylius/Bundle/ThemeBundle/Locator/ResourceNotFoundException.php
+++ b/src/Sylius/Bundle/ThemeBundle/Locator/ResourceNotFoundException.php
@@ -24,7 +24,7 @@ final class ResourceNotFoundException extends \RuntimeException
* @param string $resourceName
* @param ThemeInterface $theme
*/
- public function __construct($resourceName, ThemeInterface $theme)
+ public function __construct(string $resourceName, ThemeInterface $theme)
{
parent::__construct(sprintf(
'Could not find resource "%s" using theme "%s".',
diff --git a/src/Sylius/Bundle/ThemeBundle/Model/Theme.php b/src/Sylius/Bundle/ThemeBundle/Model/Theme.php
index 9e0b5a3ce4e..2a23d5403a8 100644
--- a/src/Sylius/Bundle/ThemeBundle/Model/Theme.php
+++ b/src/Sylius/Bundle/ThemeBundle/Model/Theme.php
@@ -39,17 +39,17 @@ class Theme implements ThemeInterface
protected $description;
/**
- * @var ThemeAuthor[]
+ * @var array|ThemeAuthor[]
*/
protected $authors = [];
/**
- * @var ThemeInterface[]
+ * @var array|ThemeInterface[]
*/
protected $parents = [];
/**
- * @var ThemeScreenshot[]
+ * @var array|ThemeScreenshot[]
*/
protected $screenshots = [];
@@ -57,7 +57,7 @@ class Theme implements ThemeInterface
* @param string $name
* @param string $path
*/
- public function __construct($name, $path)
+ public function __construct(string $name, string $path)
{
$this->assertNameIsValid($name);
@@ -68,7 +68,7 @@ public function __construct($name, $path)
/**
* @return string
*/
- public function __toString()
+ public function __toString(): string
{
return $this->title ?: $this->name;
}
@@ -76,7 +76,7 @@ public function __toString()
/**
* {@inheritdoc}
*/
- public function getName()
+ public function getName(): string
{
return $this->name;
}
@@ -84,7 +84,7 @@ public function getName()
/**
* {@inheritdoc}
*/
- public function getPath()
+ public function getPath(): string
{
return $this->path;
}
@@ -92,7 +92,7 @@ public function getPath()
/**
* {@inheritdoc}
*/
- public function getTitle()
+ public function getTitle(): ?string
{
return $this->title;
}
@@ -100,7 +100,7 @@ public function getTitle()
/**
* {@inheritdoc}
*/
- public function setTitle($title)
+ public function setTitle(?string $title): void
{
$this->title = $title;
}
@@ -108,7 +108,7 @@ public function setTitle($title)
/**
* {@inheritdoc}
*/
- public function getDescription()
+ public function getDescription(): ?string
{
return $this->description;
}
@@ -116,7 +116,7 @@ public function getDescription()
/**
* {@inheritdoc}
*/
- public function setDescription($description)
+ public function setDescription(?string $description): void
{
$this->description = $description;
}
@@ -124,7 +124,7 @@ public function setDescription($description)
/**
* {@inheritdoc}
*/
- public function getAuthors()
+ public function getAuthors(): array
{
return $this->authors;
}
@@ -132,7 +132,7 @@ public function getAuthors()
/**
* {@inheritdoc}
*/
- public function addAuthor(ThemeAuthor $author)
+ public function addAuthor(ThemeAuthor $author): void
{
$this->authors[] = $author;
}
@@ -140,7 +140,7 @@ public function addAuthor(ThemeAuthor $author)
/**
* {@inheritdoc}
*/
- public function removeAuthor(ThemeAuthor $author)
+ public function removeAuthor(ThemeAuthor $author): void
{
$this->authors = array_filter($this->authors, function ($currentAuthor) use ($author) {
return $currentAuthor !== $author;
@@ -150,7 +150,7 @@ public function removeAuthor(ThemeAuthor $author)
/**
* {@inheritdoc}
*/
- public function getParents()
+ public function getParents(): array
{
return $this->parents;
}
@@ -158,7 +158,7 @@ public function getParents()
/**
* {@inheritdoc}
*/
- public function addParent(ThemeInterface $theme)
+ public function addParent(ThemeInterface $theme): void
{
$this->parents[] = $theme;
}
@@ -166,7 +166,7 @@ public function addParent(ThemeInterface $theme)
/**
* {@inheritdoc}
*/
- public function removeParent(ThemeInterface $theme)
+ public function removeParent(ThemeInterface $theme): void
{
$this->parents = array_filter($this->parents, function ($currentTheme) use ($theme) {
return $currentTheme !== $theme;
@@ -176,7 +176,7 @@ public function removeParent(ThemeInterface $theme)
/**
* {@inheritdoc}
*/
- public function getScreenshots()
+ public function getScreenshots(): array
{
return $this->screenshots;
}
@@ -184,7 +184,7 @@ public function getScreenshots()
/**
* {@inheritdoc}
*/
- public function addScreenshot(ThemeScreenshot $screenshot)
+ public function addScreenshot(ThemeScreenshot $screenshot): void
{
$this->screenshots[] = $screenshot;
}
@@ -192,7 +192,7 @@ public function addScreenshot(ThemeScreenshot $screenshot)
/**
* {@inheritdoc}
*/
- public function removeScreenshot(ThemeScreenshot $screenshot)
+ public function removeScreenshot(ThemeScreenshot $screenshot): void
{
$this->screenshots = array_filter($this->screenshots, function ($currentScreenshot) use ($screenshot) {
return $currentScreenshot !== $screenshot;
@@ -202,7 +202,7 @@ public function removeScreenshot(ThemeScreenshot $screenshot)
/**
* @param string $name
*/
- private function assertNameIsValid($name)
+ private function assertNameIsValid(string $name): void
{
$pattern = '/^[a-zA-Z0-9\-]+\/[a-zA-Z0-9\-]+$/';
if (false === (bool) preg_match($pattern, $name)) {
diff --git a/src/Sylius/Bundle/ThemeBundle/Model/ThemeAuthor.php b/src/Sylius/Bundle/ThemeBundle/Model/ThemeAuthor.php
index c3c02088cd4..2b487293388 100644
--- a/src/Sylius/Bundle/ThemeBundle/Model/ThemeAuthor.php
+++ b/src/Sylius/Bundle/ThemeBundle/Model/ThemeAuthor.php
@@ -19,29 +19,29 @@
final class ThemeAuthor
{
/**
- * @var string
+ * @var string|null
*/
private $name;
/**
- * @var string
+ * @var string|null
*/
private $email;
/**
- * @var string
+ * @var string|null
*/
private $homepage;
/**
- * @var string
+ * @var string|null
*/
private $role;
/**
* {@inheritdoc}
*/
- public function getName()
+ public function getName(): ?string
{
return $this->name;
}
@@ -49,7 +49,7 @@ public function getName()
/**
* {@inheritdoc}
*/
- public function setName($name)
+ public function setName(?string $name): void
{
$this->name = $name;
}
@@ -57,7 +57,7 @@ public function setName($name)
/**
* {@inheritdoc}
*/
- public function getEmail()
+ public function getEmail(): ?string
{
return $this->email;
}
@@ -65,7 +65,7 @@ public function getEmail()
/**
* {@inheritdoc}
*/
- public function setEmail($email)
+ public function setEmail(?string $email): void
{
$this->email = $email;
}
@@ -73,7 +73,7 @@ public function setEmail($email)
/**
* {@inheritdoc}
*/
- public function getHomepage()
+ public function getHomepage(): ?string
{
return $this->homepage;
}
@@ -81,7 +81,7 @@ public function getHomepage()
/**
* {@inheritdoc}
*/
- public function setHomepage($homepage)
+ public function setHomepage(?string $homepage): void
{
$this->homepage = $homepage;
}
@@ -89,7 +89,7 @@ public function setHomepage($homepage)
/**
* {@inheritdoc}
*/
- public function getRole()
+ public function getRole(): ?string
{
return $this->role;
}
@@ -97,7 +97,7 @@ public function getRole()
/**
* {@inheritdoc}
*/
- public function setRole($role)
+ public function setRole(?string $role): void
{
$this->role = $role;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Model/ThemeInterface.php b/src/Sylius/Bundle/ThemeBundle/Model/ThemeInterface.php
index a869ff54449..4b777cc7e03 100644
--- a/src/Sylius/Bundle/ThemeBundle/Model/ThemeInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Model/ThemeInterface.php
@@ -21,75 +21,75 @@ interface ThemeInterface
/**
* @return string
*/
- public function getName();
+ public function getName(): string;
/**
* @return string
*/
- public function getPath();
+ public function getPath(): string;
/**
* @return string|null
*/
- public function getTitle();
+ public function getTitle(): ?string;
/**
- * @param string $title
+ * @param string|null $title
*/
- public function setTitle($title);
+ public function setTitle(?string $title): void;
/**
* @return string|null
*/
- public function getDescription();
+ public function getDescription(): ?string;
/**
- * @param string $description
+ * @param string|null $description
*/
- public function setDescription($description);
+ public function setDescription(?string $description): void;
/**
- * @return ThemeAuthor[]
+ * @return array|ThemeAuthor[]
*/
- public function getAuthors();
+ public function getAuthors(): array;
/**
* @param ThemeAuthor $author
*/
- public function addAuthor(ThemeAuthor $author);
+ public function addAuthor(ThemeAuthor $author): void;
/**
* @param ThemeAuthor $author
*/
- public function removeAuthor(ThemeAuthor $author);
+ public function removeAuthor(ThemeAuthor $author): void;
/**
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*/
- public function getParents();
+ public function getParents(): array;
/**
* @param ThemeInterface $theme
*/
- public function addParent(ThemeInterface $theme);
+ public function addParent(ThemeInterface $theme): void;
/**
* @param ThemeInterface $theme
*/
- public function removeParent(ThemeInterface $theme);
+ public function removeParent(ThemeInterface $theme): void;
/**
- * @return ThemeScreenshot[]
+ * @return array|ThemeScreenshot[]
*/
- public function getScreenshots();
+ public function getScreenshots(): array;
/**
* @param ThemeScreenshot $screenshot
*/
- public function addScreenshot(ThemeScreenshot $screenshot);
+ public function addScreenshot(ThemeScreenshot $screenshot): void;
/**
* @param ThemeScreenshot $screenshot
*/
- public function removeScreenshot(ThemeScreenshot $screenshot);
+ public function removeScreenshot(ThemeScreenshot $screenshot): void;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Model/ThemeScreenshot.php b/src/Sylius/Bundle/ThemeBundle/Model/ThemeScreenshot.php
index ea00e009696..4b209d4ed65 100644
--- a/src/Sylius/Bundle/ThemeBundle/Model/ThemeScreenshot.php
+++ b/src/Sylius/Bundle/ThemeBundle/Model/ThemeScreenshot.php
@@ -36,7 +36,7 @@ final class ThemeScreenshot
/**
* @param string $path
*/
- public function __construct($path)
+ public function __construct(string $path)
{
$this->path = $path;
}
@@ -44,7 +44,7 @@ public function __construct($path)
/**
* @return string
*/
- public function getPath()
+ public function getPath(): string
{
return $this->path;
}
@@ -52,15 +52,15 @@ public function getPath()
/**
* @return string|null
*/
- public function getTitle()
+ public function getTitle(): ?string
{
return $this->title;
}
/**
- * @param string $title
+ * @param string|null $title
*/
- public function setTitle($title)
+ public function setTitle(?string $title): void
{
$this->title = $title;
}
@@ -68,15 +68,15 @@ public function setTitle($title)
/**
* @return string|null
*/
- public function getDescription()
+ public function getDescription(): ?string
{
return $this->description;
}
/**
- * @param string $description
+ * @param string|null $description
*/
- public function setDescription($description)
+ public function setDescription(?string $description): void
{
$this->description = $description;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Repository/InMemoryThemeRepository.php b/src/Sylius/Bundle/ThemeBundle/Repository/InMemoryThemeRepository.php
index 8734b0ba6b0..ef7e0923592 100644
--- a/src/Sylius/Bundle/ThemeBundle/Repository/InMemoryThemeRepository.php
+++ b/src/Sylius/Bundle/ThemeBundle/Repository/InMemoryThemeRepository.php
@@ -47,7 +47,7 @@ public function __construct(ThemeLoaderInterface $themeLoader)
/**
* {@inheritdoc}
*/
- public function findAll()
+ public function findAll(): array
{
$this->loadThemesIfNeeded();
@@ -57,17 +57,17 @@ public function findAll()
/**
* {@inheritdoc}
*/
- public function findOneByName($name)
+ public function findOneByName(string $name): ?ThemeInterface
{
$this->loadThemesIfNeeded();
- return isset($this->themes[$name]) ? $this->themes[$name] : null;
+ return $this->themes[$name] ?? null;
}
/**
* {@inheritdoc}
*/
- public function findOneByTitle($title)
+ public function findOneByTitle(string $title): ?ThemeInterface
{
$this->loadThemesIfNeeded();
@@ -80,7 +80,7 @@ public function findOneByTitle($title)
return null;
}
- private function loadThemesIfNeeded()
+ private function loadThemesIfNeeded(): void
{
if ($this->themesLoaded) {
return;
diff --git a/src/Sylius/Bundle/ThemeBundle/Repository/ThemeRepositoryInterface.php b/src/Sylius/Bundle/ThemeBundle/Repository/ThemeRepositoryInterface.php
index f4581936f07..4ebd3514171 100644
--- a/src/Sylius/Bundle/ThemeBundle/Repository/ThemeRepositoryInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Repository/ThemeRepositoryInterface.php
@@ -21,21 +21,21 @@
interface ThemeRepositoryInterface
{
/**
- * @return ThemeInterface[]
+ * @return array|ThemeInterface[]
*/
- public function findAll();
+ public function findAll(): array;
/**
* @param string $name
*
* @return ThemeInterface|null
*/
- public function findOneByName($name);
+ public function findOneByName(string $name): ?ThemeInterface;
/**
* @param string $title
*
* @return ThemeInterface|null
*/
- public function findOneByTitle($title);
+ public function findOneByTitle(string $title): ?ThemeInterface;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/SyliusThemeBundle.php b/src/Sylius/Bundle/ThemeBundle/SyliusThemeBundle.php
index d3350c0006a..68faf805b9d 100644
--- a/src/Sylius/Bundle/ThemeBundle/SyliusThemeBundle.php
+++ b/src/Sylius/Bundle/ThemeBundle/SyliusThemeBundle.php
@@ -30,7 +30,7 @@ final class SyliusThemeBundle extends Bundle
/**
* {@inheritdoc}
*/
- public function build(ContainerBuilder $container)
+ public function build(ContainerBuilder $container): void
{
/** @var SyliusThemeExtension $themeExtension */
$themeExtension = $container->getExtension('sylius_theme');
diff --git a/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Clearer/TemplatePathsCacheClearer.php b/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Clearer/TemplatePathsCacheClearer.php
index 3b0572fc028..32ad16ea7b8 100644
--- a/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Clearer/TemplatePathsCacheClearer.php
+++ b/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Clearer/TemplatePathsCacheClearer.php
@@ -38,7 +38,7 @@ public function __construct(Cache $cache)
/**
* {@inheritdoc}
*/
- public function clear($cacheDir)
+ public function clear($cacheDir): void
{
if (!$this->cache instanceof ClearableCache) {
return;
diff --git a/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Warmer/TemplatePathsCacheWarmer.php b/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Warmer/TemplatePathsCacheWarmer.php
index 05b265501c1..ce2b6d5c684 100644
--- a/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Warmer/TemplatePathsCacheWarmer.php
+++ b/src/Sylius/Bundle/ThemeBundle/Templating/Cache/Warmer/TemplatePathsCacheWarmer.php
@@ -68,7 +68,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function warmUp($cacheDir)
+ public function warmUp($cacheDir): void
{
$templates = $this->templateFinder->findAllTemplates();
@@ -81,7 +81,7 @@ public function warmUp($cacheDir)
/**
* {@inheritdoc}
*/
- public function isOptional()
+ public function isOptional(): bool
{
return true;
}
@@ -89,7 +89,7 @@ public function isOptional()
/**
* @param TemplateReferenceInterface $template
*/
- private function warmUpTemplate(TemplateReferenceInterface $template)
+ private function warmUpTemplate(TemplateReferenceInterface $template): void
{
/** @var ThemeInterface $theme */
foreach ($this->themeRepository->findAll() as $theme) {
@@ -101,7 +101,7 @@ private function warmUpTemplate(TemplateReferenceInterface $template)
* @param TemplateReferenceInterface $template
* @param ThemeInterface $theme
*/
- private function warmUpThemeTemplate(TemplateReferenceInterface $template, ThemeInterface $theme)
+ private function warmUpThemeTemplate(TemplateReferenceInterface $template, ThemeInterface $theme): void
{
try {
$location = $this->templateLocator->locateTemplate($template, $theme);
@@ -118,7 +118,7 @@ private function warmUpThemeTemplate(TemplateReferenceInterface $template, Theme
*
* @return string
*/
- private function getCacheKey(TemplateReferenceInterface $template, ThemeInterface $theme)
+ private function getCacheKey(TemplateReferenceInterface $template, ThemeInterface $theme): string
{
return $template->getLogicalName().'|'.$theme->getName();
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/CachedTemplateLocator.php b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/CachedTemplateLocator.php
index 9fb1337e39d..2fde10d1e92 100644
--- a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/CachedTemplateLocator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/CachedTemplateLocator.php
@@ -46,7 +46,7 @@ public function __construct(TemplateLocatorInterface $decoratedTemplateLocator,
/**
* {@inheritdoc}
*/
- public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme)
+ public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme): string
{
$cacheKey = $this->getCacheKey($template, $theme);
if ($this->cache->contains($cacheKey)) {
@@ -68,7 +68,7 @@ public function locateTemplate(TemplateReferenceInterface $template, ThemeInterf
*
* @return string
*/
- private function getCacheKey(TemplateReferenceInterface $template, ThemeInterface $theme)
+ private function getCacheKey(TemplateReferenceInterface $template, ThemeInterface $theme): string
{
return $template->getLogicalName().'|'.$theme->getName();
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateFileLocator.php b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateFileLocator.php
index 3471c8712d5..f9aac70d993 100644
--- a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateFileLocator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateFileLocator.php
@@ -69,13 +69,14 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function locate($template, $currentPath = null, $first = true)
+ public function locate($template, $currentPath = null, $first = true): string
{
if (!$template instanceof TemplateReferenceInterface) {
throw new \InvalidArgumentException('The template must be an instance of TemplateReferenceInterface.');
}
- $themes = $this->themeHierarchyProvider->getThemeHierarchy($this->themeContext->getTheme());
+ $theme = $this->themeContext->getTheme();
+ $themes = $theme !== null ? $this->themeHierarchyProvider->getThemeHierarchy($theme) : [];
foreach ($themes as $theme) {
try {
return $this->templateLocator->locateTemplate($template, $theme);
@@ -90,7 +91,7 @@ public function locate($template, $currentPath = null, $first = true)
/**
* {@inheritdoc}
*/
- public function serialize()
+ public function serialize(): string
{
return serialize($this->decoratedFileLocator);
}
@@ -98,7 +99,7 @@ public function serialize()
/**
* {@inheritdoc}
*/
- public function unserialize($serialized)
+ public function unserialize($serialized): void
{
$this->decoratedFileLocator = unserialize($serialized);
diff --git a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocator.php b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocator.php
index 41a0f1561b7..59ac413bb0f 100644
--- a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocator.php
@@ -38,7 +38,7 @@ public function __construct(ResourceLocatorInterface $resourceLocator)
/**
* {@inheritdoc}
*/
- public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme)
+ public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme): string
{
return $this->resourceLocator->locateResource($template->getPath(), $theme);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocatorInterface.php b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocatorInterface.php
index 1e1de160da1..7c39e38d824 100644
--- a/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocatorInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Templating/Locator/TemplateLocatorInterface.php
@@ -30,5 +30,5 @@ interface TemplateLocatorInterface
*
* @throws ResourceNotFoundException
*/
- public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme);
+ public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme): string;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Templating/TemplateNameParser.php b/src/Sylius/Bundle/ThemeBundle/Templating/TemplateNameParser.php
index a3ae6bcbffa..6b6ecb937c5 100644
--- a/src/Sylius/Bundle/ThemeBundle/Templating/TemplateNameParser.php
+++ b/src/Sylius/Bundle/ThemeBundle/Templating/TemplateNameParser.php
@@ -37,7 +37,7 @@ final class TemplateNameParser implements TemplateNameParserInterface
private $kernel;
/**
- * @var TemplateReferenceInterface[]
+ * @var array|TemplateReferenceInterface[]
*/
private $cache = [];
@@ -54,11 +54,13 @@ public function __construct(TemplateNameParserInterface $decoratedParser, Kernel
/**
* {@inheritdoc}
*/
- public function parse($name)
+ public function parse($name): TemplateReferenceInterface
{
if ($name instanceof TemplateReferenceInterface) {
return $name;
- } elseif (isset($this->cache[$name])) {
+ }
+
+ if (isset($this->cache[$name])) {
return $this->cache[$name];
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Configuration/ThemeConfigurationTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Configuration/ThemeConfigurationTest.php
index 5bfa5c339dd..48796a51e12 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Configuration/ThemeConfigurationTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Configuration/ThemeConfigurationTest.php
@@ -15,6 +15,7 @@
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use Sylius\Bundle\ThemeBundle\Configuration\ThemeConfiguration;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* @author Kamil Kokot
@@ -26,7 +27,7 @@ final class ThemeConfigurationTest extends \PHPUnit_Framework_TestCase
/**
* @test
*/
- public function it_requires_only_name()
+ public function it_requires_only_name(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -40,7 +41,7 @@ public function it_requires_only_name()
/**
* @test
*/
- public function its_name_is_required_and_cannot_be_empty()
+ public function its_name_is_required_and_cannot_be_empty(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -60,7 +61,7 @@ public function its_name_is_required_and_cannot_be_empty()
/**
* @test
*/
- public function its_title_is_optional_but_cannot_be_empty()
+ public function its_title_is_optional_but_cannot_be_empty(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -80,7 +81,7 @@ public function its_title_is_optional_but_cannot_be_empty()
/**
* @test
*/
- public function its_description_is_optional_but_cannot_be_empty()
+ public function its_description_is_optional_but_cannot_be_empty(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -100,7 +101,7 @@ public function its_description_is_optional_but_cannot_be_empty()
/**
* @test
*/
- public function its_path_is_optional_but_cannot_be_empty()
+ public function its_path_is_optional_but_cannot_be_empty(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -120,7 +121,7 @@ public function its_path_is_optional_but_cannot_be_empty()
/**
* @test
*/
- public function its_authors_are_optional()
+ public function its_authors_are_optional(): void
{
$this->assertConfigurationIsValid(
[
@@ -133,7 +134,7 @@ public function its_authors_are_optional()
/**
* @test
*/
- public function its_author_can_have_only_name_email_homepage_and_role_properties()
+ public function its_author_can_have_only_name_email_homepage_and_role_properties(): void
{
$this->assertConfigurationIsValid(
[
@@ -174,7 +175,7 @@ public function its_author_can_have_only_name_email_homepage_and_role_properties
/**
* @test
*/
- public function its_author_must_have_at_least_one_property()
+ public function its_author_must_have_at_least_one_property(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -188,7 +189,7 @@ public function its_author_must_have_at_least_one_property()
/**
* @test
*/
- public function its_authors_replaces_other_authors_defined_elsewhere()
+ public function its_authors_replaces_other_authors_defined_elsewhere(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -203,7 +204,7 @@ public function its_authors_replaces_other_authors_defined_elsewhere()
/**
* @test
*/
- public function it_ignores_undefined_root_level_fields()
+ public function it_ignores_undefined_root_level_fields(): void
{
$this->assertConfigurationIsValid(
[
@@ -215,7 +216,7 @@ public function it_ignores_undefined_root_level_fields()
/**
* @test
*/
- public function its_parents_are_optional_but_has_to_have_at_least_one_element()
+ public function its_parents_are_optional_but_has_to_have_at_least_one_element(): void
{
$this->assertConfigurationIsValid(
[
@@ -235,7 +236,7 @@ public function its_parents_are_optional_but_has_to_have_at_least_one_element()
/**
* @test
*/
- public function its_parent_is_strings()
+ public function its_parent_is_strings(): void
{
$this->assertConfigurationIsValid(
[
@@ -248,7 +249,7 @@ public function its_parent_is_strings()
/**
* @test
*/
- public function its_parent_cannot_be_empty()
+ public function its_parent_cannot_be_empty(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -261,7 +262,7 @@ public function its_parent_cannot_be_empty()
/**
* @test
*/
- public function its_parents_replaces_other_parents_defined_elsewhere()
+ public function its_parents_replaces_other_parents_defined_elsewhere(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -276,7 +277,7 @@ public function its_parents_replaces_other_parents_defined_elsewhere()
/**
* @test
*/
- public function its_screenshots_are_strings()
+ public function its_screenshots_are_strings(): void
{
$this->assertConfigurationIsValid(
[
@@ -289,7 +290,7 @@ public function its_screenshots_are_strings()
/**
* @test
*/
- public function its_screenshots_are_optional()
+ public function its_screenshots_are_optional(): void
{
$this->assertConfigurationIsValid(
[
@@ -302,7 +303,7 @@ public function its_screenshots_are_optional()
/**
* @test
*/
- public function its_screenshots_must_have_at_least_one_element()
+ public function its_screenshots_must_have_at_least_one_element(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -315,7 +316,7 @@ public function its_screenshots_must_have_at_least_one_element()
/**
* @test
*/
- public function its_screenshots_cannot_be_empty()
+ public function its_screenshots_cannot_be_empty(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -328,7 +329,7 @@ public function its_screenshots_cannot_be_empty()
/**
* @test
*/
- public function its_screenshots_replaces_other_screenshots_defined_elsewhere()
+ public function its_screenshots_replaces_other_screenshots_defined_elsewhere(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -343,7 +344,7 @@ public function its_screenshots_replaces_other_screenshots_defined_elsewhere()
/**
* @test
*/
- public function its_screenshots_are_an_array()
+ public function its_screenshots_are_an_array(): void
{
$this->assertConfigurationIsValid(
[
@@ -356,7 +357,7 @@ public function its_screenshots_are_an_array()
/**
* @test
*/
- public function its_screenshots_must_have_a_path()
+ public function its_screenshots_must_have_a_path(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -369,7 +370,7 @@ public function its_screenshots_must_have_a_path()
/**
* @test
*/
- public function its_screenshots_have_optional_title_and_description()
+ public function its_screenshots_have_optional_title_and_description(): void
{
$this->assertConfigurationIsValid(
[
@@ -386,7 +387,7 @@ public function its_screenshots_have_optional_title_and_description()
/**
* {@inheritdoc}
*/
- protected function getConfiguration()
+ protected function getConfiguration(): ConfigurationInterface
{
return new ThemeConfiguration();
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/ConfigurationTest.php
index 5866160cc93..e8a4030b182 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -15,6 +15,7 @@
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use Sylius\Bundle\ThemeBundle\DependencyInjection\Configuration;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* @author Kamil Kokot
@@ -26,7 +27,7 @@ final class ConfigurationTest extends \PHPUnit_Framework_TestCase
/**
* @test
*/
- public function it_has_default_context_service_set()
+ public function it_has_default_context_service_set(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -40,7 +41,7 @@ public function it_has_default_context_service_set()
/**
* @test
*/
- public function its_context_cannot_be_empty()
+ public function its_context_cannot_be_empty(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -53,7 +54,7 @@ public function its_context_cannot_be_empty()
/**
* @test
*/
- public function its_context_can_be_overridden()
+ public function its_context_can_be_overridden(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -130,7 +131,7 @@ public function translations_support_may_be_toggled()
/**
* {@inheritdoc}
*/
- protected function getConfiguration()
+ protected function getConfiguration(): ConfigurationInterface
{
return new Configuration();
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/ConfigurationTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/ConfigurationTest.php
index f9aa4bc30e2..4a4152569bd 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/ConfigurationTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/ConfigurationTest.php
@@ -16,6 +16,7 @@
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use Sylius\Bundle\ThemeBundle\Configuration\Filesystem\FilesystemConfigurationSourceFactory;
use Sylius\Bundle\ThemeBundle\DependencyInjection\Configuration;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* @author Kamil Kokot
@@ -27,7 +28,7 @@ final class ConfigurationTest extends \PHPUnit_Framework_TestCase
/**
* @test
*/
- public function it_uses_app_themes_filesystem_as_the_default_source()
+ public function it_uses_app_themes_filesystem_as_the_default_source(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -45,7 +46,7 @@ public function it_uses_app_themes_filesystem_as_the_default_source()
/**
* @test
*/
- public function it_does_not_add_default_theme_directories_if_there_are_some_defined_by_user()
+ public function it_does_not_add_default_theme_directories_if_there_are_some_defined_by_user(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -63,7 +64,7 @@ public function it_does_not_add_default_theme_directories_if_there_are_some_defi
/**
* @test
*/
- public function it_uses_the_last_theme_directories_passed_and_rejects_the_other_ones()
+ public function it_uses_the_last_theme_directories_passed_and_rejects_the_other_ones(): void
{
$this->assertProcessedConfigurationEquals(
[
@@ -82,7 +83,7 @@ public function it_uses_the_last_theme_directories_passed_and_rejects_the_other_
/**
* @test
*/
- public function it_is_invalid_to_pass_a_string_as_theme_directories()
+ public function it_is_invalid_to_pass_a_string_as_theme_directories(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -95,7 +96,7 @@ public function it_is_invalid_to_pass_a_string_as_theme_directories()
/**
* @test
*/
- public function it_throws_an_error_if_trying_to_set_theme_directories_to_an_empty_array()
+ public function it_throws_an_error_if_trying_to_set_theme_directories_to_an_empty_array(): void
{
$this->assertPartialConfigurationIsInvalid(
[
@@ -108,7 +109,7 @@ public function it_throws_an_error_if_trying_to_set_theme_directories_to_an_empt
/**
* {@inheritdoc}
*/
- protected function getConfiguration()
+ protected function getConfiguration(): ConfigurationInterface
{
return new Configuration([
new FilesystemConfigurationSourceFactory(),
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/SyliusThemeExtensionTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/SyliusThemeExtensionTest.php
index 2a886e24170..ac8ff5ae21d 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/SyliusThemeExtensionTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/FilesystemSource/SyliusThemeExtensionTest.php
@@ -25,7 +25,7 @@ final class SyliusThemeExtensionTest extends AbstractExtensionTestCase
/**
* @test
*/
- public function it_does_not_register_a_provider_while_it_is_disabled()
+ public function it_does_not_register_a_provider_while_it_is_disabled(): void
{
$this->load(['sources' => ['filesystem' => false]]);
@@ -39,7 +39,7 @@ public function it_does_not_register_a_provider_while_it_is_disabled()
/**
* {@inheritdoc}
*/
- protected function getContainerExtensions()
+ protected function getContainerExtensions(): array
{
$themeExtension = new SyliusThemeExtension();
$themeExtension->addConfigurationSourceFactory(new FilesystemConfigurationSourceFactory());
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/SyliusThemeExtensionTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/SyliusThemeExtensionTest.php
index 8d345a4fed4..3a9b4155cf5 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/SyliusThemeExtensionTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/DependencyInjection/SyliusThemeExtensionTest.php
@@ -24,7 +24,7 @@ final class SyliusThemeExtensionTest extends AbstractExtensionTestCase
/**
* @test
*/
- public function it_aliases_configured_theme_context_service()
+ public function it_aliases_configured_theme_context_service(): void
{
$this->load(['context' => 'sylius.theme.context.custom']);
@@ -34,7 +34,7 @@ public function it_aliases_configured_theme_context_service()
/**
* @test
*/
- public function it_loads_all_the_supported_features_by_default()
+ public function it_loads_all_the_supported_features_by_default(): void
{
$this->load([]);
@@ -46,7 +46,7 @@ public function it_loads_all_the_supported_features_by_default()
/**
* @test
*/
- public function it_does_not_load_assets_support_if_its_disabled()
+ public function it_does_not_load_assets_support_if_its_disabled(): void
{
$this->load(['assets' => ['enabled' => false]]);
@@ -56,7 +56,7 @@ public function it_does_not_load_assets_support_if_its_disabled()
/**
* @test
*/
- public function it_does_not_load_templating_support_if_its_disabled()
+ public function it_does_not_load_templating_support_if_its_disabled(): void
{
$this->load(['templating' => ['enabled' => false]]);
@@ -66,7 +66,7 @@ public function it_does_not_load_templating_support_if_its_disabled()
/**
* @test
*/
- public function it_does_not_load_translations_support_if_its_disabled()
+ public function it_does_not_load_translations_support_if_its_disabled(): void
{
$this->load(['translations' => ['enabled' => false]]);
@@ -76,7 +76,7 @@ public function it_does_not_load_translations_support_if_its_disabled()
/**
* {@inheritdoc}
*/
- protected function getContainerExtensions()
+ protected function getContainerExtensions(): array
{
return [
new SyliusThemeExtension(),
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/AssetTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/AssetTest.php
index aeb46b0fa49..45826f0e994 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/AssetTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/AssetTest.php
@@ -34,7 +34,7 @@ protected function tearDown()
*
* @param int $symlinkMask
*/
- public function it_dumps_assets($symlinkMask)
+ public function it_dumps_assets($symlinkMask): void
{
$client = self::createClient();
@@ -54,7 +54,7 @@ public function it_dumps_assets($symlinkMask)
*
* @param int $symlinkMask
*/
- public function it_updates_dumped_assets_if_they_are_modified($symlinkMask)
+ public function it_updates_dumped_assets_if_they_are_modified($symlinkMask): void
{
$client = self::createClient();
@@ -80,7 +80,7 @@ public function it_updates_dumped_assets_if_they_are_modified($symlinkMask)
*
* @param int $symlinkMask
*/
- public function it_dumps_assets_correctly_even_if_nothing_has_changed($symlinkMask)
+ public function it_dumps_assets_correctly_even_if_nothing_has_changed($symlinkMask): void
{
$client = self::createClient();
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php
index c4f1250cc76..ac25ce584cb 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/SyliusThemeBundleTest.php
@@ -25,7 +25,7 @@ final class SyliusThemeBundleTest extends KernelTestCase
/**
* @test
*/
- public function its_services_are_initializable()
+ public function its_services_are_initializable(): void
{
static::bootKernel();
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TemplatingTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TemplatingTest.php
index 7e3be30a012..f1102546e6f 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TemplatingTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TemplatingTest.php
@@ -27,7 +27,7 @@ final class TemplatingTest extends WebTestCase
* @param string $templateName
* @param string $contents
*/
- public function it_renders_bundle_templates($templateName, $contents)
+ public function it_renders_bundle_templates($templateName, $contents): void
{
$client = self::createClient();
@@ -56,7 +56,7 @@ public function getBundleTemplates()
* @param string $templateName
* @param string $contents
*/
- public function it_renders_bundle_templates_using_namespaced_paths($templateName, $contents)
+ public function it_renders_bundle_templates_using_namespaced_paths($templateName, $contents): void
{
$client = self::createClient();
@@ -85,7 +85,7 @@ public function getBundleTemplatesUsingNamespacedPaths()
* @param string $templateName
* @param string $contents
*/
- public function it_renders_application_templates($templateName, $contents)
+ public function it_renders_application_templates($templateName, $contents): void
{
$client = self::createClient();
@@ -112,7 +112,7 @@ public function getAppTemplates()
* @param string $templateName
* @param string $contents
*/
- public function it_renders_application_templates_using_namespaced_paths($templateName, $contents)
+ public function it_renders_application_templates_using_namespaced_paths($templateName, $contents): void
{
$client = self::createClient();
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TranslationTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TranslationTest.php
index 674699d280e..251c0902b76 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TranslationTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Functional/TranslationTest.php
@@ -23,7 +23,7 @@ final class TranslationTest extends WebTestCase
/**
* @test
*/
- public function it_respects_theming_logic_while_translating_messages()
+ public function it_respects_theming_logic_while_translating_messages(): void
{
$client = self::createClient();
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPassTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPassTest.php
index e906af0d41c..291c90ece63 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPassTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPassTest.php
@@ -26,7 +26,7 @@ final class TranslatorFallbackLocalesPassTest extends AbstractCompilerPassTestCa
/**
* @test
*/
- public function it_copies_method_call_that_sets_fallback_locales_to_theme_translator()
+ public function it_copies_method_call_that_sets_fallback_locales_to_theme_translator(): void
{
$symfonyTranslatorDefinition = new Definition();
$symfonyTranslatorDefinition->addMethodCall('setFallbackLocales', ['pl_PL']);
@@ -46,7 +46,7 @@ public function it_copies_method_call_that_sets_fallback_locales_to_theme_transl
/**
* @test
*/
- public function it_filters_out_other_method_calls_to_symfony_translator()
+ public function it_filters_out_other_method_calls_to_symfony_translator(): void
{
$symfonyTranslatorDefinition = new Definition();
$symfonyTranslatorDefinition->addMethodCall('doFooAndBar', ['argument1', 'argument2']);
@@ -68,7 +68,7 @@ public function it_filters_out_other_method_calls_to_symfony_translator()
/**
* @test
*/
- public function it_copies_method_calls_that_set_fallback_locales_to_theme_translator()
+ public function it_copies_method_calls_that_set_fallback_locales_to_theme_translator(): void
{
$symfonyTranslatorDefinition = new Definition();
$symfonyTranslatorDefinition->addMethodCall('setFallbackLocales', ['pl_PL']);
@@ -95,7 +95,7 @@ public function it_copies_method_calls_that_set_fallback_locales_to_theme_transl
/**
* @test
*/
- public function it_does_not_force_symfony_translator_to_have_any_method_calls()
+ public function it_does_not_force_symfony_translator_to_have_any_method_calls(): void
{
$this->setDefinition('translator.default', new Definition());
$this->setDefinition('sylius.theme.translation.translator', new Definition());
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPassTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPassTest.php
index 8725e57b384..a45dd141f1f 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPassTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPassTest.php
@@ -27,7 +27,7 @@ final class TranslatorLoaderProviderPassTest extends AbstractCompilerPassTestCas
/**
* @test
*/
- public function it_adds_translation_loaders_to_sylius_loader_provider()
+ public function it_adds_translation_loaders_to_sylius_loader_provider(): void
{
$this->setDefinition('sylius.theme.translation.loader_provider', new Definition(null, [[]]));
@@ -47,7 +47,7 @@ public function it_adds_translation_loaders_to_sylius_loader_provider()
/**
* @test
*/
- public function it_adds_translation_loaders_with_its_legacy_alias_to_sylius_loader_provider()
+ public function it_adds_translation_loaders_with_its_legacy_alias_to_sylius_loader_provider(): void
{
$this->setDefinition('sylius.theme.translation.loader_provider', new Definition(null, [[]]));
@@ -67,7 +67,7 @@ public function it_adds_translation_loaders_with_its_legacy_alias_to_sylius_load
/**
* @test
*/
- public function it_adds_translation_loaders_using_only_the_first_tag_alias()
+ public function it_adds_translation_loaders_using_only_the_first_tag_alias(): void
{
$this->setDefinition('sylius.theme.translation.loader_provider', new Definition(null, [[]]));
@@ -88,7 +88,7 @@ public function it_adds_translation_loaders_using_only_the_first_tag_alias()
/**
* @test
*/
- public function it_does_not_force_the_existence_of_translation_loaders()
+ public function it_does_not_force_the_existence_of_translation_loaders(): void
{
$this->setDefinition('sylius.theme.translation.loader_provider', new Definition(null, [[]]));
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPassTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPassTest.php
index f81021e9eda..f81afefd5df 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPassTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPassTest.php
@@ -26,7 +26,7 @@ final class TranslatorResourceProviderPassTest extends AbstractCompilerPassTestC
/**
* @test
*/
- public function it_copies_resource_files_from_symfony_translator_to_sylius_resource_provider()
+ public function it_copies_resource_files_from_symfony_translator_to_sylius_resource_provider(): void
{
$symfonyTranslatorDefinition = new Definition(null, [
null,
@@ -53,7 +53,7 @@ public function it_copies_resource_files_from_symfony_translator_to_sylius_resou
/**
* @test
*/
- public function it_merges_copied_resource_files_from_symfony_translator_with_existing_resource_files_from_sylius_resource_provider()
+ public function it_merges_copied_resource_files_from_symfony_translator_with_existing_resource_files_from_sylius_resource_provider(): void
{
$symfonyTranslatorDefinition = new Definition(null, [
null,
@@ -79,7 +79,7 @@ public function it_merges_copied_resource_files_from_symfony_translator_with_exi
/**
* @test
*/
- public function it_does_not_copy_anything_if_symfony_translator_does_not_have_resource_files()
+ public function it_does_not_copy_anything_if_symfony_translator_does_not_have_resource_files(): void
{
$symfonyTranslatorDefinition = new Definition(null, [
null,
@@ -103,7 +103,7 @@ public function it_does_not_copy_anything_if_symfony_translator_does_not_have_re
/**
* @test
*/
- public function it_copies_resource_files_from_symfony_translator_33_to_sylius_resource_provider()
+ public function it_copies_resource_files_from_symfony_translator_33_to_sylius_resource_provider(): void
{
$symfonyTranslatorDefinition = new Definition(null, [
null,
@@ -131,7 +131,7 @@ public function it_copies_resource_files_from_symfony_translator_33_to_sylius_re
/**
* @test
*/
- public function it_does_not_crash_if_definition_does_not_have_resource_files_at_all()
+ public function it_does_not_crash_if_definition_does_not_have_resource_files_at_all(): void
{
$symfonyTranslatorDefinition = new Definition(null, [null, null]);
$this->setDefinition('translator.default', $symfonyTranslatorDefinition);
diff --git a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/TranslatorTest.php b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/TranslatorTest.php
index aadcc0e4ee9..1457c901441 100644
--- a/src/Sylius/Bundle/ThemeBundle/Tests/Translation/TranslatorTest.php
+++ b/src/Sylius/Bundle/ThemeBundle/Tests/Translation/TranslatorTest.php
@@ -33,7 +33,7 @@ final class TranslatorTest extends \PHPUnit_Framework_TestCase
* @dataProvider getInvalidOptionsTests
* @expectedException \InvalidArgumentException
*/
- public function it_throws_exception_on_instantiating_with_invalid_options(array $options)
+ public function it_throws_exception_on_instantiating_with_invalid_options(array $options): void
{
$this->createTranslator('en', $options);
}
@@ -42,7 +42,7 @@ public function it_throws_exception_on_instantiating_with_invalid_options(array
* @test
* @dataProvider getValidOptionsTests
*/
- public function it_instantiates_with_valid_options(array $options)
+ public function it_instantiates_with_valid_options(array $options): void
{
$this->createTranslator('en', $options);
}
@@ -52,7 +52,7 @@ public function it_instantiates_with_valid_options(array $options)
* @dataProvider getInvalidLocalesTests
* @expectedException \InvalidArgumentException
*/
- public function it_throws_exception_on_instantiating_with_invalid_locale($locale)
+ public function it_throws_exception_on_instantiating_with_invalid_locale($locale): void
{
$this->createTranslator($locale);
}
@@ -61,7 +61,7 @@ public function it_throws_exception_on_instantiating_with_invalid_locale($locale
* @test
* @dataProvider getAllValidLocalesTests
*/
- public function it_instantiates_with_valid_locale($locale)
+ public function it_instantiates_with_valid_locale($locale): void
{
$translator = $this->createTranslator($locale);
@@ -73,7 +73,7 @@ public function it_instantiates_with_valid_locale($locale)
* @dataProvider getInvalidLocalesTests
* @expectedException InvalidArgumentException
*/
- public function its_throws_exception_on_setting_invalid_fallback_locales($locale)
+ public function its_throws_exception_on_setting_invalid_fallback_locales($locale): void
{
$translator = $this->createTranslator('fr');
$translator->setFallbackLocales(['fr', $locale]);
@@ -83,7 +83,7 @@ public function its_throws_exception_on_setting_invalid_fallback_locales($locale
* @test
* @dataProvider getAllValidLocalesTests
*/
- public function its_fallback_locales_can_be_set_only_if_valid($locale)
+ public function its_fallback_locales_can_be_set_only_if_valid($locale): void
{
$translator = $this->createTranslator('fr');
$translator->setFallbackLocales(['fr', $locale]);
@@ -93,7 +93,7 @@ public function its_fallback_locales_can_be_set_only_if_valid($locale)
* @test
* @dataProvider getAllValidLocalesTests
*/
- public function it_adds_resources_with_valid_locales($locale)
+ public function it_adds_resources_with_valid_locales($locale): void
{
$translator = $this->createTranslator('fr');
$translator->addResource('array', ['foo' => 'foofoo'], $locale);
@@ -103,7 +103,7 @@ public function it_adds_resources_with_valid_locales($locale)
* @test
* @dataProvider getAllValidLocalesTests
*/
- public function it_translates_valid_locales($locale)
+ public function it_translates_valid_locales($locale): void
{
$translator = $this->createTranslator($locale);
$translator->addLoader('array', new ArrayLoader());
@@ -116,7 +116,7 @@ public function it_translates_valid_locales($locale)
/**
* @test
*/
- public function it_translates_to_a_fallback_locale()
+ public function it_translates_to_a_fallback_locale(): void
{
$translator = $this->createTranslator('en');
$translator->setFallbackLocales(['fr']);
@@ -131,7 +131,7 @@ public function it_translates_to_a_fallback_locale()
/**
* @test
*/
- public function it_can_have_multiple_fallback_locales()
+ public function it_can_have_multiple_fallback_locales(): void
{
$translator = $this->createTranslator('en');
$translator->setFallbackLocales(['de', 'fr']);
@@ -149,7 +149,7 @@ public function it_can_have_multiple_fallback_locales()
* @test
* @dataProvider getThemelessLocalesTests
*/
- public function it_gets_catalogue_with_fallback_catalogues_of_a_simple_locale($locale)
+ public function it_gets_catalogue_with_fallback_catalogues_of_a_simple_locale($locale): void
{
$translator = $this->createTranslator($locale);
$catalogue = new MessageCatalogue($locale);
@@ -161,7 +161,7 @@ public function it_gets_catalogue_with_fallback_catalogues_of_a_simple_locale($l
* @test
* @dataProvider getThemedLocalesTests
*/
- public function it_gets_catalogue_with_fallback_catalogues_of_a_themed_locale($locale)
+ public function it_gets_catalogue_with_fallback_catalogues_of_a_themed_locale($locale): void
{
$translator = $this->createTranslator($locale);
@@ -176,7 +176,7 @@ public function it_gets_catalogue_with_fallback_catalogues_of_a_themed_locale($l
/**
* @test
*/
- public function it_creates_a_nested_catalogue_with_fallback_translations_of_a_territorial_locale()
+ public function it_creates_a_nested_catalogue_with_fallback_translations_of_a_territorial_locale(): void
{
$translator = $this->createTranslator('fr_FR');
@@ -191,7 +191,7 @@ public function it_creates_a_nested_catalogue_with_fallback_translations_of_a_te
/**
* @test
*/
- public function it_creates_a_nested_catalogue_with_fallback_translations_of_a_themed_locale()
+ public function it_creates_a_nested_catalogue_with_fallback_translations_of_a_themed_locale(): void
{
$translator = $this->createTranslator('fr_FR@heron');
@@ -212,7 +212,7 @@ public function it_creates_a_nested_catalogue_with_fallback_translations_of_a_th
/**
* @test
*/
- public function it_creates_a_nested_catalogue_with_fallback_translations_with_duplicated_additional_fallbacks()
+ public function it_creates_a_nested_catalogue_with_fallback_translations_with_duplicated_additional_fallbacks(): void
{
$translator = $this->createTranslator('fr_FR@heron');
$translator->setFallbackLocales(['fr_FR', 'fr']);
@@ -234,7 +234,7 @@ public function it_creates_a_nested_catalogue_with_fallback_translations_with_du
/**
* @test
*/
- public function it_creates_a_nested_catalogue_with_fallback_translations()
+ public function it_creates_a_nested_catalogue_with_fallback_translations(): void
{
$translator = $this->createTranslator('fr_FR@heron');
$translator->setFallbackLocales(['en_US', 'en']);
@@ -319,7 +319,6 @@ public function getThemelessLocalesTests()
{
return [
[''],
- [null],
['fr'],
['francais'],
['FR'],
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPass.php b/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPass.php
index 1a21ec6146a..7d614193221 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPass.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorFallbackLocalesPass.php
@@ -24,7 +24,7 @@ final class TranslatorFallbackLocalesPass implements CompilerPassInterface
/**
* {@inheritdoc}
*/
- public function process(ContainerBuilder $container)
+ public function process(ContainerBuilder $container): void
{
try {
$symfonyTranslator = $container->findDefinition('translator.default');
@@ -33,7 +33,7 @@ public function process(ContainerBuilder $container)
return;
}
- $methodCalls = array_filter($symfonyTranslator->getMethodCalls(), function (array $methodCall) {
+ $methodCalls = array_filter($symfonyTranslator->getMethodCalls(), function (array $methodCall): bool {
return 'setFallbackLocales' === $methodCall[0];
});
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPass.php b/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPass.php
index 5a06ac02bac..6db24390dcd 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPass.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorLoaderProviderPass.php
@@ -26,7 +26,7 @@ final class TranslatorLoaderProviderPass implements CompilerPassInterface
/**
* {@inheritdoc}
*/
- public function process(ContainerBuilder $container)
+ public function process(ContainerBuilder $container): void
{
try {
$loaderProvider = $container->findDefinition('sylius.theme.translation.loader_provider');
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPass.php b/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPass.php
index a4cf7e1fd76..b78c49bc10b 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPass.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/DependencyInjection/Compiler/TranslatorResourceProviderPass.php
@@ -26,7 +26,7 @@ final class TranslatorResourceProviderPass implements CompilerPassInterface
/**
* {@inheritdoc}
*/
- public function process(ContainerBuilder $container)
+ public function process(ContainerBuilder $container): void
{
try {
$symfonyTranslator = $container->findDefinition('translator.default');
@@ -48,7 +48,7 @@ public function process(ContainerBuilder $container)
*
* @return array
*/
- private function extractResourcesFilesFromSymfonyTranslator(Definition $symfonyTranslator)
+ private function extractResourcesFilesFromSymfonyTranslator(Definition $symfonyTranslator): array
{
try {
$options = $symfonyTranslator->getArgument(3);
@@ -60,7 +60,7 @@ private function extractResourcesFilesFromSymfonyTranslator(Definition $symfonyT
$options = [];
}
- $languagesFiles = isset($options['resource_files']) ? $options['resource_files'] : [];
+ $languagesFiles = $options['resource_files'] ?? [];
$resourceFiles = [];
foreach ($languagesFiles as $language => $files) {
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Finder/OrderingTranslationFilesFinder.php b/src/Sylius/Bundle/ThemeBundle/Translation/Finder/OrderingTranslationFilesFinder.php
index 1107e98c86a..fdd894d08c8 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Finder/OrderingTranslationFilesFinder.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Finder/OrderingTranslationFilesFinder.php
@@ -31,11 +31,11 @@ public function __construct(TranslationFilesFinderInterface $translationFilesFin
$this->translationFilesFinder = $translationFilesFinder;
}
- public function findTranslationFiles($path)
+ public function findTranslationFiles(string $path): array
{
$files = $this->translationFilesFinder->findTranslationFiles($path);
- usort($files, function ($firstFile, $secondFile) use ($path) {
+ usort($files, function (string $firstFile, string $secondFile) use ($path): int {
$firstFile = str_replace($path, '', $firstFile);
$secondFile = str_replace($path, '', $secondFile);
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinder.php b/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinder.php
index 869f871ee92..42444faa9c3 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinder.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinder.php
@@ -14,6 +14,7 @@
namespace Sylius\Bundle\ThemeBundle\Translation\Finder;
use Sylius\Bundle\ThemeBundle\Factory\FinderFactoryInterface;
+use Symfony\Component\Finder\SplFileInfo;
/**
* @author Kamil Kokot
@@ -36,7 +37,7 @@ public function __construct(FinderFactoryInterface $finderFactory)
/**
* {@inheritdoc}
*/
- public function findTranslationFiles($path)
+ public function findTranslationFiles(string $path): array
{
$themeFiles = $this->getFiles($path);
@@ -57,9 +58,9 @@ public function findTranslationFiles($path)
/**
* @param string $path
*
- * @return \Iterator|SplFileInfo[]
+ * @return iterable|SplFileInfo[]
*/
- private function getFiles($path)
+ private function getFiles(string $path): iterable
{
$finder = $this->finderFactory->create();
@@ -76,7 +77,7 @@ private function getFiles($path)
*
* @return bool
*/
- private function isTranslationFile($file)
+ private function isTranslationFile(string $file): bool
{
return false !== strpos($file, 'translations/')
&& (bool) preg_match('/^[^\.]+?\.[a-zA-Z_]{2,}?\.[a-z0-9]{2,}?$/', basename($file));
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinderInterface.php b/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinderInterface.php
index 73cd59fffd6..aa453069f26 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinderInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Finder/TranslationFilesFinderInterface.php
@@ -23,5 +23,5 @@ interface TranslationFilesFinderInterface
*
* @return array Paths to translation files
*/
- public function findTranslationFiles($path);
+ public function findTranslationFiles(string $path): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProvider.php b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProvider.php
index eba553c6e91..e2dec376ace 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProvider.php
@@ -36,7 +36,7 @@ public function __construct(array $loaders = [])
/**
* {@inheritdoc}
*/
- public function getLoaders()
+ public function getLoaders(): array
{
return $this->loaders;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProviderInterface.php b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProviderInterface.php
index d5934662877..8e5cc1dc320 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProviderInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Loader/TranslatorLoaderProviderInterface.php
@@ -21,5 +21,5 @@ interface TranslatorLoaderProviderInterface
/**
* @return array Format => Loader
*/
- public function getLoaders();
+ public function getLoaders(): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/CompositeTranslatorResourceProvider.php b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/CompositeTranslatorResourceProvider.php
index 4a0120d33a9..bbdb419085e 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/CompositeTranslatorResourceProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/CompositeTranslatorResourceProvider.php
@@ -34,7 +34,7 @@ public function __construct(array $resourceProviders = [])
/**
* {@inheritdoc}
*/
- public function getResources()
+ public function getResources(): array
{
$resources = [];
@@ -48,7 +48,7 @@ public function getResources()
/**
* {@inheritdoc}
*/
- public function getResourcesLocales()
+ public function getResourcesLocales(): array
{
$resourcesLocales = [];
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/ThemeTranslatorResourceProvider.php b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/ThemeTranslatorResourceProvider.php
index 12ad52c652b..c3a475b48be 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/ThemeTranslatorResourceProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/ThemeTranslatorResourceProvider.php
@@ -58,7 +58,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function getResources()
+ public function getResources(): array
{
/** @var ThemeInterface[] $themes */
$themes = $this->themeRepository->findAll();
@@ -74,9 +74,9 @@ public function getResources()
/**
* {@inheritdoc}
*/
- public function getResourcesLocales()
+ public function getResourcesLocales(): array
{
- return array_values(array_unique(array_map(function (TranslationResourceInterface $translationResource) {
+ return array_values(array_unique(array_map(function (TranslationResourceInterface $translationResource): string {
return $translationResource->getLocale();
}, $this->getResources())));
}
@@ -86,7 +86,7 @@ public function getResourcesLocales()
*
* @return array
*/
- private function extractResourcesFromTheme(ThemeInterface $mainTheme)
+ private function extractResourcesFromTheme(ThemeInterface $mainTheme): array
{
/** @var ThemeInterface[] $themes */
$themes = array_reverse($this->themeHierarchyProvider->getThemeHierarchy($mainTheme));
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProvider.php b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProvider.php
index 52617dd0f97..17d17a58ed6 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProvider.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProvider.php
@@ -47,7 +47,7 @@ public function __construct(array $filepaths = [])
/**
* {@inheritdoc}
*/
- public function getResources()
+ public function getResources(): array
{
$this->initializeIfNeeded();
@@ -57,14 +57,14 @@ public function getResources()
/**
* {@inheritdoc}
*/
- public function getResourcesLocales()
+ public function getResourcesLocales(): array
{
$this->initializeIfNeeded();
return $this->resourcesLocales;
}
- private function initializeIfNeeded()
+ private function initializeIfNeeded(): void
{
foreach ($this->filepaths as $key => $filepath) {
$resource = new TranslationResource($filepath);
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProviderInterface.php b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProviderInterface.php
index fdf2b284b57..75178022c20 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProviderInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Provider/Resource/TranslatorResourceProviderInterface.php
@@ -21,12 +21,12 @@
interface TranslatorResourceProviderInterface
{
/**
- * @return TranslationResourceInterface[]
+ * @return array|TranslationResourceInterface[]
*/
- public function getResources();
+ public function getResources(): array;
/**
- * @return array
+ * @return array|string[]
*/
- public function getResourcesLocales();
+ public function getResourcesLocales(): array;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Resource/ThemeTranslationResource.php b/src/Sylius/Bundle/ThemeBundle/Translation/Resource/ThemeTranslationResource.php
index 6e8229be830..a12fb85a734 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Resource/ThemeTranslationResource.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Resource/ThemeTranslationResource.php
@@ -44,7 +44,7 @@ final class ThemeTranslationResource implements TranslationResourceInterface
* @param ThemeInterface $theme
* @param string $filepath
*/
- public function __construct(ThemeInterface $theme, $filepath)
+ public function __construct(ThemeInterface $theme, string $filepath)
{
$this->name = $filepath;
@@ -64,7 +64,7 @@ public function __construct(ThemeInterface $theme, $filepath)
/**
* {@inheritdoc}
*/
- public function getName()
+ public function getName(): string
{
return $this->name;
}
@@ -72,7 +72,7 @@ public function getName()
/**
* {@inheritdoc}
*/
- public function getLocale()
+ public function getLocale(): string
{
return $this->locale;
}
@@ -80,7 +80,7 @@ public function getLocale()
/**
* {@inheritdoc}
*/
- public function getFormat()
+ public function getFormat(): string
{
return $this->format;
}
@@ -88,7 +88,7 @@ public function getFormat()
/**
* {@inheritdoc}
*/
- public function getDomain()
+ public function getDomain(): string
{
return $this->domain;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResource.php b/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResource.php
index 07dcd1e8ebc..47e416f4164 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResource.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResource.php
@@ -41,7 +41,7 @@ final class TranslationResource implements TranslationResourceInterface
/**
* @param string $filepath
*/
- public function __construct($filepath)
+ public function __construct(string $filepath)
{
$this->name = $filepath;
@@ -61,7 +61,7 @@ public function __construct($filepath)
/**
* {@inheritdoc}
*/
- public function getName()
+ public function getName(): string
{
return $this->name;
}
@@ -69,7 +69,7 @@ public function getName()
/**
* {@inheritdoc}
*/
- public function getLocale()
+ public function getLocale(): string
{
return $this->locale;
}
@@ -77,7 +77,7 @@ public function getLocale()
/**
* {@inheritdoc}
*/
- public function getFormat()
+ public function getFormat(): string
{
return $this->format;
}
@@ -85,7 +85,7 @@ public function getFormat()
/**
* {@inheritdoc}
*/
- public function getDomain()
+ public function getDomain(): string
{
return $this->domain;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResourceInterface.php b/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResourceInterface.php
index 44740edf3ea..0a393ada265 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResourceInterface.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Resource/TranslationResourceInterface.php
@@ -21,20 +21,20 @@ interface TranslationResourceInterface
/**
* @return string
*/
- public function getName();
+ public function getName(): string;
/**
* @return string
*/
- public function getLocale();
+ public function getLocale(): string;
/**
* @return string
*/
- public function getFormat();
+ public function getFormat(): string;
/**
* @return string
*/
- public function getDomain();
+ public function getDomain(): string;
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/ThemeAwareTranslator.php b/src/Sylius/Bundle/ThemeBundle/Translation/ThemeAwareTranslator.php
index 615fbc63f2b..f2b9a547726 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/ThemeAwareTranslator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/ThemeAwareTranslator.php
@@ -15,6 +15,7 @@
use Sylius\Bundle\ThemeBundle\Context\ThemeContextInterface;
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
+use Symfony\Component\Translation\MessageCatalogueInterface;
use Symfony\Component\Translation\TranslatorBagInterface;
use Symfony\Component\Translation\TranslatorInterface;
@@ -57,7 +58,7 @@ public function __construct(TranslatorInterface $translator, ThemeContextInterfa
*
* @return mixed
*/
- public function __call($method, array $arguments)
+ public function __call(string $method, array $arguments)
{
$translator = $this->translator;
$arguments = array_values($arguments);
@@ -68,7 +69,7 @@ public function __call($method, array $arguments)
/**
* {@inheritdoc}
*/
- public function trans($id, array $parameters = [], $domain = null, $locale = null)
+ public function trans($id, array $parameters = [], $domain = null, $locale = null): string
{
return $this->translator->trans($id, $parameters, $domain, $this->transformLocale($locale));
}
@@ -76,7 +77,7 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul
/**
* {@inheritdoc}
*/
- public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
+ public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null): string
{
return $this->translator->transChoice($id, $number, $parameters, $domain, $this->transformLocale($locale));
}
@@ -84,7 +85,7 @@ public function transChoice($id, $number, array $parameters = [], $domain = null
/**
* {@inheritdoc}
*/
- public function getLocale()
+ public function getLocale(): string
{
return $this->translator->getLocale();
}
@@ -92,7 +93,7 @@ public function getLocale()
/**
* {@inheritdoc}
*/
- public function setLocale($locale)
+ public function setLocale($locale): void
{
$this->translator->setLocale($this->transformLocale($locale));
}
@@ -100,7 +101,7 @@ public function setLocale($locale)
/**
* {@inheritdoc}
*/
- public function getCatalogue($locale = null)
+ public function getCatalogue($locale = null): MessageCatalogueInterface
{
return $this->translator->getCatalogue($locale);
}
@@ -108,7 +109,7 @@ public function getCatalogue($locale = null)
/**
* {@inheritdoc}
*/
- public function warmUp($cacheDir)
+ public function warmUp($cacheDir): void
{
if ($this->translator instanceof WarmableInterface) {
$this->translator->warmUp($cacheDir);
@@ -116,11 +117,11 @@ public function warmUp($cacheDir)
}
/**
- * @param string $locale
+ * @param string|null $locale
*
- * @return string
+ * @return string|null
*/
- private function transformLocale($locale)
+ private function transformLocale(?string $locale): ?string
{
$theme = $this->themeContext->getTheme();
@@ -132,8 +133,6 @@ private function transformLocale($locale)
$locale = $this->getLocale();
}
- $locale = $locale . '@' . str_replace('/', '-', $theme->getName());
-
- return $locale;
+ return $locale . '@' . str_replace('/', '-', $theme->getName());
}
}
diff --git a/src/Sylius/Bundle/ThemeBundle/Translation/Translator.php b/src/Sylius/Bundle/ThemeBundle/Translation/Translator.php
index b95af85abfa..fff1377038e 100644
--- a/src/Sylius/Bundle/ThemeBundle/Translation/Translator.php
+++ b/src/Sylius/Bundle/ThemeBundle/Translation/Translator.php
@@ -58,7 +58,7 @@ public function __construct(
TranslatorLoaderProviderInterface $loaderProvider,
TranslatorResourceProviderInterface $resourceProvider,
MessageSelector $messageSelector,
- $locale,
+ string $locale,
array $options = []
) {
$this->assertOptionsAreKnown($options);
@@ -77,7 +77,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function warmUp($cacheDir)
+ public function warmUp($cacheDir): void
{
// skip warmUp when translator doesn't use cache
if (null === $this->options['cache_dir']) {
@@ -102,7 +102,7 @@ public function warmUp($cacheDir)
/**
* {@inheritdoc}
*/
- protected function initializeCatalogue($locale)
+ protected function initializeCatalogue($locale): void
{
$this->initialize();
@@ -112,7 +112,7 @@ protected function initializeCatalogue($locale)
/**
* {@inheritdoc}
*/
- protected function computeFallbackLocales($locale)
+ protected function computeFallbackLocales($locale): array
{
$themeModifier = $this->getLocaleModifier($locale);
$localeWithoutModifier = $this->getLocaleWithoutModifier($locale, $themeModifier);
@@ -138,9 +138,9 @@ protected function computeFallbackLocales($locale)
*
* @return string
*/
- private function getLocaleModifier($locale)
+ private function getLocaleModifier(string $locale): string
{
- $modifier = strrchr((string) $locale, '@');
+ $modifier = strrchr($locale, '@');
return $modifier ?: '';
}
@@ -151,18 +151,18 @@ private function getLocaleModifier($locale)
*
* @return string
*/
- private function getLocaleWithoutModifier($locale, $modifier)
+ private function getLocaleWithoutModifier(string $locale, string $modifier): string
{
return str_replace($modifier, '', $locale);
}
- private function initialize()
+ private function initialize(): void
{
$this->addResources();
$this->addLoaders();
}
- private function addResources()
+ private function addResources(): void
{
if ($this->resourcesLoaded) {
return;
@@ -181,7 +181,7 @@ private function addResources()
$this->resourcesLoaded = true;
}
- private function addLoaders()
+ private function addLoaders(): void
{
$loaders = $this->loaderProvider->getLoaders();
foreach ($loaders as $alias => $loader) {
@@ -192,7 +192,7 @@ private function addLoaders()
/**
* @param array $options
*/
- private function assertOptionsAreKnown(array $options)
+ private function assertOptionsAreKnown(array $options): void
{
if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
throw new \InvalidArgumentException(sprintf('The Translator does not support the following options: \'%s\'.', implode('\', \'', $diff)));
diff --git a/src/Sylius/Bundle/ThemeBundle/Twig/ThemeFilesystemLoader.php b/src/Sylius/Bundle/ThemeBundle/Twig/ThemeFilesystemLoader.php
index 7b325369c8c..3ce9fa01557 100644
--- a/src/Sylius/Bundle/ThemeBundle/Twig/ThemeFilesystemLoader.php
+++ b/src/Sylius/Bundle/ThemeBundle/Twig/ThemeFilesystemLoader.php
@@ -60,69 +60,67 @@ public function __construct(
/**
* {@inheritdoc}
*/
- public function getSourceContext($name)
+ public function getSourceContext($name): \Twig_Source
{
try {
- $path = $this->findTemplate($name);
+ $path = $this->findTemplate((string) $name);
return new \Twig_Source(file_get_contents($path), $name, $path);
} catch (\Exception $exception) {
- return $this->decoratedLoader->getSourceContext($name);
+ return $this->decoratedLoader->getSourceContext((string) $name);
}
}
/**
* {@inheritdoc}
*/
- public function getCacheKey($name)
+ public function getCacheKey($name): string
{
try {
- return $this->findTemplate($name);
+ return $this->findTemplate((string) $name);
} catch (\Exception $exception) {
- return $this->decoratedLoader->getCacheKey($name);
+ return $this->decoratedLoader->getCacheKey((string) $name);
}
}
/**
* {@inheritdoc}
*/
- public function isFresh($name, $time)
+ public function isFresh($name, $time): bool
{
try {
- return filemtime($this->findTemplate($name)) <= $time;
+ return filemtime($this->findTemplate((string) $name)) <= $time;
} catch (\Exception $exception) {
- return $this->decoratedLoader->isFresh($name, $time);
+ return $this->decoratedLoader->isFresh((string) $name, $time);
}
}
/**
* {@inheritdoc}
*/
- public function exists($name)
+ public function exists($name): bool
{
try {
- return stat($this->findTemplate($name)) !== false;
+ return stat($this->findTemplate((string) $name)) !== false;
} catch (\Exception $exception) {
- return $this->decoratedLoader->exists($name);
+ return $this->decoratedLoader->exists((string) $name);
}
}
/**
- * @param TemplateReferenceInterface|string $template
+ * @param string $logicalName
*
* @return string
*/
- private function findTemplate($template)
+ private function findTemplate(string $logicalName): string
{
- $logicalName = (string) $template;
-
if (isset($this->cache[$logicalName])) {
- return $this->cache[$logicalName];
+ return (string) $this->cache[$logicalName];
}
- $template = $this->templateNameParser->parse($template);
+ $template = $this->templateNameParser->parse($logicalName);
$file = $this->templateLocator->locate($template);
- return $this->cache[$logicalName] = $file;
+ return (string) $this->cache[$logicalName] = $file;
}
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Asset/Package/PathPackageSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Asset/Package/PathPackageSpec.php
index 1898af55064..5ccf6c982e1 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Asset/Package/PathPackageSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Asset/Package/PathPackageSpec.php
@@ -29,11 +29,11 @@ function let(
VersionStrategyInterface $versionStrategy,
ThemeContextInterface $themeContext,
PathResolverInterface $pathResolver
- ) {
+ ): void {
$this->beConstructedWith('/', $versionStrategy, $themeContext, $pathResolver);
}
- function it_implements_package_interface_interface()
+ function it_implements_package_interface_interface(): void
{
$this->shouldImplement(PackageInterface::class);
}
@@ -41,7 +41,7 @@ function it_implements_package_interface_interface()
function it_returns_vanilla_path_if_there_are_no_active_themes(
ThemeContextInterface $themeContext,
VersionStrategyInterface $versionStrategy
- ) {
+ ): void {
$path = 'bundles/sample/asset.js';
$versionedPath = 'bundles/sample/asset.js?v=42';
@@ -56,7 +56,7 @@ function it_returns_modified_path_if_there_is_active_theme(
VersionStrategyInterface $versionStrategy,
PathResolverInterface $pathResolver,
ThemeInterface $theme
- ) {
+ ): void {
$path = 'bundles/sample/asset.js';
$themedPath = 'bundles/theme/foo/bar/sample/asset.js';
$versionedThemedPath = 'bundles/theme/foo/bar/sample/asset.js?v=42';
@@ -68,7 +68,7 @@ function it_returns_modified_path_if_there_is_active_theme(
$this->getUrl($path)->shouldReturn('/' . $versionedThemedPath);
}
- function it_returns_path_without_changes_if_it_is_absolute()
+ function it_returns_path_without_changes_if_it_is_absolute(): void
{
$this->getUrl('//localhost/asset.js')->shouldReturn('//localhost/asset.js');
$this->getUrl('https://localhost/asset.js')->shouldReturn('https://localhost/asset.js');
@@ -79,7 +79,7 @@ function it_does_not_prepend_it_with_base_path_if_modified_path_is_an_absolute_o
VersionStrategyInterface $versionStrategy,
PathResolverInterface $pathResolver,
ThemeInterface $theme
- ) {
+ ): void {
$path = 'bundles/sample/asset.js';
$themedPath = 'bundles/theme/foo/bar/sample/asset.js';
$versionedThemedPath = '/bundles/theme/foo/bar/sample/asset.js?v=42';
@@ -96,7 +96,7 @@ function it_does_not_prepend_it_with_base_path_if_modified_path_is_an_absolute_u
VersionStrategyInterface $versionStrategy,
PathResolverInterface $pathResolver,
ThemeInterface $theme
- ) {
+ ): void {
$path = 'bundles/sample/asset.js';
$themedPath = 'bundles/theme/foo/bar/sample/asset.js';
$versionedThemedPath = 'https://bundles/theme/foo/bar/sample/asset.js?v=42';
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Asset/PathResolverSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Asset/PathResolverSpec.php
index 250cf594800..518fc2d4239 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Asset/PathResolverSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Asset/PathResolverSpec.php
@@ -23,25 +23,22 @@
*/
final class PathResolverSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(PathResolver::class);
- }
-
- function it_implements_path_resolver_interface()
+ function it_implements_path_resolver_interface(): void
{
$this->shouldImplement(PathResolverInterface::class);
}
- function it_returns_modified_path_if_its_referencing_bundle_asset(ThemeInterface $theme)
+ function it_returns_modified_path_if_its_referencing_bundle_asset(ThemeInterface $theme): void
{
$theme->getName()->willReturn('theme/name');
$this->resolve('bundles/asset.min.js', $theme)->shouldReturn('bundles/_themes/theme/name/asset.min.js');
}
- function it_does_not_change_path_if_its_not_referencing_bundle_asset(ThemeInterface $theme)
+ function it_does_not_change_path_if_its_not_referencing_bundle_asset(ThemeInterface $theme): void
{
+ $theme->getName()->willReturn('theme/name');
+
$this->resolve('/long.path/asset.min.js', $theme)->shouldReturn('/long.path/asset.min.js');
}
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/CompositeConfigurationProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/CompositeConfigurationProviderSpec.php
index 1a89c66916c..b852a05b624 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/CompositeConfigurationProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/CompositeConfigurationProviderSpec.php
@@ -22,22 +22,17 @@
*/
final class CompositeConfigurationProviderSpec extends ObjectBehavior
{
- function let()
+ function let(): void
{
$this->beConstructedWith([]);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(CompositeConfigurationProvider::class);
- }
-
- function it_implements_configuration_provider_interface()
+ function it_implements_configuration_provider_interface(): void
{
$this->shouldImplement(ConfigurationProviderInterface::class);
}
- function it_returns_empty_array_if_no_configurations_are_loaded()
+ function it_returns_empty_array_if_no_configurations_are_loaded(): void
{
$this->getConfigurations()->shouldReturn([]);
}
@@ -45,7 +40,7 @@ function it_returns_empty_array_if_no_configurations_are_loaded()
function it_returns_sum_of_configurations_returned_by_nested_configuration_providers(
ConfigurationProviderInterface $firstConfigurationProvider,
ConfigurationProviderInterface $secondConfigurationProvider
- ) {
+ ): void {
$this->beConstructedWith([
$firstConfigurationProvider,
$secondConfigurationProvider,
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/FilesystemConfigurationProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/FilesystemConfigurationProviderSpec.php
index 8e95c1d935d..15cd0216f11 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/FilesystemConfigurationProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/FilesystemConfigurationProviderSpec.php
@@ -24,22 +24,17 @@
*/
final class FilesystemConfigurationProviderSpec extends ObjectBehavior
{
- function let(FileLocatorInterface $fileLocator, ConfigurationLoaderInterface $loader)
+ function let(FileLocatorInterface $fileLocator, ConfigurationLoaderInterface $loader): void
{
$this->beConstructedWith($fileLocator, $loader, 'configurationfile.json');
}
- function it_is_initializable()
- {
- $this->shouldHaveType(FilesystemConfigurationProvider::class);
- }
-
- function it_implements_configuration_provider_interface()
+ function it_implements_configuration_provider_interface(): void
{
$this->shouldImplement(ConfigurationProviderInterface::class);
}
- function it_provides_loaded_configuration_files(FileLocatorInterface $fileLocator, ConfigurationLoaderInterface $loader)
+ function it_provides_loaded_configuration_files(FileLocatorInterface $fileLocator, ConfigurationLoaderInterface $loader): void
{
$fileLocator->locateFilesNamed('configurationfile.json')->willReturn([
'/cristopher/configurationfile.json',
@@ -55,7 +50,7 @@ function it_provides_loaded_configuration_files(FileLocatorInterface $fileLocato
]);
}
- function it_provides_an_empty_array_if_there_were_no_themes_found(FileLocatorInterface $fileLocator)
+ function it_provides_an_empty_array_if_there_were_no_themes_found(FileLocatorInterface $fileLocator): void
{
$fileLocator->locateFilesNamed('configurationfile.json')->willThrow(\InvalidArgumentException::class);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/JsonFileConfigurationLoaderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/JsonFileConfigurationLoaderSpec.php
index b045a0e3555..caa88b6a195 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/JsonFileConfigurationLoaderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/JsonFileConfigurationLoaderSpec.php
@@ -23,22 +23,17 @@
*/
final class JsonFileConfigurationLoaderSpec extends ObjectBehavior
{
- function let(FilesystemInterface $filesystem)
+ function let(FilesystemInterface $filesystem): void
{
$this->beConstructedWith($filesystem);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(JsonFileConfigurationLoader::class);
- }
-
- function it_implements_configuration_loader_interface()
+ function it_implements_configuration_loader_interface(): void
{
$this->shouldImplement(ConfigurationLoaderInterface::class);
}
- function it_loads_json_file(FilesystemInterface $filesystem)
+ function it_loads_json_file(FilesystemInterface $filesystem): void
{
$filesystem->exists('/directory/composer.json')->willReturn(true);
@@ -50,7 +45,7 @@ function it_loads_json_file(FilesystemInterface $filesystem)
]);
}
- function it_throws_an_exception_if_file_does_not_exist(FilesystemInterface $filesystem)
+ function it_throws_an_exception_if_file_does_not_exist(FilesystemInterface $filesystem): void
{
$filesystem->exists('composer.json')->willReturn(false);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/ProcessingConfigurationLoaderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/ProcessingConfigurationLoaderSpec.php
index e932dd86ef0..88cacc2f11c 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/ProcessingConfigurationLoaderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Filesystem/ProcessingConfigurationLoaderSpec.php
@@ -23,17 +23,12 @@
*/
final class ProcessingConfigurationLoaderSpec extends ObjectBehavior
{
- function let(ConfigurationLoaderInterface $decoratedLoader, ConfigurationProcessorInterface $configurationProcessor)
+ function let(ConfigurationLoaderInterface $decoratedLoader, ConfigurationProcessorInterface $configurationProcessor): void
{
$this->beConstructedWith($decoratedLoader, $configurationProcessor);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ProcessingConfigurationLoader::class);
- }
-
- function it_implements_loader_interface()
+ function it_implements_loader_interface(): void
{
$this->shouldImplement(ConfigurationLoaderInterface::class);
}
@@ -41,7 +36,7 @@ function it_implements_loader_interface()
function it_processes_the_configuration(
ConfigurationLoaderInterface $decoratedLoader,
ConfigurationProcessorInterface $configurationProcessor
- ) {
+ ): void {
$basicConfiguration = ['name' => 'example/sylius-theme'];
$decoratedLoader->load('theme-configuration-resource')->willReturn($basicConfiguration);
@@ -58,7 +53,7 @@ function it_processes_the_configuration(
function it_processes_the_configuration_and_extracts_extra_sylius_theme_key_as_another_configuration(
ConfigurationLoaderInterface $decoratedLoader,
ConfigurationProcessorInterface $configurationProcessor
- ) {
+ ): void {
$basicConfiguration = [
'name' => 'example/sylius-theme',
'extra' => [
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/SymfonyConfigurationProcessorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/SymfonyConfigurationProcessorSpec.php
index debb9d858ef..45820aac523 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/SymfonyConfigurationProcessorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/SymfonyConfigurationProcessorSpec.php
@@ -24,17 +24,12 @@
*/
final class SymfonyConfigurationProcessorSpec extends ObjectBehavior
{
- function let(ConfigurationInterface $configuration, Processor $processor)
+ function let(ConfigurationInterface $configuration, Processor $processor): void
{
$this->beConstructedWith($configuration, $processor);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(SymfonyConfigurationProcessor::class);
- }
-
- function it_implements_configuration_processor_interface()
+ function it_implements_configuration_processor_interface(): void
{
$this->shouldImplement(ConfigurationProcessorInterface::class);
}
@@ -42,7 +37,7 @@ function it_implements_configuration_processor_interface()
function it_proxies_configuration_processing_to_symfony_configuration_processor(
ConfigurationInterface $configuration,
Processor $processor
- ) {
+ ): void {
$processor
->processConfiguration($configuration, [['name' => 'example/theme']])
->willReturn(['name' => 'example/theme'])
@@ -54,7 +49,7 @@ function it_proxies_configuration_processing_to_symfony_configuration_processor(
function it_does_not_catch_any_exception_thrown_by_symfony_configuration_processor(
ConfigurationInterface $configuration,
Processor $processor
- ) {
+ ): void {
$processor
->processConfiguration($configuration, [])
->willThrow(\Exception::class)
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestConfigurationProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestConfigurationProviderSpec.php
index edfc005b29c..fcf9ecfb9c8 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestConfigurationProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestConfigurationProviderSpec.php
@@ -23,22 +23,17 @@
*/
final class TestConfigurationProviderSpec extends ObjectBehavior
{
- function let(TestThemeConfigurationManagerInterface $testThemeConfigurationManager)
+ function let(TestThemeConfigurationManagerInterface $testThemeConfigurationManager): void
{
$this->beConstructedWith($testThemeConfigurationManager);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TestConfigurationProvider::class);
- }
-
- function it_implements_configuration_provider_interface()
+ function it_implements_configuration_provider_interface(): void
{
$this->shouldImplement(ConfigurationProviderInterface::class);
}
- function it_provides_configuration_based_on_test_configuration_manager(TestThemeConfigurationManagerInterface $testThemeConfigurationManager)
+ function it_provides_configuration_based_on_test_configuration_manager(TestThemeConfigurationManagerInterface $testThemeConfigurationManager): void
{
$testThemeConfigurationManager->findAll()->willReturn([
['name' => 'theme/name'],
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestThemeConfigurationManagerSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestThemeConfigurationManagerSpec.php
index 56c55016801..72c864e00e6 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestThemeConfigurationManagerSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Configuration/Test/TestThemeConfigurationManagerSpec.php
@@ -25,7 +25,7 @@
*/
final class TestThemeConfigurationManagerSpec extends ObjectBehavior
{
- function let(ConfigurationProcessorInterface $configurationProcessor)
+ function let(ConfigurationProcessorInterface $configurationProcessor): void
{
VfsStreamWrapper::register();
VfsStreamWrapper::setRoot(new VfsStreamDirectory(''));
@@ -33,27 +33,22 @@ function let(ConfigurationProcessorInterface $configurationProcessor)
$this->beConstructedWith($configurationProcessor, 'vfs://cache/');
}
- function letGo()
+ function letGo(): void
{
VfsStreamWrapper::unregister();
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TestThemeConfigurationManager::class);
- }
-
- function it_implements_test_configuration_manager_interface()
+ function it_implements_test_configuration_manager_interface(): void
{
$this->shouldImplement(TestThemeConfigurationManagerInterface::class);
}
- function it_finds_all_saved_configurations()
+ function it_finds_all_saved_configurations(): void
{
$this->findAll()->shouldReturn([]);
}
- function it_stores_theme_configuration(ConfigurationProcessorInterface $configurationProcessor)
+ function it_stores_theme_configuration(ConfigurationProcessorInterface $configurationProcessor): void
{
$configurationProcessor->process([['name' => 'theme/name']])->willReturn(['name' => 'theme/name']);
@@ -62,7 +57,7 @@ function it_stores_theme_configuration(ConfigurationProcessorInterface $configur
$this->findAll()->shouldHaveCount(1);
}
- function its_theme_configurations_can_be_removed(ConfigurationProcessorInterface $configurationProcessor)
+ function its_theme_configurations_can_be_removed(ConfigurationProcessorInterface $configurationProcessor): void
{
$configurationProcessor->process([['name' => 'theme/name']])->willReturn(['name' => 'theme/name']);
@@ -72,7 +67,7 @@ function its_theme_configurations_can_be_removed(ConfigurationProcessorInterface
$this->findAll()->shouldReturn([]);
}
- function it_clears_all_theme_configurations(ConfigurationProcessorInterface $configurationProcessor)
+ function it_clears_all_theme_configurations(ConfigurationProcessorInterface $configurationProcessor): void
{
$configurationProcessor->process([['name' => 'theme/name1']])->willReturn(['name' => 'theme/name1']);
$configurationProcessor->process([['name' => 'theme/name2']])->willReturn(['name' => 'theme/name2']);
@@ -85,7 +80,7 @@ function it_clears_all_theme_configurations(ConfigurationProcessorInterface $con
$this->findAll()->shouldReturn([]);
}
- function it_does_not_throw_any_exception_if_clearing_unexisting_storage()
+ function it_does_not_throw_any_exception_if_clearing_unexisting_storage(): void
{
$this->clear();
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Context/EmptyThemeContextSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Context/EmptyThemeContextSpec.php
index 8bfa81f8927..12593cd5fea 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Context/EmptyThemeContextSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Context/EmptyThemeContextSpec.php
@@ -22,17 +22,12 @@
*/
final class EmptyThemeContextSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(EmptyThemeContext::class);
- }
-
- function it_implements_theme_context_interface()
+ function it_implements_theme_context_interface(): void
{
$this->shouldImplement(ThemeContextInterface::class);
}
- function it_always_returns_null()
+ function it_always_returns_null(): void
{
$this->getTheme()->shouldReturn(null);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Context/SettableThemeContextSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Context/SettableThemeContextSpec.php
index a0f25c6df15..6b04ea42d77 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Context/SettableThemeContextSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Context/SettableThemeContextSpec.php
@@ -23,17 +23,12 @@
*/
final class SettableThemeContextSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(SettableThemeContext::class);
- }
-
- function it_implements_theme_context_interface()
+ function it_implements_theme_context_interface(): void
{
$this->shouldImplement(ThemeContextInterface::class);
}
- function it_has_theme(ThemeInterface $theme)
+ function it_has_theme(ThemeInterface $theme): void
{
$this->getTheme()->shouldReturn(null);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Controller/ThemeScreenshotControllerSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Controller/ThemeScreenshotControllerSpec.php
index 000f946221d..444c4aa875b 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Controller/ThemeScreenshotControllerSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Controller/ThemeScreenshotControllerSpec.php
@@ -16,6 +16,7 @@
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\ThemeBundle\Controller\ThemeScreenshotController;
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
+use Sylius\Bundle\ThemeBundle\Model\ThemeScreenshot;
use Sylius\Bundle\ThemeBundle\Repository\ThemeRepositoryInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -30,25 +31,20 @@ final class ThemeScreenshotControllerSpec extends ObjectBehavior
*/
private $fixturesPath;
- function let(ThemeRepositoryInterface $themeRepository)
+ function let(ThemeRepositoryInterface $themeRepository): void
{
$this->beConstructedWith($themeRepository);
$this->fixturesPath = realpath(__DIR__ . '/../Fixtures');
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeScreenshotController::class);
- }
-
- function it_streams_screenshot_as_a_response(ThemeRepositoryInterface $themeRepository, ThemeInterface $theme)
+ function it_streams_screenshot_as_a_response(ThemeRepositoryInterface $themeRepository, ThemeInterface $theme): void
{
$themeRepository->findOneByName('theme/name')->willReturn($theme);
$theme->getScreenshots()->willReturn([
- 'screenshot/0-amazing.jpg', // exists
- 'screenshot/1-awesome.jpg', // does not exist
+ new ThemeScreenshot('screenshot/0-amazing.jpg'), // exists
+ new ThemeScreenshot('screenshot/1-awesome.jpg'), // does not exist
]);
$theme->getPath()->willReturn($this->fixturesPath);
@@ -61,12 +57,12 @@ function it_streams_screenshot_as_a_response(ThemeRepositoryInterface $themeRepo
function it_throws_not_found_http_exception_if_screenshot_cannot_be_found(
ThemeRepositoryInterface $themeRepository,
ThemeInterface $theme
- ) {
+ ): void {
$themeRepository->findOneByName('theme/name')->willReturn($theme);
$theme->getScreenshots()->willReturn([
- 'screenshot/0-amazing.jpg', // exists
- 'screenshot/1-awesome.jpg', // does not exists
+ new ThemeScreenshot('screenshot/0-amazing.jpg'), // exists
+ new ThemeScreenshot('screenshot/1-awesome.jpg'), // does not exists
]);
$theme->getPath()->willReturn($this->fixturesPath);
@@ -82,12 +78,12 @@ function it_throws_not_found_http_exception_if_screenshot_cannot_be_found(
function it_throws_not_found_http_exception_if_screenshot_number_exceeds_the_number_of_theme_screenshots(
ThemeRepositoryInterface $themeRepository,
ThemeInterface $theme
- ) {
+ ): void {
$themeRepository->findOneByName('theme/name')->willReturn($theme);
$theme->getScreenshots()->willReturn([
- 'screenshot/0-amazing.jpg',
- 'screenshot/1-awesome.jpg',
+ new ThemeScreenshot('screenshot/0-amazing.jpg'),
+ new ThemeScreenshot('screenshot/1-awesome.jpg'),
]);
$theme->getTitle()->willReturn('Candy shop');
@@ -97,7 +93,7 @@ function it_throws_not_found_http_exception_if_screenshot_number_exceeds_the_num
;
}
- function it_throws_not_found_http_exception_if_theme_with_given_id_cannot_be_found(ThemeRepositoryInterface $themeRepository)
+ function it_throws_not_found_http_exception_if_theme_with_given_id_cannot_be_found(ThemeRepositoryInterface $themeRepository): void
{
$themeRepository->findOneByName('theme/name')->willReturn(null);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Factory/FinderFactorySpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Factory/FinderFactorySpec.php
index 2ad0eaeed8e..a10fd5f85f9 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Factory/FinderFactorySpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Factory/FinderFactorySpec.php
@@ -23,17 +23,12 @@
*/
final class FinderFactorySpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(FinderFactory::class);
- }
-
- function it_implements_finder_factory_interface()
+ function it_implements_finder_factory_interface(): void
{
$this->shouldImplement(FinderFactoryInterface::class);
}
- function it_creates_a_brand_new_finder()
+ function it_creates_a_brand_new_finder(): void
{
$this->create()->shouldHaveType(Finder::class);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeAuthorFactorySpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeAuthorFactorySpec.php
index b9a3844d82c..96d8249b9fa 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeAuthorFactorySpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeAuthorFactorySpec.php
@@ -23,17 +23,12 @@
*/
final class ThemeAuthorFactorySpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeAuthorFactory::class);
- }
-
- function it_implements_theme_author_factory_interface()
+ function it_implements_theme_author_factory_interface(): void
{
$this->shouldImplement(ThemeAuthorFactoryInterface::class);
}
- function it_creates_an_author_from_an_array()
+ function it_creates_an_author_from_an_array(): void
{
$expectedAuthor = new ThemeAuthor();
$expectedAuthor->setName('Rynkowsky');
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeFactorySpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeFactorySpec.php
index 31750a6cf37..149c6192ef1 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeFactorySpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeFactorySpec.php
@@ -23,17 +23,12 @@
*/
final class ThemeFactorySpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeFactory::class);
- }
-
- function it_implements_theme_factory_interface()
+ function it_implements_theme_factory_interface(): void
{
$this->shouldImplement(ThemeFactoryInterface::class);
}
- function it_creates_a_theme()
+ function it_creates_a_theme(): void
{
$this->create('example/theme', '/theme/path')->shouldHaveNameAndPath('example/theme', '/theme/path');
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeScreenshotFactorySpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeScreenshotFactorySpec.php
index 455aeea28a7..36be119eac6 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeScreenshotFactorySpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Factory/ThemeScreenshotFactorySpec.php
@@ -23,17 +23,12 @@
*/
final class ThemeScreenshotFactorySpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeScreenshotFactory::class);
- }
-
- function it_implements_theme_screenshot_factory_interface()
+ function it_implements_theme_screenshot_factory_interface(): void
{
$this->shouldImplement(ThemeScreenshotFactoryInterface::class);
}
- function it_creates_a_screenshot_from_an_array()
+ function it_creates_a_screenshot_from_an_array(): void
{
$this
->createFromArray(['path' => '/screenshot/path.jpg', 'title' => 'Steamboat', 'description' => 'With steamboat into a wonderful cruise'])
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/NoopThemeHierarchyProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/NoopThemeHierarchyProviderSpec.php
index ecb0f4fd70c..4647703405f 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/NoopThemeHierarchyProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/NoopThemeHierarchyProviderSpec.php
@@ -23,23 +23,13 @@
*/
final class NoopThemeHierarchyProviderSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(NoopThemeHierarchyProvider::class);
- }
-
- function it_implements_theme_hierarchy_provider_interface()
+ function it_implements_theme_hierarchy_provider_interface(): void
{
$this->shouldImplement(ThemeHierarchyProviderInterface::class);
}
- function it_returns_array_with_given_theme_as_only_element(ThemeInterface $theme)
+ function it_returns_array_with_given_theme_as_only_element(ThemeInterface $theme): void
{
$this->getThemeHierarchy($theme)->shouldReturn([$theme]);
}
-
- function it_returns_empty_array_if_given_theme_is_null()
- {
- $this->getThemeHierarchy(null)->shouldReturn([]);
- }
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/ThemeHierarchyProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/ThemeHierarchyProviderSpec.php
index 6db7991ccad..0befb623467 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/ThemeHierarchyProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/HierarchyProvider/ThemeHierarchyProviderSpec.php
@@ -23,17 +23,12 @@
*/
final class ThemeHierarchyProviderSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeHierarchyProvider::class);
- }
-
- function it_implements_theme_hierarchy_provider_interface()
+ function it_implements_theme_hierarchy_provider_interface(): void
{
$this->shouldImplement(ThemeHierarchyProviderInterface::class);
}
- function it_returns_theme_list_in_hierarchized_order(ThemeInterface $firstTheme, ThemeInterface $secondTheme)
+ function it_returns_theme_list_in_hierarchized_order(ThemeInterface $firstTheme, ThemeInterface $secondTheme): void
{
$firstTheme->getParents()->willReturn([$secondTheme]);
$secondTheme->getParents()->willReturn([]);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyCheckerSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyCheckerSpec.php
index 81c1f62bcc4..e024eb99823 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyCheckerSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyCheckerSpec.php
@@ -24,19 +24,14 @@
*/
final class CircularDependencyCheckerSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(CircularDependencyChecker::class);
- }
-
- function it_implements_circular_dependency_checker_interface()
+ function it_implements_circular_dependency_checker_interface(): void
{
$this->shouldImplement(CircularDependencyCheckerInterface::class);
}
function it_does_not_find_circular_dependency_if_checking_a_theme_without_any_parents(
ThemeInterface $theme
- ) {
+ ): void {
$theme->getParents()->willReturn([]);
$this->check($theme);
@@ -47,7 +42,7 @@ function it_does_not_find_circular_dependency_if_theme_parents_are_not_cycled(
ThemeInterface $secondTheme,
ThemeInterface $thirdTheme,
ThemeInterface $fourthTheme
- ) {
+ ): void {
$firstTheme->getParents()->willReturn([$secondTheme, $thirdTheme]);
$secondTheme->getParents()->willReturn([$thirdTheme, $fourthTheme]);
$thirdTheme->getParents()->willReturn([$fourthTheme]);
@@ -61,7 +56,7 @@ function it_finds_circular_dependency_if_theme_parents_are_cycled(
ThemeInterface $secondTheme,
ThemeInterface $thirdTheme,
ThemeInterface $fourthTheme
- ) {
+ ): void {
$firstTheme->getParents()->willReturn([$secondTheme, $thirdTheme]);
$secondTheme->getParents()->willReturn([$thirdTheme]);
$thirdTheme->getParents()->willReturn([$fourthTheme]);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyFoundExceptionSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyFoundExceptionSpec.php
index cc9a8dadfd9..aee07926898 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyFoundExceptionSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Loader/CircularDependencyFoundExceptionSpec.php
@@ -22,22 +22,17 @@
*/
final class CircularDependencyFoundExceptionSpec extends ObjectBehavior
{
- function let()
+ function let(): void
{
$this->beConstructedWith([]);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(CircularDependencyFoundException::class);
- }
-
- function it_is_a_domain_exception()
+ function it_is_a_domain_exception(): void
{
$this->shouldHaveType(\DomainException::class);
}
- function it_is_a_logic_exception()
+ function it_is_a_logic_exception(): void
{
$this->shouldHaveType(\LogicException::class);
}
@@ -47,7 +42,7 @@ function it_transforms_a_cycle_to_user_friendly_message(
ThemeInterface $secondTheme,
ThemeInterface $thirdTheme,
ThemeInterface $fourthTheme
- ) {
+ ): void {
$this->beConstructedWith([$firstTheme, $secondTheme, $thirdTheme, $fourthTheme, $thirdTheme]);
$firstTheme->getName()->willReturn('first/theme');
@@ -63,7 +58,7 @@ function it_throws_another_exception_if_there_is_no_cycle_in_given_elements(
ThemeInterface $secondTheme,
ThemeInterface $thirdTheme,
ThemeInterface $fourthTheme
- ) {
+ ): void {
$this->beConstructedWith([$firstTheme, $secondTheme, $thirdTheme, $fourthTheme]);
$this->shouldThrow(new \InvalidArgumentException('There is no cycle within given themes.'))->duringInstantiation();
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoaderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoaderSpec.php
index 7eec4fc0524..4b99f2bb967 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoaderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoaderSpec.php
@@ -41,7 +41,7 @@ function let(
ThemeScreenshotFactoryInterface $themeScreenshotFactory,
HydrationInterface $themeHydrator,
CircularDependencyCheckerInterface $circularDependencyChecker
- ) {
+ ): void {
$this->beConstructedWith(
$configurationProvider,
$themeFactory,
@@ -52,12 +52,7 @@ function let(
);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeLoader::class);
- }
-
- function it_implements_theme_loader_interface()
+ function it_implements_theme_loader_interface(): void
{
$this->shouldImplement(ThemeLoaderInterface::class);
}
@@ -68,7 +63,7 @@ function it_loads_a_single_theme(
HydrationInterface $themeHydrator,
CircularDependencyCheckerInterface $circularDependencyChecker,
ThemeInterface $theme
- ) {
+ ): void {
$configurationProvider->getConfigurations()->willReturn([
[
'name' => 'first/theme',
@@ -101,7 +96,7 @@ function it_loads_a_theme_with_author(
HydrationInterface $themeHydrator,
CircularDependencyCheckerInterface $circularDependencyChecker,
ThemeInterface $theme
- ) {
+ ): void {
$themeAuthor = new ThemeAuthor();
$configurationProvider->getConfigurations()->willReturn([
@@ -137,7 +132,7 @@ function it_loads_a_theme_with_screenshot(
HydrationInterface $themeHydrator,
CircularDependencyCheckerInterface $circularDependencyChecker,
ThemeInterface $theme
- ) {
+ ): void {
$themeScreenshot = new ThemeScreenshot('screenshot/omg.jpg');
$configurationProvider->getConfigurations()->willReturn([
@@ -175,7 +170,7 @@ function it_loads_a_theme_with_its_dependency(
CircularDependencyCheckerInterface $circularDependencyChecker,
ThemeInterface $firstTheme,
ThemeInterface $secondTheme
- ) {
+ ): void {
$configurationProvider->getConfigurations()->willReturn([
[
'name' => 'first/theme',
@@ -221,7 +216,7 @@ function it_throws_an_exception_if_requires_not_existing_dependency(
ConfigurationProviderInterface $configurationProvider,
ThemeFactoryInterface $themeFactory,
ThemeInterface $firstTheme
- ) {
+ ): void {
$configurationProvider->getConfigurations()->willReturn([
[
'name' => 'first/theme',
@@ -247,7 +242,7 @@ function it_throws_an_exception_if_there_is_a_circular_dependency_found(
CircularDependencyCheckerInterface $circularDependencyChecker,
ThemeInterface $firstTheme,
ThemeInterface $secondTheme
- ) {
+ ): void {
$configurationProvider->getConfigurations()->willReturn([
[
'name' => 'first/theme',
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoadingFailedExceptionSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoadingFailedExceptionSpec.php
index 00e23692468..22a392e16a2 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoadingFailedExceptionSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Loader/ThemeLoadingFailedExceptionSpec.php
@@ -21,17 +21,12 @@
*/
final class ThemeLoadingFailedExceptionSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeLoadingFailedException::class);
- }
-
- function it_is_a_domain_exception()
+ function it_is_a_domain_exception(): void
{
$this->shouldHaveType(\DomainException::class);
}
- function it_is_a_logic_exception()
+ function it_is_a_logic_exception(): void
{
$this->shouldHaveType(\LogicException::class);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Locator/ApplicationResourceLocatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Locator/ApplicationResourceLocatorSpec.php
index cb70aa7b330..cfe53b24151 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Locator/ApplicationResourceLocatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Locator/ApplicationResourceLocatorSpec.php
@@ -25,22 +25,17 @@
*/
final class ApplicationResourceLocatorSpec extends ObjectBehavior
{
- function let(Filesystem $filesystem)
+ function let(Filesystem $filesystem): void
{
$this->beConstructedWith($filesystem);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ApplicationResourceLocator::class);
- }
-
- function it_implements_resource_locator_interface()
+ function it_implements_resource_locator_interface(): void
{
$this->shouldImplement(ResourceLocatorInterface::class);
}
- function it_locates_application_resource(Filesystem $filesystem, ThemeInterface $theme)
+ function it_locates_application_resource(Filesystem $filesystem, ThemeInterface $theme): void
{
$theme->getPath()->willReturn('/theme/path');
@@ -49,7 +44,7 @@ function it_locates_application_resource(Filesystem $filesystem, ThemeInterface
$this->locateResource('resource', $theme)->shouldReturn('/theme/path/resource');
}
- function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, ThemeInterface $theme)
+ function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, ThemeInterface $theme): void
{
$theme->getName()->willReturn('theme/name');
$theme->getPath()->willReturn('/theme/path');
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Locator/BundleResourceLocatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Locator/BundleResourceLocatorSpec.php
index 6b3b89b377a..ffbd5dfd011 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Locator/BundleResourceLocatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Locator/BundleResourceLocatorSpec.php
@@ -27,17 +27,12 @@
*/
final class BundleResourceLocatorSpec extends ObjectBehavior
{
- function let(Filesystem $filesystem, KernelInterface $kernel)
+ function let(Filesystem $filesystem, KernelInterface $kernel): void
{
$this->beConstructedWith($filesystem, $kernel);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(BundleResourceLocator::class);
- }
-
- function it_implements_resource_locator_interface()
+ function it_implements_resource_locator_interface(): void
{
$this->shouldImplement(ResourceLocatorInterface::class);
}
@@ -48,7 +43,7 @@ function it_locates_bundle_resource(
ThemeInterface $theme,
BundleInterface $childBundle,
BundleInterface $parentBundle
- ) {
+ ): void {
$kernel->getBundle('ParentBundle', false)->willReturn([$childBundle, $parentBundle]);
$childBundle->getName()->willReturn('ChildBundle');
@@ -68,7 +63,7 @@ function it_throws_an_exception_if_resource_can_not_be_located(
ThemeInterface $theme,
BundleInterface $childBundle,
BundleInterface $parentBundle
- ) {
+ ): void {
$kernel->getBundle('ParentBundle', false)->willReturn([$childBundle, $parentBundle]);
$childBundle->getName()->willReturn('ChildBundle');
@@ -83,17 +78,17 @@ function it_throws_an_exception_if_resource_can_not_be_located(
$this->shouldThrow(ResourceNotFoundException::class)->during('locateResource', ['@ParentBundle/Resources/views/index.html.twig', $theme]);
}
- function it_throws_an_exception_if_resource_path_does_not_start_with_an_asperand(ThemeInterface $theme)
+ function it_throws_an_exception_if_resource_path_does_not_start_with_an_asperand(ThemeInterface $theme): void
{
$this->shouldThrow(\InvalidArgumentException::class)->during('locateResource', ['ParentBundle/Resources/views/index.html.twig', $theme]);
}
- function it_throws_an_exception_if_resource_path_contains_two_dots_in_a_row(ThemeInterface $theme)
+ function it_throws_an_exception_if_resource_path_contains_two_dots_in_a_row(ThemeInterface $theme): void
{
$this->shouldThrow(\InvalidArgumentException::class)->during('locateResource', ['@ParentBundle/Resources/views/../views/index.html.twig', $theme]);
}
- function it_throws_an_exception_if_resource_path_does_not_contain_resources_dir(ThemeInterface $theme)
+ function it_throws_an_exception_if_resource_path_does_not_contain_resources_dir(ThemeInterface $theme): void
{
$this->shouldThrow(\InvalidArgumentException::class)->during('locateResource', ['@ParentBundle/views/Resources.index.html.twig', $theme]);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Locator/RecursiveFileLocatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Locator/RecursiveFileLocatorSpec.php
index 4f487285398..abaaa6c3ae8 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Locator/RecursiveFileLocatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Locator/RecursiveFileLocatorSpec.php
@@ -25,22 +25,17 @@
*/
final class RecursiveFileLocatorSpec extends ObjectBehavior
{
- function let(FinderFactoryInterface $finderFactory)
+ function let(FinderFactoryInterface $finderFactory): void
{
$this->beConstructedWith($finderFactory, ['/search/path/']);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(RecursiveFileLocator::class);
- }
-
- function it_implements_sylius_file_locator_interface()
+ function it_implements_sylius_file_locator_interface(): void
{
$this->shouldImplement(FileLocatorInterface::class);
}
- function it_searches_for_file(FinderFactoryInterface $finderFactory, Finder $finder, SplFileInfo $splFileInfo)
+ function it_searches_for_file(FinderFactoryInterface $finderFactory, Finder $finder, SplFileInfo $splFileInfo): void
{
$finderFactory->create()->willReturn($finder);
@@ -63,7 +58,7 @@ function it_searches_for_files(
Finder $finder,
SplFileInfo $firstSplFileInfo,
SplFileInfo $secondSplFileInfo
- ) {
+ ): void {
$finderFactory->create()->willReturn($finder);
$finder->name('readme.md')->shouldBeCalled()->willReturn($finder);
@@ -85,22 +80,20 @@ function it_searches_for_files(
]);
}
- function it_throws_an_exception_if_searching_for_file_with_empty_name()
+ function it_throws_an_exception_if_searching_for_file_with_empty_name(): void
{
$this->shouldThrow(\InvalidArgumentException::class)->during('locateFileNamed', ['']);
- $this->shouldThrow(\InvalidArgumentException::class)->during('locateFileNamed', [null]);
}
- function it_throws_an_exception_if_searching_for_files_with_empty_name()
+ function it_throws_an_exception_if_searching_for_files_with_empty_name(): void
{
$this->shouldThrow(\InvalidArgumentException::class)->during('locateFilesNamed', ['']);
- $this->shouldThrow(\InvalidArgumentException::class)->during('locateFilesNamed', [null]);
}
function it_throws_an_exception_if_there_is_no_file_that_matches_the_given_name(
FinderFactoryInterface $finderFactory,
Finder $finder
- ) {
+ ): void {
$finderFactory->create()->willReturn($finder);
$finder->name('readme.md')->shouldBeCalled()->willReturn($finder);
@@ -116,7 +109,7 @@ function it_throws_an_exception_if_there_is_no_file_that_matches_the_given_name(
function it_throws_an_exception_if_there_is_there_are_not_any_files_that_matches_the_given_name(
FinderFactoryInterface $finderFactory,
Finder $finder
- ) {
+ ): void {
$finderFactory->create()->willReturn($finder);
$finder->name('readme.md')->shouldBeCalled()->willReturn($finder);
@@ -134,7 +127,7 @@ function it_isolates_finding_paths_from_multiple_sources(
Finder $firstFinder,
Finder $secondFinder,
SplFileInfo $splFileInfo
- ) {
+ ): void {
$this->beConstructedWith($finderFactory, ['/search/path/first/', '/search/path/second/']);
$finderFactory->create()->willReturn($firstFinder, $secondFinder);
@@ -164,7 +157,7 @@ function it_silences_finder_exceptions_even_if_searching_in_multiple_sources(
Finder $firstFinder,
Finder $secondFinder,
SplFileInfo $splFileInfo
- ) {
+ ): void {
$this->beConstructedWith($finderFactory, ['/search/path/first/', '/search/path/second/']);
$finderFactory->create()->willReturn($firstFinder, $secondFinder);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceLocatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceLocatorSpec.php
index 5f06ad1a42d..848b67db1d6 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceLocatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceLocatorSpec.php
@@ -27,16 +27,11 @@ final class ResourceLocatorSpec extends ObjectBehavior
function let(
ResourceLocatorInterface $applicationResourceLocator,
ResourceLocatorInterface $bundleResourceLocator
- ) {
+ ): void {
$this->beConstructedWith($applicationResourceLocator, $bundleResourceLocator);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ResourceLocator::class);
- }
-
- function it_implements_resource_locator_interface()
+ function it_implements_resource_locator_interface(): void
{
$this->shouldImplement(ResourceLocatorInterface::class);
}
@@ -45,7 +40,7 @@ function it_proxies_locating_resource_to_bundle_resource_locator_if_resource_pat
ResourceLocatorInterface $applicationResourceLocator,
ResourceLocatorInterface $bundleResourceLocator,
ThemeInterface $theme
- ) {
+ ): void {
$applicationResourceLocator->locateResource(Argument::cetera())->shouldNotBeCalled();
$bundleResourceLocator->locateResource('@AcmeBundle/Resources/resource', $theme)->shouldBeCalled();
@@ -57,7 +52,7 @@ function it_proxies_locating_resource_to_application_resource_locator_if_resourc
ResourceLocatorInterface $applicationResourceLocator,
ResourceLocatorInterface $bundleResourceLocator,
ThemeInterface $theme
- ) {
+ ): void {
$bundleResourceLocator->locateResource(Argument::cetera())->shouldNotBeCalled();
$applicationResourceLocator->locateResource('AcmeBundle/resource', $theme)->shouldBeCalled();
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceNotFoundExceptionSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceNotFoundExceptionSpec.php
index 2ee4b0f126c..0bf755a8a14 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceNotFoundExceptionSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Locator/ResourceNotFoundExceptionSpec.php
@@ -22,24 +22,19 @@
*/
final class ResourceNotFoundExceptionSpec extends ObjectBehavior
{
- function let(ThemeInterface $theme)
+ function let(ThemeInterface $theme): void
{
$theme->getName()->willReturn('theme/name');
$this->beConstructedWith('resource name', $theme);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ResourceNotFoundException::class);
- }
-
- function it_is_a_runtime_exception()
+ function it_is_a_runtime_exception(): void
{
$this->shouldHaveType(\RuntimeException::class);
}
- function it_has_custom_message()
+ function it_has_custom_message(): void
{
$this->getMessage()->shouldReturn('Could not find resource "resource name" using theme "theme/name".');
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeAuthorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeAuthorSpec.php
index 472ae07c5dc..452d2460f28 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeAuthorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeAuthorSpec.php
@@ -21,17 +21,12 @@
*/
final class ThemeAuthorSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeAuthor::class);
- }
-
- function it_implements_theme_author_interface()
+ function it_implements_theme_author_interface(): void
{
$this->shouldImplement(ThemeAuthor::class);
}
- function it_has_name()
+ function it_has_name(): void
{
$this->getName()->shouldReturn(null);
@@ -39,7 +34,7 @@ function it_has_name()
$this->getName()->shouldReturn('Krzysztof Krawczyk');
}
- function it_has_email()
+ function it_has_email(): void
{
$this->getEmail()->shouldReturn(null);
@@ -47,7 +42,7 @@ function it_has_email()
$this->getEmail()->shouldReturn('cristopher@example.com');
}
- function it_has_homepage()
+ function it_has_homepage(): void
{
$this->getHomepage()->shouldReturn(null);
@@ -55,7 +50,7 @@ function it_has_homepage()
$this->getHomepage()->shouldReturn('http://example.com');
}
- function it_has_role()
+ function it_has_role(): void
{
$this->getRole()->shouldReturn(null);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeScreenshotSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeScreenshotSpec.php
index f7fc4397e7e..110e3b4576d 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeScreenshotSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeScreenshotSpec.php
@@ -21,24 +21,19 @@
*/
final class ThemeScreenshotSpec extends ObjectBehavior
{
- function let()
+ function let(): void
{
$this->beConstructedWith('/screenshot/path.jpg');
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeScreenshot::class);
- }
-
- function it_has_path()
+ function it_has_path(): void
{
$this->beConstructedWith('/my/screenshot.jpg');
$this->getPath()->shouldReturn('/my/screenshot.jpg');
}
- function it_has_title()
+ function it_has_title(): void
{
$this->getTitle()->shouldReturn(null);
@@ -46,7 +41,7 @@ function it_has_title()
$this->getTitle()->shouldReturn('Candy shop');
}
- function it_has_description()
+ function it_has_description(): void
{
$this->getDescription()->shouldReturn(null);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeSpec.php
index 4f5eb480273..2956f8e8589 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Model/ThemeSpec.php
@@ -24,53 +24,48 @@
*/
final class ThemeSpec extends ObjectBehavior
{
- function let()
+ function let(): void
{
$this->beConstructedWith('theme/name', '/theme/path');
}
- function it_is_initializable()
- {
- $this->shouldHaveType(Theme::class);
- }
-
- function it_implements_theme_interface()
+ function it_implements_theme_interface(): void
{
$this->shouldImplement(ThemeInterface::class);
}
- function its_name_cannot_have_underscores()
+ function its_name_cannot_have_underscores(): void
{
$this->beConstructedWith('first_theme/name', '/theme/path');
$this->shouldThrow(\InvalidArgumentException::class)->duringInstantiation();
}
- function it_has_immutable_name()
+ function it_has_immutable_name(): void
{
$this->getName()->shouldReturn('theme/name');
}
- function its_name_might_contain_numbers()
+ function its_name_might_contain_numbers(): void
{
$this->beConstructedWith('1e/e7', '/theme/path');
$this->getName()->shouldReturn('1e/e7');
}
- function its_name_might_contain_uppercase_characters()
+ function its_name_might_contain_uppercase_characters(): void
{
$this->beConstructedWith('AbC/DeF', '/theme/path');
$this->getName()->shouldReturn('AbC/DeF');
}
- function it_has_immutable_path()
+ function it_has_immutable_path(): void
{
$this->getPath()->shouldReturn('/theme/path');
}
- function it_has_title()
+ function it_has_title(): void
{
$this->getTitle()->shouldReturn(null);
@@ -78,7 +73,7 @@ function it_has_title()
$this->getTitle()->shouldReturn('Foo Bar');
}
- function it_has_description()
+ function it_has_description(): void
{
$this->getDescription()->shouldReturn(null);
@@ -86,7 +81,7 @@ function it_has_description()
$this->getDescription()->shouldReturn('Lorem ipsum.');
}
- function it_has_authors()
+ function it_has_authors(): void
{
$themeAuthor = new ThemeAuthor();
@@ -99,7 +94,7 @@ function it_has_authors()
$this->getAuthors()->shouldHaveCount(0);
}
- function it_has_parents(ThemeInterface $theme)
+ function it_has_parents(ThemeInterface $theme): void
{
$this->getParents()->shouldHaveCount(0);
@@ -110,7 +105,7 @@ function it_has_parents(ThemeInterface $theme)
$this->getParents()->shouldHaveCount(0);
}
- function it_has_screenshots()
+ function it_has_screenshots(): void
{
$themeScreenshot = new ThemeScreenshot('some path');
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Clearer/TemplatePathsCacheClearerSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Clearer/TemplatePathsCacheClearerSpec.php
index 18ddd8cc167..70645a75717 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Clearer/TemplatePathsCacheClearerSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Clearer/TemplatePathsCacheClearerSpec.php
@@ -24,29 +24,24 @@
*/
final class TemplatePathsCacheClearerSpec extends ObjectBehavior
{
- function let(Cache $cache)
+ function let(Cache $cache): void
{
$this->beConstructedWith($cache);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TemplatePathsCacheClearer::class);
- }
-
- function it_implements_cache_clearer_interface()
+ function it_implements_cache_clearer_interface(): void
{
$this->shouldImplement(CacheClearerInterface::class);
}
- function it_deletes_all_elements_if_cache_is_clearable(ClearableCache $cache)
+ function it_deletes_all_elements_if_cache_is_clearable(ClearableCache $cache): void
{
$cache->deleteAll()->shouldBeCalled();
$this->clear(null);
}
- function it_does_not_throw_any_error_if_cache_is_not_clearable()
+ function it_does_not_throw_any_error_if_cache_is_not_clearable(): void
{
$this->clear(null);
}
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Warmer/TemplatePathsCacheWarmerSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Warmer/TemplatePathsCacheWarmerSpec.php
index f83cb688a19..e5bfdb0068e 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Warmer/TemplatePathsCacheWarmerSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Cache/Warmer/TemplatePathsCacheWarmerSpec.php
@@ -34,16 +34,11 @@ function let(
TemplateLocatorInterface $templateLocator,
ThemeRepositoryInterface $themeRepository,
Cache $cache
- ) {
+ ): void {
$this->beConstructedWith($templateFinder, $templateLocator, $themeRepository, $cache);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TemplatePathsCacheWarmer::class);
- }
-
- function it_implements_cache_warmer_interface()
+ function it_implements_cache_warmer_interface(): void
{
$this->shouldImplement(CacheWarmerInterface::class);
}
@@ -56,7 +51,7 @@ function it_builds_cache_by_warming_up_every_template_and_every_theme_together(
ThemeInterface $theme,
TemplateReferenceInterface $firstTemplate,
TemplateReferenceInterface $secondTemplate
- ) {
+ ): void {
$templateFinder->findAllTemplates()->willReturn([$firstTemplate, $secondTemplate]);
$themeRepository->findAll()->willReturn([$theme]);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/CachedTemplateLocatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/CachedTemplateLocatorSpec.php
index 9fda24a2a2c..22b0ff3b409 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/CachedTemplateLocatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/CachedTemplateLocatorSpec.php
@@ -27,17 +27,12 @@
*/
final class CachedTemplateLocatorSpec extends ObjectBehavior
{
- function let(TemplateLocatorInterface $decoratedTemplateLocator, Cache $cache)
+ function let(TemplateLocatorInterface $decoratedTemplateLocator, Cache $cache): void
{
$this->beConstructedWith($decoratedTemplateLocator, $cache);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(CachedTemplateLocator::class);
- }
-
- function it_implements_template_locator_interface()
+ function it_implements_template_locator_interface(): void
{
$this->shouldImplement(TemplateLocatorInterface::class);
}
@@ -47,7 +42,7 @@ function it_returns_the_location_found_in_cache(
Cache $cache,
TemplateReferenceInterface $template,
ThemeInterface $theme
- ) {
+ ): void {
$template->getLogicalName()->willReturn('Logical:Name');
$theme->getName()->willReturn('theme/name');
@@ -64,7 +59,7 @@ function it_uses_decorated_template_locator_if_location_can_not_be_found_in_cach
Cache $cache,
TemplateReferenceInterface $template,
ThemeInterface $theme
- ) {
+ ): void {
$template->getLogicalName()->willReturn('Logical:Name');
$theme->getName()->willReturn('theme/name');
@@ -81,7 +76,7 @@ function it_throws_resource_not_found_exception_if_the_location_found_in_cache_i
Cache $cache,
TemplateReferenceInterface $template,
ThemeInterface $theme
- ) {
+ ): void {
$template->getLogicalName()->willReturn('Logical:Name');
$template->getPath()->willReturn('@Acme/template.html.twig');
$theme->getName()->willReturn('theme/name');
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateFileLocatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateFileLocatorSpec.php
index 7c6836625e8..48e6471932c 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateFileLocatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateFileLocatorSpec.php
@@ -34,21 +34,16 @@ function let(
ThemeContextInterface $themeContext,
ThemeHierarchyProviderInterface $themeHierarchyProvider,
TemplateLocatorInterface $templateLocator
- ) {
+ ): void {
$this->beConstructedWith($decoratedFileLocator, $themeContext, $themeHierarchyProvider, $templateLocator);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TemplateFileLocator::class);
- }
-
- function it_implements_file_locator_interface()
+ function it_implements_file_locator_interface(): void
{
$this->shouldImplement(FileLocatorInterface::class);
}
- function it_throws_an_exception_if_located_thing_is_not_an_instance_of_template_reference_interface()
+ function it_throws_an_exception_if_located_thing_is_not_an_instance_of_template_reference_interface(): void
{
$this->shouldThrow(\InvalidArgumentException::class)->during('locate', ['not an instance']);
}
@@ -60,7 +55,7 @@ function it_returns_first_possible_theme_resource(
TemplateReferenceInterface $template,
ThemeInterface $firstTheme,
ThemeInterface $secondTheme
- ) {
+ ): void {
$themeContext->getTheme()->willReturn($firstTheme);
$themeHierarchyProvider->getThemeHierarchy($firstTheme)->willReturn([$firstTheme, $secondTheme]);
@@ -77,7 +72,7 @@ function it_falls_back_to_decorated_template_locator_if_themed_tempaltes_can_not
TemplateLocatorInterface $templateLocator,
TemplateReferenceInterface $template,
ThemeInterface $theme
- ) {
+ ): void {
$themeContext->getTheme()->willReturn($theme);
$themeHierarchyProvider->getThemeHierarchy($theme)->willReturn([$theme]);
@@ -93,7 +88,7 @@ function it_falls_back_to_decorated_template_locator_if_there_are_no_themes_acti
ThemeContextInterface $themeContext,
ThemeHierarchyProviderInterface $themeHierarchyProvider,
TemplateReferenceInterface $template
- ) {
+ ): void {
$themeContext->getTheme()->willReturn(null);
$themeHierarchyProvider->getThemeHierarchy(null)->willReturn([]);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateLocatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateLocatorSpec.php
index 7aceda4c8da..bdacbbffb3b 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateLocatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Templating/Locator/TemplateLocatorSpec.php
@@ -26,17 +26,12 @@
*/
final class TemplateLocatorSpec extends ObjectBehavior
{
- function let(ResourceLocatorInterface $resourceLocator)
+ function let(ResourceLocatorInterface $resourceLocator): void
{
$this->beConstructedWith($resourceLocator);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TemplateLocator::class);
- }
-
- function it_implements_template_locator_interface()
+ function it_implements_template_locator_interface(): void
{
$this->shouldImplement(TemplateLocatorInterface::class);
}
@@ -45,7 +40,7 @@ function it_proxies_locating_template_to_resource_locator(
ResourceLocatorInterface $resourceLocator,
TemplateReferenceInterface $template,
ThemeInterface $theme
- ) {
+ ): void {
$template->getPath()->willReturn('@AcmeBundle/Resources/views/index.html.twig');
$resourceLocator->locateResource('@AcmeBundle/Resources/views/index.html.twig', $theme)->willReturn('/acme/index.html.twig');
@@ -57,7 +52,7 @@ function it_does_not_catch_exceptions_thrown_while_locating_template_to_resource
ResourceLocatorInterface $resourceLocator,
TemplateReferenceInterface $template,
ThemeInterface $theme
- ) {
+ ): void {
$template->getPath()->willReturn('@AcmeBundle/Resources/views/index.html.twig');
$resourceLocator->locateResource('@AcmeBundle/Resources/views/index.html.twig', $theme)->willThrow(ResourceNotFoundException::class);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Templating/TemplateNameParserSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Templating/TemplateNameParserSpec.php
index db30b1fd9dd..64803c67bde 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Templating/TemplateNameParserSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Templating/TemplateNameParserSpec.php
@@ -16,22 +16,17 @@
*/
final class TemplateNameParserSpec extends ObjectBehavior
{
- function let(TemplateNameParserInterface $decoratedParser, KernelInterface $kernel)
+ function let(TemplateNameParserInterface $decoratedParser, KernelInterface $kernel): void
{
$this->beConstructedWith($decoratedParser, $kernel);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TemplateNameParser::class);
- }
-
- function it_is_a_template_name_parser()
+ function it_is_a_template_name_parser(): void
{
$this->shouldImplement(TemplateNameParserInterface::class);
}
- function it_returns_template_reference_if_passed_as_name(TemplateReferenceInterface $templateReference)
+ function it_returns_template_reference_if_passed_as_name(TemplateReferenceInterface $templateReference): void
{
$this->parse($templateReference)->shouldReturn($templateReference);
}
@@ -39,7 +34,7 @@ function it_returns_template_reference_if_passed_as_name(TemplateReferenceInterf
function it_delegates_logical_paths_to_decorated_parser(
TemplateNameParserInterface $decoratedParser,
TemplateReferenceInterface $templateReference
- ) {
+ ): void {
$decoratedParser->parse('Bundle:Not:namespaced.html.twig')->willReturn($templateReference);
$this->parse('Bundle:Not:namespaced.html.twig')->shouldReturn($templateReference);
@@ -48,13 +43,13 @@ function it_delegates_logical_paths_to_decorated_parser(
function it_delegates_unknown_paths_to_decorated_parser(
TemplateNameParserInterface $decoratedParser,
TemplateReferenceInterface $templateReference
- ) {
+ ): void {
$decoratedParser->parse('Bundle/Not/namespaced.html.twig')->willReturn($templateReference);
$this->parse('Bundle/Not/namespaced.html.twig')->shouldReturn($templateReference);
}
- function it_generates_template_references_from_namespaced_paths(KernelInterface $kernel)
+ function it_generates_template_references_from_namespaced_paths(KernelInterface $kernel): void
{
$kernel->getBundle('AcmeBundle')->willReturn(null); // just do not throw an exception
@@ -69,7 +64,7 @@ function it_delegates_custom_namespace_to_decorated_parser(
KernelInterface $kernel,
TemplateNameParserInterface $decoratedParser,
TemplateReferenceInterface $templateReference
- ) {
+ ): void {
$kernel->getBundle('myBundle')->willThrow(\Exception::class);
$decoratedParser->parse('@my/custom/namespace.html.twig')->willReturn($templateReference);
@@ -77,7 +72,7 @@ function it_delegates_custom_namespace_to_decorated_parser(
$this->parse('@my/custom/namespace.html.twig')->shouldReturn($templateReference);
}
- function it_generates_template_references_from_root_namespaced_paths()
+ function it_generates_template_references_from_root_namespaced_paths(): void
{
$this->parse('/app.html.twig')->shouldBeLike(new TemplateReference('', '', 'app', 'html', 'twig'));
$this->parse('/Directory/app.html.twig')->shouldBeLike(new TemplateReference('', 'Directory', 'app', 'html', 'twig'));
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/OrderingTranslationFilesFinderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/OrderingTranslationFilesFinderSpec.php
index ad08e61cbc7..86b43bafdb5 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/OrderingTranslationFilesFinderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/OrderingTranslationFilesFinderSpec.php
@@ -22,24 +22,19 @@
*/
final class OrderingTranslationFilesFinderSpec extends ObjectBehavior
{
- function let(TranslationFilesFinderInterface $translationFilesFinder)
+ function let(TranslationFilesFinderInterface $translationFilesFinder): void
{
$this->beConstructedWith($translationFilesFinder);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(OrderingTranslationFilesFinder::class);
- }
-
- function it_implements_Translation_Files_Finder_interface()
+ function it_implements_Translation_Files_Finder_interface(): void
{
$this->shouldImplement(TranslationFilesFinderInterface::class);
}
function it_puts_application_translations_files_before_bundle_translations_files(
TranslationFilesFinderInterface $translationFilesFinder
- ) {
+ ): void {
$translationFilesFinder->findTranslationFiles('/some/path/to/theme')->willReturn([
'/some/path/to/theme/AcmeBundle/messages.en.yml',
'/some/path/to/theme/translations/messages.en.yml',
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/TranslationFilesFinderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/TranslationFilesFinderSpec.php
index caa03c57a0b..f49a617c043 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/TranslationFilesFinderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Finder/TranslationFilesFinderSpec.php
@@ -24,17 +24,12 @@
*/
final class TranslationFilesFinderSpec extends ObjectBehavior
{
- function let(FinderFactoryInterface $finderFactory)
+ function let(FinderFactoryInterface $finderFactory): void
{
$this->beConstructedWith($finderFactory);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TranslationFilesFinder::class);
- }
-
- function it_implements_translation_resource_finder_interface()
+ function it_implements_translation_resource_finder_interface(): void
{
$this->shouldImplement(TranslationFilesFinderInterface::class);
}
@@ -42,7 +37,7 @@ function it_implements_translation_resource_finder_interface()
function it_returns_an_array_of_translation_resources_paths(
FinderFactoryInterface $finderFactory,
Finder $finder
- ) {
+ ): void {
$finderFactory->create()->willReturn($finder);
$finder->in('/theme')->shouldBeCalled()->willReturn($finder);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Loader/TranslatorLoaderProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Loader/TranslatorLoaderProviderSpec.php
index efc12c9ab3f..c4f6cf2344d 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Loader/TranslatorLoaderProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Loader/TranslatorLoaderProviderSpec.php
@@ -23,12 +23,7 @@
*/
final class TranslatorLoaderProviderSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(TranslatorLoaderProvider::class);
- }
-
- function it_implements_translation_loader_provider_interface()
+ function it_implements_translation_loader_provider_interface(): void
{
$this->shouldImplement(TranslatorLoaderProviderInterface::class);
}
@@ -36,7 +31,7 @@ function it_implements_translation_loader_provider_interface()
function it_returns_previously_received_loaders(
LoaderInterface $firstLoader,
LoaderInterface $secondLoader
- ) {
+ ): void {
$this->beConstructedWith(['first' => $firstLoader, 'second' => $secondLoader]);
$this->getLoaders()->shouldReturn(['first' => $firstLoader, 'second' => $secondLoader]);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/CompositeTranslatorResourceProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/CompositeTranslatorResourceProviderSpec.php
index 55a0c011072..b2bd3c3d449 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/CompositeTranslatorResourceProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/CompositeTranslatorResourceProviderSpec.php
@@ -23,12 +23,7 @@
*/
final class CompositeTranslatorResourceProviderSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(CompositeTranslatorResourceProvider::class);
- }
-
- function it_implements_translator_resource_provider_interface()
+ function it_implements_translator_resource_provider_interface(): void
{
$this->shouldImplement(TranslatorResourceProviderInterface::class);
}
@@ -38,7 +33,7 @@ function it_aggregates_the_resources(
TranslatorResourceProviderInterface $secondResourceProvider,
TranslationResourceInterface $firstResource,
TranslationResourceInterface $secondResource
- ) {
+ ): void {
$this->beConstructedWith([$firstResourceProvider, $secondResourceProvider]);
$firstResourceProvider->getResources()->willReturn([$firstResource]);
@@ -50,7 +45,7 @@ function it_aggregates_the_resources(
function it_aggregates_the_resources_locales(
TranslatorResourceProviderInterface $firstResourceProvider,
TranslatorResourceProviderInterface $secondResourceProvider
- ) {
+ ): void {
$this->beConstructedWith([$firstResourceProvider, $secondResourceProvider]);
$firstResourceProvider->getResourcesLocales()->willReturn(['first-locale']);
@@ -62,7 +57,7 @@ function it_aggregates_the_resources_locales(
function it_aggregates_the_unique_resources_locales(
TranslatorResourceProviderInterface $firstResourceProvider,
TranslatorResourceProviderInterface $secondResourceProvider
- ) {
+ ): void {
$this->beConstructedWith([$firstResourceProvider, $secondResourceProvider]);
$firstResourceProvider->getResourcesLocales()->willReturn(['first-locale']);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/ThemeTranslatorResourceProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/ThemeTranslatorResourceProviderSpec.php
index 06c8a4dca23..5a48f63efd3 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/ThemeTranslatorResourceProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/ThemeTranslatorResourceProviderSpec.php
@@ -31,16 +31,11 @@ function let(
TranslationFilesFinderInterface $translationFilesFinder,
ThemeRepositoryInterface $themeRepository,
ThemeHierarchyProviderInterface $themeHierarchyProvider
- ) {
+ ): void {
$this->beConstructedWith($translationFilesFinder, $themeRepository, $themeHierarchyProvider);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeTranslatorResourceProvider::class);
- }
-
- function it_implements_translator_resource_provider_interface()
+ function it_implements_translator_resource_provider_interface(): void
{
$this->shouldImplement(TranslatorResourceProviderInterface::class);
}
@@ -50,7 +45,7 @@ function it_returns_translation_files_found_in_given_paths(
ThemeRepositoryInterface $themeRepository,
ThemeHierarchyProviderInterface $themeHierarchyProvider,
ThemeInterface $theme
- ) {
+ ): void {
$themeRepository->findAll()->willReturn([$theme]);
$themeHierarchyProvider->getThemeHierarchy($theme)->willReturn([$theme]);
@@ -70,7 +65,7 @@ function it_returns_inherited_themes_as_the_main_theme_resources(
ThemeHierarchyProviderInterface $themeHierarchyProvider,
ThemeInterface $mainTheme,
ThemeInterface $parentTheme
- ) {
+ ): void {
$themeRepository->findAll()->willReturn([$mainTheme]);
$themeHierarchyProvider->getThemeHierarchy($mainTheme)->willReturn([$mainTheme, $parentTheme]);
@@ -95,7 +90,7 @@ function it_doubles_resources_if_used_in_more_than_one_theme(
ThemeHierarchyProviderInterface $themeHierarchyProvider,
ThemeInterface $mainTheme,
ThemeInterface $parentTheme
- ) {
+ ): void {
$themeRepository->findAll()->willReturn([$mainTheme, $parentTheme]);
$themeHierarchyProvider->getThemeHierarchy($mainTheme)->willReturn([$mainTheme, $parentTheme]);
$themeHierarchyProvider->getThemeHierarchy($parentTheme)->willReturn([$parentTheme]);
@@ -121,7 +116,7 @@ function it_returns_resources_locales_while_using_just_one_theme(
ThemeRepositoryInterface $themeRepository,
ThemeHierarchyProviderInterface $themeHierarchyProvider,
ThemeInterface $theme
- ) {
+ ): void {
$themeRepository->findAll()->willReturn([$theme]);
$themeHierarchyProvider->getThemeHierarchy($theme)->willReturn([$theme]);
@@ -139,7 +134,7 @@ function it_returns_resources_locales_while_using_one_nested_theme(
ThemeHierarchyProviderInterface $themeHierarchyProvider,
ThemeInterface $mainTheme,
ThemeInterface $parentTheme
- ) {
+ ): void {
$themeRepository->findAll()->willReturn([$mainTheme]);
$themeHierarchyProvider->getThemeHierarchy($mainTheme)->willReturn([$mainTheme, $parentTheme]);
@@ -161,7 +156,7 @@ function it_returns_resources_locales_while_using_more_than_one_theme(
ThemeHierarchyProviderInterface $themeHierarchyProvider,
ThemeInterface $mainTheme,
ThemeInterface $parentTheme
- ) {
+ ): void {
$themeRepository->findAll()->willReturn([$mainTheme, $parentTheme]);
$themeHierarchyProvider->getThemeHierarchy($mainTheme)->willReturn([$mainTheme, $parentTheme]);
$themeHierarchyProvider->getThemeHierarchy($parentTheme)->willReturn([$parentTheme]);
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/TranslatorResourceProviderSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/TranslatorResourceProviderSpec.php
index f9f502eb77e..5e51cbc6d9f 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/TranslatorResourceProviderSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Provider/Resource/TranslatorResourceProviderSpec.php
@@ -23,17 +23,12 @@
*/
final class TranslatorResourceProviderSpec extends ObjectBehavior
{
- function it_is_initializable()
- {
- $this->shouldHaveType(TranslatorResourceProvider::class);
- }
-
- function it_implements_translation_resource_provider_interface()
+ function it_implements_translation_resource_provider_interface(): void
{
$this->shouldImplement(TranslatorResourceProviderInterface::class);
}
- function it_transforms_previously_received_paths_into_translation_resources()
+ function it_transforms_previously_received_paths_into_translation_resources(): void
{
$this->beConstructedWith([
'messages.en.yml',
@@ -46,7 +41,7 @@ function it_transforms_previously_received_paths_into_translation_resources()
]);
}
- function it_extracts_unique_locales_from_received_paths()
+ function it_extracts_unique_locales_from_received_paths(): void
{
$this->beConstructedWith([
'messages.en.yml',
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/ThemeTranslationResourceSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/ThemeTranslationResourceSpec.php
index 6bdef43a25e..2c6ddb73fcd 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/ThemeTranslationResourceSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/ThemeTranslationResourceSpec.php
@@ -23,24 +23,19 @@
*/
final class ThemeTranslationResourceSpec extends ObjectBehavior
{
- function let(ThemeInterface $theme)
+ function let(ThemeInterface $theme): void
{
$theme->getName()->willReturn('theme/name');
$this->beConstructedWith($theme, 'my-domain.my-locale.my-format');
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeTranslationResource::class);
- }
-
- function it_implements_translation_resource_interface()
+ function it_implements_translation_resource_interface(): void
{
$this->shouldImplement(TranslationResourceInterface::class);
}
- function it_is_a_translation_resource_value_object()
+ function it_is_a_translation_resource_value_object(): void
{
$this->getName()->shouldReturn('my-domain.my-locale.my-format');
$this->getDomain()->shouldReturn('my-domain');
@@ -48,7 +43,7 @@ function it_is_a_translation_resource_value_object()
$this->getFormat()->shouldReturn('my-format');
}
- function it_throws_an_invalid_argument_exception_if_failed_to_instantiate_with_given_filepath(ThemeInterface $theme)
+ function it_throws_an_invalid_argument_exception_if_failed_to_instantiate_with_given_filepath(ThemeInterface $theme): void
{
$theme->getName()->willReturn('theme/name');
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/TranslationResourceSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/TranslationResourceSpec.php
index 268ec2a416d..80bd4f53c40 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/TranslationResourceSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/Resource/TranslationResourceSpec.php
@@ -22,22 +22,17 @@
*/
final class TranslationResourceSpec extends ObjectBehavior
{
- function let()
+ function let(): void
{
$this->beConstructedWith('my-domain.my-locale.my-format');
}
- function it_is_initializable()
- {
- $this->shouldHaveType(TranslationResource::class);
- }
-
- function it_implements_translation_resource_interface()
+ function it_implements_translation_resource_interface(): void
{
$this->shouldImplement(TranslationResourceInterface::class);
}
- function it_is_a_translation_resource_value_object()
+ function it_is_a_translation_resource_value_object(): void
{
$this->getName()->shouldReturn('my-domain.my-locale.my-format');
$this->getDomain()->shouldReturn('my-domain');
@@ -45,7 +40,7 @@ function it_is_a_translation_resource_value_object()
$this->getFormat()->shouldReturn('my-format');
}
- function it_throws_an_invalid_argument_exception_if_failed_to_instantiate_with_given_filepath()
+ function it_throws_an_invalid_argument_exception_if_failed_to_instantiate_with_given_filepath(): void
{
$this->beConstructedWith('one.dot');
diff --git a/src/Sylius/Bundle/ThemeBundle/spec/Translation/ThemeAwareTranslatorSpec.php b/src/Sylius/Bundle/ThemeBundle/spec/Translation/ThemeAwareTranslatorSpec.php
index e43ee13d7ca..12b74936e02 100644
--- a/src/Sylius/Bundle/ThemeBundle/spec/Translation/ThemeAwareTranslatorSpec.php
+++ b/src/Sylius/Bundle/ThemeBundle/spec/Translation/ThemeAwareTranslatorSpec.php
@@ -27,40 +27,35 @@
*/
final class ThemeAwareTranslatorSpec extends ObjectBehavior
{
- function let(TranslatorInterface $translator, ThemeContextInterface $themeContext) {
+ function let(TranslatorInterface $translator, ThemeContextInterface $themeContext): void {
$translator->implement(TranslatorBagInterface::class);
$this->beConstructedWith($translator, $themeContext);
}
- function it_is_initializable()
- {
- $this->shouldHaveType(ThemeAwareTranslator::class);
- }
-
- function it_implements_translator_interface()
+ function it_implements_translator_interface(): void
{
$this->shouldImplement(TranslatorInterface::class);
}
- function it_implements_translator_bag_interface()
+ function it_implements_translator_bag_interface(): void
{
$this->shouldImplement(TranslatorBagInterface::class);
}
- function it_implements_warmable_interface()
+ function it_implements_warmable_interface(): void
{
$this->shouldImplement(WarmableInterface::class);
}
- function it_proxies_getting_the_locale_to_the_decorated_translator(TranslatorInterface $translator)
+ function it_proxies_getting_the_locale_to_the_decorated_translator(TranslatorInterface $translator): void
{
$translator->getLocale()->willReturn('pl_PL');
$this->getLocale()->shouldReturn('pl_PL');
}
- function it_proxies_setting_the_locale_to_the_decorated_translator(TranslatorInterface $translator)
+ function it_proxies_setting_the_locale_to_the_decorated_translator(TranslatorInterface $translator): void
{
$translator->setLocale('pl_PL')->shouldBeCalled();
@@ -70,13 +65,13 @@ function it_proxies_setting_the_locale_to_the_decorated_translator(TranslatorInt
function it_proxies_getting_catalogue_for_given_locale_to_the_decorated_translator(
TranslatorBagInterface $translator,
MessageCatalogueInterface $messageCatalogue
- ) {
+ ): void {
$translator->getCatalogue('pl_PL')->willReturn($messageCatalogue);
$this->getCatalogue('pl_PL')->shouldReturn($messageCatalogue);
}
- function it_just_proxies_translating(TranslatorInterface $translator, ThemeContextInterface $themeContext)
+ function it_just_proxies_translating(TranslatorInterface $translator, ThemeContextInterface $themeContext): void
{
$themeContext->getTheme()->willReturn(null);
@@ -85,7 +80,7 @@ function it_just_proxies_translating(TranslatorInterface $translator, ThemeConte
$this->trans('id', ['param'], 'domain')->shouldReturn('translated string');
}
- function it_just_proxies_translating_with_custom_locale(TranslatorInterface $translator, ThemeContextInterface $themeContext)
+ function it_just_proxies_translating_with_custom_locale(TranslatorInterface $translator, ThemeContextInterface $themeContext): void
{
$themeContext->getTheme()->willReturn(null);
@@ -98,7 +93,7 @@ function it_proxies_translating_with_modified_default_locale(
TranslatorInterface $translator,
ThemeContextInterface $themeContext,
ThemeInterface $theme
- ) {
+ ): void {
$themeContext->getTheme()->willReturn($theme);
$theme->getName()->willReturn('theme/name');
@@ -112,7 +107,7 @@ function it_proxies_translating_with_modified_custom_locale(
TranslatorInterface $translator,
ThemeContextInterface $themeContext,
ThemeInterface $theme
- ) {
+ ): void {
$themeContext->getTheme()->willReturn($theme);
$theme->getName()->willReturn('theme/name');
@@ -121,7 +116,7 @@ function it_proxies_translating_with_modified_custom_locale(
$this->trans('id', ['param'], 'domain', 'customlocale')->shouldReturn('translated string');
}
- function it_just_proxies_choice_translating(TranslatorInterface $translator, ThemeContextInterface $themeContext)
+ function it_just_proxies_choice_translating(TranslatorInterface $translator, ThemeContextInterface $themeContext): void
{
$themeContext->getTheme()->willReturn(null);
@@ -130,7 +125,7 @@ function it_just_proxies_choice_translating(TranslatorInterface $translator, The
$this->transChoice('id', 2, ['param'], 'domain')->shouldReturn('translated string');
}
- function it_just_proxies_choice_translating_with_custom_locale(TranslatorInterface $translator, ThemeContextInterface $themeContext)
+ function it_just_proxies_choice_translating_with_custom_locale(TranslatorInterface $translator, ThemeContextInterface $themeContext): void
{
$themeContext->getTheme()->willReturn(null);
@@ -143,7 +138,7 @@ function it_proxies_choice_translating_with_modified_default_locale(
TranslatorInterface $translator,
ThemeContextInterface $themeContext,
ThemeInterface $theme
- ) {
+ ): void {
$themeContext->getTheme()->willReturn($theme);
$theme->getName()->willReturn('theme/name');
@@ -157,7 +152,7 @@ function it_proxies_choice_translating_with_modified_custom_locale(
TranslatorInterface $translator,
ThemeContextInterface $themeContext,
ThemeInterface $theme
- ) {
+ ): void {
$themeContext->getTheme()->willReturn($theme);
$theme->getName()->willReturn('theme/name');
@@ -166,12 +161,12 @@ function it_proxies_choice_translating_with_modified_custom_locale(
$this->transChoice('id', 2, ['param'], 'domain', 'customlocale')->shouldReturn('translated string');
}
- function it_does_not_warm_up_if_decorated_translator_is_not_warmable()
+ function it_does_not_warm_up_if_decorated_translator_is_not_warmable(): void
{
$this->warmUp('cache');
}
- function it_warms_up_if_decorated_translator_is_warmable(WarmableInterface $translator)
+ function it_warms_up_if_decorated_translator_is_warmable(WarmableInterface $translator): void
{
$translator->warmUp('cache')->shouldBeCalled();