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:
parent
4e10a0ed6f
commit
7dba9bc50a
@ -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
|
||||
{
|
||||
|
@ -4,6 +4,8 @@ namespace Psalm\Internal\Diff;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class DiffElem
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace Psalm\Internal\FileManipulation;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class CodeMigration
|
||||
{
|
||||
/** @var string */
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace Psalm\Internal\Fork;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class ForkProcessDoneMessage implements ForkMessage
|
||||
{
|
||||
/** @var mixed */
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace Psalm\Internal\Fork;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class ForkProcessErrorMessage implements ForkMessage
|
||||
{
|
||||
/** @var string */
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace Psalm\Internal\Fork;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class ForkTaskDoneMessage implements ForkMessage
|
||||
{
|
||||
/** @var mixed */
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class MethodIdentifier
|
||||
{
|
||||
public $fq_class_name;
|
||||
|
@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class ArrayOffsetFetch extends UnresolvedConstantComponent
|
||||
{
|
||||
/** @var UnresolvedConstantComponent */
|
||||
|
@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class ArrayValue extends UnresolvedConstantComponent
|
||||
{
|
||||
/** @var array<int, KeyValuePair> */
|
||||
|
@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class ClassConstant extends UnresolvedConstantComponent
|
||||
{
|
||||
/** @var string */
|
||||
|
@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Constant extends UnresolvedConstantComponent
|
||||
{
|
||||
/** @var string */
|
||||
|
@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class KeyValuePair extends UnresolvedConstantComponent
|
||||
{
|
||||
/** @var ?UnresolvedConstantComponent */
|
||||
|
@ -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 */
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class UnresolvedAdditionOp extends UnresolvedBinaryOp
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
abstract class UnresolvedBinaryOp extends UnresolvedConstantComponent
|
||||
{
|
||||
/** @var UnresolvedConstantComponent */
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class UnresolvedBitwiseOr extends UnresolvedBinaryOp
|
||||
{
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class UnresolvedConcatOp extends UnresolvedBinaryOp
|
||||
{
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class UnresolvedDivisionOp extends UnresolvedBinaryOp
|
||||
{
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class UnresolvedMultiplicationOp extends UnresolvedBinaryOp
|
||||
{
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class UnresolvedSubtractionOp extends UnresolvedBinaryOp
|
||||
{
|
||||
}
|
||||
|
@ -4,6 +4,9 @@ namespace Psalm\Internal\Scanner\UnresolvedConstant;
|
||||
|
||||
use Psalm\Internal\Scanner\UnresolvedConstantComponent;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class UnresolvedTernary extends UnresolvedConstantComponent
|
||||
{
|
||||
public $cond;
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Scanner;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
abstract class UnresolvedConstantComponent
|
||||
{
|
||||
}
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
namespace Psalm\Internal\Taint;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class Path
|
||||
{
|
||||
public $type;
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace Psalm\Internal\Type\TypeAlias;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class InlineTypeAlias implements \Psalm\Internal\Type\TypeAlias
|
||||
{
|
||||
/**
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
namespace Psalm\Internal\Type\TypeAlias;
|
||||
|
||||
/**
|
||||
* @psalm-immutable
|
||||
*/
|
||||
class LinkableTypeAlias implements \Psalm\Internal\Type\TypeAlias
|
||||
{
|
||||
public $declaring_fq_classlike_name;
|
||||
|
Loading…
Reference in New Issue
Block a user