Skip to content

Commit

Permalink
Remove unused PregMatchTypeCorrector, the 3rd param in preg_match_* i…
Browse files Browse the repository at this point in the history
…s now handled natively by PHPStan (#3824)
  • Loading branch information
TomasVotruba authored May 13, 2023
1 parent 645071a commit 156d28c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 103 deletions.

This file was deleted.

3 changes: 0 additions & 3 deletions packages/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\NodeTypeCorrector\PregMatchTypeCorrector;
use Rector\NodeTypeResolver\NodeTypeResolver;

final class ArrayTypeAnalyzer
{
public function __construct(
private readonly NodeNameResolver $nodeNameResolver,
private readonly NodeTypeResolver $nodeTypeResolver,
private readonly PregMatchTypeCorrector $pregMatchTypeCorrector,
private readonly BetterNodeFinder $betterNodeFinder,
private readonly PhpDocInfoFactory $phpDocInfoFactory,
private readonly ReflectionResolver $reflectionResolver,
Expand All @@ -43,7 +41,6 @@ public function isArrayType(Expr $expr): bool
{
$nodeType = $this->nodeTypeResolver->getType($expr);

$nodeType = $this->pregMatchTypeCorrector->correct($expr, $nodeType);
if ($this->isIntersectionArrayType($nodeType)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use PhpParser\Node\Expr;
use PHPStan\Type\ObjectType;
use Rector\NodeTypeResolver\NodeTypeCorrector\PregMatchTypeCorrector;
use Rector\NodeTypeResolver\NodeTypeResolver;

final class CountableTypeAnalyzer
Expand All @@ -18,8 +17,7 @@ final class CountableTypeAnalyzer

public function __construct(
private readonly ArrayTypeAnalyzer $arrayTypeAnalyzer,
private readonly NodeTypeResolver $nodeTypeResolver,
private readonly PregMatchTypeCorrector $pregMatchTypeCorrector
private readonly NodeTypeResolver $nodeTypeResolver
) {
$this->countableObjectTypes = [
new ObjectType('Countable'),
Expand All @@ -31,7 +29,6 @@ public function __construct(
public function isCountableType(Expr $expr): bool
{
$nodeType = $this->nodeTypeResolver->getType($expr);
$nodeType = $this->pregMatchTypeCorrector->correct($expr, $nodeType);

foreach ($this->countableObjectTypes as $countableObjectType) {
if ($countableObjectType->isSuperTypeOf($nodeType)->yes()) {
Expand Down

0 comments on commit 156d28c

Please sign in to comment.