1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Add a bunch of immutable & pure annotations

This commit is contained in:
Brown 2020-08-24 19:28:53 -04:00
parent 4e10a0ed6f
commit 7dba9bc50a
26 changed files with 79 additions and 0 deletions

View File

@ -79,6 +79,8 @@ class AstDiffer
* @param array<int, bool> $bc
*
* @return DiffElem[]
*
* @psalm-pure
*/
protected static function extractDiff(array $trace, $x, $y, array $a, array $b, array $bc) : array
{

View File

@ -4,6 +4,8 @@ namespace Psalm\Internal\Diff;
/**
* @internal
*
* @psalm-immutable
*/
class DiffElem
{

View File

@ -68,6 +68,8 @@ class FileDiffer
* @param array<int, string> $b
*
* @return DiffElem[]
*
* @psalm-pure
*/
private static function extractDiff(array $trace, int $x, int $y, array $a, array $b) : array
{
@ -115,6 +117,8 @@ class FileDiffer
/**
* @return array<int, array{0: int, 1: int, 2: int, 3: int, 4: int, 5: string}>
*
* @psalm-pure
*/
public static function getDiff(string $a_code, string $b_code)
{
@ -263,6 +267,8 @@ class FileDiffer
* @param DiffElem[] $diff
*
* @return DiffElem[]
*
* @psalm-pure
*/
private static function coalesceReplacements(array $diff)
{

View File

@ -1,6 +1,9 @@
<?php
namespace Psalm\Internal\FileManipulation;
/**
* @psalm-immutable
*/
class CodeMigration
{
/** @var string */

View File

@ -1,6 +1,9 @@
<?php
namespace Psalm\Internal\Fork;
/**
* @psalm-immutable
*/
class ForkProcessDoneMessage implements ForkMessage
{
/** @var mixed */

View File

@ -1,6 +1,9 @@
<?php
namespace Psalm\Internal\Fork;
/**
* @psalm-immutable
*/
class ForkProcessErrorMessage implements ForkMessage
{
/** @var string */

View File

@ -1,6 +1,9 @@
<?php
namespace Psalm\Internal\Fork;
/**
* @psalm-immutable
*/
class ForkTaskDoneMessage implements ForkMessage
{
/** @var mixed */

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal;
/**
* @psalm-immutable
*/
class MethodIdentifier
{
public $fq_class_name;

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
class ArrayOffsetFetch extends UnresolvedConstantComponent
{
/** @var UnresolvedConstantComponent */

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
class ArrayValue extends UnresolvedConstantComponent
{
/** @var array<int, KeyValuePair> */

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
class ClassConstant extends UnresolvedConstantComponent
{
/** @var string */

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
class Constant extends UnresolvedConstantComponent
{
/** @var string */

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
class KeyValuePair extends UnresolvedConstantComponent
{
/** @var ?UnresolvedConstantComponent */

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
class ScalarValue extends UnresolvedConstantComponent
{
/** @var string|int|float|bool|null */

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Scanner\UnresolvedConstant;
/**
* @psalm-immutable
*/
class UnresolvedAdditionOp extends UnresolvedBinaryOp
{
}

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
abstract class UnresolvedBinaryOp extends UnresolvedConstantComponent
{
/** @var UnresolvedConstantComponent */

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Scanner\UnresolvedConstant;
/**
* @psalm-immutable
*/
class UnresolvedBitwiseOr extends UnresolvedBinaryOp
{
}

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Scanner\UnresolvedConstant;
/**
* @psalm-immutable
*/
class UnresolvedConcatOp extends UnresolvedBinaryOp
{
}

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Scanner\UnresolvedConstant;
/**
* @psalm-immutable
*/
class UnresolvedDivisionOp extends UnresolvedBinaryOp
{
}

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Scanner\UnresolvedConstant;
/**
* @psalm-immutable
*/
class UnresolvedMultiplicationOp extends UnresolvedBinaryOp
{
}

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Scanner\UnresolvedConstant;
/**
* @psalm-immutable
*/
class UnresolvedSubtractionOp extends UnresolvedBinaryOp
{
}

View File

@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
/**
* @psalm-immutable
*/
class UnresolvedTernary extends UnresolvedConstantComponent
{
public $cond;

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Scanner;
/**
* @psalm-immutable
*/
abstract class UnresolvedConstantComponent
{
}

View File

@ -2,6 +2,9 @@
namespace Psalm\Internal\Taint;
/**
* @psalm-immutable
*/
class Path
{
public $type;

View File

@ -1,6 +1,9 @@
<?php
namespace Psalm\Internal\Type\TypeAlias;
/**
* @psalm-immutable
*/
class InlineTypeAlias implements \Psalm\Internal\Type\TypeAlias
{
/**

View File

@ -1,6 +1,9 @@
<?php
namespace Psalm\Internal\Type\TypeAlias;
/**
* @psalm-immutable
*/
class LinkableTypeAlias implements \Psalm\Internal\Type\TypeAlias
{
public $declaring_fq_classlike_name;