Documentation

Reconciler
in package

Table of Contents

Constants

RECONCILIATION_EMPTY  = 2
RECONCILIATION_OK  = 0
RECONCILIATION_REDUNDANT  = 1

Properties

$broken_paths  : array<string, array<int, string>>

Methods

breakUpPathIntoParts()  : array<int, string>
reconcileKeyedTypes()  : Union>, array}
Takes two arrays and consolidates them, removing null values from existing types where applicable.
refineArrayKey()  : Union
triggerIssueForImpossible()  : void
addNestedAssertions()  : array<string, array<string|int, array<int, Assertion>>>
This generates a list of extra assertions for an assertion on a nested key.
adjustTKeyedArrayType()  : void
getPropertyType()  : Union|null
getValueForKey()  : Union|null
Gets the type for a given (non-existent key) based on the passed keys
refineArrayKeyInner()  : Union|null

Constants

RECONCILIATION_EMPTY

public mixed RECONCILIATION_EMPTY = 2

RECONCILIATION_OK

public mixed RECONCILIATION_OK = 0

RECONCILIATION_REDUNDANT

public mixed RECONCILIATION_REDUNDANT = 1

Properties

$broken_paths

private static array<string, array<int, string>> $broken_paths = []

Methods

breakUpPathIntoParts()

public static breakUpPathIntoParts(string $path) : array<int, string>
Parameters
$path : string
Return values
array<int, string>

reconcileKeyedTypes()

Takes two arrays and consolidates them, removing null values from existing types where applicable.

public static reconcileKeyedTypes(array<string, array<string|int, array<int, Assertion>>> $new_types, array<string, array<string|int, array<int, Assertion>>> $active_new_types, array<string, Union$existing_types, array<string, string> $existing_references, array<string, bool> &$changed_var_ids, array<string, bool> $referenced_var_ids, StatementsAnalyzer $statements_analyzer[, array<string, array<string, Union>> $template_type_map = [] ][, bool $inside_loop = false ][, CodeLocation|null $code_location = null ][, bool $negated = false ]) : Union>, array}

Returns a tuple of [new_types, new_references].

Parameters
$new_types : array<string, array<string|int, array<int, Assertion>>>
$active_new_types : array<string, array<string|int, array<int, Assertion>>>
  • types we can complain about
$existing_types : array<string, Union>
$existing_references : array<string, string>

Maps keys of $existing_types that are references to other keys of $existing_types that they are references to.

$changed_var_ids : array<string, bool>
$referenced_var_ids : array<string, bool>
$statements_analyzer : StatementsAnalyzer
$template_type_map : array<string, array<string, Union>> = []
$inside_loop : bool = false
$code_location : CodeLocation|null = null
$negated : bool = false
Tags
psalm-suppress

ComplexMethod

Return values
Union>, array}

triggerIssueForImpossible()

protected static triggerIssueForImpossible(Union|MutableUnion $existing_var_type, string $old_var_type_string, string $key, Assertion $assertion, bool $redundant, bool $negated, CodeLocation $code_location, array<string|int, string> $suppressed_issues) : void
Parameters
$existing_var_type : Union|MutableUnion
$old_var_type_string : string
$key : string
$assertion : Assertion
$redundant : bool
$negated : bool
$code_location : CodeLocation
$suppressed_issues : array<string|int, string>

addNestedAssertions()

This generates a list of extra assertions for an assertion on a nested key.

private static addNestedAssertions(array<string, array<string|int, array<int, Assertion>>> $new_types, array<string, Union$existing_types) : array<string, array<string|int, array<int, Assertion>>>

For example ['$a[0]->foo->bar' => 'isset']

generates the assertions

[ '$a' => '=int-or-string-array-access', '$a[0]' => '=isset', '$a[0]->foo' => '=isset', '$a[0]->foo->bar' => 'isset' // original assertion ]

Parameters
$new_types : array<string, array<string|int, array<int, Assertion>>>
$existing_types : array<string, Union>
Return values
array<string, array<string|int, array<int, Assertion>>>

adjustTKeyedArrayType()

private static adjustTKeyedArrayType(array<string|int, string> $key_parts, array<string, Union&$existing_types, array<string, bool> &$changed_var_ids, Union $result_type) : void
Parameters
$key_parts : array<string|int, string>
$existing_types : array<string, Union>
$changed_var_ids : array<string, bool>
$result_type : Union

getPropertyType()

private static getPropertyType(Codebase $codebase, string $fq_class_name, string $property_name) : Union|null
Parameters
$codebase : Codebase
$fq_class_name : string
$property_name : string
Return values
Union|null

getValueForKey()

Gets the type for a given (non-existent key) based on the passed keys

private static getValueForKey(Codebase $codebase, string $key, array<string, Union&$existing_keys, array<string, mixed> $new_assertions, CodeLocation|null $code_location, bool $has_isset, bool $has_inverted_isset, bool $has_inverted_key_exists, bool $has_empty, bool $inside_loop, bool &$has_object_array_access) : Union|null
Parameters
$codebase : Codebase
$key : string
$existing_keys : array<string, Union>
$new_assertions : array<string, mixed>
$code_location : CodeLocation|null
$has_isset : bool
$has_inverted_isset : bool
$has_inverted_key_exists : bool
$has_empty : bool
$inside_loop : bool
$has_object_array_access : bool
Return values
Union|null

        
On this page

Search results