Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.12.x' into 2.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 11, 2024
2 parents 3665635 + 4d3a9ab commit 5711cdd
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 34 deletions.
8 changes: 4 additions & 4 deletions src/Collectors/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
* Learn more: https://phpstan.org/developing-extensions/collectors
*
* @api
* @phpstan-template-covariant TNodeType of Node
* @phpstan-template-covariant TValue
* @template-covariant TNodeType of Node
* @template-covariant TValue
*/
interface Collector
{

/**
* @phpstan-return class-string<TNodeType>
* @return class-string<TNodeType>
*/
public function getNodeType(): string;

/**
* @phpstan-param TNodeType $node
* @param TNodeType $node
* @return TValue|null Collected data
*/
public function processNode(Node $node, Scope $scope);
Expand Down
9 changes: 3 additions & 6 deletions src/Collectors/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ public function __construct(array $collectors)

/**
* @template TNodeType of Node
* @phpstan-param class-string<TNodeType> $nodeType
* @param Node $nodeType
* @phpstan-return array<Collector<TNodeType, mixed>>
* @return Collector[]
* @param class-string<TNodeType> $nodeType
* @return array<Collector<TNodeType, mixed>>
*/
public function getCollectors(string $nodeType): array
{
Expand All @@ -48,8 +46,7 @@ public function getCollectors(string $nodeType): array
}

/**
* @phpstan-var array<Collector<TNodeType, mixed>> $selectedCollectors
* @var Collector[] $selectedCollectors
* @var array<Collector<TNodeType, mixed>> $selectedCollectors
*/
$selectedCollectors = $this->cache[$nodeType];

Expand Down
7 changes: 3 additions & 4 deletions src/DependencyInjection/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ public function hasService(string $serviceName): bool;
public function getService(string $serviceName);

/**
* @phpstan-template T of object
* @phpstan-param class-string<T> $className
* @phpstan-return T
* @return mixed
* @template T of object
* @param class-string<T> $className
* @return T
*/
public function getByType(string $className);

Expand Down
7 changes: 3 additions & 4 deletions src/DependencyInjection/Nette/NetteContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public function getService(string $serviceName)
}

/**
* @phpstan-template T of object
* @phpstan-param class-string<T> $className
* @phpstan-return T
* @return mixed
* @template T of object
* @param class-string<T> $className
* @return T
*/
public function getByType(string $className)
{
Expand Down
9 changes: 3 additions & 6 deletions src/Rules/DirectRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ public function __construct(array $rules)

/**
* @template TNodeType of Node
* @phpstan-param class-string<TNodeType> $nodeType
* @param Node $nodeType
* @phpstan-return array<Rule<TNodeType>>
* @return Rule[]
* @param class-string<TNodeType> $nodeType
* @return array<Rule<TNodeType>>
*/
public function getRules(string $nodeType): array
{
Expand All @@ -48,8 +46,7 @@ public function getRules(string $nodeType): array
}

/**
* @phpstan-var array<Rule<TNodeType>> $selectedRules
* @var Rule[] $selectedRules
* @var array<Rule<TNodeType>> $selectedRules
*/
$selectedRules = $this->cache[$nodeType];

Expand Down
9 changes: 3 additions & 6 deletions src/Rules/LazyRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ public function __construct(private Container $container)

/**
* @template TNodeType of Node
* @phpstan-param class-string<TNodeType> $nodeType
* @param Node $nodeType
* @phpstan-return array<Rule<TNodeType>>
* @return Rule[]
* @param class-string<TNodeType> $nodeType
* @return array<Rule<TNodeType>>
*/
public function getRules(string $nodeType): array
{
Expand All @@ -46,8 +44,7 @@ public function getRules(string $nodeType): array
}

/**
* @phpstan-var array<Rule<TNodeType>> $selectedRules
* @var Rule[] $selectedRules
* @var array<Rule<TNodeType>> $selectedRules
*/
$selectedRules = $this->cache[$nodeType];

Expand Down
6 changes: 2 additions & 4 deletions src/Rules/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ interface Registry

/**
* @template TNodeType of Node
* @phpstan-param class-string<TNodeType> $nodeType
* @param Node $nodeType
* @phpstan-return array<Rule<TNodeType>>
* @return Rule[]
* @param class-string<TNodeType> $nodeType
* @return array<Rule<TNodeType>>
*/
public function getRules(string $nodeType): array;

Expand Down

0 comments on commit 5711cdd

Please sign in to comment.