1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 19:07:00 +01:00
psalm/src/Psalm/Storage/ClassLikeStorage.php

409 lines
7.5 KiB
PHP
Raw Normal View History

<?php
namespace Psalm\Storage;
use Psalm\CodeLocation;
use Psalm\Internal\MethodIdentifier;
use Psalm\Type;
class ClassLikeStorage
{
use CustomMetadataTrait;
/**
* A lookup table for public class constants
*
* @var array<string, Type\Union>
*/
public $public_class_constants = [];
/**
* A lookup table for protected class constants
*
* @var array<string, Type\Union>
*/
public $protected_class_constants = [];
/**
* A lookup table for private class constants
*
* @var array<string, Type\Union>
*/
public $private_class_constants = [];
/**
2019-06-04 17:14:49 +02:00
* A lookup table for class constant name locations
*
* @var array<string, CodeLocation>
*/
public $class_constant_locations = [];
2019-06-04 17:14:49 +02:00
/**
* A lookup table for class constant statement locations
*
* @var array<string, CodeLocation>
*/
public $class_constant_stmt_locations = [];
2018-06-28 03:53:25 +02:00
/**
* A lookup table for nodes of unresolvable public class constants
*
* @var array<string, \Psalm\Internal\Scanner\UnresolvedConstantComponent>
2018-06-28 03:53:25 +02:00
*/
public $public_class_constant_nodes = [];
/**
* A lookup table for nodes of unresolvable protected class constants
*
* @var array<string, \Psalm\Internal\Scanner\UnresolvedConstantComponent>
2018-06-28 03:53:25 +02:00
*/
public $protected_class_constant_nodes = [];
/**
* A lookup table for nodes of unresolvable private class constants
*
* @var array<string, \Psalm\Internal\Scanner\UnresolvedConstantComponent>
2018-06-28 03:53:25 +02:00
*/
public $private_class_constant_nodes = [];
/**
* Aliases to help Psalm understand constant refs
*
* @var ?\Psalm\Aliases
*/
public $aliases;
/**
* @var bool
*/
Refactor scanning and analysis, introducing multithreading (#191) * Add failing test * Add visitor to soup up classlike references * Move a whole bunch of code into the visitor * Move some methods back, move onto analysis stage * Use the getAliases method everywhere * Fix refs * Fix more refs * Fix some tests * Fix more tests * Fix include tests * Shift config class finding to project checker and fix bugs * Fix a few more tests * transition test to new syntax * Remove var_dump * Delete a bunch of code and fix mutation test * Remove unnecessary visitation * Transition to better mocked out file provider, breaking some cached statement loading * Use different scheme for naming anonymous classes * Fix anonymous class issues * Refactor file/statement loading * Add specific property types * Fix mapped property assignment * Improve how we deal with traits * Fix trait checking * Pass Psalm checks * Add multi-process support * Delay console output until the end * Remove PHP 7 syntax * Update file storage with classes * Fix scanning individual files and add reflection return types * Always turn XDebug off * Add quicker method of getting method mutations * Queue return types for crawling * Interpret all strings as possible classes once we see a `get_class` call * Check invalid return types again * Fix template namespacing issues * Default to class-insensitive file names for includes * Don’t overwrite existing issues data * Add var docblocks for scanning * Add null check * Fix loading of external classes in templates * Only try to populate class when we haven’t yet seen it’s not a class * Fix trait property accessibility * Only ever improve docblock param type * Make param replacement more robust * Fix static const missing inferred type * Fix a few more tests * Register constant definitions * Fix trait aliasing * Skip constant type tests for now * Fix linting issues * Make sure caching is off for tests * Remove unnecessary return * Use emulative parser if on PHP 5.6 * Cache parser for faster first-time parse * Fix constant resolution when scanning classes * Remove test that’s beyond a practical scope * Add back --diff support * Add --help for --threads * Remove unused vars
2017-07-25 22:11:02 +02:00
public $populated = false;
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;
/**
* @var bool
*/
public $internal = false;
/**
* @var null|string
*/
public $psalm_internal = null;
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-04-26 22:49:52 +02:00
*/
public $mixin = null;
2020-04-26 22:49:52 +02:00
/**
* @var array<string, bool>
*/
public $deprecated_constants = [];
/**
* @var bool
*/
public $sealed_properties = false;
/**
* @var bool
*/
public $sealed_methods = false;
/**
* @var bool
*/
public $override_property_visibility = false;
/**
* @var bool
*/
public $override_method_visibility = false;
/**
* @var array<int, string>
*/
public $suppressed_issues = [];
2017-02-10 02:35:17 +01:00
/**
* @var string
*/
public $name;
/**
* Is this class user-defined
*
* @var bool
*/
public $user_defined = false;
/**
* Interfaces this class implements directly
*
* @var array<string, string>
*/
public $direct_class_interfaces = [];
/**
* Interfaces this class implements explicitly and implicitly
*
* @var array<lowercase-string, string>
*/
public $class_implements = [];
/**
* Parent interfaces listed explicitly
*
* @var array<lowercase-string, string>
*/
public $direct_interface_parents = [];
/**
* Parent interfaces
*
* @var array<lowercase-string, string>
*/
public $parent_interfaces = [];
/**
* There can only be one direct parent class
*
* @var ?string
*/
public $parent_class;
/**
* Parent classes
*
2020-03-02 17:20:52 +01:00
* @var array<lowercase-string, string>
*/
public $parent_classes = [];
/**
* @var CodeLocation|null
*/
public $location;
/**
* @var CodeLocation|null
*/
public $stmt_location;
2019-06-04 22:36:32 +02:00
/**
* @var CodeLocation|null
*/
public $namespace_name_location;
/**
* @var bool
*/
public $abstract = false;
/**
* @var bool
*/
public $final = false;
/**
* @var array<lowercase-string, string>
*/
public $used_traits = [];
Refactor scanning and analysis, introducing multithreading (#191) * Add failing test * Add visitor to soup up classlike references * Move a whole bunch of code into the visitor * Move some methods back, move onto analysis stage * Use the getAliases method everywhere * Fix refs * Fix more refs * Fix some tests * Fix more tests * Fix include tests * Shift config class finding to project checker and fix bugs * Fix a few more tests * transition test to new syntax * Remove var_dump * Delete a bunch of code and fix mutation test * Remove unnecessary visitation * Transition to better mocked out file provider, breaking some cached statement loading * Use different scheme for naming anonymous classes * Fix anonymous class issues * Refactor file/statement loading * Add specific property types * Fix mapped property assignment * Improve how we deal with traits * Fix trait checking * Pass Psalm checks * Add multi-process support * Delay console output until the end * Remove PHP 7 syntax * Update file storage with classes * Fix scanning individual files and add reflection return types * Always turn XDebug off * Add quicker method of getting method mutations * Queue return types for crawling * Interpret all strings as possible classes once we see a `get_class` call * Check invalid return types again * Fix template namespacing issues * Default to class-insensitive file names for includes * Don’t overwrite existing issues data * Add var docblocks for scanning * Add null check * Fix loading of external classes in templates * Only try to populate class when we haven’t yet seen it’s not a class * Fix trait property accessibility * Only ever improve docblock param type * Make param replacement more robust * Fix static const missing inferred type * Fix a few more tests * Register constant definitions * Fix trait aliasing * Skip constant type tests for now * Fix linting issues * Make sure caching is off for tests * Remove unnecessary return * Use emulative parser if on PHP 5.6 * Cache parser for faster first-time parse * Fix constant resolution when scanning classes * Remove test that’s beyond a practical scope * Add back --diff support * Add --help for --threads * Remove unused vars
2017-07-25 22:11:02 +02:00
/**
* @var array<lowercase-string, lowercase-string>
Refactor scanning and analysis, introducing multithreading (#191) * Add failing test * Add visitor to soup up classlike references * Move a whole bunch of code into the visitor * Move some methods back, move onto analysis stage * Use the getAliases method everywhere * Fix refs * Fix more refs * Fix some tests * Fix more tests * Fix include tests * Shift config class finding to project checker and fix bugs * Fix a few more tests * transition test to new syntax * Remove var_dump * Delete a bunch of code and fix mutation test * Remove unnecessary visitation * Transition to better mocked out file provider, breaking some cached statement loading * Use different scheme for naming anonymous classes * Fix anonymous class issues * Refactor file/statement loading * Add specific property types * Fix mapped property assignment * Improve how we deal with traits * Fix trait checking * Pass Psalm checks * Add multi-process support * Delay console output until the end * Remove PHP 7 syntax * Update file storage with classes * Fix scanning individual files and add reflection return types * Always turn XDebug off * Add quicker method of getting method mutations * Queue return types for crawling * Interpret all strings as possible classes once we see a `get_class` call * Check invalid return types again * Fix template namespacing issues * Default to class-insensitive file names for includes * Don’t overwrite existing issues data * Add var docblocks for scanning * Add null check * Fix loading of external classes in templates * Only try to populate class when we haven’t yet seen it’s not a class * Fix trait property accessibility * Only ever improve docblock param type * Make param replacement more robust * Fix static const missing inferred type * Fix a few more tests * Register constant definitions * Fix trait aliasing * Skip constant type tests for now * Fix linting issues * Make sure caching is off for tests * Remove unnecessary return * Use emulative parser if on PHP 5.6 * Cache parser for faster first-time parse * Fix constant resolution when scanning classes * Remove test that’s beyond a practical scope * Add back --diff support * Add --help for --threads * Remove unused vars
2017-07-25 22:11:02 +02:00
*/
public $trait_alias_map = [];
/**
* @var array<string, int>
*/
public $trait_visibility_map = [];
/**
* @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-02-13 23:52:23 +01:00
* @var array<lowercase-string, MethodStorage>
*/
public $methods = [];
/**
* @var array<lowercase-string, MethodStorage>
*/
public $pseudo_methods = [];
/**
* @var array<lowercase-string, MethodStorage>
*/
public $pseudo_static_methods = [];
/**
* @var array<lowercase-string, MethodIdentifier>
*/
public $declaring_method_ids = [];
2016-12-31 17:49:04 +01:00
/**
* @var array<lowercase-string, MethodIdentifier>
2016-12-31 17:49:04 +01:00
*/
public $appearing_method_ids = [];
/**
* @var array<lowercase-string, array<string, MethodIdentifier>>
*/
public $overridden_method_ids = [];
/**
* @var array<lowercase-string, MethodIdentifier>
*/
public $documenting_method_ids = [];
/**
* @var array<lowercase-string, MethodIdentifier>
*/
public $inheritable_method_ids = [];
/**
* @var array<lowercase-string, array<string, bool>>
*/
public $potential_declaring_method_ids = [];
/**
* @var array<string, PropertyStorage>
*/
public $properties = [];
/**
* @var array<string, Type\Union>
*/
public $pseudo_property_set_types = [];
/**
* @var array<string, Type\Union>
*/
public $pseudo_property_get_types = [];
/**
* @var array<string, string>
*/
public $declaring_property_ids = [];
/**
* @var array<string, string>
*/
public $appearing_property_ids = [];
/**
* @var array<string, string>
*/
public $inheritable_property_ids = [];
2017-02-10 02:35:17 +01:00
/**
* @var array<string, array<string>>
*/
public $overridden_property_ids = [];
2017-02-10 02:35:17 +01:00
/**
* @var array<string, non-empty-array<string, array{Type\Union}>>|null
2017-02-10 02:35:17 +01:00
*/
public $template_types;
/**
* @var array<int, bool>|null
*/
public $template_covariants;
/**
* @var array<string, array<int|string, Type\Union>>|null
*/
public $template_type_extends;
/**
* @var ?int
*/
public $template_type_extends_count;
/**
* @var array<string, int>|null
*/
public $template_type_implements_count;
/**
* @var ?Type\Union
*/
public $yield;
/**
* @var array<string, int>|null
*/
public $template_type_uses_count;
/**
* @var array<string, bool>
*/
public $initialized_properties = [];
/**
* @var array<string>
*/
public $invalid_dependencies = [];
2018-02-19 06:27:39 +01:00
/**
* @var array<lowercase-string, bool>
*/
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 = '';
/**
* @var bool
*/
public $has_visitor_issues = false;
/**
* @var list<\Psalm\Issue\CodeIssue>
*/
public $docblock_issues = [];
/**
* @var array<string, \Psalm\Internal\Type\TypeAlias>
*/
public $type_aliases = [];
/**
* @param string $name
*/
public function __construct($name)
{
$this->name = $name;
}
}