Documentation

Integer
in package
implements NumberInterface

A value object representing an integer

This class exists for type-safety purposes, to ensure that integers returned from ramsey/uuid methods as strings are truly integers and not some other kind of string.

To support large integers beyond PHP_INT_MAX and PHP_INT_MIN on both 64-bit and 32-bit systems, we store the integers as strings.

Tags
psalm-immutable

Interfaces, Classes, Traits and Enums

NumberInterface
NumberInterface ensures consistency in numeric values returned by ramsey/uuid

Table of Contents

$isNegative  : bool
$value  : mixed
__construct()  : mixed
__serialize()  : array<string|int, mixed>
__toString()  : string
__unserialize()  : void
isNegative()  : bool
Returns true if this number is less than zero
jsonSerialize()  : string
serialize()  : string
toString()  : string
unserialize()  : void
Constructs the object from a serialized string representation

Properties

$isNegative

private bool $isNegative = false

$value

private mixed $value
Tags
psalm-var

numeric-string

Methods

__construct()

public __construct(mixed $value) : mixed
Parameters
$value : mixed

The integer value to store

Return values
mixed

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

public __toString() : string
Return values
string

__unserialize()

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Return values
void

isNegative()

Returns true if this number is less than zero

public isNegative() : bool
Return values
bool

jsonSerialize()

public jsonSerialize() : string
Return values
string

serialize()

public serialize() : string
Return values
string

toString()

public toString() : string
Tags
psalm-return

numeric-string

Return values
string

unserialize()

Constructs the object from a serialized string representation

public unserialize(string $serialized) : void
Parameters
$serialized : string

The serialized string representation of the object

Tags
phpcsSuppress

SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint

psalm-suppress

UnusedMethodCall

Return values
void

Search results