Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 16, 2024
2 parents 50205f4 + fc71e91 commit 0d0f55f
Show file tree
Hide file tree
Showing 25 changed files with 194 additions and 85 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Release Notes for 11.x

## [Unreleased](https://github.com/laravel/framework/compare/v11.23.4...11.x)
## [Unreleased](https://github.com/laravel/framework/compare/v11.23.5...11.x)

## [v11.23.5](https://github.com/laravel/framework/compare/v11.23.4...v11.23.5) - 2024-09-13

* allow recursive Model::withoutTimestamps calls by [@m1guelpf](https://github.com/m1guelpf) in https://github.com/laravel/framework/pull/52768
* [11.x] Fixes out of memory issue running `route:cache` with ServeFile by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/framework/pull/52781

## [v11.23.4](https://github.com/laravel/framework/compare/v11.23.2...v11.23.4) - 2024-09-12

Expand Down
2 changes: 2 additions & 0 deletions phpstan.types.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ parameters:
level: max
paths:
- types
ignoreErrors:
- identifier: argument.templateType
12 changes: 8 additions & 4 deletions src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,11 @@ public function getOrPut($key, $value)
/**
* Group an associative array by a field or using a callback.
*
* @param (callable(TValue, TKey): array-key)|array|string $groupBy
* @template TGroupKey of array-key
*
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
* @param bool $preserveKeys
* @return static<array-key, static<array-key, TValue>>
* @return static<TGroupKey, static<($preserveKeys is true ? TKey : int), TValue>>
*/
public function groupBy($groupBy, $preserveKeys = false)
{
Expand Down Expand Up @@ -537,8 +539,10 @@ public function groupBy($groupBy, $preserveKeys = false)
/**
* Key an associative array by a field or using a callback.
*
* @param (callable(TValue, TKey): array-key)|array|string $keyBy
* @return static<array-key, TValue>
* @template TNewKey of array-key
*
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
* @return static<TNewKey, TValue>
*/
public function keyBy($keyBy)
{
Expand Down
12 changes: 8 additions & 4 deletions src/Illuminate/Collections/Enumerable.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,17 +518,21 @@ public function get($key, $default = null);
/**
* Group an associative array by a field or using a callback.
*
* @param (callable(TValue, TKey): array-key)|array|string $groupBy
* @template TGroupKey of array-key
*
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
* @param bool $preserveKeys
* @return static<array-key, static<array-key, TValue>>
* @return static<TGroupKey, static<($preserveKeys is true ? TKey : int), TValue>>
*/
public function groupBy($groupBy, $preserveKeys = false);

/**
* Key an associative array by a field or using a callback.
*
* @param (callable(TValue, TKey): array-key)|array|string $keyBy
* @return static<array-key, TValue>
* @template TNewKey of array-key
*
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
* @return static<TNewKey, TValue>
*/
public function keyBy($keyBy);

Expand Down
12 changes: 8 additions & 4 deletions src/Illuminate/Collections/LazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ public function get($key, $default = null)
/**
* Group an associative array by a field or using a callback.
*
* @param (callable(TValue, TKey): array-key)|array|string $groupBy
* @template TGroupKey of array-key
*
* @param (callable(TValue, TKey): TGroupKey)|array|string $groupBy
* @param bool $preserveKeys
* @return static<array-key, static<array-key, TValue>>
* @return static<TGroupKey, static<($preserveKeys is true ? TKey : int), TValue>>
*/
public function groupBy($groupBy, $preserveKeys = false)
{
Expand All @@ -556,8 +558,10 @@ public function groupBy($groupBy, $preserveKeys = false)
/**
* Key an associative array by a field or using a callback.
*
* @param (callable(TValue, TKey): array-key)|array|string $keyBy
* @return static<array-key, TValue>
* @template TNewKey of array-key
*
* @param (callable(TValue, TKey): TNewKey)|array|string $keyBy
* @return static<TNewKey, TValue>
*/
public function keyBy($keyBy)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Concurrency/ConcurrencyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function setDefaultInstance($name)
public function getInstanceConfig($name)
{
return $this->app['config']->get(
'concurrency.drivers.'.$name, ['driver' => $name],
'concurrency.driver.'.$name, ['driver' => $name],
);
}
}
40 changes: 7 additions & 33 deletions src/Illuminate/Concurrency/ProcessDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace Illuminate\Concurrency;

use Closure;
use Illuminate\Console\Application;
use Illuminate\Contracts\Concurrency\Driver;
use Illuminate\Foundation\Defer\DeferredCallback;
use Illuminate\Process\Factory as ProcessFactory;
use Illuminate\Process\Pool;
use Illuminate\Support\Arr;
use Laravel\SerializableClosure\SerializableClosure;
use Symfony\Component\Process\PhpExecutableFinder;

class ProcessDriver implements Driver
{
Expand All @@ -26,18 +26,13 @@ public function __construct(protected ProcessFactory $processFactory)
*/
public function run(Closure|array $tasks): array
{
$php = $this->phpBinary();
$artisan = $this->artisanBinary();
$command = Application::formatCommandString('invoke-serialized-closure');

$results = $this->processFactory->pool(function (Pool $pool) use ($tasks, $php, $artisan) {
$results = $this->processFactory->pool(function (Pool $pool) use ($tasks, $command) {
foreach (Arr::wrap($tasks) as $task) {
$pool->path(base_path())->env([
'LARAVEL_INVOKABLE_CLOSURE' => serialize(new SerializableClosure($task)),
])->command([
$php,
$artisan,
'invoke-serialized-closure',
]);
])->command($command);
}
})->start()->wait();

Expand All @@ -59,35 +54,14 @@ public function run(Closure|array $tasks): array
*/
public function defer(Closure|array $tasks): DeferredCallback
{
$php = $this->phpBinary();
$artisan = $this->artisanBinary();
$command = Application::formatCommandString('invoke-serialized-closure');

return defer(function () use ($tasks, $php, $artisan) {
return defer(function () use ($tasks, $command) {
foreach (Arr::wrap($tasks) as $task) {
$this->processFactory->path(base_path())->env([
'LARAVEL_INVOKABLE_CLOSURE' => serialize(new SerializableClosure($task)),
])->run([
$php,
$artisan,
'invoke-serialized-closure 2>&1 &',
]);
])->run($command.' 2>&1 &');
}
});
}

/**
* Get the PHP binary.
*/
protected function phpBinary(): string
{
return (new PhpExecutableFinder)->find(false) ?: 'php';
}

/**
* Get the Artisan binary.
*/
protected function artisanBinary(): string
{
return defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan';
}
}
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,11 @@ public function withoutPretending(Closure $callback)

$this->pretending = false;

$result = $callback();

$this->pretending = true;

return $result;
try {
return $callback();
} finally {
$this->pretending = true;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/DetectsLostConnections.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ protected function causedByLostConnection(Throwable $e)
'SSL: Connection timed out',
'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',
'Temporary failure in name resolution',
'SSL: Broken pipe',
'SQLSTATE[08S01]: Communication link failure',
'SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host',
'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: No route to host',
Expand All @@ -71,6 +70,7 @@ protected function causedByLostConnection(Throwable $e)
'SQLSTATE[HY000] [2002] Network is unreachable',
'SQLSTATE[HY000] [2002] The requested address is not valid in its context',
'SQLSTATE[HY000] [2002] A socket operation was attempted to an unreachable network',
'SQLSTATE[HY000] [2002] Operation now in progress',
'SQLSTATE[HY000]: General error: 3989',
'went away',
'No such file or directory',
Expand Down
10 changes: 10 additions & 0 deletions src/Illuminate/Database/Schema/ForeignKeyDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ public function restrictOnUpdate()
return $this->onUpdate('restrict');
}

/**
* Indicate that updates should set the foreign key value to null.
*
* @return $this
*/
public function nullOnUpdate()
{
return $this->onUpdate('set null');
}

/**
* Indicate that updates should have "no action".
*
Expand Down
8 changes: 5 additions & 3 deletions src/Illuminate/Filesystem/FilesystemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,18 @@ protected function serveFiles()
continue;
}

$this->app->booted(function () use ($disk, $config) {
$this->app->booted(function ($app) use ($disk, $config) {
$uri = isset($config['url'])
? rtrim(parse_url($config['url'])['path'], '/')
: '/storage';

Route::get($uri.'/{path}', function (Request $request, string $path) use ($disk, $config) {
$isProduction = $app->isProduction();

Route::get($uri.'/{path}', function (Request $request, string $path) use ($disk, $config, $isProduction) {
return (new ServeFile(
$disk,
$config,
$this->app->isProduction()
$isProduction
))($request, $path);
})->where('path', '.*')->name('storage.'.$disk);
});
Expand Down
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.23.4';
const VERSION = '11.23.5';

/**
* The base path for the Laravel installation.
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function loadConfigurationFiles(Application $app, RepositoryContract $
*/
protected function loadConfigurationFile(RepositoryContract $repository, $name, $path, array $base)
{
$config = require $path;
$config = (fn () => require $path)();

if (isset($base[$name])) {
$config = array_merge($base[$name], $config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use ArrayAccess;
use Closure;
use Countable;
use Illuminate\Support\Collection;

class DeferredCallbackCollection implements ArrayAccess, Countable
{
Expand Down Expand Up @@ -39,7 +38,7 @@ public function invoke(): void
/**
* Invoke the deferred callbacks if the given truth test evaluates to true.
*
* @param \Closure $when
* @param \Closure|null $when
* @return void
*/
public function invokeWhen(?Closure $when = null): void
Expand Down Expand Up @@ -115,7 +114,7 @@ public function offsetGet(mixed $offset): mixed
}

/**
* Set teh callback with the given key.
* Set the callback with the given key.
*
* @param mixed $offset
* @param mixed $value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Http\Middleware;

use Illuminate\Http\Response;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Vite;

Expand All @@ -17,7 +18,7 @@ class AddLinkHeadersForPreloadedAssets
public function handle($request, $next)
{
return tap($next($request), function ($response) {
if (Vite::preloadedAssets() !== []) {
if ($response instanceof Response && Vite::preloadedAssets() !== []) {
$response->header('Link', Collection::make(Vite::preloadedAssets())
->map(fn ($attributes, $url) => "<{$url}>; ".implode('; ', $attributes))
->join(', '));
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -1081,12 +1081,14 @@ public function middleware($middleware = null)
/**
* Specify that the "Authorize" / "can" middleware should be applied to the route with the given options.
*
* @param string $ability
* @param \BackedEnum|string $ability
* @param array|string $models
* @return $this
*/
public function can($ability, $models = [])
{
$ability = $ability instanceof BackedEnum ? $ability->value : $ability;

return empty($models)
? $this->middleware(['can:'.$ability])
: $this->middleware(['can:'.$ability.','.implode(',', Arr::wrap($models))]);
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Support/Facades/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @method static bool hasRenderedOnce(string $id)
* @method static void markAsRenderedOnce(string $id)
* @method static void addLocation(string $location)
* @method static void prependLocation(string $location)
* @method static \Illuminate\View\Factory addNamespace(string $namespace, string|array $hints)
* @method static \Illuminate\View\Factory prependNamespace(string $namespace, string|array $hints)
* @method static \Illuminate\View\Factory replaceNamespace(string $namespace, string|array $hints)
Expand Down
11 changes: 11 additions & 0 deletions src/Illuminate/View/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,17 @@ public function addLocation($location)
$this->finder->addLocation($location);
}

/**
* Prepend a location to the array of view locations.
*
* @param string $location
* @return void
*/
public function prependLocation($location)
{
$this->finder->prependLocation($location);
}

/**
* Add a new namespace to the loader.
*
Expand Down
11 changes: 11 additions & 0 deletions tests/Foundation/Bootstrap/LoadConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,15 @@ public function testDontLoadBaseConfiguration()

$this->assertNull($app['config']['app.name']);
}

public function testLoadsConfigurationInIsolation()
{
$app = new Application(__DIR__.'/../fixtures');
$app->useConfigPath(__DIR__.'/../fixtures/config');

(new LoadConfiguration())->bootstrap($app);

$this->assertNull($app['config']['bar.foo']);
$this->assertSame('bar', $app['config']['custom.foo']);
}
}
7 changes: 7 additions & 0 deletions tests/Foundation/fixtures/config/custom.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

$name = 'bar';

return [
'foo' => $name,
];
Loading

0 comments on commit 0d0f55f

Please sign in to comment.