PHP 8.4 Compatibility - closes #4979
This commit is contained in:
@@ -170,6 +170,7 @@
|
||||
"Illuminate\\Console\\": "overrides/laravel/framework/src/Illuminate/Console/",
|
||||
"Illuminate\\Log\\": "overrides/laravel/framework/src/Illuminate/Log/",
|
||||
"Illuminate\\Validation\\": "overrides/laravel/framework/src/Illuminate/Validation/",
|
||||
"Illuminate\\Contracts\\Container\\": "overrides/laravel/framework/src/Illuminate/Contracts/Container/",
|
||||
"Symfony\\Component\\Routing\\": "overrides/symfony/routing/",
|
||||
"Symfony\\Component\\VarDumper\\Cloner\\": "overrides/symfony/var-dumper/Cloner/",
|
||||
"Symfony\\Component\\VarDumper\\Dumper\\": "overrides/symfony/var-dumper/Dumper/",
|
||||
@@ -301,6 +302,7 @@
|
||||
"vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Support/Carbon.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Support/Str.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Support/Arr.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Support/MessageBag.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Support/Optional.php",
|
||||
@@ -484,7 +486,8 @@
|
||||
"vendor/psy/psysh/src/Exception/ErrorException.php",
|
||||
"vendor/psy/psysh/src/Exception/BreakException.php",
|
||||
"vendor/psy/psysh/src/VarDumper/Dumper.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Foundation/Application.php"
|
||||
"vendor/laravel/framework/src/Illuminate/Foundation/Application.php",
|
||||
"vendor/laravel/framework/src/Illuminate/Contracts/Container/Container.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
@@ -508,6 +511,12 @@
|
||||
"pre-install-cmd": [
|
||||
"@php -r \"@mkdir('vendor/natxet/cssmin/src', 775);\""
|
||||
],
|
||||
"pre-autoload-dump": [
|
||||
"@php -r \"file_put_contents('vendor/guzzlehttp/promises/src/functions_include.php', str_replace('/functions.php', '/../../../../overrides/guzzlehttp/promises/src/functions.php', file_get_contents('vendor/guzzlehttp/promises/src/functions_include.php')));\"",
|
||||
"@php -r \"file_put_contents('vendor/psy/psysh/src/functions.php', '<?php require_once __DIR__ . \\'/../../../../overrides/psy/psysh/src/functions.php\\';');\"",
|
||||
"@php -r \"file_put_contents('vendor/laravel/framework/src/Illuminate/Support/helpers.php', '<?php require_once __DIR__ . \\'/../../../../../../overrides/laravel/framework/src/Illuminate/Support/helpers.php\\';');\"",
|
||||
"@php -r \"file_put_contents('vendor/spatie/laravel-activitylog/src/helpers.php', '<?php require_once __DIR__ . \\'/../../../../overrides/spatie/laravel-activitylog/src/helpers.php\\';');\""
|
||||
],
|
||||
"post-autoload-dump": [
|
||||
"@php -r \"file_put_contents('vendor/composer/ClassLoader.php', preg_replace('/function includeFile.*/s', base64_decode('DQpmdW5jdGlvbiBpbmNsdWRlRmlsZSgkZmlsZSkNCnsNCiAgICB0cnkgew0KICAgICAgICBpbmNsdWRlICRmaWxlOw0KICAgIH0gY2F0Y2ggKFxFeGNlcHRpb24gJGUpIHsNCiAgICAgICAgJG1zZyA9ICRlLT5nZXRNZXNzYWdlKCk7DQogICAgICAgIGlmIChzdHJzdHIoJG1zZywgJ05vIHN1Y2ggZmlsZSBvciBkaXJlY3RvcnknKSkgew0KICAgICAgICAgICAgaWYgKHN0cnN0cigkbXNnLCAnL3ZlbmRvci9jb21wb3Nlci8uLi8uLi9vdmVycmlkZXMvJykpIHsNCiAgICAgICAgICAgICAgICAkbmV3X2ZpbGUgPSBzdHJfcmVwbGFjZSgnL3ZlbmRvci9jb21wb3Nlci8uLi8uLi9vdmVycmlkZXMvJywgJy92ZW5kb3IvY29tcG9zZXIvLi4vJywgJGZpbGUpOw0KICAgICAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgICAgICAkbmV3X2ZpbGUgPSBzdHJfcmVwbGFjZSgnL3ZlbmRvci9jb21wb3Nlci8uLi8nLCAnL3ZlbmRvci9jb21wb3Nlci8uLi8uLi9vdmVycmlkZXMvJywgJGZpbGUpOw0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgaW5jbHVkZSAkbmV3X2ZpbGU7DQogICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICB0aHJvdyAkZTsNCiAgICAgICAgfQ0KICAgIH0NCn0='), file_get_contents('vendor/composer/ClassLoader.php')));\"",
|
||||
"@php -r \"(error_reporting(0) || !error_reporting(0)) && array_map('unlink', json_decode(file_get_contents('composer.json'), true)['autoload']['exclude-from-classmap']);\"",
|
||||
|
||||
363
overrides/guzzlehttp/promises/src/functions.php
Normal file
363
overrides/guzzlehttp/promises/src/functions.php
Normal file
@@ -0,0 +1,363 @@
|
||||
<?php
|
||||
|
||||
namespace GuzzleHttp\Promise;
|
||||
|
||||
/**
|
||||
* Get the global task queue used for promise resolution.
|
||||
*
|
||||
* This task queue MUST be run in an event loop in order for promises to be
|
||||
* settled asynchronously. It will be automatically run when synchronously
|
||||
* waiting on a promise.
|
||||
*
|
||||
* <code>
|
||||
* while ($eventLoop->isRunning()) {
|
||||
* GuzzleHttp\Promise\queue()->run();
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @param TaskQueueInterface $assign Optionally specify a new queue instance.
|
||||
*
|
||||
* @return TaskQueueInterface
|
||||
*
|
||||
* @deprecated queue will be removed in guzzlehttp/promises:2.0. Use Utils::queue instead.
|
||||
*/
|
||||
function queue(?TaskQueueInterface $assign = null)
|
||||
{
|
||||
return Utils::queue($assign);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a function to run in the task queue when it is next `run()` and returns
|
||||
* a promise that is fulfilled or rejected with the result.
|
||||
*
|
||||
* @param callable $task Task function to run.
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated task will be removed in guzzlehttp/promises:2.0. Use Utils::task instead.
|
||||
*/
|
||||
function task(callable $task)
|
||||
{
|
||||
return Utils::task($task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a promise for a value if the value is not a promise.
|
||||
*
|
||||
* @param mixed $value Promise or value.
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated promise_for will be removed in guzzlehttp/promises:2.0. Use Create::promiseFor instead.
|
||||
*/
|
||||
function promise_for($value)
|
||||
{
|
||||
return Create::promiseFor($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a rejected promise for a reason if the reason is not a promise. If
|
||||
* the provided reason is a promise, then it is returned as-is.
|
||||
*
|
||||
* @param mixed $reason Promise or reason.
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated rejection_for will be removed in guzzlehttp/promises:2.0. Use Create::rejectionFor instead.
|
||||
*/
|
||||
function rejection_for($reason)
|
||||
{
|
||||
return Create::rejectionFor($reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an exception for a rejected promise value.
|
||||
*
|
||||
* @param mixed $reason
|
||||
*
|
||||
* @return \Exception|\Throwable
|
||||
*
|
||||
* @deprecated exception_for will be removed in guzzlehttp/promises:2.0. Use Create::exceptionFor instead.
|
||||
*/
|
||||
function exception_for($reason)
|
||||
{
|
||||
return Create::exceptionFor($reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator for the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return \Iterator
|
||||
*
|
||||
* @deprecated iter_for will be removed in guzzlehttp/promises:2.0. Use Create::iterFor instead.
|
||||
*/
|
||||
function iter_for($value)
|
||||
{
|
||||
return Create::iterFor($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronously waits on a promise to resolve and returns an inspection state
|
||||
* array.
|
||||
*
|
||||
* Returns a state associative array containing a "state" key mapping to a
|
||||
* valid promise state. If the state of the promise is "fulfilled", the array
|
||||
* will contain a "value" key mapping to the fulfilled value of the promise. If
|
||||
* the promise is rejected, the array will contain a "reason" key mapping to
|
||||
* the rejection reason of the promise.
|
||||
*
|
||||
* @param PromiseInterface $promise Promise or value.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspect instead.
|
||||
*/
|
||||
function inspect(PromiseInterface $promise)
|
||||
{
|
||||
return Utils::inspect($promise);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits on all of the provided promises, but does not unwrap rejected promises
|
||||
* as thrown exception.
|
||||
*
|
||||
* Returns an array of inspection state arrays.
|
||||
*
|
||||
* @see inspect for the inspection state array format.
|
||||
*
|
||||
* @param PromiseInterface[] $promises Traversable of promises to wait upon.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspectAll instead.
|
||||
*/
|
||||
function inspect_all($promises)
|
||||
{
|
||||
return Utils::inspectAll($promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits on all of the provided promises and returns the fulfilled values.
|
||||
*
|
||||
* Returns an array that contains the value of each promise (in the same order
|
||||
* the promises were provided). An exception is thrown if any of the promises
|
||||
* are rejected.
|
||||
*
|
||||
* @param iterable<PromiseInterface> $promises Iterable of PromiseInterface objects to wait on.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \Exception on error
|
||||
* @throws \Throwable on error in PHP >=7
|
||||
*
|
||||
* @deprecated unwrap will be removed in guzzlehttp/promises:2.0. Use Utils::unwrap instead.
|
||||
*/
|
||||
function unwrap($promises)
|
||||
{
|
||||
return Utils::unwrap($promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an array of promises, return a promise that is fulfilled when all the
|
||||
* items in the array are fulfilled.
|
||||
*
|
||||
* The promise's fulfillment value is an array with fulfillment values at
|
||||
* respective positions to the original array. If any promise in the array
|
||||
* rejects, the returned promise is rejected with the rejection reason.
|
||||
*
|
||||
* @param mixed $promises Promises or values.
|
||||
* @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution.
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated all will be removed in guzzlehttp/promises:2.0. Use Utils::all instead.
|
||||
*/
|
||||
function all($promises, $recursive = false)
|
||||
{
|
||||
return Utils::all($promises, $recursive);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a competitive race between multiple promises or values (values will
|
||||
* become immediately fulfilled promises).
|
||||
*
|
||||
* When count amount of promises have been fulfilled, the returned promise is
|
||||
* fulfilled with an array that contains the fulfillment values of the winners
|
||||
* in order of resolution.
|
||||
*
|
||||
* This promise is rejected with a {@see AggregateException} if the number of
|
||||
* fulfilled promises is less than the desired $count.
|
||||
*
|
||||
* @param int $count Total number of promises.
|
||||
* @param mixed $promises Promises or values.
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated some will be removed in guzzlehttp/promises:2.0. Use Utils::some instead.
|
||||
*/
|
||||
function some($count, $promises)
|
||||
{
|
||||
return Utils::some($count, $promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like some(), with 1 as count. However, if the promise fulfills, the
|
||||
* fulfillment value is not an array of 1 but the value directly.
|
||||
*
|
||||
* @param mixed $promises Promises or values.
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated any will be removed in guzzlehttp/promises:2.0. Use Utils::any instead.
|
||||
*/
|
||||
function any($promises)
|
||||
{
|
||||
return Utils::any($promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that is fulfilled when all of the provided promises have
|
||||
* been fulfilled or rejected.
|
||||
*
|
||||
* The returned promise is fulfilled with an array of inspection state arrays.
|
||||
*
|
||||
* @see inspect for the inspection state array format.
|
||||
*
|
||||
* @param mixed $promises Promises or values.
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated settle will be removed in guzzlehttp/promises:2.0. Use Utils::settle instead.
|
||||
*/
|
||||
function settle($promises)
|
||||
{
|
||||
return Utils::settle($promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an iterator that yields promises or values, returns a promise that is
|
||||
* fulfilled with a null value when the iterator has been consumed or the
|
||||
* aggregate promise has been fulfilled or rejected.
|
||||
*
|
||||
* $onFulfilled is a function that accepts the fulfilled value, iterator index,
|
||||
* and the aggregate promise. The callback can invoke any necessary side
|
||||
* effects and choose to resolve or reject the aggregate if needed.
|
||||
*
|
||||
* $onRejected is a function that accepts the rejection reason, iterator index,
|
||||
* and the aggregate promise. The callback can invoke any necessary side
|
||||
* effects and choose to resolve or reject the aggregate if needed.
|
||||
*
|
||||
* @param mixed $iterable Iterator or array to iterate over.
|
||||
* @param callable $onFulfilled
|
||||
* @param callable $onRejected
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated each will be removed in guzzlehttp/promises:2.0. Use Each::of instead.
|
||||
*/
|
||||
function each(
|
||||
$iterable,
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
) {
|
||||
return Each::of($iterable, $onFulfilled, $onRejected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like each, but only allows a certain number of outstanding promises at any
|
||||
* given time.
|
||||
*
|
||||
* $concurrency may be an integer or a function that accepts the number of
|
||||
* pending promises and returns a numeric concurrency limit value to allow for
|
||||
* dynamic a concurrency size.
|
||||
*
|
||||
* @param mixed $iterable
|
||||
* @param int|callable $concurrency
|
||||
* @param callable $onFulfilled
|
||||
* @param callable $onRejected
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated each_limit will be removed in guzzlehttp/promises:2.0. Use Each::ofLimit instead.
|
||||
*/
|
||||
function each_limit(
|
||||
$iterable,
|
||||
$concurrency,
|
||||
?callable $onFulfilled = null,
|
||||
?callable $onRejected = null
|
||||
) {
|
||||
return Each::ofLimit($iterable, $concurrency, $onFulfilled, $onRejected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like each_limit, but ensures that no promise in the given $iterable argument
|
||||
* is rejected. If any promise is rejected, then the aggregate promise is
|
||||
* rejected with the encountered rejection.
|
||||
*
|
||||
* @param mixed $iterable
|
||||
* @param int|callable $concurrency
|
||||
* @param callable $onFulfilled
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated each_limit_all will be removed in guzzlehttp/promises:2.0. Use Each::ofLimitAll instead.
|
||||
*/
|
||||
function each_limit_all(
|
||||
$iterable,
|
||||
$concurrency,
|
||||
?callable $onFulfilled = null
|
||||
) {
|
||||
return Each::ofLimitAll($iterable, $concurrency, $onFulfilled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a promise is fulfilled.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated is_fulfilled will be removed in guzzlehttp/promises:2.0. Use Is::fulfilled instead.
|
||||
*/
|
||||
function is_fulfilled(PromiseInterface $promise)
|
||||
{
|
||||
return Is::fulfilled($promise);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a promise is rejected.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated is_rejected will be removed in guzzlehttp/promises:2.0. Use Is::rejected instead.
|
||||
*/
|
||||
function is_rejected(PromiseInterface $promise)
|
||||
{
|
||||
return Is::rejected($promise);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a promise is fulfilled or rejected.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @deprecated is_settled will be removed in guzzlehttp/promises:2.0. Use Is::settled instead.
|
||||
*/
|
||||
function is_settled(PromiseInterface $promise)
|
||||
{
|
||||
return Is::settled($promise);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new coroutine.
|
||||
*
|
||||
* @see Coroutine
|
||||
*
|
||||
* @return PromiseInterface
|
||||
*
|
||||
* @deprecated coroutine will be removed in guzzlehttp/promises:2.0. Use Coroutine::of instead.
|
||||
*/
|
||||
function coroutine(callable $generatorFn)
|
||||
{
|
||||
return Coroutine::of($generatorFn);
|
||||
}
|
||||
@@ -940,7 +940,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function resolving($abstract, Closure $callback = null)
|
||||
public function resolving($abstract, ?Closure $callback = null)
|
||||
{
|
||||
if (is_string($abstract)) {
|
||||
$abstract = $this->getAlias($abstract);
|
||||
@@ -960,7 +960,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function afterResolving($abstract, Closure $callback = null)
|
||||
public function afterResolving($abstract, ?Closure $callback = null)
|
||||
{
|
||||
if (is_string($abstract)) {
|
||||
$abstract = $this->getAlias($abstract);
|
||||
@@ -1168,7 +1168,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @param \Illuminate\Contracts\Container\Container|null $container
|
||||
* @return static
|
||||
*/
|
||||
public static function setInstance(ContainerContract $container = null)
|
||||
public static function setInstance(?ContainerContract $container = null)
|
||||
{
|
||||
return static::$instance = $container;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Contracts\Container;
|
||||
|
||||
use Closure;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
interface Container extends ContainerInterface
|
||||
{
|
||||
/**
|
||||
* Determine if the given abstract type has been bound.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return bool
|
||||
*/
|
||||
public function bound($abstract);
|
||||
|
||||
/**
|
||||
* Alias a type to a different name.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param string $alias
|
||||
* @return void
|
||||
*/
|
||||
public function alias($abstract, $alias);
|
||||
|
||||
/**
|
||||
* Assign a set of tags to a given binding.
|
||||
*
|
||||
* @param array|string $abstracts
|
||||
* @param array|mixed ...$tags
|
||||
* @return void
|
||||
*/
|
||||
public function tag($abstracts, $tags);
|
||||
|
||||
/**
|
||||
* Resolve all of the bindings for a given tag.
|
||||
*
|
||||
* @param string $tag
|
||||
* @return array
|
||||
*/
|
||||
public function tagged($tag);
|
||||
|
||||
/**
|
||||
* Register a binding with the container.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param \Closure|string|null $concrete
|
||||
* @param bool $shared
|
||||
* @return void
|
||||
*/
|
||||
public function bind($abstract, $concrete = null, $shared = false);
|
||||
|
||||
/**
|
||||
* Register a binding if it hasn't already been registered.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param \Closure|string|null $concrete
|
||||
* @param bool $shared
|
||||
* @return void
|
||||
*/
|
||||
public function bindIf($abstract, $concrete = null, $shared = false);
|
||||
|
||||
/**
|
||||
* Register a shared binding in the container.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param \Closure|string|null $concrete
|
||||
* @return void
|
||||
*/
|
||||
public function singleton($abstract, $concrete = null);
|
||||
|
||||
/**
|
||||
* "Extend" an abstract type in the container.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param \Closure $closure
|
||||
* @return void
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function extend($abstract, Closure $closure);
|
||||
|
||||
/**
|
||||
* Register an existing instance as shared in the container.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param mixed $instance
|
||||
* @return mixed
|
||||
*/
|
||||
public function instance($abstract, $instance);
|
||||
|
||||
/**
|
||||
* Define a contextual binding.
|
||||
*
|
||||
* @param string $concrete
|
||||
* @return \Illuminate\Contracts\Container\ContextualBindingBuilder
|
||||
*/
|
||||
public function when($concrete);
|
||||
|
||||
/**
|
||||
* Get a closure to resolve the given type from the container.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return \Closure
|
||||
*/
|
||||
public function factory($abstract);
|
||||
|
||||
/**
|
||||
* Resolve the given type from the container.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function make($abstract, array $parameters = []);
|
||||
|
||||
/**
|
||||
* Call the given Closure / class@method and inject its dependencies.
|
||||
*
|
||||
* @param callable|string $callback
|
||||
* @param array $parameters
|
||||
* @param string|null $defaultMethod
|
||||
* @return mixed
|
||||
*/
|
||||
public function call($callback, array $parameters = [], $defaultMethod = null);
|
||||
|
||||
/**
|
||||
* Determine if the given abstract type has been resolved.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @return bool
|
||||
*/
|
||||
public function resolved($abstract);
|
||||
|
||||
/**
|
||||
* Register a new resolving callback.
|
||||
*
|
||||
* @param \Closure|string $abstract
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function resolving($abstract, ?Closure $callback = null);
|
||||
|
||||
/**
|
||||
* Register a new after resolving callback.
|
||||
*
|
||||
* @param \Closure|string $abstract
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function afterResolving($abstract, ?Closure $callback = null);
|
||||
}
|
||||
610
overrides/laravel/framework/src/Illuminate/Support/Arr.php
Normal file
610
overrides/laravel/framework/src/Illuminate/Support/Arr.php
Normal file
@@ -0,0 +1,610 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use ArrayAccess;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
|
||||
class Arr
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* Determine whether the given value is array accessible.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public static function accessible($value)
|
||||
{
|
||||
return is_array($value) || $value instanceof ArrayAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an element to an array using "dot" notation if it doesn't exist.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function add($array, $key, $value)
|
||||
{
|
||||
if (is_null(static::get($array, $key))) {
|
||||
static::set($array, $key, $value);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapse an array of arrays into a single array.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function collapse($array)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $values) {
|
||||
if ($values instanceof Collection) {
|
||||
$values = $values->all();
|
||||
} elseif (! is_array($values)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$results = array_merge($results, $values);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cross join the given arrays, returning all possible permutations.
|
||||
*
|
||||
* @param array ...$arrays
|
||||
* @return array
|
||||
*/
|
||||
public static function crossJoin(...$arrays)
|
||||
{
|
||||
$results = [[]];
|
||||
|
||||
foreach ($arrays as $index => $array) {
|
||||
$append = [];
|
||||
|
||||
foreach ($results as $product) {
|
||||
foreach ($array as $item) {
|
||||
$product[$index] = $item;
|
||||
|
||||
$append[] = $product;
|
||||
}
|
||||
}
|
||||
|
||||
$results = $append;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide an array into two arrays. One with keys and the other with values.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function divide($array)
|
||||
{
|
||||
return [array_keys($array), array_values($array)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten a multi-dimensional associative array with dots.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $prepend
|
||||
* @return array
|
||||
*/
|
||||
public static function dot($array, $prepend = '')
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_array($value) && ! empty($value)) {
|
||||
$results = array_merge($results, static::dot($value, $prepend.$key.'.'));
|
||||
} else {
|
||||
$results[$prepend.$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the given array except for a specified array of keys.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return array
|
||||
*/
|
||||
public static function except($array, $keys)
|
||||
{
|
||||
static::forget($array, $keys);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given key exists in the provided array.
|
||||
*
|
||||
* @param \ArrayAccess|array $array
|
||||
* @param string|int $key
|
||||
* @return bool
|
||||
*/
|
||||
public static function exists($array, $key)
|
||||
{
|
||||
if ($array instanceof ArrayAccess) {
|
||||
return $array->offsetExists($key);
|
||||
}
|
||||
|
||||
return array_key_exists($key, $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first element in an array passing a given truth test.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable|null $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function first($array, ?callable $callback = null, $default = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
if (empty($array)) {
|
||||
return value($default);
|
||||
}
|
||||
|
||||
foreach ($array as $item) {
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if (call_user_func($callback, $value, $key)) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return value($default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last element in an array passing a given truth test.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable|null $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function last($array, ?callable $callback = null, $default = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
return empty($array) ? value($default) : end($array);
|
||||
}
|
||||
|
||||
return static::first(array_reverse($array, true), $callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten a multi-dimensional array into a single level.
|
||||
*
|
||||
* @param array $array
|
||||
* @param int $depth
|
||||
* @return array
|
||||
*/
|
||||
public static function flatten($array, $depth = INF)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($array as $item) {
|
||||
$item = $item instanceof Collection ? $item->all() : $item;
|
||||
|
||||
if (! is_array($item)) {
|
||||
$result[] = $item;
|
||||
} elseif ($depth === 1) {
|
||||
$result = array_merge($result, array_values($item));
|
||||
} else {
|
||||
$result = array_merge($result, static::flatten($item, $depth - 1));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove one or many array items from a given array using "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return void
|
||||
*/
|
||||
public static function forget(&$array, $keys)
|
||||
{
|
||||
$original = &$array;
|
||||
|
||||
$keys = (array) $keys;
|
||||
|
||||
if (count($keys) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($keys as $key) {
|
||||
// if the exact key exists in the top-level, remove it
|
||||
if (static::exists($array, $key)) {
|
||||
unset($array[$key]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$parts = explode('.', $key);
|
||||
|
||||
// clean up before each pass
|
||||
$array = &$original;
|
||||
|
||||
while (count($parts) > 1) {
|
||||
$part = array_shift($parts);
|
||||
|
||||
if (isset($array[$part]) && is_array($array[$part])) {
|
||||
$array = &$array[$part];
|
||||
} else {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
unset($array[array_shift($parts)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item from an array using "dot" notation.
|
||||
*
|
||||
* @param \ArrayAccess|array $array
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($array, $key, $default = null)
|
||||
{
|
||||
if (! static::accessible($array)) {
|
||||
return value($default);
|
||||
}
|
||||
|
||||
if (is_null($key)) {
|
||||
return $array;
|
||||
}
|
||||
|
||||
if (static::exists($array, $key)) {
|
||||
return $array[$key];
|
||||
}
|
||||
|
||||
if (strpos($key, '.') === false) {
|
||||
return $array[$key] ?? value($default);
|
||||
}
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (static::accessible($array) && static::exists($array, $segment)) {
|
||||
$array = $array[$segment];
|
||||
} else {
|
||||
return value($default);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an item or items exist in an array using "dot" notation.
|
||||
*
|
||||
* @param \ArrayAccess|array $array
|
||||
* @param string|array $keys
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($array, $keys)
|
||||
{
|
||||
if (is_null($keys)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$keys = (array) $keys;
|
||||
|
||||
if (! $array) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($keys === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$subKeyArray = $array;
|
||||
|
||||
if (static::exists($array, $key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
|
||||
$subKeyArray = $subKeyArray[$segment];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an array is associative.
|
||||
*
|
||||
* An array is "associative" if it doesn't have sequential numerical keys beginning with zero.
|
||||
*
|
||||
* @param array $array
|
||||
* @return bool
|
||||
*/
|
||||
public static function isAssoc(array $array)
|
||||
{
|
||||
$keys = array_keys($array);
|
||||
|
||||
return array_keys($keys) !== $keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a subset of the items from the given array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return array
|
||||
*/
|
||||
public static function only($array, $keys)
|
||||
{
|
||||
return array_intersect_key($array, array_flip((array) $keys));
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluck an array of values from an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string|array $value
|
||||
* @param string|array|null $key
|
||||
* @return array
|
||||
*/
|
||||
public static function pluck($array, $value, $key = null)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
list($value, $key) = static::explodePluckParameters($value, $key);
|
||||
|
||||
foreach ($array as $item) {
|
||||
$itemValue = data_get($item, $value);
|
||||
|
||||
// If the key is "null", we will just append the value to the array and keep
|
||||
// looping. Otherwise we will key the array using the value of the key we
|
||||
// received from the developer. Then we'll return the final array form.
|
||||
if (is_null($key)) {
|
||||
$results[] = $itemValue;
|
||||
} else {
|
||||
$itemKey = data_get($item, $key);
|
||||
|
||||
if (is_object($itemKey) && method_exists($itemKey, '__toString')) {
|
||||
$itemKey = (string) $itemKey;
|
||||
}
|
||||
|
||||
$results[$itemKey] = $itemValue;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Explode the "value" and "key" arguments passed to "pluck".
|
||||
*
|
||||
* @param string|array $value
|
||||
* @param string|array|null $key
|
||||
* @return array
|
||||
*/
|
||||
protected static function explodePluckParameters($value, $key)
|
||||
{
|
||||
$value = is_string($value) ? explode('.', $value) : $value;
|
||||
|
||||
$key = is_null($key) || is_array($key) ? $key : explode('.', $key);
|
||||
|
||||
return [$value, $key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item onto the beginning of an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $value
|
||||
* @param mixed $key
|
||||
* @return array
|
||||
*/
|
||||
public static function prepend($array, $value, $key = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
array_unshift($array, $value);
|
||||
} else {
|
||||
$array = [$key => $value] + $array;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from the array, and remove it.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function pull(&$array, $key, $default = null)
|
||||
{
|
||||
$value = static::get($array, $key, $default);
|
||||
|
||||
static::forget($array, $key);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one or a specified number of random values from an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param int|null $number
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function random($array, $number = null)
|
||||
{
|
||||
$requested = is_null($number) ? 1 : $number;
|
||||
|
||||
$count = count($array);
|
||||
|
||||
if ($requested > $count) {
|
||||
throw new InvalidArgumentException(
|
||||
"You requested {$requested} items, but there are only {$count} items available."
|
||||
);
|
||||
}
|
||||
|
||||
if (is_null($number)) {
|
||||
return $array[array_rand($array)];
|
||||
}
|
||||
|
||||
if ((int) $number === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$keys = array_rand($array, $number);
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach ((array) $keys as $key) {
|
||||
$results[] = $array[$key];
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array item to a given value using "dot" notation.
|
||||
*
|
||||
* If no key is given to the method, the entire array will be replaced.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function set(&$array, $key, $value)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $array = $value;
|
||||
}
|
||||
|
||||
$keys = explode('.', $key);
|
||||
|
||||
while (count($keys) > 1) {
|
||||
$key = array_shift($keys);
|
||||
|
||||
// If the key doesn't exist at this depth, we will just create an empty array
|
||||
// to hold the next value, allowing us to create the arrays to hold final
|
||||
// values at the correct depth. Then we'll keep digging into the array.
|
||||
if (! isset($array[$key]) || ! is_array($array[$key])) {
|
||||
$array[$key] = [];
|
||||
}
|
||||
|
||||
$array = &$array[$key];
|
||||
}
|
||||
|
||||
$array[array_shift($keys)] = $value;
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuffle the given array and return the result.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function shuffle($array)
|
||||
{
|
||||
shuffle($array);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the array using the given callback or "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable|string|null $callback
|
||||
* @return array
|
||||
*/
|
||||
public static function sort($array, $callback = null)
|
||||
{
|
||||
return Collection::make($array)->sortBy($callback)->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively sort an array by keys and values.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function sortRecursive($array)
|
||||
{
|
||||
foreach ($array as &$value) {
|
||||
if (is_array($value)) {
|
||||
$value = static::sortRecursive($value);
|
||||
}
|
||||
}
|
||||
|
||||
if (static::isAssoc($array)) {
|
||||
ksort($array);
|
||||
} else {
|
||||
sort($array);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the array using the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
public static function where($array, callable $callback)
|
||||
{
|
||||
return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the given value is not an array, wrap it in one.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function wrap($value)
|
||||
{
|
||||
return ! is_array($value) ? [$value] : $value;
|
||||
}
|
||||
}
|
||||
1176
overrides/laravel/framework/src/Illuminate/Support/helpers.php
Normal file
1176
overrides/laravel/framework/src/Illuminate/Support/helpers.php
Normal file
File diff suppressed because it is too large
Load Diff
358
overrides/psy/psysh/src/functions.php
Normal file
358
overrides/psy/psysh/src/functions.php
Normal file
@@ -0,0 +1,358 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2018 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Psy;
|
||||
|
||||
use Psy\VersionUpdater\GitHubChecker;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use XdgBaseDir\Xdg;
|
||||
|
||||
if (!\function_exists('Psy\sh')) {
|
||||
/**
|
||||
* Command to return the eval-able code to startup PsySH.
|
||||
*
|
||||
* eval(\Psy\sh());
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function sh()
|
||||
{
|
||||
return 'extract(\Psy\debug(get_defined_vars(), isset($this) ? $this : @get_called_class()));';
|
||||
}
|
||||
}
|
||||
|
||||
if (!\function_exists('Psy\debug')) {
|
||||
/**
|
||||
* Invoke a Psy Shell from the current context.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* foreach ($items as $item) {
|
||||
* \Psy\debug(get_defined_vars());
|
||||
* }
|
||||
*
|
||||
* If you would like your shell interaction to affect the state of the
|
||||
* current context, you can extract() the values returned from this call:
|
||||
*
|
||||
* foreach ($items as $item) {
|
||||
* extract(\Psy\debug(get_defined_vars()));
|
||||
* var_dump($item); // will be whatever you set $item to in Psy Shell
|
||||
* }
|
||||
*
|
||||
* Optionally, supply an object as the `$bindTo` parameter. This determines
|
||||
* the value `$this` will have in the shell, and sets up class scope so that
|
||||
* private and protected members are accessible:
|
||||
*
|
||||
* class Foo {
|
||||
* function bar() {
|
||||
* \Psy\debug(get_defined_vars(), $this);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* For the static equivalent, pass a class name as the `$bindTo` parameter.
|
||||
* This makes `self` work in the shell, and sets up static scope so that
|
||||
* private and protected static members are accessible:
|
||||
*
|
||||
* class Foo {
|
||||
* static function bar() {
|
||||
* \Psy\debug(get_defined_vars(), get_called_class());
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @param array $vars Scope variables from the calling context (default: array())
|
||||
* @param object|string $bindTo Bound object ($this) or class (self) value for the shell
|
||||
*
|
||||
* @return array Scope variables from the debugger session
|
||||
*/
|
||||
function debug(array $vars = [], $bindTo = null)
|
||||
{
|
||||
echo PHP_EOL;
|
||||
|
||||
$sh = new Shell();
|
||||
$sh->setScopeVariables($vars);
|
||||
|
||||
// Show a couple of lines of call context for the debug session.
|
||||
//
|
||||
// @todo come up with a better way of doing this which doesn't involve injecting input :-P
|
||||
if ($sh->has('whereami')) {
|
||||
$sh->addInput('whereami -n2', true);
|
||||
}
|
||||
|
||||
if (\is_string($bindTo)) {
|
||||
$sh->setBoundClass($bindTo);
|
||||
} elseif ($bindTo !== null) {
|
||||
$sh->setBoundObject($bindTo);
|
||||
}
|
||||
|
||||
$sh->run();
|
||||
|
||||
return $sh->getScopeVariables(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!\function_exists('Psy\info')) {
|
||||
/**
|
||||
* Get a bunch of debugging info about the current PsySH environment and
|
||||
* configuration.
|
||||
*
|
||||
* If a Configuration param is passed, that configuration is stored and
|
||||
* used for the current shell session, and no debugging info is returned.
|
||||
*
|
||||
* @param Configuration|null $config
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
function info(?Configuration $config = null)
|
||||
{
|
||||
static $lastConfig;
|
||||
if ($config !== null) {
|
||||
$lastConfig = $config;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$xdg = new Xdg();
|
||||
$home = \rtrim(\str_replace('\\', '/', $xdg->getHomeDir()), '/');
|
||||
$homePattern = '#^' . \preg_quote($home, '#') . '/#';
|
||||
|
||||
$prettyPath = function ($path) use ($homePattern) {
|
||||
if (\is_string($path)) {
|
||||
return \preg_replace($homePattern, '~/', $path);
|
||||
} else {
|
||||
return $path;
|
||||
}
|
||||
};
|
||||
|
||||
$config = $lastConfig ?: new Configuration();
|
||||
|
||||
$core = [
|
||||
'PsySH version' => Shell::VERSION,
|
||||
'PHP version' => PHP_VERSION,
|
||||
'OS' => PHP_OS,
|
||||
'default includes' => $config->getDefaultIncludes(),
|
||||
'require semicolons' => $config->requireSemicolons(),
|
||||
'error logging level' => $config->errorLoggingLevel(),
|
||||
'config file' => [
|
||||
'default config file' => $prettyPath($config->getConfigFile()),
|
||||
'local config file' => $prettyPath($config->getLocalConfigFile()),
|
||||
'PSYSH_CONFIG env' => $prettyPath(\getenv('PSYSH_CONFIG')),
|
||||
],
|
||||
// 'config dir' => $config->getConfigDir(),
|
||||
// 'data dir' => $config->getDataDir(),
|
||||
// 'runtime dir' => $config->getRuntimeDir(),
|
||||
];
|
||||
|
||||
// Use an explicit, fresh update check here, rather than relying on whatever is in $config.
|
||||
$checker = new GitHubChecker();
|
||||
$updateAvailable = null;
|
||||
$latest = null;
|
||||
try {
|
||||
$updateAvailable = !$checker->isLatest();
|
||||
$latest = $checker->getLatest();
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
$updates = [
|
||||
'update available' => $updateAvailable,
|
||||
'latest release version' => $latest,
|
||||
'update check interval' => $config->getUpdateCheck(),
|
||||
'update cache file' => $prettyPath($config->getUpdateCheckCacheFile()),
|
||||
];
|
||||
|
||||
if ($config->hasReadline()) {
|
||||
$info = \readline_info();
|
||||
|
||||
$readline = [
|
||||
'readline available' => true,
|
||||
'readline enabled' => $config->useReadline(),
|
||||
'readline service' => \get_class($config->getReadline()),
|
||||
];
|
||||
|
||||
if (isset($info['library_version'])) {
|
||||
$readline['readline library'] = $info['library_version'];
|
||||
}
|
||||
|
||||
if (isset($info['readline_name']) && $info['readline_name'] !== '') {
|
||||
$readline['readline name'] = $info['readline_name'];
|
||||
}
|
||||
} else {
|
||||
$readline = [
|
||||
'readline available' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$pcntl = [
|
||||
'pcntl available' => \function_exists('pcntl_signal'),
|
||||
'posix available' => \function_exists('posix_getpid'),
|
||||
];
|
||||
|
||||
$disabledFuncs = \array_map('trim', \explode(',', \ini_get('disable_functions')));
|
||||
if (\in_array('pcntl_signal', $disabledFuncs) || \in_array('pcntl_fork', $disabledFuncs)) {
|
||||
$pcntl['pcntl disabled'] = true;
|
||||
}
|
||||
|
||||
$history = [
|
||||
'history file' => $prettyPath($config->getHistoryFile()),
|
||||
'history size' => $config->getHistorySize(),
|
||||
'erase duplicates' => $config->getEraseDuplicates(),
|
||||
];
|
||||
|
||||
$docs = [
|
||||
'manual db file' => $prettyPath($config->getManualDbFile()),
|
||||
'sqlite available' => true,
|
||||
];
|
||||
|
||||
try {
|
||||
if ($db = $config->getManualDb()) {
|
||||
if ($q = $db->query('SELECT * FROM meta;')) {
|
||||
$q->setFetchMode(\PDO::FETCH_KEY_PAIR);
|
||||
$meta = $q->fetchAll();
|
||||
|
||||
foreach ($meta as $key => $val) {
|
||||
switch ($key) {
|
||||
case 'built_at':
|
||||
$d = new \DateTime('@' . $val);
|
||||
$val = $d->format(\DateTime::RFC2822);
|
||||
break;
|
||||
}
|
||||
$key = 'db ' . \str_replace('_', ' ', $key);
|
||||
$docs[$key] = $val;
|
||||
}
|
||||
} else {
|
||||
$docs['db schema'] = '0.1.0';
|
||||
}
|
||||
}
|
||||
} catch (Exception\RuntimeException $e) {
|
||||
if ($e->getMessage() === 'SQLite PDO driver not found') {
|
||||
$docs['sqlite available'] = false;
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$autocomplete = [
|
||||
'tab completion enabled' => $config->useTabCompletion(),
|
||||
'custom matchers' => \array_map('get_class', $config->getTabCompletionMatchers()),
|
||||
'bracketed paste' => $config->useBracketedPaste(),
|
||||
];
|
||||
|
||||
// Shenanigans, but totally justified.
|
||||
if ($shell = Sudo::fetchProperty($config, 'shell')) {
|
||||
$core['loop listeners'] = \array_map('get_class', Sudo::fetchProperty($shell, 'loopListeners'));
|
||||
$core['commands'] = \array_map('get_class', $shell->all());
|
||||
|
||||
$autocomplete['custom matchers'] = \array_map('get_class', Sudo::fetchProperty($shell, 'matchers'));
|
||||
}
|
||||
|
||||
// @todo Show Presenter / custom casters.
|
||||
|
||||
return \array_merge($core, \compact('updates', 'pcntl', 'readline', 'history', 'docs', 'autocomplete'));
|
||||
}
|
||||
}
|
||||
|
||||
if (!\function_exists('Psy\bin')) {
|
||||
/**
|
||||
* `psysh` command line executable.
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
function bin()
|
||||
{
|
||||
return function () {
|
||||
$usageException = null;
|
||||
|
||||
$input = new ArgvInput();
|
||||
try {
|
||||
$input->bind(new InputDefinition([
|
||||
new InputOption('help', 'h', InputOption::VALUE_NONE),
|
||||
new InputOption('config', 'c', InputOption::VALUE_REQUIRED),
|
||||
new InputOption('version', 'v', InputOption::VALUE_NONE),
|
||||
new InputOption('cwd', null, InputOption::VALUE_REQUIRED),
|
||||
new InputOption('color', null, InputOption::VALUE_NONE),
|
||||
new InputOption('no-color', null, InputOption::VALUE_NONE),
|
||||
|
||||
new InputArgument('include', InputArgument::IS_ARRAY),
|
||||
]));
|
||||
} catch (\RuntimeException $e) {
|
||||
$usageException = $e;
|
||||
}
|
||||
|
||||
$config = [];
|
||||
|
||||
// Handle --config
|
||||
if ($configFile = $input->getOption('config')) {
|
||||
$config['configFile'] = $configFile;
|
||||
}
|
||||
|
||||
// Handle --color and --no-color
|
||||
if ($input->getOption('color') && $input->getOption('no-color')) {
|
||||
$usageException = new \RuntimeException('Using both "--color" and "--no-color" options is invalid');
|
||||
} elseif ($input->getOption('color')) {
|
||||
$config['colorMode'] = Configuration::COLOR_MODE_FORCED;
|
||||
} elseif ($input->getOption('no-color')) {
|
||||
$config['colorMode'] = Configuration::COLOR_MODE_DISABLED;
|
||||
}
|
||||
|
||||
$shell = new Shell(new Configuration($config));
|
||||
|
||||
// Handle --help
|
||||
if ($usageException !== null || $input->getOption('help')) {
|
||||
if ($usageException !== null) {
|
||||
echo $usageException->getMessage() . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
$version = $shell->getVersion();
|
||||
$name = \basename(\reset($_SERVER['argv']));
|
||||
echo <<<EOL
|
||||
$version
|
||||
|
||||
Usage:
|
||||
$name [--version] [--help] [files...]
|
||||
|
||||
Options:
|
||||
--help -h Display this help message.
|
||||
--config -c Use an alternate PsySH config file location.
|
||||
--cwd Use an alternate working directory.
|
||||
--version -v Display the PsySH version.
|
||||
--color Force colors in output.
|
||||
--no-color Disable colors in output.
|
||||
|
||||
EOL;
|
||||
exit($usageException === null ? 0 : 1);
|
||||
}
|
||||
|
||||
// Handle --version
|
||||
if ($input->getOption('version')) {
|
||||
echo $shell->getVersion() . PHP_EOL;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Pass additional arguments to Shell as 'includes'
|
||||
$shell->setIncludes($input->getArgument('include'));
|
||||
|
||||
try {
|
||||
// And go!
|
||||
$shell->run();
|
||||
} catch (\Exception $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
|
||||
// @todo this triggers the "exited unexpectedly" logic in the
|
||||
// ForkingLoop, so we can't exit(1) after starting the shell...
|
||||
// fix this :)
|
||||
|
||||
// exit(1);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
12
overrides/spatie/laravel-activitylog/src/helpers.php
Normal file
12
overrides/spatie/laravel-activitylog/src/helpers.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Spatie\Activitylog\ActivityLogger;
|
||||
|
||||
if (! function_exists('activity')) {
|
||||
function activity(?string $logName = null): ActivityLogger
|
||||
{
|
||||
$defaultLogName = config('activitylog.default_log_name');
|
||||
|
||||
return app(ActivityLogger::class)->useLog($logName ?? $defaultLogName);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user