Skip to content

Commit ef95e41

Browse files
Merge branch '10.x'
2 parents 84bab4c + b184c5e commit ef95e41

File tree

20 files changed

+328
-88
lines changed

20 files changed

+328
-88
lines changed

src/Illuminate/Collections/Arr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static function divide($array)
109109
*/
110110
public static function dot($array, $prepend = '')
111111
{
112-
$results = [[]];
112+
$results = [];
113113

114114
foreach ($array as $key => $value) {
115115
if (is_array($value) && ! empty($value)) {

src/Illuminate/Console/Concerns/ConfiguresPrompts.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminate\Console\Concerns;
44

5+
use Illuminate\Console\PromptValidationException;
56
use Laravel\Prompts\ConfirmPrompt;
67
use Laravel\Prompts\MultiSearchPrompt;
78
use Laravel\Prompts\MultiSelectPrompt;
@@ -132,7 +133,11 @@ protected function promptUntilValid($prompt, $required, $validate)
132133
if ($required && ($result === '' || $result === [] || $result === false)) {
133134
$this->components->error(is_string($required) ? $required : 'Required.');
134135

135-
continue;
136+
if ($this->laravel->runningUnitTests()) {
137+
throw new PromptValidationException;
138+
} else {
139+
continue;
140+
}
136141
}
137142

138143
if ($validate) {
@@ -141,7 +146,11 @@ protected function promptUntilValid($prompt, $required, $validate)
141146
if (is_string($error) && strlen($error) > 0) {
142147
$this->components->error($error);
143148

144-
continue;
149+
if ($this->laravel->runningUnitTests()) {
150+
throw new PromptValidationException;
151+
} else {
152+
continue;
153+
}
145154
}
146155
}
147156

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace Illuminate\Console;
4+
5+
use RuntimeException;
6+
7+
class PromptValidationException extends RuntimeException
8+
{
9+
}

src/Illuminate/Filesystem/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @param string ...$paths
1111
* @return string
1212
*/
13-
function join_paths($basePath, string ...$paths)
13+
function join_paths($basePath, ...$paths)
1414
{
1515
foreach ($paths as $index => $path) {
1616
if (empty($path)) {

src/Illuminate/Foundation/Bootstrap/HandleExceptions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Contracts\Debug\ExceptionHandler;
88
use Illuminate\Contracts\Foundation\Application;
99
use Illuminate\Log\LogManager;
10+
use Illuminate\Support\Env;
1011
use Monolog\Handler\NullHandler;
1112
use Symfony\Component\Console\Output\ConsoleOutput;
1213
use Symfony\Component\ErrorHandler\Error\FatalError;
@@ -118,7 +119,7 @@ protected function shouldIgnoreDeprecationErrors()
118119
{
119120
return ! class_exists(LogManager::class)
120121
|| ! static::$app->hasBeenBootstrapped()
121-
|| static::$app->runningUnitTests();
122+
|| (static::$app->runningUnitTests() && ! Env::get('LOG_DEPRECATIONS_WHILE_TESTING'));
122123
}
123124

124125
/**

src/Illuminate/Mail/MailManager.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Symfony\Component\Mailer\Bridge\Postmark\Transport\PostmarkTransportFactory;
2222
use Symfony\Component\Mailer\Transport\Dsn;
2323
use Symfony\Component\Mailer\Transport\FailoverTransport;
24+
use Symfony\Component\Mailer\Transport\RoundRobinTransport;
2425
use Symfony\Component\Mailer\Transport\SendmailTransport;
2526
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
2627
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransportFactory;
@@ -375,6 +376,34 @@ protected function createFailoverTransport(array $config)
375376
return new FailoverTransport($transports);
376377
}
377378

379+
/**
380+
* Create an instance of the Symfony Roundrobin Transport driver.
381+
*
382+
* @param array $config
383+
* @return \Symfony\Component\Mailer\Transport\RoundRobinTransport
384+
*/
385+
protected function createRoundrobinTransport(array $config)
386+
{
387+
$transports = [];
388+
389+
foreach ($config['mailers'] as $name) {
390+
$config = $this->getConfig($name);
391+
392+
if (is_null($config)) {
393+
throw new InvalidArgumentException("Mailer [{$name}] is not defined.");
394+
}
395+
396+
// Now, we will check if the "driver" key exists and if it does we will set
397+
// the transport configuration parameter in order to offer compatibility
398+
// with any Laravel <= 6.x application style mail configuration files.
399+
$transports[] = $this->app['config']['mail.driver']
400+
? $this->createSymfonyTransport(array_merge($config, ['transport' => $name]))
401+
: $this->createSymfonyTransport($config);
402+
}
403+
404+
return new RoundRobinTransport($transports);
405+
}
406+
378407
/**
379408
* Create an instance of the Log Transport driver.
380409
*

src/Illuminate/Queue/Queue.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected function createObjectPayload($job, $queue)
142142
'uuid' => (string) Str::uuid(),
143143
'displayName' => $this->getDisplayName($job),
144144
'job' => 'Illuminate\Queue\CallQueuedHandler@call',
145-
'maxTries' => $job->tries ?? null,
145+
'maxTries' => $this->getJobTries($job) ?? null,
146146
'maxExceptions' => $job->maxExceptions ?? null,
147147
'failOnTimeout' => $job->failOnTimeout ?? false,
148148
'backoff' => $this->getJobBackoff($job),
@@ -178,6 +178,27 @@ protected function getDisplayName($job)
178178
? $job->displayName() : get_class($job);
179179
}
180180

181+
/**
182+
* Get the maximum number of attempts for an object-based queue handler.
183+
*
184+
* @param mixed $job
185+
* @return mixed
186+
*/
187+
public function getJobTries($job)
188+
{
189+
if (! method_exists($job, 'tries') && ! isset($job->tries)) {
190+
return;
191+
}
192+
193+
if (isset($job->tries)) {
194+
return $job->tries;
195+
}
196+
197+
if (method_exists($job, 'tries') && ! is_null($job->tries())) {
198+
return $job->tries();
199+
}
200+
}
201+
181202
/**
182203
* Get the backoff for an object-based queue handler.
183204
*

src/Illuminate/Support/Facades/Queue.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* @method static \Illuminate\Contracts\Queue\Job|null pop(string|null $queue = null)
3232
* @method static string getConnectionName()
3333
* @method static \Illuminate\Contracts\Queue\Queue setConnectionName(string $name)
34+
* @method static mixed getJobTries(mixed $job)
3435
* @method static mixed getJobBackoff(mixed $job)
3536
* @method static mixed getJobExpiration(mixed $job)
3637
* @method static void createPayloadUsing(callable|null $callback)

src/Illuminate/Support/Testing/Fakes/QueueFake.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public function push($job, $data = '', $queue = null)
359359
}
360360

361361
$this->jobs[is_object($job) ? get_class($job) : $job][] = [
362-
'job' => $this->serializeAndRestore ? $this->serializeAndRestoreJob($job) : $job,
362+
'job' => $this->serializeAndRestore ? $this->serializeAndRestoreJob($job) : $job,
363363
'queue' => $queue,
364364
'data' => $data,
365365
];

src/Illuminate/Testing/PendingCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Testing;
44

55
use Illuminate\Console\OutputStyle;
6+
use Illuminate\Console\PromptValidationException;
67
use Illuminate\Contracts\Console\Kernel;
78
use Illuminate\Contracts\Container\Container;
89
use Illuminate\Contracts\Support\Arrayable;
@@ -300,6 +301,8 @@ public function run()
300301
}
301302

302303
throw $e;
304+
} catch (PromptValidationException) {
305+
$exitCode = Command::FAILURE;
303306
}
304307

305308
if ($this->expectedExitCode !== null) {

0 commit comments

Comments
 (0)