Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/Arrayy.php
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,7 @@ public static function createFromObjectVars($object): self
* @phpstan-return static<int,string>
* @psalm-mutation-free
*/
public static function createFromString(string $str, string $delimiter = null, string $regEx = null): self
public static function createFromString(string $str, ?string $delimiter = null, ?string $regEx = null): self
{
if ($regEx) {
\preg_match_all($regEx, $str, $array);
Expand Down Expand Up @@ -2648,7 +2648,7 @@ public function filter($closure = null, int $flag = \ARRAY_FILTER_USE_BOTH)
public function filterBy(
string $property,
$value,
string $comparisonOp = null
?string $comparisonOp = null
): self {
if (!$comparisonOp) {
$comparisonOp = \is_array($value) ? 'contains' : 'eq';
Expand Down Expand Up @@ -2834,7 +2834,7 @@ public function firstKey()
* @phpstan-return static<TKey,T>
* @psalm-mutation-free
*/
public function firstsImmutable(int $number = null): self
public function firstsImmutable(?int $number = null): self
{
$arrayTmp = $this->toArray();

Expand Down Expand Up @@ -2863,7 +2863,7 @@ public function firstsImmutable(int $number = null): self
* @phpstan-return static<array-key,TKey>
* @psalm-mutation-free
*/
public function firstsKeys(int $number = null): self
public function firstsKeys(?int $number = null): self
{
$arrayTmp = $this->keys()->toArray();

Expand Down Expand Up @@ -2895,7 +2895,7 @@ public function firstsKeys(int $number = null): self
*
* @phpstan-return ($number is null ? static<int,T> : static<TKey,T>)
*/
public function firstsMutable(int $number = null): self
public function firstsMutable(?int $number = null): self
{
$this->generatorToArray();

Expand Down Expand Up @@ -2972,7 +2972,7 @@ public function flip(): self
public function get(
$key = null,
$fallback = null,
array $array = null,
?array $array = null,
bool $useByReference = false
) {
if ($array === null && $key === null) {
Expand Down Expand Up @@ -4265,7 +4265,7 @@ public function lastKey()
* @phpstan-return static<TKey,T>
* @psalm-mutation-free
*/
public function lastsImmutable(int $number = null): self
public function lastsImmutable(?int $number = null): self
{
if ($this->isEmpty()) {
return static::create(
Expand Down Expand Up @@ -4310,7 +4310,7 @@ public function lastsImmutable(int $number = null): self
*
* @phpstan-return static<TKey,T>
*/
public function lastsMutable(int $number = null): self
public function lastsMutable(?int $number = null): self
{
if ($this->isEmpty()) {
return $this;
Expand Down Expand Up @@ -4724,7 +4724,7 @@ public function mostUsedValue()
* @phpstan-return static<array-key,T>
* @psalm-mutation-free
*/
public function mostUsedValues(int $number = null): self
public function mostUsedValues(?int $number = null): self
{
return $this->countValues()->arsortImmutable()->firstsKeys($number);
}
Expand Down Expand Up @@ -5230,7 +5230,7 @@ public function push(...$args)
*
* @phpstan-return static<array-key,T>
*/
public function randomImmutable(int $number = null): self
public function randomImmutable(?int $number = null): self
{
$this->generatorToArray();

Expand Down Expand Up @@ -5347,7 +5347,7 @@ public function randomKeys(int $number): self
*
* @phpstan-return static<TKey,T>
*/
public function randomMutable(int $number = null): self
public function randomMutable(?int $number = null): self
{
$this->generatorToArray();

Expand Down Expand Up @@ -5429,7 +5429,7 @@ public function randomValues(int $number): self
* @phpstan-param array<(int&T)|(string&T),int> $array
* @phpstan-return static<array-key,T>
*/
public function randomWeighted(array $array, int $number = null): self
public function randomWeighted(array $array, ?int $number = null): self
{
// init
$options = [];
Expand Down Expand Up @@ -6248,7 +6248,7 @@ public function shift()
* @phpstan-param array<TKey,T> $array
* @phpstan-return static<TKey,T>
*/
public function shuffle(bool $secure = false, array $array = null): self
public function shuffle(bool $secure = false, ?array $array = null): self
{
if ($array === null) {
$array = $this->toArray(false);
Expand Down Expand Up @@ -6454,7 +6454,7 @@ public function sizeRecursive(): int
* @phpstan-return static<array-key,T>
* @psalm-mutation-free
*/
public function slice(int $offset, int $length = null, bool $preserveKeys = false)
public function slice(int $offset, ?int $length = null, bool $preserveKeys = false)
{
return static::create(
\array_slice(
Expand Down Expand Up @@ -6719,7 +6719,7 @@ static function ($value) use ($sorter) {
* @phpstan-return static<TKey,T>
* @psalm-mutation-free
*/
public function splice(int $offset, int $length = null, $replacement = []): self
public function splice(int $offset, ?int $length = null, $replacement = []): self
{
$tmpArray = $this->toArray();

Expand Down Expand Up @@ -6967,7 +6967,7 @@ public function toJson(int $options = 0, int $depth = 512): string
*
* @phpstan-return static<int, static<TKey,T>>
*/
public function toPermutation(array $items = null, array $helper = []): self
public function toPermutation(?array $items = null, array $helper = []): self
{
// init
$return = [];
Expand Down
2 changes: 1 addition & 1 deletion src/ArrayyRewindableExtendedGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ArrayyRewindableExtendedGenerator extends ArrayyRewindableGenerator
{
public function __construct(
callable $generatorConstructionFunction,
callable $onRewind = null,
?callable $onRewind = null,
string $class = ''
) {
parent::__construct(
Expand Down
2 changes: 1 addition & 1 deletion src/ArrayyRewindableGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ArrayyRewindableGenerator extends \ArrayIterator
*/
public function __construct(
callable $generatorConstructionFunction,
callable $onRewind = null,
?callable $onRewind = null,
string $class = ''
) {
$this->class = $class;
Expand Down
6 changes: 3 additions & 3 deletions src/Collection/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ class Collection extends AbstractCollection
*/
public function __construct(
$data = [],
string $iteratorClass = null,
bool $checkPropertiesInConstructor = null,
TypeInterface $type = null
?string $iteratorClass = null,
?bool $checkPropertiesInConstructor = null,
?TypeInterface $type = null
) {
// fallback
if ($iteratorClass === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Collection/CollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ public function set($key, $value);
*
* @phpstan-return CollectionInterface<array-key|TKey,T>
*/
public function slice(int $offset, int $length = null, bool $preserveKeys = false);
public function slice(int $offset, ?int $length = null, bool $preserveKeys = false);

/**
* Gets a native PHP array representation of the collection.
Expand Down
2 changes: 1 addition & 1 deletion src/StaticArrayy.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function __callStatic(string $name, $arguments)
* @psalm-suppress InvalidReturnStatement - why?
* @psalm-suppress InvalidReturnType - why?
*/
public static function range(int $base, int $stop = null, int $step = 1): Arrayy
public static function range(int $base, ?int $stop = null, int $step = 1): Arrayy
{
if ($stop !== null) {
$start = $base;
Expand Down
4 changes: 2 additions & 2 deletions src/Type/InstanceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ final class InstanceCollection extends Collection implements TypeInterface
*/
public function __construct(
array $data = [],
string $iteratorClass = null,
bool $checkPropertiesInConstructor = null,
?string $iteratorClass = null,
?bool $checkPropertiesInConstructor = null,
$className = null
) {
// fallback
Expand Down
6 changes: 3 additions & 3 deletions src/Type/InstancesCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ final class InstancesCollection extends Collection implements TypeInterface
*/
public function __construct(
array $data = [],
string $iteratorClass = null,
bool $checkPropertiesInConstructor = null,
array $classNames = null
?string $iteratorClass = null,
?bool $checkPropertiesInConstructor = null,
?array $classNames = null
) {
// fallback
if ($iteratorClass === null) {
Expand Down