Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆ Bump Foundation to 11.21.0 #396

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '11.15.0';
const VERSION = '11.21.0';

/**
* The base path for the Laravel installation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected function buildRoutingCallback(array|string|null $web,
}

if (is_string($health)) {
Route::middleware('web')->get($health, function () {
Route::get($health, function () {
Event::dispatch(new DiagnosingHealth);

return View::file(__DIR__.'/../resources/health-up.blade.php');
Expand Down Expand Up @@ -300,6 +300,8 @@ protected function withCommandRouting(array $paths)
$this->app->afterResolving(ConsoleKernel::class, function ($kernel) use ($paths) {
$this->app->booted(fn () => $kernel->addCommandRoutePaths($paths));
});

return $this;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function installReverb()
}

$this->requireComposerPackages($this->option('composer'), [
'laravel/reverb:@beta',
'laravel/reverb:^1.0',
]);

$php = (new PhpExecutableFinder())->find(false) ?: 'php';
Expand Down
28 changes: 19 additions & 9 deletions src/Illuminate/Foundation/Console/ComponentMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function handle()
protected function writeView()
{
$path = $this->viewPath(
str_replace('.', '/', 'components.'.$this->getView()).'.blade.php'
str_replace('.', '/', $this->getView()).'.blade.php'
);

if (! $this->files->isDirectory(dirname($path))) {
Expand Down Expand Up @@ -104,24 +104,33 @@ protected function buildClass($name)

return str_replace(
['DummyView', '{{ view }}'],
'view(\'components.'.$this->getView().'\')',
'view(\''.$this->getView().'\')',
parent::buildClass($name)
);
}

/**
* Get the view name relative to the components directory.
* Get the view name relative to the view path.
*
* @return string view
*/
protected function getView()
{
$name = str_replace('\\', '/', $this->argument('name'));
$segments = explode('/', str_replace('\\', '/', $this->argument('name')));

return collect(explode('/', $name))
->map(function ($part) {
return Str::kebab($part);
})
$name = array_pop($segments);

$path = is_string($this->option('path'))
? explode('/', trim($this->option('path'), '/'))
: [
'components',
...$segments,
];

$path[] = $name;

return collect($path)
->map(fn ($segment) => Str::kebab($segment))
->implode('.');
}

Expand Down Expand Up @@ -167,9 +176,10 @@ protected function getDefaultNamespace($rootNamespace)
protected function getOptions()
{
return [
['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the component already exists'],
['inline', null, InputOption::VALUE_NONE, 'Create a component that renders an inline view'],
['view', null, InputOption::VALUE_NONE, 'Create an anonymous component with only a view'],
['path', null, InputOption::VALUE_REQUIRED, 'The location where the component view should be created'],
['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the component already exists'],
];
}
}
4 changes: 1 addition & 3 deletions src/Illuminate/Foundation/Console/ConfigShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public function handle()
$config = $this->argument('config');

if (! config()->has($config)) {
$this->components->error("Configuration file or key <comment>{$config}</comment> does not exist.");

return Command::FAILURE;
$this->fail("Configuration file or key <comment>{$config}</comment> does not exist.");
}

$this->newLine();
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/DownCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function getDownFilePayload()
'retry' => $this->getRetryTime(),
'refresh' => $this->option('refresh'),
'secret' => $this->getSecret(),
'status' => (int) $this->option('status', 503),
'status' => (int) ($this->option('status') ?? 503),
'template' => $this->option('render') ? $this->prerenderView() : null,
];
}
Expand Down
20 changes: 5 additions & 15 deletions src/Illuminate/Foundation/Console/EnvironmentDecryptCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ public function handle()
$key = $this->option('key') ?: Env::get('LARAVEL_ENV_ENCRYPTION_KEY');

if (! $key) {
$this->components->error('A decryption key is required.');

return Command::FAILURE;
$this->fail('A decryption key is required.');
}

$cipher = $this->option('cipher') ?: 'AES-256-CBC';
Expand All @@ -79,21 +77,15 @@ public function handle()
$outputFile = $this->outputFilePath();

if (Str::endsWith($outputFile, '.encrypted')) {
$this->components->error('Invalid filename.');

return Command::FAILURE;
$this->fail('Invalid filename.');
}

if (! $this->files->exists($encryptedFile)) {
$this->components->error('Encrypted environment file not found.');

return Command::FAILURE;
$this->fail('Encrypted environment file not found.');
}

if ($this->files->exists($outputFile) && ! $this->option('force')) {
$this->components->error('Environment file already exists.');

return Command::FAILURE;
$this->fail('Environment file already exists.');
}

try {
Expand All @@ -104,9 +96,7 @@ public function handle()
$encrypter->decrypt($this->files->get($encryptedFile))
);
} catch (Exception $e) {
$this->components->error($e->getMessage());

return Command::FAILURE;
$this->fail($e->getMessage());
}

$this->components->info('Environment successfully decrypted.');
Expand Down
12 changes: 3 additions & 9 deletions src/Illuminate/Foundation/Console/EnvironmentEncryptCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,11 @@ public function handle()
}

if (! $this->files->exists($environmentFile)) {
$this->components->error('Environment file not found.');

return Command::FAILURE;
$this->fail('Environment file not found.');
}

if ($this->files->exists($encryptedFile) && ! $this->option('force')) {
$this->components->error('Encrypted environment file already exists.');

return Command::FAILURE;
$this->fail('Encrypted environment file already exists.');
}

try {
Expand All @@ -94,9 +90,7 @@ public function handle()
$encrypter->encrypt($this->files->get($environmentFile))
);
} catch (Exception $e) {
$this->components->error($e->getMessage());

return Command::FAILURE;
$this->fail($e->getMessage());
}

if ($this->option('prune')) {
Expand Down
3 changes: 3 additions & 0 deletions src/Illuminate/Foundation/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Foundation\Events\Terminating;
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Illuminate\Support\Env;
Expand Down Expand Up @@ -212,6 +213,8 @@ public function handle($input, $output = null)
*/
public function terminate($input, $status)
{
$this->events->dispatch(new Terminating);

$this->app->terminate();

if ($this->commandStartedAt === null) {
Expand Down
33 changes: 33 additions & 0 deletions src/Illuminate/Foundation/Console/NotificationMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@

use Illuminate\Console\Concerns\CreatesMatchingTest;
use Illuminate\Console\GeneratorCommand;
use Illuminate\Support\Str;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

use function Laravel\Prompts\confirm;
use function Laravel\Prompts\text;

#[AsCommand(name: 'make:notification')]
class NotificationMakeCommand extends GeneratorCommand
Expand Down Expand Up @@ -122,6 +128,33 @@ protected function getDefaultNamespace($rootNamespace)
return $rootNamespace.'\Notifications';
}

/**
* Perform actions after the user was prompted for missing arguments.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
{
if ($this->didReceiveOptions($input)) {
return;
}

$wantsMarkdownView = confirm('Would you like to create a markdown view?');

if ($wantsMarkdownView) {
$defaultMarkdownView = collect(explode('/', str_replace('\\', '/', $this->argument('name'))))
->map(fn ($path) => Str::kebab($path))
->prepend('mail')
->implode('.');

$markdownView = text('What should the markdown view be named?', default: $defaultMarkdownView);

$input->setOption('markdown', $markdownView);
}
}

/**
* Get the console command options.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ protected function publishDirectory($from, $to)
*/
protected function moveManagedFiles($from, $manager)
{
foreach ($manager->listContents('from://', true) as $file) {
foreach ($manager->listContents('from://', true)->sortByPath() as $file) {
$path = Str::after($file['path'], 'from://');

if (
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Console/stubs/job.queued.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace {{ namespace }};

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class {{ class }} implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
use Queueable;

/**
* Create a new job instance.
Expand Down
8 changes: 8 additions & 0 deletions src/Illuminate/Foundation/Events/Terminating.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Illuminate\Foundation\Events;

class Terminating
{
//
}
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Illuminate\Console\View\Components\Error;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Debug\ExceptionHandler as ExceptionHandlerContract;
use Illuminate\Contracts\Debug\ShouldntReport;
use Illuminate\Contracts\Foundation\ExceptionRenderer;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Database\Eloquent\ModelNotFoundException;
Expand Down Expand Up @@ -401,6 +402,10 @@ protected function shouldntReport(Throwable $e)
return true;
}

if ($e instanceof ShouldntReport) {
return true;
}

$dontReport = array_merge($this->dontReport, $this->internalDontReport);

if (! is_null(Arr::first($dontReport, fn ($type) => $e instanceof $type))) {
Expand Down
3 changes: 3 additions & 0 deletions src/Illuminate/Foundation/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Http\Kernel as KernelContract;
use Illuminate\Foundation\Events\Terminating;
use Illuminate\Foundation\Http\Events\RequestHandled;
use Illuminate\Routing\Pipeline;
use Illuminate\Routing\Router;
Expand Down Expand Up @@ -210,6 +211,8 @@ protected function dispatchToRouter()
*/
public function terminate($request, $response)
{
$this->app['events']->dispatch(new Terminating);

$this->terminateMiddleware($request, $response);

$this->app->terminate();
Expand Down
5 changes: 2 additions & 3 deletions src/Illuminate/Foundation/Mix.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Illuminate\Foundation;

use Exception;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Str;

Expand All @@ -15,7 +14,7 @@ class Mix
* @param string $manifestDirectory
* @return \Illuminate\Support\HtmlString|string
*
* @throws \Illuminate\Foundation\MixManifestNotFoundException
* @throws \Illuminate\Foundation\MixManifestNotFoundException|\Illuminate\Foundation\MixFileNotFoundException
*/
public function __invoke($path, $manifestDirectory = '')
{
Expand Down Expand Up @@ -58,7 +57,7 @@ public function __invoke($path, $manifestDirectory = '')
$manifest = $manifests[$manifestPath];

if (! isset($manifest[$path])) {
$exception = new Exception("Unable to locate Mix file: {$path}.");
$exception = new MixFileNotFoundException("Unable to locate Mix file: {$path}.");

if (! app('config')->get('app.debug')) {
report($exception);
Expand Down
10 changes: 10 additions & 0 deletions src/Illuminate/Foundation/MixFileNotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Illuminate\Foundation;

use Exception;

class MixFileNotFoundException extends Exception
{
//
}
Loading
Loading