language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | laravel | framework | b57b61c01ea2a5666a5a2242117fa1d3db89ef63.json | Add handlerStats method for Http Client (#35520)
Co-authored-by: root <root@homedev.rconfig.com> | src/Illuminate/Http/Client/Response.php | @@ -120,6 +120,16 @@ public function effectiveUri()
return $this->transferStats->getEffectiveUri();
}
+ /**
+ * Get the handler stats of the response.
+ *
+ * @return \Psr\Http\Message\UriInterface
+ */
+ public function handlerStats()
+ {
+ return $this->transferStats->getHandlerStats();
+ }
+
/**
* Determine if the request was successful.
* | false |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Auth/Notifications/VerifyEmail.php | @@ -56,7 +56,7 @@ public function toMail($notifiable)
/**
* Get the verify email notification mail message for the given URL.
*
- * @param string $verificationUrl
+ * @param string $url
* @return \Illuminate\Notifications\Messages\MailMessage
*/
protected function buildMailMessage($url) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/Concerns/ManagesTransactions.php | @@ -314,6 +314,7 @@ public function transactionLevel()
/**
* Execute the callback after a transaction commits.
*
+ * @param callable $callback
* @return void
*/
public function afterCommit($callback) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/Console/DumpCommand.php | @@ -32,6 +32,8 @@ class DumpCommand extends Command
/**
* Execute the console command.
*
+ * @param \Illuminate\Database\ConnectionResolverInterface $connections
+ * @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
* @return int
*/
public function handle(ConnectionResolverInterface $connections, Dispatcher $dispatcher) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/Eloquent/Factories/Factory.php | @@ -105,12 +105,12 @@ abstract class Factory
* Create a new factory instance.
*
* @param int|null $count
- * @param \Illuminate\Support\Collection $states
- * @param \Illuminate\Support\Collection $has
- * @param \Illuminate\Support\Collection $for
- * @param \Illuminate\Support\Collection $afterMaking
- * @param \Illuminate\Support\Collection $afterCreating
- * @param string $connection
+ * @param \Illuminate\Support\Collection|null $states
+ * @param \Illuminate\Support\Collection|null $has
+ * @param \Illuminate\Support\Collection|null $for
+ * @param \Illuminate\Support\Collection|null $afterMaking
+ * @param \Illuminate\Support\Collection|null $afterCreating
+ * @param string|null $connection
* @return void
*/
public function __construct($count = null, | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/Eloquent/Relations/MorphTo.php | @@ -326,7 +326,7 @@ public function morphWithCount(array $withCount)
/**
* Specify constraints on the query for a given morph types.
*
- * @param array $with
+ * @param array $callbacks
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function constrain(array $callbacks) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/PDO/SqlServerConnection.php | @@ -114,8 +114,8 @@ public function rollBack()
/**
* Wrap quotes around the given input.
*
- * @param string $input
- * @param string $type
+ * @param string $value
+ * @param int $type
* @return string
*/
public function quote($value, $type = ParameterType::STRING) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/PostgresConnection.php | @@ -77,7 +77,7 @@ protected function getDefaultSchemaGrammar()
/**
* Get the schema state for the connection.
*
- * @param \Illuminate\Filesystem\Filesystem|null $files
+ * @param \Illuminate\Database\Filesystem|null $files
* @param callable|null $processFactory
* @return \Illuminate\Database\Schema\PostgresSchemaState
*/ | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/Query/Grammars/MySqlGrammar.php | @@ -17,10 +17,9 @@ class MySqlGrammar extends Grammar
/**
* Add a "where null" clause to the query.
*
- * @param string|array $columns
- * @param string $boolean
- * @param bool $not
- * @return $this
+ * @param \Illuminate\Database\Query\Builder $query
+ * @param array $where
+ * @return string
*/
protected function whereNull(Builder $query, $where)
{
@@ -36,9 +35,9 @@ protected function whereNull(Builder $query, $where)
/**
* Add a "where not null" clause to the query.
*
- * @param string|array $columns
- * @param string $boolean
- * @return $this
+ * @param \Illuminate\Database\Query\Builder $query
+ * @param array $where
+ * @return string
*/
protected function whereNotNull(Builder $query, $where)
{ | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/Schema/SchemaState.php | @@ -47,8 +47,8 @@ abstract class SchemaState
* Create a new dumper instance.
*
* @param \Illuminate\Database\Connection $connection
- * @param \Illuminate\Filesystem\Filesystem $files
- * @param callable $processFactory
+ * @param \Illuminate\Filesystem\Filesystem|null $files
+ * @param callable|null $processFactory
* @return void
*/
public function __construct(Connection $connection, Filesystem $files = null, callable $processFactory = null) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Database/Schema/SqliteSchemaState.php | @@ -34,6 +34,7 @@ public function dump(Connection $connection, $path)
/**
* Append the migration data to the schema dump.
*
+ * @param string $path
* @return void
*/
protected function appendMigrationData(string $path)
@@ -80,6 +81,7 @@ protected function baseCommand()
/**
* Get the base variables for a dump / load command.
*
+ * @param array $config
* @return array
*/
protected function baseVariables(array $config) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Encryption/MissingAppKeyException.php | @@ -9,6 +9,7 @@ class MissingAppKeyException extends RuntimeException
/**
* Create a new exception instance.
*
+ * @param string $message
* @return void
*/
public function __construct($message = 'No application encryption key has been specified.') | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Foundation/Bus/Dispatchable.php | @@ -21,6 +21,7 @@ public static function dispatch()
* Dispatch the job with the given arguments if the given truth test passes.
*
* @param bool $boolean
+ * @param mixed ...$arguments
* @return \Illuminate\Foundation\Bus\PendingDispatch|\Illuminate\Support\Fluent
*/
public static function dispatchIf($boolean, ...$arguments)
@@ -34,6 +35,7 @@ public static function dispatchIf($boolean, ...$arguments)
* Dispatch the job with the given arguments unless the given truth test passes.
*
* @param bool $boolean
+ * @param mixed ...$arguments
* @return \Illuminate\Foundation\Bus\PendingDispatch|\Illuminate\Support\Fluent
*/
public static function dispatchUnless($boolean, ...$arguments) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Foundation/Events/Dispatchable.php | @@ -18,6 +18,7 @@ public static function dispatch()
* Dispatch the event with the given arguments if the given truth test passes.
*
* @param bool $boolean
+ * @param mixed ...$arguments
* @return void
*/
public static function dispatchIf($boolean, ...$arguments)
@@ -31,6 +32,7 @@ public static function dispatchIf($boolean, ...$arguments)
* Dispatch the event with the given arguments unless the given truth test passes.
*
* @param bool $boolean
+ * @param mixed ...$arguments
* @return void
*/
public static function dispatchUnless($boolean, ...$arguments) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Http/Concerns/InteractsWithInput.php | @@ -482,6 +482,7 @@ public function dd(...$keys)
/**
* Dump the items.
*
+ * @param array $keys
* @return $this
*/
public function dump($keys = []) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Queue/CallQueuedClosure.php | @@ -87,7 +87,7 @@ public function onFailure($callback)
/**
* Handle a job failure.
*
- * @param \Exception $exception
+ * @param \Exception $e
* @return void
*/
public function failed(Exception $e) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Queue/SyncQueue.php | @@ -105,7 +105,7 @@ protected function raiseExceptionOccurredJobEvent(Job $job, Throwable $e)
/**
* Handle an exception that occurred while processing a job.
*
- * @param \Illuminate\Queue\Jobs\Job $queueJob
+ * @param \Illuminate\Contracts\Queue\Job $queueJob
* @param \Throwable $e
* @return void
* | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/Routing/Middleware/ThrottleRequests.php | @@ -235,7 +235,7 @@ protected function addHeaders(Response $response, $maxAttempts, $remainingAttemp
* @param int $maxAttempts
* @param int $remainingAttempts
* @param int|null $retryAfter
- * @param \Symfony\Component\HttpFoundation\Response $response
+ * @param \Symfony\Component\HttpFoundation\Response|null $response
* @return array
*/
protected function getHeaders($maxAttempts, | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/View/Compilers/ComponentTagCompiler.php | @@ -51,7 +51,8 @@ class ComponentTagCompiler
* Create new component tag compiler.
*
* @param array $aliases
- * @param \Illuminate\View\Compilers\BladeCompiler|null
+ * @param array $namespaces
+ * @param \Illuminate\View\Compilers\BladeCompiler|null $blade
* @return void
*/
public function __construct(array $aliases = [], array $namespaces = [], ?BladeCompiler $blade = null) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php | @@ -285,6 +285,7 @@ protected function compileEndSwitch()
/**
* Compile an once block into valid PHP.
*
+ * @param string|null $id
* @return string
*/
protected function compileOnce($id = null) | true |
Other | laravel | framework | 410d0c83d51f55cd428657e71891f918f73b8d7d.json | Fix docblocks params (#35495) | src/Illuminate/View/DynamicComponent.php | @@ -32,6 +32,7 @@ class DynamicComponent extends Component
/**
* Create a new component instance.
*
+ * @param string $component
* @return void
*/
public function __construct(string $component) | true |
Other | laravel | framework | 75cdbedd505441de42427ab5bb2c7e03e5fb0777.json | Remove unnecessary import | src/Illuminate/Validation/ValidationException.php | @@ -5,7 +5,6 @@
use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Validator as ValidatorFacade;
-use Illuminate\Support\Str;
class ValidationException extends Exception
{ | false |
Other | laravel | framework | 4822b4fc6a0c1ff429f29c5b8f9e575225e79008.json | Remove calls to TestCase::at (#35474) | tests/Database/DatabaseConnectionTest.php | @@ -153,9 +153,8 @@ public function testTransactionLevelNotIncrementedOnTransactionException()
public function testBeginTransactionMethodRetriesOnFailure()
{
$pdo = $this->createMock(DatabaseConnectionTestMockPDO::class);
- $pdo->expects($this->at(0))
- ->method('beginTransaction')
- ->will($this->throwException(new ErrorException('server has gone away')));
+ $pdo->method('beginTransaction')
+ ->willReturnOnConsecutiveCalls($this->throwException(new ErrorException('server has gone away')));
$connection = $this->getMockConnection(['reconnect'], $pdo);
$connection->expects($this->once())->method('reconnect');
$connection->beginTransaction(); | true |
Other | laravel | framework | 4822b4fc6a0c1ff429f29c5b8f9e575225e79008.json | Remove calls to TestCase::at (#35474) | tests/Validation/ValidationValidatorTest.php | @@ -1787,14 +1787,14 @@ public function testValidateMax()
$this->assertFalse($v->passes());
$file = $this->getMockBuilder(UploadedFile::class)->setMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
- $file->expects($this->any())->method('isValid')->willReturn(true);
- $file->expects($this->at(1))->method('getSize')->willReturn(3072);
+ $file->method('isValid')->willReturn(true);
+ $file->method('getSize')->willReturn(3072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:10']);
$this->assertTrue($v->passes());
$file = $this->getMockBuilder(UploadedFile::class)->setMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
- $file->expects($this->at(0))->method('isValid')->willReturn(true);
- $file->expects($this->at(1))->method('getSize')->willReturn(4072);
+ $file->method('isValid')->willReturn(true);
+ $file->method('getSize')->willReturn(4072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:2']);
$this->assertFalse($v->passes());
| true |
Other | laravel | framework | 80835ab0d0c2b11b2781de209fc257f08bf5963a.json | Update VERSION constant | src/Illuminate/Foundation/Application.php | @@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
- const VERSION = '8.17.0';
+ const VERSION = '8.17.1';
/**
* The base path for the Laravel installation. | false |
Other | laravel | framework | 307f6fb8d9579427a9521a07e8700355a3e9d948.json | fix sortBy bug | src/Illuminate/Collections/Collection.php | @@ -1128,7 +1128,7 @@ public function sortDesc($options = SORT_REGULAR)
*/
public function sortBy($callback, $options = SORT_REGULAR, $descending = false)
{
- if (is_array($callback)) {
+ if (is_array($callback) && ! is_callable($callback)) {
return $this->sortByMany($callback);
}
| false |
Other | laravel | framework | 3e255bfa410957c4a268a13aeeb6bbdfdbe47286.json | Use PHP_EOL (#35409)
Use PHP_EOL in PendingCommand@applyTableOutputExpectations | src/Illuminate/Testing/PendingCommand.php | @@ -351,7 +351,7 @@ private function applyTableOutputExpectations($mock)
$table->render();
$lines = array_filter(
- explode("\n", $output->fetch())
+ explode(PHP_EOL, $output->fetch())
);
foreach ($lines as $line) { | false |
Other | laravel | framework | 858ff9b2264c204c007b37079300499c9c178380.json | Add dd() and dump() to the request object | src/Illuminate/Http/Concerns/InteractsWithInput.php | @@ -7,6 +7,7 @@
use Illuminate\Support\Str;
use SplFileInfo;
use stdClass;
+use Symfony\Component\VarDumper\VarDumper;
trait InteractsWithInput
{
@@ -462,4 +463,39 @@ protected function retrieveItem($source, $key, $default)
return $this->$source->get($key, $default);
}
+
+ /**
+ * Dump the items and end the script.
+ *
+ * @param array|mixed $keys
+ * @return void
+ */
+ public function dd(...$keys)
+ {
+ $keys = is_array($keys) ? $keys : func_get_args();
+
+ call_user_func_array([$this, 'dump'], $keys);
+
+ exit(1);
+ }
+
+ /**
+ * Dump the items.
+ *
+ * @return $this
+ */
+ public function dump($keys = [])
+ {
+ $keys = is_array($keys) ? $keys : func_get_args();
+
+ if (count($keys) > 0) {
+ $data = $this->only($keys);
+ } else {
+ $data = $this->all();
+ }
+
+ VarDumper::dump($data);
+
+ return $this;
+ }
} | false |
Other | laravel | framework | ae885e664bc0c8921566a334dcd75b1512f12134.json | fix typo in code comment (#35375)
* fix typo
* Update Container.php
Co-authored-by: Taylor Otwell <taylor@laravel.com> | src/Illuminate/Container/Container.php | @@ -681,7 +681,7 @@ protected function resolve($abstract, $parameters = [], $raiseEvents = true)
{
$abstract = $this->getAlias($abstract);
- // First we wil fire any event handlers that handle the "before" resolving of
+ // First we'll fire any event handlers which handle the "before" resolving of
// specific types. This gives some hooks the chance to add various extends
// calls to change the resolution of objects that they're interested in.
if ($raiseEvents) { | false |
Other | laravel | framework | 0bb7fe4758d617b07b84f6fabfcfe2ca2cdb0964.json | set default value on cloud driver' | src/Illuminate/Filesystem/FilesystemManager.php | @@ -326,7 +326,7 @@ public function getDefaultDriver()
*/
public function getDefaultCloudDriver()
{
- return $this->app['config']['filesystems.cloud'];
+ return $this->app['config']['filesystems.cloud'] ?? 's3';
}
/** | false |
Other | laravel | framework | c6e8357e19b10a800df8a67446f23310f4e83d1f.json | fix reflection exceptions | src/Illuminate/Routing/Router.php | @@ -715,10 +715,14 @@ public function gatherRouteMiddleware(Route $route)
return true;
}
+ if (! class_exists($name)) {
+ return false;
+ }
+
$reflection = new ReflectionClass($name);
return collect($excluded)->contains(function ($exclude) use ($reflection) {
- return $reflection->isSubclassOf($exclude);
+ return class_exists($exclude) && $reflection->isSubclassOf($exclude);
});
})->values();
| false |
Other | laravel | framework | b4de11725cc1e4157938864961deeaa889b54d46.json | Add test for implicit binding (#35346) | tests/Routing/ImplicitRouteBindingTest.php | @@ -0,0 +1,35 @@
+<?php
+
+namespace Illuminate\Tests\Routing;
+
+use Illuminate\Container\Container;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Routing\ImplicitRouteBinding;
+use Illuminate\Routing\Route;
+use PHPUnit\Framework\TestCase;
+
+class ImplicitRouteBindingTest extends TestCase
+{
+ public function test_it_can_resolve_the_implicit_route_bindings_for_the_given_route()
+ {
+ $action = ['uses' => function (ImplicitRouteBindingUser $user) {
+ return $user;
+ }];
+
+ $route = new Route('GET', '/test', $action);
+ $route->parameters = ['user' => new ImplicitRouteBindingUser];
+
+ $route->prepareForSerialization();
+
+ $container = Container::getInstance();
+
+ ImplicitRouteBinding::resolveForRoute($container, $route);
+
+ $this->assertTrue(true);
+ }
+}
+
+class ImplicitRouteBindingUser extends Model
+{
+ //
+} | false |
Other | laravel | framework | eb3e262c870739a6e9705b851e0066b3473eed2b.json | fix route model binding on cached closure routes | src/Illuminate/Routing/ImplicitRouteBinding.php | @@ -36,7 +36,6 @@ public static function resolveForRoute($container, $route)
$instance = $container->make(Reflector::getParameterClassName($parameter));
$parent = $route->parentOfParameter($parameterName);
-
if ($parent instanceof UrlRoutable && in_array($parameterName, array_keys($route->bindingFields()))) {
if (! $model = $parent->resolveChildRouteBinding(
$parameterName, $parameterValue, $route->bindingFieldFor($parameterName) | true |
Other | laravel | framework | eb3e262c870739a6e9705b851e0066b3473eed2b.json | fix route model binding on cached closure routes | src/Illuminate/Routing/Route.php | @@ -238,8 +238,7 @@ protected function runCallable()
*/
protected function isSerializedClosure()
{
- return is_string($this->action['uses']) &&
- Str::startsWith($this->action['uses'], 'C:32:"Opis\\Closure\\SerializableClosure') !== false;
+ return RouteAction::containsSerializedClosure($this->action);
}
/** | true |
Other | laravel | framework | eb3e262c870739a6e9705b851e0066b3473eed2b.json | fix route model binding on cached closure routes | src/Illuminate/Routing/RouteAction.php | @@ -94,4 +94,16 @@ protected static function makeInvokable($action)
return $action.'@__invoke';
}
+
+ /**
+ * Determine if the given array actions contains a serialized Closure.
+ *
+ * @param array $action
+ * @return bool
+ */
+ public static function containsSerializedClosure(array $action)
+ {
+ return is_string($action['uses']) &&
+ Str::startsWith($action['uses'], 'C:32:"Opis\\Closure\\SerializableClosure') !== false;
+ }
} | true |
Other | laravel | framework | eb3e262c870739a6e9705b851e0066b3473eed2b.json | fix route model binding on cached closure routes | src/Illuminate/Routing/RouteSignatureParameters.php | @@ -18,9 +18,13 @@ class RouteSignatureParameters
*/
public static function fromAction(array $action, $subClass = null)
{
- $parameters = is_string($action['uses'])
- ? static::fromClassMethodString($action['uses'])
- : (new ReflectionFunction($action['uses']))->getParameters();
+ $callback = RouteAction::containsSerializedClosure($action)
+ ? unserialize($action['uses'])->getClosure()
+ : $action['uses'];
+
+ $parameters = is_string($callback)
+ ? static::fromClassMethodString($callback)
+ : (new ReflectionFunction($callback))->getParameters();
return is_null($subClass) ? $parameters : array_filter($parameters, function ($p) use ($subClass) {
return Reflector::isParameterSubclassOf($p, $subClass); | true |
Other | laravel | framework | 04ef97558030a51dc5247b444ae17d3b608719de.json | Drop Guzzle <7.2 (#35313) | .github/workflows/tests.yml | @@ -50,14 +50,6 @@ jobs:
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- - name: Set Minimum Guzzle Version
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 5
- max_attempts: 5
- command: composer require guzzlehttp/guzzle:^7.2 --no-interaction --no-update
- if: matrix.php >= 8
-
- name: Install dependencies
uses: nick-invision/retry@v1
with:
@@ -102,14 +94,6 @@ jobs:
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- - name: Set Minimum Guzzle Version
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 5
- max_attempts: 5
- command: composer require guzzlehttp/guzzle:^7.2 --no-interaction --no-update
- if: matrix.php >= 8
-
- name: Install dependencies
uses: nick-invision/retry@v1
with: | true |
Other | laravel | framework | 04ef97558030a51dc5247b444ae17d3b608719de.json | Drop Guzzle <7.2 (#35313) | composer.json | @@ -81,7 +81,7 @@
"aws/aws-sdk-php": "^3.155",
"doctrine/dbal": "^2.6|^3.0",
"filp/whoops": "^2.8",
- "guzzlehttp/guzzle": "^6.5.5|^7.0.1",
+ "guzzlehttp/guzzle": "^7.2",
"league/flysystem-cached-adapter": "^1.0",
"mockery/mockery": "^1.4.2",
"orchestra/testbench-core": "^7.0",
@@ -132,7 +132,7 @@
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
"filp/whoops": "Required for friendly error pages in development (^2.8).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
- "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.5.5|^7.0.1).",
+ "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^7.2).",
"laravel/tinker": "Required to use the tinker console command (^2.0).",
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).",
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", | true |
Other | laravel | framework | 04ef97558030a51dc5247b444ae17d3b608719de.json | Drop Guzzle <7.2 (#35313) | src/Illuminate/Console/composer.json | @@ -34,7 +34,7 @@
},
"suggest": {
"dragonmantank/cron-expression": "Required to use scheduler (^3.0.2).",
- "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^6.5.5|^7.0.1).",
+ "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^7.2).",
"illuminate/bus": "Required to use the scheduled job dispatcher (^9.0).",
"illuminate/container": "Required to use the scheduler (^9.0).",
"illuminate/filesystem": "Required to use the generator command (^9.0).", | true |
Other | laravel | framework | 04ef97558030a51dc5247b444ae17d3b608719de.json | Drop Guzzle <7.2 (#35313) | src/Illuminate/Http/composer.json | @@ -31,7 +31,7 @@
},
"suggest": {
"ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().",
- "guzzlehttp/guzzle": "Required to use the HTTP Client (^6.5.5|^7.0.1)."
+ "guzzlehttp/guzzle": "Required to use the HTTP Client (^7.2)."
},
"extra": {
"branch-alias": { | true |
Other | laravel | framework | 04ef97558030a51dc5247b444ae17d3b608719de.json | Drop Guzzle <7.2 (#35313) | src/Illuminate/Mail/composer.json | @@ -38,7 +38,7 @@
},
"suggest": {
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.155).",
- "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.5.5|^7.0.1).",
+ "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^7.2).",
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
},
"config": { | true |
Other | laravel | framework | 7ddfd4f8732b0690d40ca1e75dec6537561c8e60.json | Drop Guzzle <7.2 | .github/workflows/tests.yml | @@ -50,14 +50,6 @@ jobs:
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- - name: Set Minimum Guzzle Version
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 5
- max_attempts: 5
- command: composer require guzzlehttp/guzzle:^7.2 --no-interaction --no-update
- if: matrix.php >= 8
-
- name: Install dependencies
uses: nick-invision/retry@v1
with:
@@ -102,14 +94,6 @@ jobs:
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- - name: Set Minimum Guzzle Version
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 5
- max_attempts: 5
- command: composer require guzzlehttp/guzzle:^7.2 --no-interaction --no-update
- if: matrix.php >= 8
-
- name: Install dependencies
uses: nick-invision/retry@v1
with: | true |
Other | laravel | framework | 7ddfd4f8732b0690d40ca1e75dec6537561c8e60.json | Drop Guzzle <7.2 | composer.json | @@ -81,7 +81,7 @@
"aws/aws-sdk-php": "^3.155",
"doctrine/dbal": "^2.6|^3.0",
"filp/whoops": "^2.8",
- "guzzlehttp/guzzle": "^6.5.5|^7.0.1",
+ "guzzlehttp/guzzle": "^7.2",
"league/flysystem-cached-adapter": "^1.0",
"mockery/mockery": "^1.4.2",
"orchestra/testbench-core": "^7.0",
@@ -132,7 +132,7 @@
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
"filp/whoops": "Required for friendly error pages in development (^2.8).",
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
- "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^6.5.5|^7.0.1).",
+ "guzzlehttp/guzzle": "Required to use the HTTP Client, Mailgun mail driver and the ping methods on schedules (^7.2).",
"laravel/tinker": "Required to use the tinker console command (^2.0).",
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).",
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", | true |
Other | laravel | framework | 7ddfd4f8732b0690d40ca1e75dec6537561c8e60.json | Drop Guzzle <7.2 | src/Illuminate/Console/composer.json | @@ -34,7 +34,7 @@
},
"suggest": {
"dragonmantank/cron-expression": "Required to use scheduler (^3.0.2).",
- "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^6.5.5|^7.0.1).",
+ "guzzlehttp/guzzle": "Required to use the ping methods on schedules (^7.2).",
"illuminate/bus": "Required to use the scheduled job dispatcher (^9.0).",
"illuminate/container": "Required to use the scheduler (^9.0).",
"illuminate/filesystem": "Required to use the generator command (^9.0).", | true |
Other | laravel | framework | 7ddfd4f8732b0690d40ca1e75dec6537561c8e60.json | Drop Guzzle <7.2 | src/Illuminate/Http/composer.json | @@ -31,7 +31,7 @@
},
"suggest": {
"ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().",
- "guzzlehttp/guzzle": "Required to use the HTTP Client (^6.5.5|^7.0.1)."
+ "guzzlehttp/guzzle": "Required to use the HTTP Client (^7.2)."
},
"extra": {
"branch-alias": { | true |
Other | laravel | framework | 7ddfd4f8732b0690d40ca1e75dec6537561c8e60.json | Drop Guzzle <7.2 | src/Illuminate/Mail/composer.json | @@ -38,7 +38,7 @@
},
"suggest": {
"aws/aws-sdk-php": "Required to use the SES mail driver (^3.155).",
- "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.5.5|^7.0.1).",
+ "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^7.2).",
"wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)."
},
"config": { | true |
Other | laravel | framework | 3bf0ee51fa59a71bba16ba91e3bce45c88af6f5a.json | fix typo in docblock | src/Illuminate/Database/Console/DbCommand.php | @@ -20,7 +20,7 @@ class DbCommand extends Command
*
* @var string
*/
- protected $description = 'Open the database CLI';
+ protected $description = 'Drop into the database CLI.';
/**
* Execute the console command.
@@ -147,7 +147,7 @@ protected function getSqliteArgs($connection)
}
/**
- * Get the arguments for the sqlite CLI.
+ * Get the arguments for the SQL Server CLI.
*
* @param array $connection
* @return array | false |
Other | laravel | framework | 318c226907707e6d82941e8449ab9527b789cd90.json | add currentLocale method | src/Illuminate/Foundation/Application.php | @@ -1181,6 +1181,16 @@ public function getLocale()
return $this['config']->get('app.locale');
}
+ /**
+ * Get the current application locale.
+ *
+ * @return string
+ */
+ public function currentLocale()
+ {
+ return $this->getLocale();
+ }
+
/**
* Get the current application fallback locale.
* | true |
Other | laravel | framework | 318c226907707e6d82941e8449ab9527b789cd90.json | add currentLocale method | src/Illuminate/Support/Facades/App.php | @@ -27,6 +27,7 @@
* @method static string getCachedRoutesPath()
* @method static string getCachedServicesPath()
* @method static string getLocale()
+ * @method static string currentLocale()
* @method static string getNamespace()
* @method static string resourcePath(string $path = '')
* @method static string storagePath(string $path = '') | true |
Other | laravel | framework | 169fd2b5156650a067aa77a38681875d2a6c5e57.json | remove optional value | src/Illuminate/Console/Concerns/InteractsWithIO.php | @@ -245,7 +245,7 @@ public function table($headers, $rows, $tableStyle = 'default', array $columnSty
* @param \Closure $callback
* @return mixed|void
*/
- public function withProgressBar($totalSteps = 0, Closure $callback)
+ public function withProgressBar($totalSteps, Closure $callback)
{
$bar = $this->output->createProgressBar(
is_iterable($totalSteps) ? count($totalSteps) : $totalSteps | false |
Other | laravel | framework | 6381aa994756429156b7376e98606458b052b1d7.json | pass entire configuration | src/Illuminate/Broadcasting/BroadcastManager.php | @@ -230,7 +230,7 @@ protected function createPusherDriver(array $config)
*/
protected function createAblyDriver(array $config)
{
- return new AblyBroadcaster(new AblyRest($config['key']));
+ return new AblyBroadcaster(new AblyRest($config));
}
/** | false |
Other | laravel | framework | 5d58b0fddbe81e6e6589b294c48a71ce095183e3.json | add table name as default morph type | src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php | @@ -731,6 +731,10 @@ public function getMorphClass()
return array_search(static::class, $morphMap, true);
}
+ if (Relation::$tableNameAsMorphType) {
+ return $this->getTable();
+ }
+
return static::class;
}
| true |
Other | laravel | framework | 5d58b0fddbe81e6e6589b294c48a71ce095183e3.json | add table name as default morph type | src/Illuminate/Database/Eloquent/Relations/Relation.php | @@ -55,6 +55,13 @@ abstract class Relation
*/
public static $morphMap = [];
+ /**
+ * Indicates if the morph relation type should default to table name.
+ *
+ * @var bool
+ */
+ public static $tableNameAsMorphType = false;
+
/**
* Create a new relation instance.
*
@@ -341,6 +348,16 @@ public static function morphMap(array $map = null, $merge = true)
return static::$morphMap;
}
+ /**
+ * Changes the default morph type to table name.
+ *
+ * @return void
+ */
+ public static function tableNameAsMorphType()
+ {
+ self::$tableNameAsMorphType = true;
+ }
+
/**
* Builds a table-keyed array from model class names.
* | true |
Other | laravel | framework | 5d58b0fddbe81e6e6589b294c48a71ce095183e3.json | add table name as default morph type | tests/Database/DatabaseEloquentModelTest.php | @@ -1200,6 +1200,23 @@ public function testCorrectMorphClassIsReturned()
}
}
+ public function testCorrectMorphClassIsReturnedOnChangingDefault()
+ {
+ Relation::tableNameAsMorphType();
+ Relation::morphMap(['alias' => EloquentModelCamelStub::class]);
+ Relation::morphMap(['alias2' => 'AnotherModel']);
+ $model = new EloquentModelStub;
+ $model2 = new EloquentModelCamelStub;
+
+ try {
+ $this->assertEquals('stub', $model->getMorphClass());
+ $this->assertEquals('alias', $model2->getMorphClass());
+ } finally {
+ Relation::morphMap([], false);
+ Relation::$tableNameAsMorphType = false;
+ }
+ }
+
public function testHasManyCreatesProperRelation()
{
$model = new EloquentModelStub; | true |
Other | laravel | framework | 7f3101bf6e8a0f048a243a55be7fc79eb359b609.json | add alias for call silent | src/Illuminate/Console/Concerns/CallsCommands.php | @@ -29,7 +29,7 @@ public function call($command, array $arguments = [])
}
/**
- * Call another console command silently.
+ * Call another console command without output.
*
* @param \Symfony\Component\Console\Command\Command|string $command
* @param array $arguments
@@ -40,6 +40,18 @@ public function callSilent($command, array $arguments = [])
return $this->runCommand($command, $arguments, new NullOutput);
}
+ /**
+ * Call another console command without output.
+ *
+ * @param \Symfony\Component\Console\Command\Command|string $command
+ * @param array $arguments
+ * @return int
+ */
+ public function callWithoutOutput($command, array $arguments = [])
+ {
+ return $this->callSilent($command, $arguments);
+ }
+
/**
* Run the given the console command.
* | false |
Other | laravel | framework | 4e52a606e91619f6082ed8d46f8d64f9d4dbd0b2.json | add convenient progress bar method | src/Illuminate/Console/Concerns/InteractsWithIO.php | @@ -2,6 +2,7 @@
namespace Illuminate\Console\Concerns;
+use Closure;
use Illuminate\Console\OutputStyle;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Str;
@@ -237,6 +238,38 @@ public function table($headers, $rows, $tableStyle = 'default', array $columnSty
$table->render();
}
+ /**
+ * Execute a given callback while advancing a progress bar.
+ *
+ * @param iterable|int $totalSteps
+ * @param \Closure $callback
+ * @return mixed|void
+ */
+ public function withProgressBar($totalSteps = 0, Closure $callback)
+ {
+ $bar = $this->output->createProgressBar(
+ is_iterable($totalSteps) ? count($totalSteps) : $totalSteps
+ );
+
+ $bar->start();
+
+ if (is_iterable($totalSteps)) {
+ foreach ($totalSteps as $value) {
+ $callback($value, $bar);
+
+ $bar->advance();
+ }
+ } else {
+ $callback($bar);
+ }
+
+ $bar->finish();
+
+ if (is_iterable($totalSteps)) {
+ return $totalSteps;
+ }
+ }
+
/**
* Write a string as information output.
* | false |
Other | laravel | framework | 61b4de9bc4693470d142395fdd475c5a0178aeb1.json | Add beforeResolving method | src/Illuminate/Container/Container.php | @@ -1050,6 +1050,26 @@ protected function unresolvablePrimitive(ReflectionParameter $parameter)
throw new BindingResolutionException($message);
}
+ /**
+ * Register a new before resolving callback for all types.
+ *
+ * @param \Closure|string $abstract
+ * @param \Closure|null $callback
+ * @return void
+ */
+ public function beforeResolving($abstract, Closure $callback = null)
+ {
+ if (is_string($abstract)) {
+ $abstract = $this->getAlias($abstract);
+ }
+
+ if ($abstract instanceof Closure && is_null($callback)) {
+ $this->globalBeforeResolvingCallbacks[] = $abstract;
+ } else {
+ $this->beforeResolvingCallbacks[$abstract][] = $callback;
+ }
+ }
+
/**
* Register a new resolving callback.
*
@@ -1097,19 +1117,32 @@ public function afterResolving($abstract, Closure $callback = null)
* @param array $parameters
* @return void
*/
- protected function fireBeforeResolvingCallbacks($abstract, $parameters)
+ protected function fireBeforeResolvingCallbacks($abstract, $parameters = [])
{
- foreach ($this->globalBeforeResolvingCallbacks as $callback) {
- $callback($abstract, $parameters, $this);
- }
+ $this->fireBeforeCallbackArray($abstract, $parameters, $this->globalBeforeResolvingCallbacks);
- foreach ($this->beforeResolvingCallbacks as $type => $callback) {
+ foreach ($this->beforeResolvingCallbacks as $type => $callbacks) {
if ($type === $abstract || is_subclass_of($abstract, $type)) {
- $callback($abstract, $parameters, $this);
+ $this->fireBeforeCallbackArray($abstract, $parameters, $callbacks);
}
}
}
+ /**
+ * Fire an array of callbacks with an object.
+ *
+ * @param string $abstract
+ * @param array $parameters
+ * @param array $callbacks
+ * @return void
+ */
+ protected function fireBeforeCallbackArray($abstract, $parameters, array $callbacks)
+ {
+ foreach ($callbacks as $callback) {
+ $callback($abstract, $parameters, $this);
+ }
+ }
+
/**
* Fire all of the resolving callbacks.
* | false |
Other | laravel | framework | e2dea14e0573d9b4293d2eef13b03ec038c203ea.json | Remove extra code from event list (#35221) | src/Illuminate/Foundation/Console/EventListCommand.php | @@ -4,7 +4,6 @@
use Closure;
use Illuminate\Console\Command;
-use Illuminate\Foundation\Support\Providers\EventServiceProvider;
use Illuminate\Support\Str;
use ReflectionFunction;
@@ -58,12 +57,6 @@ protected function getEvents()
{
$events = [];
- foreach ($this->laravel->getProviders(EventServiceProvider::class) as $provider) {
- $providerEvents = array_merge_recursive($provider->shouldDiscoverEvents() ? $provider->discoverEvents() : [], $provider->listens());
-
- $events = array_merge_recursive($events, $providerEvents);
- }
-
$events = $this->addListenersOnDispatcher($events);
if ($this->filteringByEvent()) { | false |
Other | laravel | framework | c2d60b5ac186af29219549daf0806b4c9cdc4a21.json | Apply fixes from StyleCI (#35220) | src/Illuminate/Support/Stringable.php | @@ -82,7 +82,7 @@ public function basename($suffix = '')
{
return new static(basename($this->value, $suffix));
}
-
+
/**
* Get the basename of the class path.
* | true |
Other | laravel | framework | c2d60b5ac186af29219549daf0806b4c9cdc4a21.json | Apply fixes from StyleCI (#35220) | tests/Support/SupportStringableTest.php | @@ -16,7 +16,7 @@ protected function stringable($string = '')
{
return new Stringable($string);
}
-
+
public function testClassBasename()
{
$this->assertEquals( | true |
Other | laravel | framework | 851b6719603437acec47f6c2959f70d11a9be9af.json | Reset array keys for restoration (#35218) | src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php | @@ -284,6 +284,8 @@ public function newQueryForRestoration($ids)
*/
protected function newQueryForCollectionRestoration(array $ids)
{
+ $ids = array_values($ids);
+
if (! Str::contains($ids[0], ':')) {
return parent::newQueryForRestoration($ids);
} | true |
Other | laravel | framework | 851b6719603437acec47f6c2959f70d11a9be9af.json | Reset array keys for restoration (#35218) | src/Illuminate/Database/Eloquent/Relations/MorphPivot.php | @@ -139,6 +139,8 @@ public function newQueryForRestoration($ids)
*/
protected function newQueryForCollectionRestoration(array $ids)
{
+ $ids = array_values($ids);
+
if (! Str::contains($ids[0], ':')) {
return parent::newQueryForRestoration($ids);
} | true |
Other | laravel | framework | be56c6fc9741783a708a10b1e7e4189ed342f0a2.json | Apply fixes from StyleCI (#35216) | src/Illuminate/Database/Eloquent/Factories/Factory.php | @@ -3,7 +3,6 @@
namespace Illuminate\Database\Eloquent\Factories;
use Closure;
-use Throwable;
use Faker\Generator;
use Illuminate\Container\Container;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
@@ -12,6 +11,7 @@
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\ForwardsCalls;
+use Throwable;
abstract class Factory
{ | false |
Other | laravel | framework | a5c47f6872c2c7d1623a6fe5ffee1396de63aa4c.json | Add missing methods to Request facade (#35201) | src/Illuminate/Support/Facades/Request.php | @@ -83,6 +83,9 @@
* @method static mixed offsetGet(string $offset)
* @method static void offsetSet(string $offset, mixed $value)
* @method static void offsetUnset(string $offset)
+ * @method static array validate(array $rules, ...$params)
+ * @method static array validateWithBag(string $errorBag, array $rules, ...$params)
+ * @method static bool hasValidSignature(bool $absolute = true)
*
* @see \Illuminate\Http\Request
*/ | false |
Other | laravel | framework | c90fc5f6b8e91e3f6b0f2f3a74cad7d8a49bc71b.json | fix unexpected output. flush expections | src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php | @@ -23,11 +23,11 @@ trait InteractsWithConsole
public $expectedOutput = [];
/**
- * All of the output lines that are expected to never be output.
+ * All of the output lines that aren't expected to be displayed.
*
* @var array
*/
- public $expectedOutputNever = [];
+ public $unexpectedOutput = [];
/**
* All of the expected ouput tables. | true |
Other | laravel | framework | c90fc5f6b8e91e3f6b0f2f3a74cad7d8a49bc71b.json | fix unexpected output. flush expections | src/Illuminate/Testing/PendingCommand.php | @@ -139,9 +139,9 @@ public function expectsOutput($output)
* @param string $output
* @return $this
*/
- public function expectsOutputNever($output)
+ public function doesntExpectOutput($output)
{
- $this->test->expectedOutputNever[$output] = false;
+ $this->test->unexpectedOutput[$output] = false;
return $this;
}
@@ -221,6 +221,7 @@ public function run()
}
$this->verifyExpectations();
+ $this->flushExpectations();
return $exitCode;
}
@@ -252,7 +253,7 @@ protected function verifyExpectations()
$this->test->fail('Output "'.Arr::first($this->test->expectedOutput).'" was not printed.');
}
- if ($output = array_search(true, $this->test->expectedOutputNever)) {
+ if ($output = array_search(true, $this->test->unexpectedOutput)) {
$this->test->fail('Output "'.$output.'" was printed.');
}
}
@@ -316,13 +317,13 @@ private function createABufferedOutputMock()
});
}
- foreach ($this->test->expectedOutputNever as $output => $displayed) {
+ foreach ($this->test->unexpectedOutput as $output => $displayed) {
$mock->shouldReceive('doWrite')
->once()
->ordered()
->with($output, Mockery::any())
->andReturnUsing(function () use ($output) {
- $this->test->expectedOutputNever[$output] = true;
+ $this->test->unexpectedOutput[$output] = true;
});
}
@@ -359,6 +360,20 @@ private function applyTableOutputExpectations($mock)
}
}
+ /**
+ * Flush the expectations from the test case.
+ *
+ * @return void
+ */
+ protected function flushExpectations()
+ {
+ $this->test->expectedOutput = [];
+ $this->test->unexpectedOutput = [];
+ $this->test->expectedTables = [];
+ $this->test->expectedQuestions = [];
+ $this->test->expectedChoices = [];
+ }
+
/**
* Handle the object's destruction.
* | true |
Other | laravel | framework | 50c1a43c71d3d0ec51ab2533111df4e227d0a0d0.json | Add NoLock for null cache store | src/Illuminate/Cache/NoLock.php | @@ -0,0 +1,46 @@
+<?php
+
+namespace Illuminate\Cache;
+
+class NoLock extends Lock
+{
+ /**
+ * Attempt to acquire the lock.
+ *
+ * @return bool
+ */
+ public function acquire()
+ {
+ return true;
+ }
+
+ /**
+ * Release the lock.
+ *
+ * @return bool
+ */
+ public function release()
+ {
+ return true;
+ }
+
+ /**
+ * Releases this lock in disregard of ownership.
+ *
+ * @return void
+ */
+ public function forceRelease()
+ {
+ //
+ }
+
+ /**
+ * Returns the owner value written into the driver for this lock.
+ *
+ * @return mixed
+ */
+ protected function getCurrentOwner()
+ {
+ return $this->owner;
+ }
+} | true |
Other | laravel | framework | 50c1a43c71d3d0ec51ab2533111df4e227d0a0d0.json | Add NoLock for null cache store | src/Illuminate/Cache/NullStore.php | @@ -6,7 +6,7 @@
class NullStore extends TaggableStore implements LockProvider
{
- use RetrievesMultipleKeys, HasCacheLock;
+ use RetrievesMultipleKeys;
/**
* Retrieve an item from the cache by key.
@@ -98,4 +98,29 @@ public function getPrefix()
{
return '';
}
+
+ /**
+ * Get a lock instance.
+ *
+ * @param string $name
+ * @param int $seconds
+ * @param string|null $owner
+ * @return \Illuminate\Contracts\Cache\Lock
+ */
+ public function lock($name, $seconds = 0, $owner = null)
+ {
+ return new NoLock($name, $seconds, $owner);
+ }
+
+ /**
+ * Restore a lock instance using the owner identifier.
+ *
+ * @param string $name
+ * @param string $owner
+ * @return \Illuminate\Contracts\Cache\Lock
+ */
+ public function restoreLock($name, $owner)
+ {
+ return $this->lock($name, 0, $owner);
+ }
} | true |
Other | laravel | framework | 50c1a43c71d3d0ec51ab2533111df4e227d0a0d0.json | Add NoLock for null cache store | tests/Integration/Cache/NoLockTest.php | @@ -0,0 +1,55 @@
+<?php
+
+namespace Illuminate\Tests\Integration\Cache;
+
+use Exception;
+use Illuminate\Support\Carbon;
+use Illuminate\Support\Facades\Cache;
+use Orchestra\Testbench\TestCase;
+
+/**
+ * @group integration
+ */
+class NoLockTest extends TestCase
+{
+ /**
+ * Define environment setup.
+ *
+ * @param \Illuminate\Foundation\Application $app
+ * @return void
+ */
+ protected function getEnvironmentSetUp($app)
+ {
+ $app['config']->set('cache.default', 'null');
+
+ $app['config']->set('cache.stores', [
+ 'null' => [
+ 'driver' => 'null',
+ ],
+ ]);
+ }
+
+ public function testLocksCanAlwaysBeAcquiredAndReleased()
+ {
+ Cache::lock('foo')->forceRelease();
+
+ $lock = Cache::lock('foo', 10);
+ $this->assertTrue($lock->get());
+ $this->assertTrue(Cache::lock('foo', 10)->get());
+ $this->assertTrue($lock->release());
+ $this->assertTrue($lock->release());
+ }
+
+ public function testLocksCanBlockForSeconds()
+ {
+ Carbon::setTestNow();
+
+ Cache::lock('foo')->forceRelease();
+ $this->assertSame('taylor', Cache::lock('foo', 10)->block(1, function () {
+ return 'taylor';
+ }));
+
+ Cache::lock('foo')->forceRelease();
+ $this->assertTrue(Cache::lock('foo', 10)->block(1));
+ }
+} | true |
Other | laravel | framework | d1a52d4809105716c668a20260bed722bf386062.json | Use getter instead of property (#35138) | src/Illuminate/Database/Schema/Blueprint.php | @@ -859,7 +859,7 @@ public function foreignIdFor($model, $column = null)
$model = new $model;
}
- return $model->getKeyType() === 'int' && $model->incrementing
+ return $model->getKeyType() === 'int' && $model->getIncrementing()
? $this->foreignId($column ?: $model->getForeignKey())
: $this->foreignUuid($column ?: $model->getForeignKey());
} | false |
Other | laravel | framework | 3db385623bf1bc56ca49b8a3bf01aff5c44c5abb.json | Fix unrelated test | tests/Integration/View/templates/components/hello-span.blade.php | @@ -1,7 +1,6 @@
@props([
'name',
])
-
<span {{ $attributes }}>
Hello {{ $name }}
</span> | false |
Other | laravel | framework | 3ed442d1ad5112b75d7c60fd8326ff2af7b51eab.json | Add missing return | src/Illuminate/Console/Events/ScheduledTaskFailed.php | @@ -26,6 +26,7 @@ class ScheduledTaskFailed
*
* @param \Illuminate\Console\Scheduling\Event $task
* @param \Throwable $exception
+ * @return void
*/
public function __construct(Event $task, Throwable $exception)
{ | false |
Other | laravel | framework | ed4411d310f259f75e95e882b748ba9d76d7cfad.json | respect them when previewing notification | src/Illuminate/Notifications/Messages/MailMessage.php | @@ -314,6 +314,7 @@ public function render()
return Container::getInstance()
->make(Markdown::class)
+ ->theme($this->theme ?: 'default')
->render($this->markdown, $this->data());
}
| false |
Other | laravel | framework | bc45489f4a666221d11875e5fab77cc03d448b8c.json | Remove interface and check method/property instead | src/Illuminate/Contracts/Queue/UniqueJob.php | @@ -1,8 +0,0 @@
-<?php
-
-namespace Illuminate\Contracts\Queue;
-
-interface UniqueJob
-{
- //
-} | true |
Other | laravel | framework | bc45489f4a666221d11875e5fab77cc03d448b8c.json | Remove interface and check method/property instead | src/Illuminate/Foundation/Bus/PendingDispatch.php | @@ -5,7 +5,6 @@
use Illuminate\Container\Container;
use Illuminate\Contracts\Bus\Dispatcher;
use Illuminate\Contracts\Cache\Repository as Cache;
-use Illuminate\Contracts\Queue\UniqueJob;
class PendingDispatch
{
@@ -131,7 +130,8 @@ public function afterResponse()
*/
protected function shouldDispatch()
{
- if (! ($this->job instanceof UniqueJob)) {
+ if (! method_exists($this->job, 'uniqueId')
+ && ! property_exists($this->job, 'uniqueId')) {
return true;
}
| true |
Other | laravel | framework | bc45489f4a666221d11875e5fab77cc03d448b8c.json | Remove interface and check method/property instead | src/Illuminate/Foundation/Console/stubs/job.queued.stub | @@ -4,7 +4,6 @@ namespace {{ namespace }};
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
-use Illuminate\Contracts\Queue\UniqueJob;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; | true |
Other | laravel | framework | bc45489f4a666221d11875e5fab77cc03d448b8c.json | Remove interface and check method/property instead | src/Illuminate/Queue/CallQueuedHandler.php | @@ -8,7 +8,6 @@
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Queue\Job;
-use Illuminate\Contracts\Queue\UniqueJob;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Pipeline\Pipeline;
use ReflectionClass;
@@ -167,7 +166,8 @@ protected function ensureSuccessfulBatchJobIsRecorded($command)
*/
protected function ensureUniqueJobLockIsReleased($command)
{
- if ($command instanceof UniqueJob) {
+ if (method_exists($command, 'uniqueId')
+ || property_exists($command, 'uniqueId')) {
$uniqueId = method_exists($command, 'uniqueId')
? $command->uniqueId()
: ($command->uniqueId ?? ''); | true |
Other | laravel | framework | bc45489f4a666221d11875e5fab77cc03d448b8c.json | Remove interface and check method/property instead | tests/Integration/Queue/UniqueJobTest.php | @@ -5,7 +5,6 @@
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Contracts\Queue\ShouldQueue;
-use Illuminate\Contracts\Queue\UniqueJob;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
@@ -146,24 +145,28 @@ protected function getLockKey($job)
}
}
-class UniqueTestJob implements ShouldQueue, UniqueJob
+class UniqueTestJob implements ShouldQueue
{
use InteractsWithQueue, Queueable, Dispatchable;
public static $handled = false;
+ public $uniqueId = '';
+
public function handle()
{
static::$handled = true;
}
}
-class UniqueTestFailJob implements ShouldQueue, UniqueJob
+class UniqueTestFailJob implements ShouldQueue
{
use InteractsWithQueue, Queueable, Dispatchable;
public $tries = 1;
+ public $uniqueId = '';
+
public static $handled = false;
public function handle() | true |
Other | laravel | framework | e2067d33a002386280c63e559af932cda113d873.json | Add test for released jobs | tests/Integration/Queue/UniqueJobTest.php | @@ -115,6 +115,31 @@ public function testLockIsNotReleasedForJobRetries()
$this->assertTrue($this->app->get(Cache::class)->lock($this->getLockKey($job), 10)->get());
}
+ public function testLockIsNotReleasedForJobReleases()
+ {
+ UniqueTestReleasedJob::$handled = false;
+ dispatch($job = new UniqueTestReleasedJob);
+
+ $this->assertFalse($this->app->get(Cache::class)->lock($this->getLockKey($job), 10)->get());
+
+ $this->artisan('queue:work', [
+ 'connection' => 'database',
+ '--once' => true,
+ ]);
+
+ $this->assertTrue($job::$handled);
+ $this->assertFalse($this->app->get(Cache::class)->lock($this->getLockKey($job), 10)->get());
+
+ UniqueTestReleasedJob::$handled = false;
+ $this->artisan('queue:work', [
+ 'connection' => 'database',
+ '--once' => true,
+ ]);
+
+ $this->assertFalse($job::$handled);
+ $this->assertTrue($this->app->get(Cache::class)->lock($this->getLockKey($job), 10)->get());
+ }
+
protected function getLockKey($job)
{
return 'unique:'.(is_string($job) ? $job : get_class($job));
@@ -135,10 +160,10 @@ public function handle()
class UniqueTestFailJob implements ShouldQueue, UniqueJob
{
- public $tries = 1;
-
use InteractsWithQueue, Queueable, Dispatchable;
+ public $tries = 1;
+
public static $handled = false;
public function handle()
@@ -149,6 +174,20 @@ public function handle()
}
}
+class UniqueTestReleasedJob extends UniqueTestFailJob
+{
+ public $tries = 1;
+
+ public $connection = 'database';
+
+ public function handle()
+ {
+ static::$handled = true;
+
+ $this->release();
+ }
+}
+
class UniqueTestRetryJob extends UniqueTestFailJob
{
public $tries = 2; | false |
Other | laravel | framework | bc91989fe282460b4626986429d8bbe26761b99e.json | fix tests after merging 35061 and 35063 (#35065) | tests/Database/DatabaseEloquentBuilderTest.php | @@ -822,7 +822,7 @@ public function testWithMin()
$builder = $model->withMin('foo', 'price');
- $this->assertSame('select "eloquent_builder_test_model_parent_stubs".*, (select min("eloquent_builder_test_model_close_related_stubs"."price") from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" limit 1) as "foo_min_price" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql());
+ $this->assertSame('select "eloquent_builder_test_model_parent_stubs".*, (select min("eloquent_builder_test_model_close_related_stubs"."price") from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id") as "foo_min_price" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql());
}
public function testWithMinOnBelongsToMany()
@@ -831,7 +831,7 @@ public function testWithMinOnBelongsToMany()
$builder = $model->withMin('roles', 'id');
- $this->assertSame('select "eloquent_builder_test_model_parent_stubs".*, (select min("eloquent_builder_test_model_far_related_stubs"."id") from "eloquent_builder_test_model_far_related_stubs" inner join "user_role" on "eloquent_builder_test_model_far_related_stubs"."id" = "user_role"."related_id" where "eloquent_builder_test_model_parent_stubs"."id" = "user_role"."self_id" limit 1) as "roles_min_id" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql());
+ $this->assertSame('select "eloquent_builder_test_model_parent_stubs".*, (select min("eloquent_builder_test_model_far_related_stubs"."id") from "eloquent_builder_test_model_far_related_stubs" inner join "user_role" on "eloquent_builder_test_model_far_related_stubs"."id" = "user_role"."related_id" where "eloquent_builder_test_model_parent_stubs"."id" = "user_role"."self_id") as "roles_min_id" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql());
}
public function testWithCountAndConstraintsAndHaving() | false |
Other | laravel | framework | b0dc0b2432d426349009a70775fa469d16ea1a14.json | fix qualified column in withAggregate | src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php | @@ -381,9 +381,17 @@ public function withAggregate($relations, $column, $function = null)
$relation = $this->getRelationWithoutConstraints($name);
- $expression = $function
- ? sprintf('%s(%s)', $function, $this->getQuery()->getGrammar()->wrap($column))
- : $column;
+ if ($function) {
+ $expression = sprintf(
+ '%s(%s)',
+ $function,
+ $this->getQuery()->getGrammar()->wrap(
+ $column === '*' ? $column : $relation->getRelated()->qualifyColumn($column)
+ )
+ );
+ } else {
+ $expression = $column;
+ }
// Here, we will grab the relationship sub-query and prepare to add it to the main query
// as a sub-select. First, we'll get the "has" query and use that to get the relation | true |
Other | laravel | framework | b0dc0b2432d426349009a70775fa469d16ea1a14.json | fix qualified column in withAggregate | tests/Database/DatabaseEloquentBuilderTest.php | @@ -816,6 +816,24 @@ public function testWithCountAndGlobalScope()
$this->assertSame('select "id", (select count(*) from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" limit 1) as "foo_count" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql());
}
+ public function testWithMin()
+ {
+ $model = new EloquentBuilderTestModelParentStub;
+
+ $builder = $model->withMin('foo', 'price');
+
+ $this->assertSame('select "eloquent_builder_test_model_parent_stubs".*, (select min("eloquent_builder_test_model_close_related_stubs"."price") from "eloquent_builder_test_model_close_related_stubs" where "eloquent_builder_test_model_parent_stubs"."foo_id" = "eloquent_builder_test_model_close_related_stubs"."id" limit 1) as "foo_min_price" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql());
+ }
+
+ public function testWithMinOnBelongsToMany()
+ {
+ $model = new EloquentBuilderTestModelParentStub;
+
+ $builder = $model->withMin('roles', 'id');
+
+ $this->assertSame('select "eloquent_builder_test_model_parent_stubs".*, (select min("eloquent_builder_test_model_far_related_stubs"."id") from "eloquent_builder_test_model_far_related_stubs" inner join "user_role" on "eloquent_builder_test_model_far_related_stubs"."id" = "user_role"."related_id" where "eloquent_builder_test_model_parent_stubs"."id" = "user_role"."self_id" limit 1) as "roles_min_id" from "eloquent_builder_test_model_parent_stubs"', $builder->toSql());
+ }
+
public function testWithCountAndConstraintsAndHaving()
{
$model = new EloquentBuilderTestModelParentStub;
@@ -1482,6 +1500,16 @@ public function activeFoo()
{
return $this->belongsTo(EloquentBuilderTestModelCloseRelatedStub::class, 'foo_id')->where('active', true);
}
+
+ public function roles()
+ {
+ return $this->belongsToMany(
+ EloquentBuilderTestModelFarRelatedStub::class,
+ 'user_role',
+ 'self_id',
+ 'related_id'
+ );
+ }
}
class EloquentBuilderTestModelCloseRelatedStub extends Model | true |
Other | laravel | framework | cab42a6f873253f2b0b41b67250b79f87d8f930f.json | Replace a `preg_split` call with `explode`
Replaces a `preg_split()` call with `explode()` because the the delimiter is a simple new-line character.
`explode()` is faster for this case and provides identical results.
From [php.net preg_split](https://www.php.net/manual/function.preg-split.php):
> If you don't need the power of regular expressions, you can choose faster (albeit simpler) alternatives like explode() or str_split(). | src/Illuminate/Testing/PendingCommand.php | @@ -323,7 +323,7 @@ private function applyTableOutputExpectations($mock)
$table->render();
$lines = array_filter(
- preg_split("/\n/", $output->fetch())
+ explode("\n", $output->fetch())
);
foreach ($lines as $line) { | false |
Other | laravel | framework | 7eb03cdb06259269db02404080d946f52a433825.json | add env variable | src/Illuminate/Foundation/Console/ServeCommand.php | @@ -99,7 +99,7 @@ protected function startProcess()
return [$key => $value];
}
- return $key === 'APP_ENV'
+ return in_array($key, ['APP_ENV', 'LARAVEL_SAIL'])
? [$key => $value]
: [$key => false];
})->all()); | false |
Other | laravel | framework | 609104806b8b639710268c75c22f43034c2b72db.json | fix alias usage | src/Illuminate/Database/Eloquent/Builder.php | @@ -510,7 +510,7 @@ public function firstOr($columns = ['*'], Closure $callback = null)
public function value($column)
{
if ($result = $this->first([$column])) {
- return $result->{$column};
+ return $result->{Str::afterLast($column, '.')};
}
}
| false |
Other | laravel | framework | 0db867ad26e0b20962c30d98504e08c9929f2d96.json | remove empty array | src/Illuminate/Redis/Connectors/PhpRedisConnector.php | @@ -157,7 +157,7 @@ protected function createRedisClusterInstance(array $servers, array $options)
}
if (version_compare(phpversion('redis'), '5.3.2', '>=')) {
- $parameters[] = Arr::get($options, 'context', []);
+ $parameters[] = Arr::get($options, 'context');
}
return tap(new RedisCluster(...$parameters), function ($client) use ($options) { | false |
Other | laravel | framework | 1c7cfe2b0b29b427d442e20b767e7b67fe5af2bb.json | fix postgres dump (#35018) | src/Illuminate/Database/Console/DumpCommand.php | @@ -35,9 +35,11 @@ class DumpCommand extends Command
*/
public function handle(ConnectionResolverInterface $connections, Dispatcher $dispatcher)
{
- $this->schemaState(
- $connection = $connections->connection($database = $this->input->getOption('database'))
- )->dump($path = $this->path($connection));
+ $connection = $connections->connection($database = $this->input->getOption('database'));
+
+ $this->schemaState($connection)->dump(
+ $connection, $path = $this->path($connection)
+ );
$dispatcher->dispatch(new SchemaDumped($connection, $path));
| true |
Other | laravel | framework | 1c7cfe2b0b29b427d442e20b767e7b67fe5af2bb.json | fix postgres dump (#35018) | src/Illuminate/Database/Schema/MySqlSchemaState.php | @@ -3,6 +3,7 @@
namespace Illuminate\Database\Schema;
use Exception;
+use Illuminate\Database\Connection;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;
@@ -11,10 +12,11 @@ class MySqlSchemaState extends SchemaState
/**
* Dump the database's schema into a file.
*
+ * @param \Illuminate\Database\Connection $connection
* @param string $path
* @return void
*/
- public function dump($path)
+ public function dump(Connection $connection, $path)
{
$this->executeDumpProcess($this->makeProcess(
$this->baseDumpCommand().' --routines --result-file="${:LARAVEL_LOAD_PATH}" --no-data' | true |
Other | laravel | framework | 1c7cfe2b0b29b427d442e20b767e7b67fe5af2bb.json | fix postgres dump (#35018) | src/Illuminate/Database/Schema/PostgresSchemaState.php | @@ -2,47 +2,33 @@
namespace Illuminate\Database\Schema;
+use Illuminate\Database\Connection;
use Illuminate\Support\Str;
class PostgresSchemaState extends SchemaState
{
/**
* Dump the database's schema into a file.
*
+ * @param \Illuminate\Database\Connection $connection
* @param string $path
* @return void
*/
- public function dump($path)
+ public function dump(Connection $connection, $path)
{
+ $excludedTables = collect($connection->getSchemaBuilder()->getAllTables())
+ ->map->tablename
+ ->reject(function ($table) {
+ return $table === 'migrations';
+ })->map(function ($table) {
+ return '--exclude-table-data='.$table;
+ })->implode(' ');
+
$this->makeProcess(
- $this->baseDumpCommand().' --no-owner --file=$LARAVEL_LOAD_PATH --schema-only'
+ $this->baseDumpCommand().' --no-owner --file=$LARAVEL_LOAD_PATH '.$excludedTables
)->mustRun($this->output, array_merge($this->baseVariables($this->connection->getConfig()), [
'LARAVEL_LOAD_PATH' => $path,
]));
-
- $this->appendMigrationData($path);
- }
-
- /**
- * Append the migration data to the schema dump.
- *
- * @param string $path
- * @return void
- */
- protected function appendMigrationData(string $path)
- {
- with($process = $this->makeProcess(
- $this->baseDumpCommand().' --table=migrations --data-only --inserts'
- ))->setTimeout(null)->mustRun(null, array_merge($this->baseVariables($this->connection->getConfig()), [
- //
- ]));
-
- $migrations = collect(preg_split("/\r\n|\n|\r/", $process->getOutput()))->filter(function ($line) {
- return preg_match('/^\s*(--|SELECT\s|SET\s)/iu', $line) === 0 &&
- strlen($line) > 0;
- })->all();
-
- $this->files->append($path, implode(PHP_EOL, $migrations).PHP_EOL);
}
/** | true |
Other | laravel | framework | 1c7cfe2b0b29b427d442e20b767e7b67fe5af2bb.json | fix postgres dump (#35018) | src/Illuminate/Database/Schema/SchemaState.php | @@ -62,10 +62,11 @@ public function __construct(Connection $connection, Filesystem $files = null, ca
/**
* Dump the database's schema into a file.
*
+ * @param \Illuminate\Database\Connection $connection
* @param string $path
* @return void
*/
- abstract public function dump($path);
+ abstract public function dump(Connection $connection, $path);
/**
* Load the given schema file into the database. | true |
Other | laravel | framework | 1c7cfe2b0b29b427d442e20b767e7b67fe5af2bb.json | fix postgres dump (#35018) | src/Illuminate/Database/Schema/SqliteSchemaState.php | @@ -2,16 +2,18 @@
namespace Illuminate\Database\Schema;
+use Illuminate\Database\Connection;
+
class SqliteSchemaState extends SchemaState
{
/**
* Dump the database's schema into a file.
*
- * @param string $path
- *
+ * @param \Illuminate\Database\Connection
+ * @param string $path
* @return void
*/
- public function dump($path)
+ public function dump(Connection $connection, $path)
{
with($process = $this->makeProcess(
$this->baseCommand().' .schema'
@@ -53,8 +55,7 @@ protected function appendMigrationData(string $path)
/**
* Load the given schema file into the database.
*
- * @param string $path
- *
+ * @param string $path
* @return void
*/
public function load($path) | true |
Other | laravel | framework | e86f58a62ef54d5e28f7f53abe928bc94116d17c.json | change method order | src/Illuminate/Routing/CreatesRegularExpressionRouteConstraints.php | @@ -7,25 +7,25 @@
trait CreatesRegularExpressionRouteConstraints
{
/**
- * Specify that the given route parameters must be numeric.
+ * Specify that the given route parameters must be alphabetic.
*
* @param array|string $parameters
* @return $this
*/
- public function whereNumber($parameters)
+ public function whereAlpha($parameters)
{
- return $this->assignExpressionToParameters($parameters, '[0-9]+');
+ return $this->assignExpressionToParameters($parameters, '[a-zA-Z]+');
}
/**
- * Specify that the given route parameters must be alphabetic.
+ * Specify that the given route parameters must be numeric.
*
* @param array|string $parameters
* @return $this
*/
- public function whereAlpha($parameters)
+ public function whereNumber($parameters)
{
- return $this->assignExpressionToParameters($parameters, '[a-zA-Z]+');
+ return $this->assignExpressionToParameters($parameters, '[0-9]+');
}
/** | false |
Other | laravel | framework | 366495bf6b54cc9fe359ee093f25b7797956ddd8.json | remove breaking change | src/Illuminate/Foundation/Console/OptimizeCommand.php | @@ -29,7 +29,6 @@ public function handle()
{
$this->call('config:cache');
$this->call('route:cache');
- $this->call('view:cache');
$this->info('Files cached successfully!');
} | false |
Other | laravel | framework | 9717c195fa4ab1edb489041b82563c28d7edb52a.json | Apply fixes from StyleCI (#35002) | src/Illuminate/Console/Scheduling/Event.php | @@ -12,8 +12,8 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Date;
-use Illuminate\Support\Stringable;
use Illuminate\Support\Reflector;
+use Illuminate\Support\Stringable;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Support\Traits\ReflectsClosures;
use Psr\Http\Client\ClientExceptionInterface; | true |
Other | laravel | framework | 9717c195fa4ab1edb489041b82563c28d7edb52a.json | Apply fixes from StyleCI (#35002) | src/Illuminate/Foundation/Exceptions/Handler.php | @@ -20,8 +20,8 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
-use Illuminate\Support\Traits\ReflectsClosures;
use Illuminate\Support\Reflector;
+use Illuminate\Support\Traits\ReflectsClosures;
use Illuminate\Support\ViewErrorBag;
use Illuminate\Validation\ValidationException;
use InvalidArgumentException; | true |
Other | laravel | framework | 47bc923605d0230a29ce2be878548a830347a9cd.json | Apply fixes from StyleCI (#35001) | src/Illuminate/Console/Scheduling/Event.php | @@ -12,8 +12,8 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Date;
-use Illuminate\Support\Stringable;
use Illuminate\Support\Reflector;
+use Illuminate\Support\Stringable;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Support\Traits\ReflectsClosures;
use Psr\Http\Client\ClientExceptionInterface; | true |
Other | laravel | framework | 47bc923605d0230a29ce2be878548a830347a9cd.json | Apply fixes from StyleCI (#35001) | src/Illuminate/Foundation/Exceptions/Handler.php | @@ -20,8 +20,8 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
-use Illuminate\Support\Traits\ReflectsClosures;
use Illuminate\Support\Reflector;
+use Illuminate\Support\Traits\ReflectsClosures;
use Illuminate\Support\ViewErrorBag;
use Illuminate\Validation\ValidationException;
use InvalidArgumentException; | true |
Other | laravel | framework | 1627d05c1624f81b8edf3fc116cd8443e7899f05.json | Apply fixes from StyleCI (#34996) | tests/Support/SupportReflectorTest.php | @@ -60,7 +60,8 @@ public function testUnionTypeName()
public function testIsCallable()
{
- $this->assertTrue(Reflector::isCallable(function () {}));
+ $this->assertTrue(Reflector::isCallable(function () {
+ }));
$this->assertTrue(Reflector::isCallable([B::class, 'f']));
$this->assertFalse(Reflector::isCallable([TestClassWithCall::class, 'f']));
$this->assertTrue(Reflector::isCallable([new TestClassWithCall, 'f']));
@@ -97,14 +98,12 @@ class TestClassWithCall
{
public function __call($method, $parameters)
{
-
}
}
class TestClassWithCallStatic
{
public static function __callStatic($method, $parameters)
{
-
}
} | false |
Other | laravel | framework | c7f4143ce826143910883786856c86b3a5cb8e7d.json | Apply fixes from StyleCI (#34995) | tests/Support/SupportReflectorTest.php | @@ -60,7 +60,8 @@ public function testUnionTypeName()
public function testIsCallable()
{
- $this->assertTrue(Reflector::isCallable(function () {}));
+ $this->assertTrue(Reflector::isCallable(function () {
+ }));
$this->assertTrue(Reflector::isCallable([B::class, 'f']));
$this->assertFalse(Reflector::isCallable([TestClassWithCall::class, 'f']));
$this->assertTrue(Reflector::isCallable([new TestClassWithCall, 'f']));
@@ -97,14 +98,12 @@ class TestClassWithCall
{
public function __call($method, $parameters)
{
-
}
}
class TestClassWithCallStatic
{
public static function __callStatic($method, $parameters)
{
-
}
} | false |
Other | laravel | framework | 8c16891c6e7a4738d63788f4447614056ab5136e.json | add isCallable helper | src/Illuminate/Support/Reflector.php | @@ -3,10 +3,52 @@
namespace Illuminate\Support;
use ReflectionClass;
+use ReflectionMethod;
use ReflectionNamedType;
class Reflector
{
+ /**
+ * This is a PHP 7.4 compatible implementation of is_callable.
+ *
+ * @param mixed $var
+ * @param bool $syntaxOnly
+ * @return bool
+ */
+ public static function isCallable($var, $syntaxOnly = false)
+ {
+ if (! is_array($var)) {
+ return is_callable($var, $syntaxOnly);
+ }
+
+ if (! isset($var[0]) && ! isset($var[1]) ||
+ ! is_string($var[1])) {
+ return false;
+ }
+
+ $class = is_object($var[0]) ? get_class($var[0]) : $var[0];
+
+ $method = $var[1];
+
+ if (! class_exists($class)) {
+ return false;
+ }
+
+ if (method_exists($class, $method)) {
+ return (new ReflectionMethod($class, $method))->isPublic();
+ }
+
+ if (is_object($var[0]) && method_exists($class, '__call')) {
+ return (new ReflectionMethod($class, '__call'))->isPublic();
+ }
+
+ if (! is_object($var[0]) && method_exists($class, '__callStatic')) {
+ return (new ReflectionMethod($class, '__callStatic'))->isPublic();
+ }
+
+ return false;
+ }
+
/**
* Get the class name of the given parameter's type, if possible.
* | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.