2016-12-30 18:41:14 +01:00
|
|
|
<?php
|
|
|
|
namespace Psalm\Storage;
|
|
|
|
|
2017-02-08 06:28:26 +01:00
|
|
|
use Psalm\CodeLocation;
|
2020-02-15 02:54:26 +01:00
|
|
|
use Psalm\Internal\MethodIdentifier;
|
2016-12-30 18:41:14 +01:00
|
|
|
use Psalm\Type;
|
|
|
|
|
|
|
|
class ClassLikeStorage
|
|
|
|
{
|
2019-02-24 22:21:28 +01:00
|
|
|
use CustomMetadataTrait;
|
|
|
|
|
2016-12-30 18:41:14 +01:00
|
|
|
/**
|
2020-10-05 15:50:32 +02:00
|
|
|
* @var array<string, ClassConstantStorage>
|
2018-06-28 03:53:25 +02:00
|
|
|
*/
|
2020-10-05 15:50:32 +02:00
|
|
|
public $constants = [];
|
2018-06-28 03:53:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Aliases to help Psalm understand constant refs
|
|
|
|
*
|
|
|
|
* @var ?\Psalm\Aliases
|
|
|
|
*/
|
|
|
|
public $aliases;
|
|
|
|
|
2016-12-30 18:41:14 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
2017-07-25 22:11:02 +02:00
|
|
|
public $populated = false;
|
2016-12-30 18:41:14 +01:00
|
|
|
|
2018-02-01 05:27:25 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $stubbed = false;
|
|
|
|
|
2017-07-09 03:19:16 +02:00
|
|
|
/**
|
2017-02-10 02:35:17 +01:00
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $deprecated = false;
|
|
|
|
|
2019-05-10 00:33:27 +02:00
|
|
|
/**
|
2020-07-24 15:32:54 +02:00
|
|
|
* @var string
|
2019-05-10 00:33:27 +02:00
|
|
|
*/
|
2020-07-24 15:32:54 +02:00
|
|
|
public $internal = '';
|
2019-05-10 00:33:27 +02:00
|
|
|
|
2020-04-26 22:49:52 +02:00
|
|
|
/**
|
2020-04-27 15:50:27 +02:00
|
|
|
* @var null|Type\Atomic\TTemplateParam|Type\Atomic\TNamedObject
|
2020-08-05 21:49:19 +02:00
|
|
|
* @deprecated
|
2020-04-26 22:49:52 +02:00
|
|
|
*/
|
2020-04-27 15:10:24 +02:00
|
|
|
public $mixin = null;
|
2020-04-26 22:49:52 +02:00
|
|
|
|
2020-08-05 21:49:19 +02:00
|
|
|
/**
|
|
|
|
* @var Type\Atomic\TTemplateParam[]
|
|
|
|
*/
|
|
|
|
public $templatedMixins = [];
|
|
|
|
|
|
|
|
/**
|
2020-11-27 21:25:16 +01:00
|
|
|
* @var list<Type\Atomic\TNamedObject>
|
2020-08-05 21:49:19 +02:00
|
|
|
*/
|
|
|
|
public $namedMixins = [];
|
|
|
|
|
2020-05-27 05:29:37 +02:00
|
|
|
/**
|
|
|
|
* @var ?string
|
|
|
|
*/
|
|
|
|
public $mixin_declaring_fqcln = null;
|
|
|
|
|
2017-11-17 02:47:58 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $sealed_properties = false;
|
|
|
|
|
2018-04-22 06:40:30 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $sealed_methods = false;
|
|
|
|
|
2018-11-25 00:31:00 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
2018-11-25 17:11:33 +01:00
|
|
|
public $override_property_visibility = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $override_method_visibility = false;
|
2018-11-25 00:31:00 +01:00
|
|
|
|
2017-09-13 17:32:13 +02:00
|
|
|
/**
|
|
|
|
* @var array<int, string>
|
|
|
|
*/
|
|
|
|
public $suppressed_issues = [];
|
|
|
|
|
2017-02-10 02:35:17 +01:00
|
|
|
/**
|
|
|
|
* @var string
|
2017-01-02 21:31:18 +01:00
|
|
|
*/
|
2017-02-08 06:28:26 +01:00
|
|
|
public $name;
|
2017-01-02 21:31:18 +01:00
|
|
|
|
2016-12-30 18:41:14 +01:00
|
|
|
/**
|
|
|
|
* Is this class user-defined
|
|
|
|
*
|
|
|
|
* @var bool
|
|
|
|
*/
|
2017-01-18 06:33:48 +01:00
|
|
|
public $user_defined = false;
|
2016-12-30 18:41:14 +01:00
|
|
|
|
|
|
|
/**
|
2020-01-08 23:23:40 +01:00
|
|
|
* Interfaces this class implements directly
|
|
|
|
*
|
2020-12-04 07:19:51 +01:00
|
|
|
* @var array<lowercase-string, string>
|
2020-01-08 23:23:40 +01:00
|
|
|
*/
|
|
|
|
public $direct_class_interfaces = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interfaces this class implements explicitly and implicitly
|
2016-12-30 18:41:14 +01:00
|
|
|
*
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, string>
|
2016-12-30 18:41:14 +01:00
|
|
|
*/
|
|
|
|
public $class_implements = [];
|
|
|
|
|
2020-01-08 23:23:40 +01:00
|
|
|
/**
|
|
|
|
* Parent interfaces listed explicitly
|
|
|
|
*
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, string>
|
2020-01-08 23:23:40 +01:00
|
|
|
*/
|
|
|
|
public $direct_interface_parents = [];
|
|
|
|
|
2016-12-30 18:41:14 +01:00
|
|
|
/**
|
|
|
|
* Parent interfaces
|
|
|
|
*
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, string>
|
2016-12-30 18:41:14 +01:00
|
|
|
*/
|
|
|
|
public $parent_interfaces = [];
|
|
|
|
|
2019-05-25 17:51:09 +02:00
|
|
|
/**
|
|
|
|
* There can only be one direct parent class
|
|
|
|
*
|
|
|
|
* @var ?string
|
|
|
|
*/
|
|
|
|
public $parent_class;
|
|
|
|
|
2017-01-02 21:31:18 +01:00
|
|
|
/**
|
2018-02-19 19:06:35 +01:00
|
|
|
* Parent classes
|
2017-01-02 21:31:18 +01:00
|
|
|
*
|
2020-03-02 17:20:52 +01:00
|
|
|
* @var array<lowercase-string, string>
|
2017-01-02 21:31:18 +01:00
|
|
|
*/
|
|
|
|
public $parent_classes = [];
|
|
|
|
|
2016-12-30 18:41:14 +01:00
|
|
|
/**
|
2017-02-08 06:28:26 +01:00
|
|
|
* @var CodeLocation|null
|
2016-12-30 18:41:14 +01:00
|
|
|
*/
|
2017-02-08 06:28:26 +01:00
|
|
|
public $location;
|
2017-01-20 05:45:21 +01:00
|
|
|
|
2019-06-01 06:56:54 +02:00
|
|
|
/**
|
|
|
|
* @var CodeLocation|null
|
|
|
|
*/
|
|
|
|
public $stmt_location;
|
|
|
|
|
2019-06-04 22:36:32 +02:00
|
|
|
/**
|
|
|
|
* @var CodeLocation|null
|
|
|
|
*/
|
|
|
|
public $namespace_name_location;
|
|
|
|
|
2017-01-20 06:10:10 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $abstract = false;
|
|
|
|
|
2017-11-30 05:46:56 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $final = false;
|
|
|
|
|
2020-12-02 21:13:28 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $final_from_docblock = false;
|
|
|
|
|
2016-12-30 18:41:14 +01:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, string>
|
2016-12-30 18:41:14 +01:00
|
|
|
*/
|
|
|
|
public $used_traits = [];
|
2016-12-30 21:53:35 +01:00
|
|
|
|
2017-07-25 22:11:02 +02:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, lowercase-string>
|
2017-07-25 22:11:02 +02:00
|
|
|
*/
|
|
|
|
public $trait_alias_map = [];
|
|
|
|
|
2020-07-26 21:21:05 +02:00
|
|
|
/**
|
|
|
|
* @var array<lowercase-string, bool>
|
|
|
|
*/
|
|
|
|
public $trait_final_map = [];
|
|
|
|
|
2019-01-07 17:53:22 +01:00
|
|
|
/**
|
|
|
|
* @var array<string, int>
|
|
|
|
*/
|
|
|
|
public $trait_visibility_map = [];
|
|
|
|
|
2017-06-30 07:24:45 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $is_trait = false;
|
|
|
|
|
2018-02-19 06:27:39 +01:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $is_interface = false;
|
|
|
|
|
2019-08-30 18:36:35 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $external_mutation_free = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $mutation_free = false;
|
|
|
|
|
2020-06-19 07:22:51 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $specialize_instance = false;
|
|
|
|
|
2016-12-30 21:53:35 +01:00
|
|
|
/**
|
2020-02-13 23:52:23 +01:00
|
|
|
* @var array<lowercase-string, MethodStorage>
|
2016-12-30 21:53:35 +01:00
|
|
|
*/
|
|
|
|
public $methods = [];
|
|
|
|
|
2018-04-22 04:13:10 +02:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, MethodStorage>
|
2018-04-22 04:13:10 +02:00
|
|
|
*/
|
|
|
|
public $pseudo_methods = [];
|
|
|
|
|
2019-01-18 17:37:52 +01:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, MethodStorage>
|
2019-01-18 17:37:52 +01:00
|
|
|
*/
|
|
|
|
public $pseudo_static_methods = [];
|
|
|
|
|
2016-12-30 21:53:35 +01:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, MethodIdentifier>
|
2016-12-30 21:53:35 +01:00
|
|
|
*/
|
|
|
|
public $declaring_method_ids = [];
|
|
|
|
|
2016-12-31 17:49:04 +01:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, MethodIdentifier>
|
2016-12-31 17:49:04 +01:00
|
|
|
*/
|
|
|
|
public $appearing_method_ids = [];
|
|
|
|
|
2016-12-30 21:53:35 +01:00
|
|
|
/**
|
2021-04-08 04:01:41 +02:00
|
|
|
* Map from lowercase method name to list of declarations in order from parent, to grandparent, to
|
|
|
|
* great-grandparent, etc **including traits and interfaces**. Ancestors that don't have their own declaration are
|
|
|
|
* skipped.
|
|
|
|
*
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, array<string, MethodIdentifier>>
|
2016-12-30 21:53:35 +01:00
|
|
|
*/
|
|
|
|
public $overridden_method_ids = [];
|
2017-01-02 01:09:17 +01:00
|
|
|
|
2019-03-25 16:25:43 +01:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, MethodIdentifier>
|
2019-03-25 16:25:43 +01:00
|
|
|
*/
|
|
|
|
public $documenting_method_ids = [];
|
|
|
|
|
2017-11-09 03:27:23 +01:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, MethodIdentifier>
|
2017-11-09 03:27:23 +01:00
|
|
|
*/
|
|
|
|
public $inheritable_method_ids = [];
|
|
|
|
|
2018-09-26 00:37:24 +02:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, array<string, bool>>
|
2018-09-26 00:37:24 +02:00
|
|
|
*/
|
|
|
|
public $potential_declaring_method_ids = [];
|
|
|
|
|
2017-01-02 01:09:17 +01:00
|
|
|
/**
|
|
|
|
* @var array<string, PropertyStorage>
|
|
|
|
*/
|
|
|
|
public $properties = [];
|
|
|
|
|
2017-05-05 00:35:05 +02:00
|
|
|
/**
|
|
|
|
* @var array<string, Type\Union>
|
|
|
|
*/
|
2017-05-05 17:20:05 +02:00
|
|
|
public $pseudo_property_set_types = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<string, Type\Union>
|
|
|
|
*/
|
|
|
|
public $pseudo_property_get_types = [];
|
2017-05-05 00:35:05 +02:00
|
|
|
|
2017-01-02 01:09:17 +01:00
|
|
|
/**
|
|
|
|
* @var array<string, string>
|
|
|
|
*/
|
|
|
|
public $declaring_property_ids = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<string, string>
|
|
|
|
*/
|
|
|
|
public $appearing_property_ids = [];
|
2017-01-19 19:11:45 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<string, string>
|
|
|
|
*/
|
|
|
|
public $inheritable_property_ids = [];
|
2017-02-10 02:35:17 +01:00
|
|
|
|
2018-03-04 18:24:50 +01:00
|
|
|
/**
|
|
|
|
* @var array<string, array<string>>
|
|
|
|
*/
|
|
|
|
public $overridden_property_ids = [];
|
|
|
|
|
2017-02-10 02:35:17 +01:00
|
|
|
/**
|
2020-11-30 01:22:54 +01:00
|
|
|
* An array holding the class template "as" types.
|
|
|
|
*
|
|
|
|
* It's the de-facto list of all templates on a given class.
|
|
|
|
*
|
|
|
|
* The name of the template is the first key. The nested array is keyed by the defining class
|
|
|
|
* (i.e. the same as the class name). This allows operations with the same-named template defined
|
|
|
|
* across multiple classes to not run into trouble.
|
|
|
|
*
|
2020-11-27 17:43:23 +01:00
|
|
|
* @var array<string, non-empty-array<string, Type\Union>>|null
|
2017-02-10 02:35:17 +01:00
|
|
|
*/
|
|
|
|
public $template_types;
|
2017-02-27 05:09:18 +01:00
|
|
|
|
2019-05-06 22:38:08 +02:00
|
|
|
/**
|
|
|
|
* @var array<int, bool>|null
|
|
|
|
*/
|
|
|
|
public $template_covariants;
|
|
|
|
|
2018-05-28 23:26:43 +02:00
|
|
|
/**
|
2020-11-29 21:05:32 +01:00
|
|
|
* A map of which generic classlikes are extended or implemented by this class or interface.
|
|
|
|
*
|
|
|
|
* This is only used in the populator, which poulates the $template_extended_params property below.
|
|
|
|
*
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* @var array<string, non-empty-array<int, Type\Union>>|null
|
|
|
|
*/
|
|
|
|
public $template_extended_offsets;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A map of which generic classlikes are extended or implemented by this class or interface.
|
|
|
|
*
|
|
|
|
* The annotation "@extends Traversable<SomeClass, SomeOtherClass>" would generate an entry of
|
|
|
|
*
|
|
|
|
* [
|
|
|
|
* "Traversable" => [
|
|
|
|
* "TKey" => new Union([new TNamedObject("SomeClass")]),
|
|
|
|
* "TValue" => new Union([new TNamedObject("SomeOtherClass")])
|
|
|
|
* ]
|
|
|
|
* ]
|
|
|
|
*
|
|
|
|
* @var array<string, array<string, Type\Union>>|null
|
2018-05-28 23:26:43 +02:00
|
|
|
*/
|
2020-11-29 21:05:32 +01:00
|
|
|
public $template_extended_params;
|
2019-01-10 23:58:32 +01:00
|
|
|
|
2019-01-24 23:55:03 +01:00
|
|
|
/**
|
|
|
|
* @var ?int
|
|
|
|
*/
|
2020-11-29 21:05:32 +01:00
|
|
|
public $template_extended_count;
|
2019-01-24 23:55:03 +01:00
|
|
|
|
2019-01-28 03:00:27 +01:00
|
|
|
/**
|
2019-01-28 05:12:40 +01:00
|
|
|
* @var array<string, int>|null
|
2019-01-28 03:00:27 +01:00
|
|
|
*/
|
2019-01-28 05:12:40 +01:00
|
|
|
public $template_type_implements_count;
|
2019-01-28 03:00:27 +01:00
|
|
|
|
2020-04-03 04:38:10 +02:00
|
|
|
/**
|
|
|
|
* @var ?Type\Union
|
|
|
|
*/
|
|
|
|
public $yield;
|
|
|
|
|
2019-01-28 03:00:27 +01:00
|
|
|
/**
|
2019-01-28 05:12:40 +01:00
|
|
|
* @var array<string, int>|null
|
2019-01-28 03:00:27 +01:00
|
|
|
*/
|
2019-01-28 05:12:40 +01:00
|
|
|
public $template_type_uses_count;
|
2019-01-28 03:00:27 +01:00
|
|
|
|
2017-12-27 12:27:59 +01:00
|
|
|
/**
|
|
|
|
* @var array<string, bool>
|
|
|
|
*/
|
|
|
|
public $initialized_properties = [];
|
2018-02-14 19:34:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<string>
|
|
|
|
*/
|
|
|
|
public $invalid_dependencies = [];
|
2018-02-19 06:27:39 +01:00
|
|
|
|
2019-01-24 21:03:13 +01:00
|
|
|
/**
|
2020-02-15 02:54:26 +01:00
|
|
|
* @var array<lowercase-string, bool>
|
2019-01-24 21:03:13 +01:00
|
|
|
*/
|
|
|
|
public $dependent_classlikes = [];
|
|
|
|
|
2018-02-19 06:27:39 +01:00
|
|
|
/**
|
|
|
|
* A hash of the source file's name, contents, and this file's modified on date
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
public $hash = '';
|
2018-05-03 17:38:27 +02:00
|
|
|
|
2018-05-29 16:13:26 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $has_visitor_issues = false;
|
|
|
|
|
2018-11-01 22:03:08 +01:00
|
|
|
/**
|
2020-03-29 00:54:55 +01:00
|
|
|
* @var list<\Psalm\Issue\CodeIssue>
|
2018-11-01 22:03:08 +01:00
|
|
|
*/
|
2020-03-29 00:54:55 +01:00
|
|
|
public $docblock_issues = [];
|
2018-11-01 22:03:08 +01:00
|
|
|
|
2020-05-14 06:41:50 +02:00
|
|
|
/**
|
2020-05-15 06:15:48 +02:00
|
|
|
* @var array<string, \Psalm\Internal\Type\TypeAlias\ClassTypeAlias>
|
2020-05-14 06:41:50 +02:00
|
|
|
*/
|
|
|
|
public $type_aliases = [];
|
|
|
|
|
2020-08-06 01:39:27 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public $preserve_constructor_signature = false;
|
|
|
|
|
2020-10-19 21:08:18 +02:00
|
|
|
/**
|
|
|
|
* @var null|string
|
|
|
|
*/
|
|
|
|
public $extension_requirement;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var array<int, string>
|
|
|
|
*/
|
|
|
|
public $implementation_requirements = [];
|
|
|
|
|
2020-10-24 06:10:22 +02:00
|
|
|
/**
|
|
|
|
* @var list<AttributeStorage>
|
|
|
|
*/
|
|
|
|
public $attributes = [];
|
|
|
|
|
2021-02-24 16:14:04 +01:00
|
|
|
/**
|
|
|
|
* @var ?string
|
|
|
|
*/
|
|
|
|
public $description;
|
|
|
|
|
2020-09-07 01:36:47 +02:00
|
|
|
public function __construct(string $name)
|
2018-05-03 17:38:27 +02:00
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
}
|
2016-12-30 18:41:14 +01:00
|
|
|
}
|