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
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryArrayListType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -19,6 +20,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
use PHPStan\Type\Traits\NonGeneralizableTypeTrait;
use PHPStan\Type\Traits\NonGenericTypeTrait;
Expand Down Expand Up @@ -579,6 +581,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('list');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isArrayAllowed() ? new Identifier('array') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryDecimalIntegerStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -24,6 +25,7 @@
use PHPStan\Type\IntegerType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\StringType;
use PHPStan\Type\Traits\NonArrayTypeTrait;
use PHPStan\Type\Traits\NonGenericTypeTrait;
Expand Down Expand Up @@ -480,6 +482,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode($this->inverse ? 'non-decimal-int-string' : 'decimal-int-string');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isScalarAllowed() ? new Identifier('string') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryLiteralStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -21,6 +22,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StringType;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
Expand Down Expand Up @@ -401,6 +403,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('literal-string');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isScalarAllowed() ? new Identifier('string') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryLowercaseStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -21,6 +22,7 @@
use PHPStan\Type\IntegerType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StringType;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
Expand Down Expand Up @@ -406,6 +408,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('lowercase-string');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isScalarAllowed() ? new Identifier('string') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryNonEmptyStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -22,6 +23,7 @@
use PHPStan\Type\IntegerType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StringType;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
Expand Down Expand Up @@ -410,6 +412,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('non-empty-string');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isScalarAllowed() ? new Identifier('string') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryNonFalsyStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -22,6 +23,7 @@
use PHPStan\Type\IntegerType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\NullType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StringType;
Expand Down Expand Up @@ -407,6 +409,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('non-falsy-string');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isScalarAllowed() ? new Identifier('string') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryNumericStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\DependencyInjection\ReportUnsafeArrayStringKeyCastingToggle;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
Expand All @@ -23,6 +24,7 @@
use PHPStan\Type\IntegerType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\StringType;
use PHPStan\Type\Traits\NonArrayTypeTrait;
use PHPStan\Type\Traits\NonCallableTypeTrait;
Expand Down Expand Up @@ -419,6 +421,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('numeric-string');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isScalarAllowed() ? new Identifier('string') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/AccessoryUppercaseStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -21,6 +22,7 @@
use PHPStan\Type\IntegerType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StringType;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
Expand Down Expand Up @@ -406,6 +408,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('uppercase-string');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isScalarAllowed() ? new Identifier('string') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/HasMethodType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StringType;
Expand Down Expand Up @@ -345,6 +346,12 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode(''); // no PHPDoc representation
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
// not certainly an object on its own, object&hasMethod(foo) maps to object through the intersection
return null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/HasOffsetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace PHPStan\Type\Accessory;

use ArrayAccess;
use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -21,6 +22,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\Traits\MaybeArrayTypeTrait;
Expand Down Expand Up @@ -474,6 +476,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode(''); // no PHPDoc representation
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isArrayAllowed() ? new Identifier('array') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return $this->offsetType->hasTemplateOrLateResolvableType();
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/HasOffsetValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace PHPStan\Type\Accessory;

use ArrayAccess;
use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -23,6 +24,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StaticTypeFactory;
Expand Down Expand Up @@ -576,6 +578,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode(''); // no PHPDoc representation
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isArrayAllowed() ? new Identifier('array') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return $this->offsetType->hasTemplateOrLateResolvableType() || $this->valueType->hasTemplateOrLateResolvableType();
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/HasPropertyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
use PHPStan\Type\Traits\MaybeIterableTypeTrait;
Expand Down Expand Up @@ -321,6 +322,12 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode(''); // no PHPDoc representation
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
// not certainly an object on its own, object&hasMethod(foo) maps to object through the intersection
return null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/NonEmptyArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -20,6 +21,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
use PHPStan\Type\Traits\NonGeneralizableTypeTrait;
use PHPStan\Type\Traits\NonGenericTypeTrait;
Expand Down Expand Up @@ -558,6 +560,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode('non-empty-array');
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isArrayAllowed() ? new Identifier('array') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/Type/Accessory/OversizedArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Accessory;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
Expand All @@ -19,6 +20,7 @@
use PHPStan\Type\IntersectionType;
use PHPStan\Type\IsSuperTypeOfResult;
use PHPStan\Type\MixedType;
use PHPStan\Type\NativeTypePosition;
use PHPStan\Type\Traits\MaybeCallableTypeTrait;
use PHPStan\Type\Traits\NonGeneralizableTypeTrait;
use PHPStan\Type\Traits\NonGenericTypeTrait;
Expand Down Expand Up @@ -528,6 +530,11 @@ public function toPhpDocNode(): TypeNode
return new IdentifierTypeNode(''); // no PHPDoc representation
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isArrayAllowed() ? new Identifier('array') : null;
}

public function hasTemplateOrLateResolvableType(): bool
{
return false;
Expand Down
6 changes: 6 additions & 0 deletions src/Type/ArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type;

use PhpParser\Node\Identifier;
use PHPStan\Php\PhpVersion;
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
Expand Down Expand Up @@ -975,6 +976,11 @@ public function toPhpDocNode(): TypeNode
);
}

public function toNativePhpTypeNode(NativeTypePosition $position)
{
return $position->isArrayAllowed() ? new Identifier('array') : null;
}

public function traverseSimultaneously(Type $right, callable $cb): Type
{
$keyType = $cb($this->keyType, $right->getIterableKeyType());
Expand Down
Loading
Loading