Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -30,10 +30,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 @@ -51,8 +49,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
6 changes: 3 additions & 3 deletions stubs/bleedingEdge/Rule.stub
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ use PHPStan\Analyser\Scope;

/**
* @api
* @phpstan-template TNodeType of Node
* @template TNodeType of Node
*/
interface Rule
{

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

/**
* @phpstan-param TNodeType $node
* @param TNodeType $node
* @return list<IdentifierRuleError>
*/
public function processNode(Node $node, Scope $scope): array;
Expand Down
Loading