<commit_before><?php declare(strict_types = 1);

namespace PHPStan\Type;

use PHPStan\Reflection\ClassMemberAccessAnswerer;
use PHPStan\Reflection\ConstantReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\PropertyReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Traits\TruthyBooleanTypeTrait;

class StaticType implements StaticResolvableType, TypeWithClassName
{

	use TruthyBooleanTypeTrait;

	/** @var string */
	private $baseClass;

	/** @var \PHPStan\Type\ObjectType */
	private $staticObjectType;

	public function __construct(string $baseClass)
	{
		$this->baseClass = $baseClass;
		$this->staticObjectType = new ObjectType($baseClass);
	}

	public function getClassName(): string
	{
		return $this->baseClass;
	}

	protected function getStaticObjectType(): ObjectType
	{
		return $this->staticObjectType;
	}

	/**
	 * @return string[]
	 */
	public function getReferencedClasses(): array
	{
		return $this->staticObjectType->getReferencedClasses();
	}

	public function getBaseClass(): string
	{
		return $this->baseClass;
	}

	public function accepts(Type $type, bool $strictTypes): TrinaryLogic
	{
		return $this->staticObjectType->accepts($type, $strictTypes);
	}

	public function isSuperTypeOf(Type $type): TrinaryLogic
	{
		if ($type instanceof self) {
			return $this->staticObjectType->isSuperTypeOf($type);
		}

		if ($type instanceof ObjectType) {
			return TrinaryLogic::createMaybe()->and($this->staticObjectType->isSuperTypeOf($type));
		}

		if ($type instanceof CompoundType) {
			return $type->isSubTypeOf($this);
		}

		return TrinaryLogic::createNo();
	}

	public function equals(Type $type): bool
	{
		return $this->staticObjectType->equals($type);
	}

	public function describe(VerbosityLevel $level): string
	{
		return sprintf('static(%s)', $this->staticObjectType->describe($level));
	}

	public function canAccessProperties(): TrinaryLogic
	{
		return $this->staticObjectType->canAccessProperties();
	}

	public function hasProperty(string $propertyName): bool
	{
		return $this->staticObjectType->hasProperty($propertyName);
	}

	public function getProperty(string $propertyName, ClassMemberAccessAnswerer $scope): PropertyReflection
	{
		return $this->staticObjectType->getProperty($propertyName, $scope);
	}

	public function canCallMethods(): TrinaryLogic
	{
		return $this->staticObjectType->canCallMethods();
	}

	public function hasMethod(string $methodName): bool
	{
		return $this->staticObjectType->hasMethod($methodName);
	}

	public function getMethod(string $methodName, ClassMemberAccessAnswerer $scope): MethodReflection
	{
		return $this->staticObjectType->getMethod($methodName, $scope);
	}

	public function canAccessConstants(): TrinaryLogic
	{
		return $this->staticObjectType->canAccessConstants();
	}

	public function hasConstant(string $constantName): bool
	{
		return $this->staticObjectType->hasConstant($constantName);
	}

	public function getConstant(string $constantName): ConstantReflection
	{
		return $this->staticObjectType->getConstant($constantName);
	}

	public function resolveStatic(string $className): Type
	{
		return new ObjectType($className);
	}

	public function changeBaseClass(string $className): StaticResolvableType
	{
		$thisClass = get_class($this);
		return new $thisClass($className);
	}

	public function isIterable(): TrinaryLogic
	{
		return $this->staticObjectType->isInstanceOf(\Traversable::class);
	}

	public function getIterableKeyType(): Type
	{
		return $this->staticObjectType->getIterableKeyType();
	}

	public function getIterableValueType(): Type
	{
		return $this->staticObjectType->getIterableValueType();
	}

	public function isOffsetAccessible(): TrinaryLogic
	{
		return $this->staticObjectType->isInstanceOf(\ArrayAccess::class);
	}

	public function hasOffsetValueType(Type $offsetType): TrinaryLogic
	{
		return $this->staticObjectType->hasOffsetValueType($offsetType);
	}

	public function getOffsetValueType(Type $offsetType): Type<commit_msg>static::class can be used here<commit_after><?php declare(strict_types = 1);

namespace PHPStan\Type;

use PHPStan\Reflection\ClassMemberAccessAnswerer;
use PHPStan\Reflection\ConstantReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\PropertyReflection;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Traits\TruthyBooleanTypeTrait;

class StaticType implements StaticResolvableType, TypeWithClassName
{

	use TruthyBooleanTypeTrait;

	/** @var string */
	private $baseClass;

	/** @var \PHPStan\Type\ObjectType */
	private $staticObjectType;

	public function __construct(string $baseClass)
	{
		$this->baseClass = $baseClass;
		$this->staticObjectType = new ObjectType($baseClass);
	}

	public function getClassName(): string
	{
		return $this->baseClass;
	}

	protected function getStaticObjectType(): ObjectType
	{
		return $this->staticObjectType;
	}

	/**
	 * @return string[]
	 */
	public function getReferencedClasses(): array
	{
		return $this->staticObjectType->getReferencedClasses();
	}

	public function getBaseClass(): string
	{
		return $this->baseClass;
	}

	public function accepts(Type $type, bool $strictTypes): TrinaryLogic
	{
		return $this->staticObjectType->accepts($type, $strictTypes);
	}

	public function isSuperTypeOf(Type $type): TrinaryLogic
	{
		if ($type instanceof self) {
			return $this->staticObjectType->isSuperTypeOf($type);
		}

		if ($type instanceof ObjectType) {
			return TrinaryLogic::createMaybe()->and($this->staticObjectType->isSuperTypeOf($type));
		}

		if ($type instanceof CompoundType) {
			return $type->isSubTypeOf($this);
		}

		return TrinaryLogic::createNo();
	}

	public function equals(Type $type): bool
	{
		return $this->staticObjectType->equals($type);
	}

	public function describe(VerbosityLevel $level): string
	{
		return sprintf('static(%s)', $this->staticObjectType->describe($level));
	}

	public function canAccessProperties(): TrinaryLogic
	{
		return $this->staticObjectType->canAccessProperties();
	}

	public function hasProperty(string $propertyName): bool
	{
		return $this->staticObjectType->hasProperty($propertyName);
	}

	public function getProperty(string $propertyName, ClassMemberAccessAnswerer $scope): PropertyReflection
	{
		return $this->staticObjectType->getProperty($propertyName, $scope);
	}

	public function canCallMethods(): TrinaryLogic
	{
		return $this->staticObjectType->canCallMethods();
	}

	public function hasMethod(string $methodName): bool
	{
		return $this->staticObjectType->hasMethod($methodName);
	}

	public function getMethod(string $methodName, ClassMemberAccessAnswerer $scope): MethodReflection
	{
		return $this->staticObjectType->getMethod($methodName, $scope);
	}

	public function canAccessConstants(): TrinaryLogic
	{
		return $this->staticObjectType->canAccessConstants();
	}

	public function hasConstant(string $constantName): bool
	{
		return $this->staticObjectType->hasConstant($constantName);
	}

	public function getConstant(string $constantName): ConstantReflection
	{
		return $this->staticObjectType->getConstant($constantName);
	}

	public function resolveStatic(string $className): Type
	{
		return new ObjectType($className);
	}

	public function changeBaseClass(string $className): StaticResolvableType
	{
		$thisClass = static::class;
		return new $thisClass($className);
	}

	public function isIterable(): TrinaryLogic
	{
		return $this->staticObjectType->isInstanceOf(\Traversable::class);
	}

	public function getIterableKeyType(): Type
	{
		return $this->staticObjectType->getIterableKeyType();
	}

	public function getIterableValueType(): Type
	{
		return $this->staticObjectType->getIterableValueType();
	}

	public function isOffsetAccessible(): TrinaryLogic
	{
		return $this->staticObjectType->isInstanceOf(\ArrayAccess::class);
	}

	public function hasOffsetValueType(Type $offsetType): TrinaryLogic
	{
		return $this->staticObjectType->hasOffsetValueType($offsetType);
	}

	public function getOffsetValueType(Type $offsetType): Type
{'fraction_non_alphanumeric': 0.11942355889724311, 'fraction_numerical': 0.0002506265664160401, 'mean_word_length': 5.958151700087184, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 97, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '777427', 'n_tokens_mistral': 2521, 'n_tokens_neox': 2350, 'n_words': 477}