Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Some modernization
Browse files Browse the repository at this point in the history
  • Loading branch information
Korbeil committed Oct 4, 2023
1 parent 29f0949 commit da78c27
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/AutoMapperBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class AutoMapperBundle extends Bundle
{
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
parent::build($container);

Expand Down
18 changes: 5 additions & 13 deletions src/CacheWarmup/CacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,20 @@
*/
final class CacheWarmer implements CacheWarmerInterface
{
private $autoMapperRegistry;
/** @var iterable<CacheWarmerLoaderInterface> */
private $cacheWarmerLoaders;
private $autoMapperCacheDirectory;

/** @param iterable<CacheWarmerLoaderInterface> $cacheWarmerLoaders */
public function __construct(
AutoMapperRegistryInterface $autoMapperRegistry,
iterable $cacheWarmerLoaders,
string $autoMapperCacheDirectory
private readonly AutoMapperRegistryInterface $autoMapperRegistry,
private readonly iterable $cacheWarmerLoaders,
private readonly string $autoMapperCacheDirectory
) {
$this->autoMapperRegistry = $autoMapperRegistry;
$this->cacheWarmerLoaders = $cacheWarmerLoaders;
$this->autoMapperCacheDirectory = $autoMapperCacheDirectory;
}

public function isOptional()
public function isOptional(): bool
{
return false;
}

public function warmUp($cacheDir)
public function warmUp(string $cacheDir): array
{
foreach ($this->cacheWarmerLoaders as $cacheWarmerLoader) {
foreach ($cacheWarmerLoader->loadCacheWarmupData() as $cacheWarmupData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MapperConfigurationPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;

public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$autoMapper = $container->getDefinition(AutoMapper::class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TransformerFactoryPass implements CompilerPassInterface
{
use PriorityTaggedServiceTrait;

public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$definition = $container->getDefinition(ChainTransformerFactory::class);

Expand Down
10 changes: 4 additions & 6 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class Configuration implements ConfigurationInterface
readonly class Configuration implements ConfigurationInterface
{
private $debug;

/**
* @param bool $debug Whether debugging is enabled or not
*/
public function __construct(bool $debug)
{
$this->debug = $debug;
public function __construct(
private bool $debug,
) {
}

public function getConfigTreeBuilder(): TreeBuilder
Expand Down

0 comments on commit da78c27

Please sign in to comment.