-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid duplicate in union type description
- Loading branch information
1 parent
063f6a8
commit bd6bb86
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace PHPStan\Type\data; | ||
|
||
use PHPStan\Type\Generic\GenericObjectType; | ||
use PHPStan\Type\MixedType; | ||
use PHPStan\Type\Type; | ||
|
||
class QueryType extends GenericObjectType | ||
{ | ||
/** @var Type */ | ||
private $indexType; | ||
|
||
/** @var Type */ | ||
private $resultType; | ||
|
||
/** @var string */ | ||
private $dql; | ||
|
||
public function __construct(string $dql, ?Type $indexType = null, ?Type $resultType = null, ?Type $subtractedType = null) | ||
{ | ||
$this->indexType = $indexType ?? new MixedType(); | ||
$this->resultType = $resultType ?? new MixedType(); | ||
|
||
parent::__construct('Doctrine\ORM\Query', [ | ||
$this->indexType, | ||
$this->resultType, | ||
], $subtractedType); | ||
|
||
$this->dql = $dql; | ||
} | ||
|
||
public function getDql(): string { | ||
return $this->dql; | ||
} | ||
|
||
public function equals(Type $type): bool | ||
{ | ||
if ($type instanceof self) { | ||
return $this->getDql() === $type->getDql(); | ||
} | ||
|
||
return parent::equals($type); | ||
} | ||
|
||
} |