Skip to content

Commit

Permalink
refactor #110 Use PHP 7.4 syntax (Zales0123)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.2-dev branch.

Discussion
----------

Related to Sylius/Sylius#12891 馃枛 馃殌 

Commits
-------

cea92fc Do not use empty string as valid locale
7601b50 Use PHP 7.4 syntax
  • Loading branch information
lchrusciel committed Dec 20, 2021
2 parents 588ed2c + 7601b50 commit 707bcf5
Show file tree
Hide file tree
Showing 48 changed files with 113 additions and 183 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"symfony/security-csrf": "^4.4 || ^5.2",
"symfony/twig-bundle": "^4.4 || ^5.2",
"twig/twig": "^2.0 || ^3.0",
"vimeo/psalm": "4.7.3"
"vimeo/psalm": "4.7.3",
"rector/rector": "^0.11.57"
},
"extra": {
"branch-alias": {
Expand Down
18 changes: 18 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void
{
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);

$services = $containerConfigurator->services();
$services->set(TypedPropertyRector::class);
};
15 changes: 5 additions & 10 deletions src/Asset/Installer/AssetsInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@

final class AssetsInstaller implements AssetsInstallerInterface
{
/** @var Filesystem */
private $filesystem;
private Filesystem $filesystem;

/** @var KernelInterface */
private $kernel;
private KernelInterface $kernel;

/** @var ThemeRepositoryInterface */
private $themeRepository;
private ThemeRepositoryInterface $themeRepository;

/** @var PathResolverInterface */
private $pathResolver;
private PathResolverInterface $pathResolver;

/** @var AssetsProviderInterface */
private $assetsProvider;
private AssetsProviderInterface $assetsProvider;

public function __construct(
Filesystem $filesystem,
Expand Down
6 changes: 2 additions & 4 deletions src/Asset/Installer/AssetsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@

final class AssetsProvider implements AssetsProviderInterface
{
/** @var KernelInterface */
private $kernel;
private KernelInterface $kernel;

/** @var ThemeHierarchyProviderInterface */
private $themeHierarchyProvider;
private ThemeHierarchyProviderInterface $themeHierarchyProvider;

public function __construct(KernelInterface $kernel, ThemeHierarchyProviderInterface $themeHierarchyProvider)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Asset/Installer/LegacyAssetsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@
*/
final class LegacyAssetsProvider implements AssetsProviderInterface
{
/** @var AssetsProviderInterface */
private $assetsProvider;
private AssetsProviderInterface $assetsProvider;

/** @var KernelInterface */
private $kernel;
private KernelInterface $kernel;

/** @var ThemeHierarchyProviderInterface */
private $themeHierarchyProvider;
private ThemeHierarchyProviderInterface $themeHierarchyProvider;

public function __construct(AssetsProviderInterface $assetsProvider, KernelInterface $kernel, ThemeHierarchyProviderInterface $themeHierarchyProvider)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Asset/Installer/OutputAwareAssetsInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

final class OutputAwareAssetsInstaller implements AssetsInstallerInterface, OutputAwareInterface
{
/** @var AssetsInstallerInterface */
private $assetsInstaller;
private AssetsInstallerInterface $assetsInstaller;

/** @var OutputInterface */
private $output;
private OutputInterface $output;

public function __construct(AssetsInstallerInterface $assetsInstaller)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Asset/PathResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

final class PathResolver implements PathResolverInterface
{
/** @var AssetsProviderInterface */
private $assetsProvider;
private AssetsProviderInterface $assetsProvider;

/** @var FilesystemInterface */
private $filesystem;
private FilesystemInterface $filesystem;

public function __construct(AssetsProviderInterface $assetsProvider, FilesystemInterface $filesystem)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Collector/ThemeCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@

final class ThemeCollector extends DataCollector
{
/** @var ThemeRepositoryInterface */
private $themeRepository;
private ThemeRepositoryInterface $themeRepository;

/** @var ThemeContextInterface */
private $themeContext;
private ThemeContextInterface $themeContext;

/** @var ThemeHierarchyProviderInterface */
private $themeHierarchyProvider;
private ThemeHierarchyProviderInterface $themeHierarchyProvider;

/**
* @var array
Expand Down
6 changes: 2 additions & 4 deletions src/Command/AssetsInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
*/
final class AssetsInstallCommand extends Command
{
/** @var AssetsInstallerInterface */
private $assetsInstaller;
private AssetsInstallerInterface $assetsInstaller;

/** @var string */
private $projectDir;
private string $projectDir;

public function __construct(AssetsInstallerInterface $assetsInstaller, string $projectDir)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Command/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

final class ListCommand extends Command
{
/** @var ThemeRepositoryInterface */
private $themeRepository;
private ThemeRepositoryInterface $themeRepository;

public function __construct(ThemeRepositoryInterface $themeRepository)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/CompositeConfigurationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
final class CompositeConfigurationProvider implements ConfigurationProviderInterface
{
/** @var ConfigurationProviderInterface[] */
private $configurationProviders;
private array $configurationProviders;

/**
* @param ConfigurationProviderInterface[] $configurationProviders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@

final class FilesystemConfigurationProvider implements ConfigurationProviderInterface
{
/** @var FileLocatorInterface */
private $fileLocator;
private FileLocatorInterface $fileLocator;

/** @var ConfigurationLoaderInterface */
private $loader;
private ConfigurationLoaderInterface $loader;

/** @var string */
private $configurationFilename;
private string $configurationFilename;

/**
* @param string $configurationFilename
Expand Down
3 changes: 1 addition & 2 deletions src/Configuration/Filesystem/JsonFileConfigurationLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

final class JsonFileConfigurationLoader implements ConfigurationLoaderInterface
{
/** @var FilesystemInterface */
private $filesystem;
private FilesystemInterface $filesystem;

public function __construct(FilesystemInterface $filesystem)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@

final class ProcessingConfigurationLoader implements ConfigurationLoaderInterface
{
/** @var ConfigurationLoaderInterface */
private $decoratedLoader;
private ConfigurationLoaderInterface $decoratedLoader;

/** @var ConfigurationProcessorInterface */
private $configurationProcessor;
private ConfigurationProcessorInterface $configurationProcessor;

public function __construct(ConfigurationLoaderInterface $decoratedLoader, ConfigurationProcessorInterface $configurationProcessor)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Configuration/SymfonyConfigurationProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@

final class SymfonyConfigurationProcessor implements ConfigurationProcessorInterface
{
/** @var ConfigurationInterface */
private $configuration;
private ConfigurationInterface $configuration;

/** @var Processor */
private $processor;
private Processor $processor;

public function __construct(ConfigurationInterface $configuration, Processor $processor)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Configuration/Test/TestConfigurationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

final class TestConfigurationProvider implements ConfigurationProviderInterface
{
/** @var TestThemeConfigurationManagerInterface */
private $testThemeConfigurationManager;
private TestThemeConfigurationManagerInterface $testThemeConfigurationManager;

public function __construct(TestThemeConfigurationManagerInterface $testThemeConfigurationManager)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Configuration/Test/TestThemeConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@

final class TestThemeConfigurationManager implements TestThemeConfigurationManagerInterface
{
/** @var ConfigurationProcessorInterface */
private $configurationProcessor;
private ConfigurationProcessorInterface $configurationProcessor;

/** @var Filesystem */
private $filesystem;
private Filesystem $filesystem;

/** @var string */
private $configurationsFile;
private string $configurationsFile;

public function __construct(ConfigurationProcessorInterface $configurationProcessor, string $cacheDir)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Context/SettableThemeContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

final class SettableThemeContext implements ThemeContextInterface
{
/** @var ThemeInterface|null */
private $theme;
private ?ThemeInterface $theme = null;

public function setTheme(ThemeInterface $theme): void
{
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/ThemeScreenshotController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

final class ThemeScreenshotController
{
/** @var ThemeRepositoryInterface */
private $themeRepository;
private ThemeRepositoryInterface $themeRepository;

public function __construct(ThemeRepositoryInterface $themeRepository)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
final class Configuration implements ConfigurationInterface
{
/** @var ConfigurationSourceFactoryInterface[] */
private $configurationSourceFactories;
private array $configurationSourceFactories;

/**
* @param ConfigurationSourceFactoryInterface[] $configurationSourceFactories
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/SyliusThemeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
final class SyliusThemeExtension extends Extension
{
/** @var ConfigurationSourceFactoryInterface[] */
private $configurationSourceFactories = [];
private array $configurationSourceFactories = [];

/**
* @internal
Expand Down
3 changes: 1 addition & 2 deletions src/Form/Type/ThemeChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

final class ThemeChoiceType extends AbstractType
{
/** @var ThemeRepositoryInterface */
private $themeRepository;
private ThemeRepositoryInterface $themeRepository;

public function __construct(ThemeRepositoryInterface $themeRepository)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Form/Type/ThemeNameChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

final class ThemeNameChoiceType extends AbstractType
{
/** @var ThemeRepositoryInterface */
private $themeRepository;
private ThemeRepositoryInterface $themeRepository;

public function __construct(ThemeRepositoryInterface $themeRepository)
{
Expand Down
15 changes: 5 additions & 10 deletions src/Loader/ThemeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@

final class ThemeLoader implements ThemeLoaderInterface
{
/** @var ConfigurationProviderInterface */
private $configurationProvider;
private ConfigurationProviderInterface $configurationProvider;

/** @var ThemeFactoryInterface */
private $themeFactory;
private ThemeFactoryInterface $themeFactory;

/** @var ThemeAuthorFactoryInterface */
private $themeAuthorFactory;
private ThemeAuthorFactoryInterface $themeAuthorFactory;

/** @var ThemeScreenshotFactoryInterface */
private $themeScreenshotFactory;
private ThemeScreenshotFactoryInterface $themeScreenshotFactory;

/** @var CircularDependencyCheckerInterface */
private $circularDependencyChecker;
private CircularDependencyCheckerInterface $circularDependencyChecker;

public function __construct(
ConfigurationProviderInterface $configurationProvider,
Expand Down
9 changes: 3 additions & 6 deletions src/Locator/RecursiveFileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@

final class RecursiveFileLocator implements FileLocatorInterface
{
/** @var FinderFactoryInterface */
private $finderFactory;
private FinderFactoryInterface $finderFactory;

/** @var array */
private $paths;
private array $paths;

/** @var int|null */
private $depth;
private ?int $depth;

/**
* @param array|string[] $paths An array of paths where to look for resources
Expand Down
12 changes: 4 additions & 8 deletions src/Model/ThemeAuthor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@

final class ThemeAuthor
{
/** @var string|null */
private $name;
private ?string $name = null;

/** @var string|null */
private $email;
private ?string $email = null;

/** @var string|null */
private $homepage;
private ?string $homepage = null;

/** @var string|null */
private $role;
private ?string $role = null;

public function getName(): ?string
{
Expand Down
9 changes: 3 additions & 6 deletions src/Model/ThemeScreenshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@

final class ThemeScreenshot
{
/** @var string */
private $path;
private string $path;

/** @var string|null */
private $title;
private ?string $title = null;

/** @var string|null */
private $description;
private ?string $description = null;

public function __construct(string $path)
{
Expand Down
Loading

0 comments on commit 707bcf5

Please sign in to comment.