Skip to content
Merged
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
24 changes: 24 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ jobs:
- php: 8.2
phpunit: '12.4.0'
include:
- php: 8.5
phpunit: '12.1.0'
stability: prefer-stable
- php: 8.5
phpunit: '12.2.0'
stability: prefer-stable
- php: 8.5
phpunit: '12.3.0'
stability: prefer-stable
- php: 8.5
phpunit: '12.4.0'
stability: prefer-stable
- php: 8.3
phpunit: '12.1.0'
stability: prefer-stable
Expand Down Expand Up @@ -119,6 +131,18 @@ jobs:
- php: 8.2
phpunit: '12.4.0'
include:
- php: 8.5
phpunit: '12.1.0'
stability: prefer-stable
- php: 8.5
phpunit: '12.2.0'
stability: prefer-stable
- php: 8.5
phpunit: '12.3.0'
stability: prefer-stable
- php: 8.5
phpunit: '12.4.0'
stability: prefer-stable
- php: 8.3
phpunit: '12.1.0'
stability: prefer-stable
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"league/flysystem-sftp-v3": "^3.25.1",
"mockery/mockery": "^1.6.10",
"opis/json-schema": "^2.4.1",
"orchestra/testbench-core": "^10.7.0",
"orchestra/testbench-core": "^10.8.0",
"pda/pheanstalk": "^5.0.6|^7.0.0",
"php-http/discovery": "^1.15",
"phpstan/phpstan": "^2.0",
Expand Down
4 changes: 2 additions & 2 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
(PHP_VERSION_ID >= 80500 ? Pdo\Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],

Expand All @@ -81,7 +81,7 @@
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
(PHP_VERSION_ID >= 80500 ? Pdo\Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],

Expand Down
8 changes: 7 additions & 1 deletion src/Illuminate/Cache/RedisTagSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ public function entries()
$cursor = $defaultCursorValue;

do {
[$cursor, $entries] = $connection->zscan(
$results = $connection->zscan(
$this->store->getPrefix().$tagKey,
$cursor,
['match' => '*', 'count' => 1000]
);

if (! is_array($results)) {
break;
}

[$cursor, $entries] = $results;

if (! is_array($entries)) {
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Collections/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,10 @@ public static function mapSpread(array $array, callable $callback)
*
* @param array $array
* @param mixed $value
* @param array-key $key
* @param mixed $key
* @return array
*/
public static function prepend($array, $value, $key = '')
public static function prepend($array, $value, $key = null)
{
if (func_num_args() == 2) {
array_unshift($array, $value);
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ public function pop($count = 1)
*/
public function prepend($value, $key = null)
{
$this->items = Arr::prepend($this->items, ...func_get_args());
$this->items = Arr::prepend($this->items, ...(func_num_args() > 1 ? func_get_args() : [$value]));

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Connectors/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function createConnection($dsn, array $config, array $options)
*/
protected function createPdoConnection($dsn, $username, #[\SensitiveParameter] $password, $options)
{
return version_compare(phpversion(), '8.4.0', '<')
return version_compare(PHP_VERSION, '8.4.0', '<')
? new PDO($dsn, $username, $password, $options)
: PDO::connect($dsn, $username, $password, $options); /** @phpstan-ignore staticMethod.notFound (PHP 8.4) */
}
Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Database/Schema/MySqlSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ protected function connectionString()
? ' --socket="${:LARAVEL_LOAD_SOCKET}"'
: ' --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}"';

if (isset($config['options'][\PDO::MYSQL_ATTR_SSL_CA])) {
/** @phpstan-ignore class.notFound */
if (isset($config['options'][PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA])) {
$value .= ' --ssl-ca="${:LARAVEL_LOAD_SSL_CA}"';
}

Expand Down Expand Up @@ -140,7 +141,7 @@ protected function baseVariables(array $config)
'LARAVEL_LOAD_USER' => $config['username'],
'LARAVEL_LOAD_PASSWORD' => $config['password'] ?? '',
'LARAVEL_LOAD_DATABASE' => $config['database'],
'LARAVEL_LOAD_SSL_CA' => $config['options'][\PDO::MYSQL_ATTR_SSL_CA] ?? '',
'LARAVEL_LOAD_SSL_CA' => $config['options'][PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA] ?? '', // @phpstan-ignore class.notFound
];
}

Expand Down
6 changes: 6 additions & 0 deletions tests/Cache/RedisCacheIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
use Illuminate\Support\Env;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;
use Redis;

#[RequiresPhpExtension('redis')]
class RedisCacheIntegrationTest extends TestCase
{
use InteractsWithRedis;
Expand Down Expand Up @@ -166,6 +168,10 @@ public function testItFailsWithAnInvalidPhpRedisAlgorithm()

public static function phpRedisBackoffAlgorithmsProvider()
{
if (! class_exists(Redis::class)) {
return [];
}

return [
['default', Redis::BACKOFF_ALGORITHM_DEFAULT],
['decorrelated_jitter', Redis::BACKOFF_ALGORITHM_DECORRELATED_JITTER],
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseMariaDbSchemaStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function provider(): Generator
'username' => 'root',
'database' => 'forge',
'options' => [
\PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca',
PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca',
],
],
];
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseMySqlSchemaStateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function provider(): Generator
'username' => 'root',
'database' => 'forge',
'options' => [
\PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca',
PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA => 'ssl.ca',
],
],
];
Expand Down
25 changes: 24 additions & 1 deletion tests/Support/SupportArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Support\ItemNotFoundException;
use Illuminate\Support\MultipleItemsFoundException;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use stdClass;
use WeakMap;
Expand Down Expand Up @@ -164,6 +165,7 @@ public function testCrossJoin()
$this->assertSame([[]], Arr::crossJoin());
}

#[IgnoreDeprecations]
public function testDivide(): void
{
// Test dividing an empty array
Expand All @@ -187,7 +189,7 @@ public function testDivide(): void
$this->assertEquals(['first', 'second'], $values);

// Test dividing an array with null key
[$keys, $values] = Arr::divide(['' => 'Null', 1 => 'one']);
[$keys, $values] = Arr::divide([null => 'Null', 1 => 'one']);
$this->assertEquals([null, 1], $keys);
$this->assertEquals(['Null', 'one'], $values);

Expand All @@ -200,6 +202,11 @@ public function testDivide(): void
[$keys, $values] = Arr::divide(['' => ['one' => 1, 2 => 'second'], 1 => 'one']);
$this->assertEquals([null, 1], $keys);
$this->assertEquals([['one' => 1, 2 => 'second'], 'one'], $values);

// Test dividing an array where the values are arrays (with null key)
[$keys, $values] = Arr::divide([null => ['one' => 1, 2 => 'second'], 1 => 'one']);
$this->assertEquals([null, 1], $keys);
$this->assertEquals([['one' => 1, 2 => 'second'], 'one'], $values);
}

public function testDot()
Expand Down Expand Up @@ -1036,6 +1043,7 @@ public function testMapSpread()
$this->assertEquals(['1-a-0', '2-b-1'], $result);
}

#[IgnoreDeprecations]
public function testPrepend()
{
$array = Arr::prepend(['one', 'two', 'three', 'four'], 'zero');
Expand All @@ -1047,6 +1055,9 @@ public function testPrepend()
$array = Arr::prepend(['one' => 1, 'two' => 2], 0, '');
$this->assertEquals(['' => 0, 'one' => 1, 'two' => 2], $array);

$array = Arr::prepend(['one' => 1, 'two' => 2], 0, null);
$this->assertEquals([null => 0, 'one' => 1, 'two' => 2], $array);

$array = Arr::prepend(['one', 'two'], null, '');
$this->assertEquals(['' => null, 'one', 'two'], $array);

Expand All @@ -1061,6 +1072,18 @@ public function testPrepend()

$array = Arr::prepend(['one', 'two'], ['zero'], 'key');
$this->assertEquals(['key' => ['zero'], 'one', 'two'], $array);

$array = Arr::prepend(['one', 'two'], ['zero'], '');
$this->assertEquals(['one', 'two', '' => ['zero']], $array);

$array = Arr::prepend(['one', 'two', '' => 'three'], ['zero'], '');
$this->assertEquals(['one', 'two', '' => ['zero']], $array);

$array = Arr::prepend(['one', 'two'], ['zero'], null);
$this->assertEquals(['one', 'two', null => ['zero']], $array);

$array = Arr::prepend(['one', 'two', '' => 'three'], ['zero'], null);
$this->assertEquals(['one', 'two', null => ['zero']], $array);
}

public function testPull()
Expand Down
8 changes: 8 additions & 0 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use JsonSerializable;
use Mockery as m;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use stdClass;
Expand Down Expand Up @@ -4215,6 +4216,7 @@ public function testPaginate($collection)
$this->assertEquals([], $c->forPage(3, 2)->all());
}

#[IgnoreDeprecations]
public function testPrepend()
{
$c = new Collection(['one', 'two', 'three', 'four']);
Expand All @@ -4234,6 +4236,12 @@ public function testPrepend()
[null => 0, 'one' => 1, 'two' => 2],
$c->prepend(0, null)->all()
);

$c = new Collection(['one' => 1, 'two' => 2]);
$this->assertEquals(
[null => 0, 'one' => 1, 'two' => 2],
$c->prepend(0, '')->all()
);
}

public function testPushWithOneItem()
Expand Down
Loading