Skip to content

Commit f6e89bd

Browse files
committed
GNSR basics
1 parent 56eef73 commit f6e89bd

13 files changed

+1006
-14
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Build;
4+
5+
use Override;
6+
use PHPStan\Analyser\Generator\GeneratorNodeScopeResolver;
7+
use ReflectionMethod;
8+
use ShipMonk\PHPStan\DeadCode\Provider\ReflectionBasedMemberUsageProvider;
9+
use ShipMonk\PHPStan\DeadCode\Provider\VirtualUsageData;
10+
11+
final class IgnoreGeneratorNodeScopeResolverUsageProvider extends ReflectionBasedMemberUsageProvider
12+
{
13+
14+
#[Override]
15+
protected function shouldMarkMethodAsUsed(ReflectionMethod $method): ?VirtualUsageData
16+
{
17+
if ($method->getDeclaringClass()->getName() === GeneratorNodeScopeResolver::class) {
18+
return VirtualUsageData::withNote('WIP');
19+
}
20+
21+
return null;
22+
}
23+
24+
}

build/phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,7 @@ services:
147147
class: PHPStan\Build\ContainerDynamicReturnTypeExtension
148148
tags:
149149
- phpstan.broker.dynamicMethodReturnTypeExtension
150+
-
151+
class: PHPStan\Build\IgnoreGeneratorNodeScopeResolverUsageProvider
152+
tags:
153+
- shipmonk.deadCode.memberUsageProvider
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Analyser\Generator;
4+
5+
use PhpParser\Node\Expr;
6+
7+
final class ExprAnalysisRequest
8+
{
9+
10+
public function __construct(
11+
public Expr $expr,
12+
public GeneratorScope $scope,
13+
)
14+
{
15+
}
16+
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Analyser\Generator;
4+
5+
use PHPStan\Type\Type;
6+
7+
final class ExprAnalysisResult
8+
{
9+
10+
public function __construct(
11+
public Type $type,
12+
public GeneratorScope $scope,
13+
)
14+
{
15+
}
16+
17+
}

0 commit comments

Comments
 (0)