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

[11.x] Fixes function loading conflicts when using @include('vendor/autoload.php') via Laravel Envoy #52974

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Changes from 1 commit
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
Next Next commit
Fix conflicts with ading function_exists in Support functions
s-damian committed Sep 29, 2024
commit 7dd2b7fc55a294d8c06c6dbe9a8484cae07bc6ac
54 changes: 29 additions & 25 deletions src/Illuminate/Support/functions.php
Original file line number Diff line number Diff line change
@@ -6,32 +6,36 @@
use Illuminate\Support\Defer\DeferredCallbackCollection;
use Illuminate\Support\Process\PhpExecutableFinder;

/**
* Defer execution of the given callback.
*
* @param callable|null $callback
* @param string|null $name
* @param bool $always
* @return \Illuminate\Support\Defer\DeferredCallback
*/
function defer(?callable $callback = null, ?string $name = null, bool $always = false)
{
if ($callback === null) {
return app(DeferredCallbackCollection::class);
}
if (! function_exists('defer')) {
/**
* Defer execution of the given callback.
*
* @param callable|null $callback
* @param string|null $name
* @param bool $always
* @return \Illuminate\Support\Defer\DeferredCallback
*/
function defer(?callable $callback = null, ?string $name = null, bool $always = false)
{
if ($callback === null) {
return app(DeferredCallbackCollection::class);
}

return tap(
new DeferredCallback($callback, $name, $always),
fn ($deferred) => app(DeferredCallbackCollection::class)[] = $deferred
);
return tap(
new DeferredCallback($callback, $name, $always),
fn ($deferred) => app(DeferredCallbackCollection::class)[] = $deferred
);
}
}

/**
* Determine the PHP Binary.
*
* @return string
*/
function php_binary()
{
return (new PhpExecutableFinder)->find(false) ?: 'php';
if (! function_exists('defer')) {
/**
* Determine the PHP Binary.
*
* @return string
*/
function php_binary()
{
return (new PhpExecutableFinder)->find(false) ?: 'php';
}
}