Skip to content

Commit

Permalink
Merge pull request #11 from samsonasik/apply-php74
Browse files Browse the repository at this point in the history
Apply PHP 7.4 syntax and typed property
  • Loading branch information
Ocramius authored Sep 27, 2022
2 parents 2c271fa + 37877a4 commit 26498f0
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 45 deletions.
15 changes: 5 additions & 10 deletions src/Command/InspectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@ final class InspectCommand extends Command
/** @var string|null $defaultName */
public static $defaultName = 'servicemanager:inspect';

/** @var DependencyConfigInterface */
private $config;
private DependencyConfigInterface $config;

/** @var DependencyScannerInterface */
private $dependencyScanner;
private DependencyScannerInterface $dependencyScanner;

/** @var TraverserInterface */
private $traverser;
private TraverserInterface $traverser;

/** @var EventCollectorInterface */
private $eventCollector;
private EventCollectorInterface $eventCollector;

/** @var EventReporterInterface */
private $eventReporter;
private EventReporterInterface $eventReporter;

public function __construct(
DependencyConfigInterface $config,
Expand Down
6 changes: 2 additions & 4 deletions src/Dependency/Dependency.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

final class Dependency
{
/** @var string */
private $name;
private string $name;

/** @var bool */
private $isOptional;
private bool $isOptional;

public function __construct(string $name, bool $isOptional = false)
{
Expand Down
3 changes: 1 addition & 2 deletions src/Event/AutowireFactoryEnteredEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

final class AutowireFactoryEnteredEvent implements EnterEventInterface
{
/** @var string */
private $dependencyName;
private string $dependencyName;

/** @psalm-var list<string> */
private $instantiationStack;
Expand Down
3 changes: 1 addition & 2 deletions src/Event/CircularDependencyDetectedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

final class CircularDependencyDetectedEvent implements TerminalEventInterface
{
/** @var string */
private $dependencyName;
private string $dependencyName;

/** @psalm-var list<string> */
private $instantiationStack;
Expand Down
3 changes: 1 addition & 2 deletions src/Event/CustomFactoryEnteredEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

final class CustomFactoryEnteredEvent implements EnterEventInterface
{
/** @var string */
private $dependencyName;
private string $dependencyName;

/** @psalm-var list<string> */
private $instantiationStack;
Expand Down
3 changes: 1 addition & 2 deletions src/Event/InvokableEnteredEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

final class InvokableEnteredEvent implements EnterEventInterface
{
/** @var string */
private $dependencyName;
private string $dependencyName;

/** @psalm-var list<string> */
private $instantiationStack;
Expand Down
3 changes: 1 addition & 2 deletions src/Event/MissingFactoryDetectedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

final class MissingFactoryDetectedEvent implements TerminalEventInterface
{
/** @var string */
private $dependencyName;
private string $dependencyName;

public function __construct(string $dependencyName)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Event/UnresolvableParameterDetectedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

final class UnresolvableParameterDetectedEvent implements TerminalEventInterface
{
/** @var string */
private $dependencyName;
private string $dependencyName;

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

public function __construct(string $dependencyName, string $paramName)
{
Expand Down
2 changes: 1 addition & 1 deletion src/EventCollector/EventCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class EventCollector implements EventCollectorInterface
* @psalm-var list<EventInterface>
* @var EventInterface[]
*/
private $events = [];
private array $events = [];

/**
* TODO preserve number of occurred events per dependency
Expand Down
7 changes: 3 additions & 4 deletions src/EventReporter/ConsoleDetailedEventReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Laminas\ServiceManager\Inspector\Event\EventInterface;
use Laminas\ServiceManager\Inspector\Event\TerminalEventInterface;
use Laminas\ServiceManager\Inspector\EventReporter\ConsoleColor\ConsoleColorInterface;
use Laminas\ServiceManager\Inspector\EventReporter\ConsoleSummaryEventReporter;
use Symfony\Component\Console\Output\OutputInterface;

use function count;
Expand All @@ -16,11 +17,9 @@

final class ConsoleDetailedEventReporter implements EventReporterInterface
{
/** @var ConsoleColorInterface */
private $consoleColor;
private ConsoleColorInterface $consoleColor;

/** @var ConsoleSummaryEventReporter */
private $summaryReporter;
private ConsoleSummaryEventReporter $summaryReporter;

public function __construct(ConsoleColorInterface $consoleColor, ConsoleSummaryEventReporter $summaryReporter)
{
Expand Down
3 changes: 1 addition & 2 deletions src/EventReporter/ConsoleSummaryEventReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

class ConsoleSummaryEventReporter implements EventReporterInterface
{
/** @var ConsoleColorInterface */
private $consoleColor;
private ConsoleColorInterface $consoleColor;

public function __construct(ConsoleColorInterface $consoleColor)
{
Expand Down
6 changes: 2 additions & 4 deletions src/Scanner/ReflectionBasedDependencyScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ final class ReflectionBasedDependencyScanner implements DependencyScannerInterfa
'Zend\ServiceManager\AbstractFactory\ReflectionBasedAbstractFactory',
];

/** @var DependencyConfigInterface */
private $config;
private DependencyConfigInterface $config;

/** @var EventCollectorInterface */
private $eventCollector;
private EventCollectorInterface $eventCollector;

public function __construct(DependencyConfigInterface $config, EventCollectorInterface $eventCollector)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Traverser/Traverser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
*/
final class Traverser implements TraverserInterface
{
/** @var DependencyConfigInterface */
private $config;
private DependencyConfigInterface $config;

/** @var DependencyScannerInterface */
private $dependencyScanner;
private DependencyScannerInterface $dependencyScanner;

/** @var EventCollectorInterface */
private $eventCollector;
private EventCollectorInterface $eventCollector;

public function __construct(
DependencyConfigInterface $config,
Expand Down

0 comments on commit 26498f0

Please sign in to comment.