Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #318 from tighten/v8.83.18-changes
Browse files Browse the repository at this point in the history
V8.83.18 changes
  • Loading branch information
jamisonvalenta authored Aug 22, 2022
2 parents 68d2d38 + ce95604 commit a4423c6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Collect/Support/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public static function prepend($array, $value, $key = null)
* Get a value from the array, and remove it.
*
* @param array $array
* @param string $key
* @param string|int $key
* @param mixed $default
* @return mixed
*/
Expand Down
12 changes: 9 additions & 3 deletions tests/Support/SupportArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,19 +620,25 @@ public function testPull()
$array = ['name' => 'Desk', 'price' => 100];
$name = Arr::pull($array, 'name');
$this->assertSame('Desk', $name);
$this->assertEquals(['price' => 100], $array);
$this->assertSame(['price' => 100], $array);

// Only works on first level keys
$array = ['[email protected]' => 'Joe', 'jane@localhost' => 'Jane'];
$name = Arr::pull($array, '[email protected]');
$this->assertSame('Joe', $name);
$this->assertEquals(['jane@localhost' => 'Jane'], $array);
$this->assertSame(['jane@localhost' => 'Jane'], $array);

// Does not work for nested keys
$array = ['emails' => ['[email protected]' => 'Joe', 'jane@localhost' => 'Jane']];
$name = Arr::pull($array, '[email protected]');
$this->assertNull($name);
$this->assertEquals(['emails' => ['[email protected]' => 'Joe', 'jane@localhost' => 'Jane']], $array);
$this->assertSame(['emails' => ['[email protected]' => 'Joe', 'jane@localhost' => 'Jane']], $array);

// Works with int keys
$array = ['First', 'Second'];
$first = Arr::pull($array, 0);
$this->assertSame('First', $first);
$this->assertSame([1 => 'Second'], $array);
}

public function testQuery()
Expand Down
14 changes: 11 additions & 3 deletions tests/files/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,18 @@ public static function mask($string, $character, $index, $length = null, $encodi
return $string;
}

$start = mb_substr($string, 0, mb_strpos($string, $segment, 0, $encoding), $encoding);
$end = mb_substr($string, mb_strpos($string, $segment, 0, $encoding) + mb_strlen($segment, $encoding));
$strlen = mb_strlen($string, $encoding);
$startIndex = $index;

return $start.str_repeat(mb_substr($character, 0, 1, $encoding), mb_strlen($segment, $encoding)).$end;
if ($index < 0) {
$startIndex = $index < -$strlen ? 0 : $strlen + $index;
}

$start = mb_substr($string, 0, $startIndex, $encoding);
$segmentLen = mb_strlen($segment, $encoding);
$end = mb_substr($string, $startIndex + $segmentLen);

return $start.str_repeat(mb_substr($character, 0, 1, $encoding), $segmentLen).$end;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ carriageReturn="
'Support/SupportLazyCollectionIsLazyTest.php'
'Support/Concerns/CountsEnumerations.php'
)

testSupportClasses=(
'Support/Carbon'
'Support/HigherOrderTapProxy'
Expand Down Expand Up @@ -367,7 +366,7 @@ function getCurrentVersionFromGitHub()
echo Getting current version from $repository...

if [ -z "$requestedVersion" ]; then
collectionVersion=$(git ls-remote $repository --tags v8.83.17\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1)
collectionVersion=$(git ls-remote $repository --tags v8.83.18\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1)
else
collectionVersion=$requestedVersion
fi
Expand Down

0 comments on commit a4423c6

Please sign in to comment.