1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 10:57:08 +01:00
psalm/src/Psalm/Storage/PropertyStorage.php
Bruce Weirdan abb1c95b94 Limited custom metadata to be (array of) scalars
Also moved `$custom_metadata` property to trait
2019-02-25 10:19:31 -05:00

90 lines
1.5 KiB
PHP

<?php
namespace Psalm\Storage;
use Psalm\CodeLocation;
use Psalm\Type;
use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
class PropertyStorage
{
use CustomMetadataTrait;
/**
* @var bool
*/
public $is_static;
/**
* @var int
*/
public $visibility;
/**
* @var CodeLocation|null
*/
public $location;
/**
* @var CodeLocation|null
*/
public $type_location;
/**
* @var CodeLocation|null
*/
public $signature_type_location;
/**
* @var Type\Union|null
*/
public $type;
/**
* @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;
/**
* @var bool
*/
public $internal = false;
/**
* @var array<string, array<int, CodeLocation>>|null
*/
public $referencing_locations;
public function getInfo() : string
{
switch ($this->visibility) {
case ClassLikeAnalyzer::VISIBILITY_PRIVATE:
$visibility_text = 'private';
break;
case ClassLikeAnalyzer::VISIBILITY_PROTECTED:
$visibility_text = 'protected';
break;
default:
$visibility_text = 'public';
}
return $visibility_text . ' ' . ($this->type ?: 'mixed');
}
}