1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-16 11:26:55 +01:00
psalm/src/Psalm/Storage/PropertyStorage.php

127 lines
2.1 KiB
PHP
Raw Normal View History

<?php
namespace Psalm\Storage;
use Psalm\CodeLocation;
2018-11-06 03:57:36 +01:00
use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
2019-07-05 22:24:00 +02:00
use Psalm\Type;
class PropertyStorage
{
use CustomMetadataTrait;
/**
2019-11-25 21:20:31 +01:00
* @var ?bool
*/
public $is_static;
/**
* @var ClassLikeAnalyzer::VISIBILITY_*
*/
public $visibility = 1;
/**
* @var CodeLocation|null
*/
public $location;
2017-03-02 04:27:52 +01:00
/**
* @var CodeLocation|null
*/
public $stmt_location;
/**
* @var CodeLocation|null
2017-03-02 04:27:52 +01:00
*/
public $type_location;
/**
2019-01-11 23:21:50 +01:00
* @var CodeLocation|null
*/
public $signature_type_location;
/**
* @var Type\Union|null
*/
public $type;
2019-01-11 23:21:50 +01:00
/**
* @var Type\Union|null
*/
public $signature_type;
/**
* @var Type\Union|null
*/
public $suggested_type;
/**
* @var bool
*/
public $has_default = false;
/**
* @var bool
*/
public $deprecated = false;
2019-08-11 22:01:37 +02:00
/**
* @var bool
*/
public $readonly = false;
/**
* Whether or not to allow mutation by internal methods
*
* @var bool
*/
public $allow_private_mutation = false;
/**
* @var string
*/
public $internal = '';
/**
* @var ?string
*/
public $getter_method = null;
/**
* @var bool
*/
public $is_promoted = false;
/**
* @var list<AttributeStorage>
*/
public $attributes = [];
/**
* @var array<int, string>
*/
public $suppressed_issues = [];
/**
* @var ?string
*/
public $description;
public function getInfo() : string
{
switch ($this->visibility) {
2018-11-06 03:57:36 +01:00
case ClassLikeAnalyzer::VISIBILITY_PRIVATE:
$visibility_text = 'private';
break;
2018-11-06 03:57:36 +01:00
case ClassLikeAnalyzer::VISIBILITY_PROTECTED:
$visibility_text = 'protected';
break;
default:
$visibility_text = 'public';
}
return $visibility_text . ' ' . ($this->type ? $this->type->getId() : 'mixed');
}
}