1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-16 03:17:02 +01:00
psalm/src/Psalm/Storage/PropertyStorage.php
Joe Hoyle e59670ef68
Add documentation to LSP (#5267)
* Add documention to LSP

Add descriptions for all Classes, Functions, Methods, Class Constants for LSP methods for Hover, SignatureInformation and Completions

* Descriptions for class name completions

* PHPCS

* Fix docblock being overriden

* Remove trailing comma in args

* Add description to function param before early `continue`

* Update php-language-server-protocol to 1.5

* Break up long array docblocks

* Break up docblock onto newline

Co-authored-by: Matthew Brown <github@muglug.com>
2021-02-24 10:14:04 -05:00

127 lines
2.1 KiB
PHP

<?php
namespace Psalm\Storage;
use Psalm\CodeLocation;
use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
use Psalm\Type;
class PropertyStorage
{
use CustomMetadataTrait;
/**
* @var ?bool
*/
public $is_static;
/**
* @var ClassLikeAnalyzer::VISIBILITY_*
*/
public $visibility = 1;
/**
* @var CodeLocation|null
*/
public $location;
/**
* @var CodeLocation|null
*/
public $stmt_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 $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) {
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 ? $this->type->getId() : 'mixed');
}
}