2017-01-02 01:09:17 +01:00
|
|
|
<?php
|
|
|
|
namespace Psalm\Storage;
|
|
|
|
|
2017-01-27 07:40:22 +01:00
|
|
|
use Psalm\CodeLocation;
|
2017-01-02 01:09:17 +01:00
|
|
|
use Psalm\Type;
|
2018-11-06 03:57:36 +01:00
|
|
|
use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
|
2017-01-02 01:09:17 +01:00
|
|
|
|
|
|
|
class PropertyStorage
|
|
|
|
{
|
2019-02-24 22:21:28 +01:00
|
|
|
use CustomMetadataTrait;
|
|
|
|
|
2017-01-02 01:09:17 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $is_static;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
public $visibility;
|
|
|
|
|
2017-01-27 07:40:22 +01:00
|
|
|
/**
|
|
|
|
* @var CodeLocation|null
|
|
|
|
*/
|
|
|
|
public $location;
|
|
|
|
|
2017-03-02 04:27:52 +01:00
|
|
|
/**
|
|
|
|
* @var CodeLocation|null
|
|
|
|
*/
|
|
|
|
public $type_location;
|
|
|
|
|
2017-01-02 01:09:17 +01:00
|
|
|
/**
|
2019-01-11 23:21:50 +01:00
|
|
|
* @var CodeLocation|null
|
|
|
|
*/
|
|
|
|
public $signature_type_location;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var Type\Union|null
|
2017-01-02 01:09:17 +01:00
|
|
|
*/
|
|
|
|
public $type;
|
2017-01-27 07:23:12 +01:00
|
|
|
|
2019-01-11 23:21:50 +01:00
|
|
|
/**
|
|
|
|
* @var Type\Union|null
|
|
|
|
*/
|
|
|
|
public $signature_type;
|
|
|
|
|
2017-04-15 05:09:34 +02:00
|
|
|
/**
|
|
|
|
* @var Type\Union|null
|
|
|
|
*/
|
|
|
|
public $suggested_type;
|
|
|
|
|
2017-01-27 07:23:12 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $has_default = false;
|
2017-05-25 07:32:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $deprecated = false;
|
2018-01-11 05:29:18 +01:00
|
|
|
|
2018-12-02 00:37:49 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $internal = false;
|
|
|
|
|
2018-01-11 05:29:18 +01:00
|
|
|
/**
|
|
|
|
* @var array<string, array<int, CodeLocation>>|null
|
|
|
|
*/
|
|
|
|
public $referencing_locations;
|
2018-10-26 22:17:15 +02:00
|
|
|
|
|
|
|
public function getInfo() : string
|
|
|
|
{
|
|
|
|
switch ($this->visibility) {
|
2018-11-06 03:57:36 +01:00
|
|
|
case ClassLikeAnalyzer::VISIBILITY_PRIVATE:
|
2018-10-26 22:17:15 +02:00
|
|
|
$visibility_text = 'private';
|
|
|
|
break;
|
|
|
|
|
2018-11-06 03:57:36 +01:00
|
|
|
case ClassLikeAnalyzer::VISIBILITY_PROTECTED:
|
2018-10-26 22:17:15 +02:00
|
|
|
$visibility_text = 'protected';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$visibility_text = 'public';
|
|
|
|
}
|
|
|
|
|
|
|
|
return $visibility_text . ' ' . ($this->type ?: 'mixed');
|
|
|
|
}
|
2017-01-02 01:09:17 +01:00
|
|
|
}
|