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

95 lines
1.5 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;
/**
* @var bool
*/
public $is_static;
/**
* @var int
*/
public $visibility;
/**
* @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;
/**
* @var bool
*/
public $internal = false;
/**
* @var null|string
*/
public $psalm_internal = null;
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');
}
}