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
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Jobs/SqsJob.php
@@ -42,7 +42,7 @@ public function __construct(Container $container, SqsClient $sqs, array $job, $c } /** - * Release the job back into the queue. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Jobs/SyncJob.php
@@ -39,7 +39,7 @@ public function __construct(Container $container, $payload, $connectionName, $qu } /** - * Release the job back into the queue. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/NullQueue.php
@@ -44,7 +44,7 @@ public function pushRaw($payload, $queue = null, array $options = []) } /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Queue.php
@@ -58,7 +58,7 @@ public function pushOn($queue, $job, $data = '') } /** - * Push a new job onto the queue after a delay. + * Push a new job onto a specific queue after (n) seconds. * * @param string $queue * @param \DateTimeInterface|\DateInterval|int $delay
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/RedisQueue.php
@@ -167,7 +167,7 @@ function ($payload, $queue, $delay) { } /** - * Push a raw job onto the queue after a delay. + * Push a raw job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $payload
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/SqsQueue.php
@@ -116,7 +116,7 @@ public function pushRaw($payload, $queue = null, array $options = []) } /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/SyncQueue.php
@@ -134,7 +134,7 @@ public function pushRaw($payload, $queue = null, array $options = []) } /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Support/Testing/Fakes/QueueFake.php
@@ -299,7 +299,7 @@ public function pushRaw($payload, $queue = null, array $options = []) } /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job @@ -326,7 +326,7 @@ public function pushOn($queue, $job, $data = '') } /** - * Push a new job onto the queue after a delay. + * Push a new job onto a specific queue after (n) seconds. * * @param string $queue * @param \DateTimeInterface|\DateInterval|int $delay
true
Other
laravel
framework
dec6b72b690d8bc673413856bbb9b72f4f05078d.json
Remove some useless import. (#41169)
src/Illuminate/Mail/Mailable.php
@@ -23,7 +23,6 @@ use Symfony\Component\Mailer\Header\MetadataHeader; use Symfony\Component\Mailer\Header\TagHeader; use Symfony\Component\Mime\Address; -use Symfony\Component\Mime\Email; class Mailable implements MailableContract, Renderable {
false
Other
laravel
framework
6c0ffe3b274aeff16661efc33921ae5211b5f7d2.json
Apply fixes from StyleCI
tests/Validation/ValidationValidatorTest.php
@@ -754,13 +754,13 @@ public function message() $this->assertSame('my custom message', $v->messages()->first('name')); $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['name' => 'Ryan'], ['name' => $rule], ['name.' . $rule::class => 'my custom message']); + $v = new Validator($trans, ['name' => 'Ryan'], ['name' => $rule], ['name.'.$rule::class => 'my custom message']); $this->assertFalse($v->passes()); $v->messages()->setFormat(':message'); $this->assertSame('my custom message', $v->messages()->first('name')); $trans = $this->getIlluminateArrayTranslator(); - $v = new Validator($trans, ['name' => ['foo', 'bar']], ['name.*' => $rule], ['name.*.' . $rule::class => 'my custom message']); + $v = new Validator($trans, ['name' => ['foo', 'bar']], ['name.*' => $rule], ['name.*.'.$rule::class => 'my custom message']); $this->assertFalse($v->passes()); $v->messages()->setFormat(':message'); $this->assertSame('my custom message', $v->messages()->first('name.0'));
false
Other
laravel
framework
40abea870dbb802b752eb294fad5ab9de1eec1e5.json
Fix setPriority Call for MailChannel (#41120)
src/Illuminate/Notifications/Channels/MailChannel.php
@@ -143,7 +143,7 @@ protected function buildMessage($mailMessage, $notifiable, $notification, $messa $this->addAttachments($mailMessage, $message); if (! is_null($message->priority)) { - $mailMessage->setPriority($message->priority); + $mailMessage->priority($message->priority); } if ($message->tags) {
true
Other
laravel
framework
40abea870dbb802b752eb294fad5ab9de1eec1e5.json
Fix setPriority Call for MailChannel (#41120)
tests/Integration/Notifications/SendingMailNotificationsTest.php
@@ -98,7 +98,7 @@ public function testMailIsSent() $message->shouldReceive('subject')->once()->with('Test Mail Notification'); - $message->shouldReceive('setPriority')->once()->with(1); + $message->shouldReceive('priority')->once()->with(1); $closure($message); @@ -144,7 +144,7 @@ public function testMailIsSentToNamedAddress() $message->shouldReceive('subject')->once()->with('Test Mail Notification'); - $message->shouldReceive('setPriority')->once()->with(1); + $message->shouldReceive('priority')->once()->with(1); $closure($message);
true
Other
laravel
framework
502a5054025a81996d45d2657a598809db3c2aab.json
Remove duplicate queries to find batch (#41121)
src/Illuminate/Queue/CallQueuedHandler.php
@@ -179,12 +179,13 @@ protected function ensureSuccessfulBatchJobIsRecorded($command) $uses = class_uses_recursive($command); if (! in_array(Batchable::class, $uses) || - ! in_array(InteractsWithQueue::class, $uses) || - is_null($command->batch())) { + ! in_array(InteractsWithQueue::class, $uses)) { return; } - $command->batch()->recordSuccessfulJob($command->job->uuid()); + if ($batch = $command->batch()) { + $batch->recordSuccessfulJob($command->job->uuid()); + } } /** @@ -273,12 +274,13 @@ public function failed(array $data, $e, string $uuid) */ protected function ensureFailedBatchJobIsRecorded(string $uuid, $command, $e) { - if (! in_array(Batchable::class, class_uses_recursive($command)) || - is_null($command->batch())) { + if (! in_array(Batchable::class, class_uses_recursive($command))) { return; } - $command->batch()->recordFailedJob($uuid, $e); + if ($batch = $command->batch()) { + $batch->recordFailedJob($uuid, $e); + } } /**
false
Other
laravel
framework
9236336c554fb88f6a5372814e4e993e64c2ecca.json
Add missing test for Password Reset (#41104) Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
tests/Integration/Auth/ForgotPasswordTest.php
@@ -12,6 +12,14 @@ class ForgotPasswordTest extends TestCase { + protected function tearDown(): void + { + ResetPassword::$createUrlCallback = null; + ResetPassword::$toMailCallback = null; + + parent::tearDown(); + } + protected function defineEnvironment($app) { $app['config']->set('auth.providers.users.model', AuthenticationTestUser::class);
true
Other
laravel
framework
9236336c554fb88f6a5372814e4e993e64c2ecca.json
Add missing test for Password Reset (#41104) Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
tests/Integration/Auth/ForgotPasswordWithoutDefaultRoutesTest.php
@@ -0,0 +1,126 @@ +<?php + +namespace Illuminate\Tests\Integration\Auth; + +use Illuminate\Auth\Notifications\ResetPassword; +use Illuminate\Notifications\Messages\MailMessage; +use Illuminate\Support\Facades\Notification; +use Illuminate\Support\Facades\Password; +use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser; +use Orchestra\Testbench\Factories\UserFactory; +use Orchestra\Testbench\TestCase; + +class ForgotPasswordWithoutDefaultRoutesTest extends TestCase +{ + protected function tearDown(): void + { + ResetPassword::$createUrlCallback = null; + ResetPassword::$toMailCallback = null; + + parent::tearDown(); + } + + protected function defineEnvironment($app) + { + $app['config']->set('auth.providers.users.model', AuthenticationTestUser::class); + } + + protected function defineDatabaseMigrations() + { + $this->loadLaravelMigrations(); + } + + protected function defineRoutes($router) + { + $router->get('custom/password/reset/{token}', function ($token) { + return 'Custom reset password!'; + })->name('custom.password.reset'); + } + + /** @test */ + public function it_cannot_send_forgot_password_email() + { + $this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException'); + $this->expectExceptionMessage('Route [password.reset] not defined.'); + + Notification::fake(); + + UserFactory::new()->create(); + + $user = AuthenticationTestUser::first(); + + Password::broker()->sendResetLink([ + 'email' => $user->email, + ]); + + Notification::assertSentTo( + $user, + function (ResetPassword $notification, $channels) use ($user) { + $message = $notification->toMail($user); + + return ! is_null($notification->token) + && $message->actionUrl === route('custom.password.reset', ['token' => $notification->token, 'email' => $user->email]); + } + ); + } + + /** @test */ + public function it_can_send_forgot_password_email_via_create_url_using() + { + Notification::fake(); + + ResetPassword::createUrlUsing(function ($user, string $token) { + return route('custom.password.reset', $token); + }); + + UserFactory::new()->create(); + + $user = AuthenticationTestUser::first(); + + Password::broker()->sendResetLink([ + 'email' => $user->email, + ]); + + Notification::assertSentTo( + $user, + function (ResetPassword $notification, $channels) use ($user) { + $message = $notification->toMail($user); + + return ! is_null($notification->token) + && $message->actionUrl === route('custom.password.reset', ['token' => $notification->token]); + } + ); + } + + /** @test */ + public function it_can_send_forgot_password_email_via_to_mail_using() + { + Notification::fake(); + + ResetPassword::toMailUsing(function ($notifiable, $token) { + return (new MailMessage) + ->subject(__('Reset Password Notification')) + ->line(__('You are receiving this email because we received a password reset request for your account.')) + ->action(__('Reset Password'), route('custom.password.reset', $token)) + ->line(__('If you did not request a password reset, no further action is required.')); + }); + + UserFactory::new()->create(); + + $user = AuthenticationTestUser::first(); + + Password::broker()->sendResetLink([ + 'email' => $user->email, + ]); + + Notification::assertSentTo( + $user, + function (ResetPassword $notification, $channels) use ($user) { + $message = $notification->toMail($user); + + return ! is_null($notification->token) + && $message->actionUrl === route('custom.password.reset', ['token' => $notification->token]); + } + ); + } +}
true
Other
laravel
framework
0c710c5769ed8bb8e5c487c9885afec9be96f76e.json
Update Enumerable interface
src/Illuminate/Collections/Enumerable.php
@@ -964,7 +964,7 @@ public function splitIn($numberOfGroups); /** * Sort through each item with a callback. * - * @param (callable(TValue, TValue): bool)|null|int $callback + * @param (callable(TValue, TValue): int)|null|int $callback * @return static */ public function sort($callback = null);
false
Other
laravel
framework
b74e66b1588e6517f93a759c301246aaaa5135d0.json
add test for CacheManager (#41022)
tests/Cache/CacheManagerTest.php
@@ -4,8 +4,11 @@ use Illuminate\Cache\ArrayStore; use Illuminate\Cache\CacheManager; +use Illuminate\Cache\NullStore; use Illuminate\Config\Repository; use Illuminate\Container\Container; +use Illuminate\Contracts\Events\Dispatcher; +use Illuminate\Events\Dispatcher as Event; use InvalidArgumentException; use Mockery as m; use PHPUnit\Framework\TestCase; @@ -33,6 +36,62 @@ public function testCustomDriverClosureBoundObjectIsCacheManager() $this->assertEquals($cacheManager, $cacheManager->store(__CLASS__)); } + public function testCustomDriverOverridesInternalDrivers() + { + $userConfig = [ + 'cache' => [ + 'stores' => [ + 'my_store' => [ + 'driver' => 'array', + ], + ], + ], + ]; + + $app = $this->getApp($userConfig); + $cacheManager = new CacheManager($app); + + $myArrayDriver = (object) ['flag' => 'mm(u_u)mm']; + $cacheManager->extend('array', fn () => $myArrayDriver); + + $driver = $cacheManager->store('my_store'); + + $this->assertEquals('mm(u_u)mm', $driver->flag); + } + + public function testItMakesRepositoryWhenContainerHasNoDispatcher() + { + $userConfig = [ + 'cache' => [ + 'stores' => [ + 'my_store' => [ + 'driver' => 'array', + ], + ], + ], + ]; + + $app = $this->getApp($userConfig); + $this->assertFalse($app->bound(Dispatcher::class)); + + $cacheManager = new CacheManager($app); + $repo = $cacheManager->repository($theStore = new NullStore); + + $this->assertNull($repo->getEventDispatcher()); + $this->assertSame($theStore, $repo->getStore()); + + // binding dispatcher after the repo's birth will have no effect. + $app->bind(Dispatcher::class, fn () => new Event); + + $this->assertNull($repo->getEventDispatcher()); + $this->assertSame($theStore, $repo->getStore()); + + $cacheManager = new CacheManager($app); + $repo = $cacheManager->repository(new NullStore); + // now that the $app has a Dispatcher, the newly born repository will also have one. + $this->assertNotNull($repo->getEventDispatcher()); + } + public function testForgetDriver() { $cacheManager = m::mock(CacheManager::class) @@ -91,10 +150,7 @@ public function testThrowExceptionWhenUnknownDriverIsUsed() ], ]; - $app = Container::getInstance(); - $app->bind('config', function () use ($userConfig) { - return new Repository($userConfig); - }); + $app = $this->getApp($userConfig); $cacheManager = new CacheManager($app); @@ -116,13 +172,18 @@ public function testThrowExceptionWhenUnknownStoreIsUsed() ], ]; - $app = Container::getInstance(); - $app->bind('config', function () use ($userConfig) { - return new Repository($userConfig); - }); + $app = $this->getApp($userConfig); $cacheManager = new CacheManager($app); $cacheManager->store('alien_store'); } + + protected function getApp(array $userConfig) + { + $app = Container::getInstance(); + $app->bind('config', fn () => new Repository($userConfig)); + + return $app; + } }
false
Other
laravel
framework
c5166e83d1b1f9ce1b9ea04093b329388ed3404a.json
add test for cache increment (#41013)
tests/Cache/CacheArrayStoreTest.php
@@ -70,6 +70,33 @@ public function testValuesCanBeIncremented() $result = $store->increment('foo'); $this->assertEquals(2, $result); $this->assertEquals(2, $store->get('foo')); + + $result = $store->increment('foo', 2); + $this->assertEquals(4, $result); + $this->assertEquals(4, $store->get('foo')); + } + + public function testValuesGetCastedByIncrementOrDecrement() + { + $store = new ArrayStore; + $store->put('foo', '1', 10); + $result = $store->increment('foo'); + $this->assertEquals(2, $result); + $this->assertEquals(2, $store->get('foo')); + + $store->put('bar', '1', 10); + $result = $store->decrement('bar'); + $this->assertEquals(0, $result); + $this->assertEquals(0, $store->get('bar')); + } + + public function testIncrementNonNumericValues() + { + $store = new ArrayStore; + $store->put('foo', 'I am string', 10); + $result = $store->increment('foo'); + $this->assertEquals(1, $result); + $this->assertEquals(1, $store->get('foo')); } public function testNonExistingKeysCanBeIncremented() @@ -78,6 +105,10 @@ public function testNonExistingKeysCanBeIncremented() $result = $store->increment('foo'); $this->assertEquals(1, $result); $this->assertEquals(1, $store->get('foo')); + + // Will be there forever + Carbon::setTestNow(Carbon::now()->addYears(10)); + $this->assertEquals(1, $store->get('foo')); } public function testExpiredKeysAreIncrementedLikeNonExistingKeys() @@ -98,6 +129,10 @@ public function testValuesCanBeDecremented() $result = $store->decrement('foo'); $this->assertEquals(0, $result); $this->assertEquals(0, $store->get('foo')); + + $result = $store->decrement('foo', 2); + $this->assertEquals(-2, $result); + $this->assertEquals(-2, $store->get('foo')); } public function testItemsCanBeRemoved()
true
Other
laravel
framework
c5166e83d1b1f9ce1b9ea04093b329388ed3404a.json
add test for cache increment (#41013)
tests/Cache/CacheFileStoreTest.php
@@ -2,6 +2,7 @@ namespace Illuminate\Tests\Cache; +use Exception; use Illuminate\Cache\FileStore; use Illuminate\Contracts\Filesystem\FileNotFoundException; use Illuminate\Filesystem\Filesystem; @@ -186,17 +187,80 @@ public function testForeversAreNotRemovedOnIncrement() $this->assertSame('Hello World', $store->get('foo')); } + public function testIncrementExpiredKeys() + { + $filePath = $this->getCachePath('foo'); + $files = $this->mockFilesystem(); + $now = Carbon::now()->getTimestamp(); + $initialValue = ($now - 10).serialize(77); + $valueAfterIncrement = '9999999999'.serialize(3); + $store = new FileStore($files, __DIR__); + + $files->expects($this->once())->method('get')->with($this->equalTo($filePath), $this->equalTo(true))->willReturn($initialValue); + $files->expects($this->once())->method('put')->with($this->equalTo($filePath), $this->equalTo($valueAfterIncrement)); + + $result = $store->increment('foo', 3); + } + public function testIncrementCanAtomicallyJump() { + $filePath = $this->getCachePath('foo'); $files = $this->mockFilesystem(); $initialValue = '9999999999'.serialize(1); $valueAfterIncrement = '9999999999'.serialize(4); $store = new FileStore($files, __DIR__); - $files->expects($this->once())->method('get')->willReturn($initialValue); - $hash = sha1('foo'); - $cache_dir = substr($hash, 0, 2).'/'.substr($hash, 2, 2); - $files->expects($this->once())->method('put')->with($this->equalTo(__DIR__.'/'.$cache_dir.'/'.$hash), $this->equalTo($valueAfterIncrement)); - $store->increment('foo', 3); + + $files->expects($this->once())->method('get')->with($this->equalTo($filePath), $this->equalTo(true))->willReturn($initialValue); + $files->expects($this->once())->method('put')->with($this->equalTo($filePath), $this->equalTo($valueAfterIncrement)); + + $result = $store->increment('foo', 3); + $this->assertEquals(4, $result); + } + + public function testDecrementCanAtomicallyJump() + { + $filePath = $this->getCachePath('foo'); + + $files = $this->mockFilesystem(); + $initialValue = '9999999999'.serialize(2); + $valueAfterIncrement = '9999999999'.serialize(0); + $store = new FileStore($files, __DIR__); + + $files->expects($this->once())->method('get')->with($this->equalTo($filePath), $this->equalTo(true))->willReturn($initialValue); + $files->expects($this->once())->method('put')->with($this->equalTo($filePath), $this->equalTo($valueAfterIncrement)); + + $result = $store->decrement('foo', 2); + $this->assertEquals(0, $result); + } + + public function testIncrementNonNumericValues() + { + $filePath = $this->getCachePath('foo'); + + $files = $this->mockFilesystem(); + $initialValue = '1999999909'.serialize('foo'); + $valueAfterIncrement = '1999999909'.serialize(1); + $store = new FileStore($files, __DIR__); + $files->expects($this->once())->method('get')->with($this->equalTo($filePath), $this->equalTo(true))->willReturn($initialValue); + $files->expects($this->once())->method('put')->with($this->equalTo($filePath), $this->equalTo($valueAfterIncrement)); + $result = $store->increment('foo'); + + $this->assertEquals(1, $result); + } + + public function testIncrementNonExistentKeys() + { + $filePath = $this->getCachePath('foo'); + + $files = $this->mockFilesystem(); + $valueAfterIncrement = '9999999999'.serialize(1); + $store = new FileStore($files, __DIR__); + // simulates a missing item in file store by the exception + $files->expects($this->once())->method('get')->with($this->equalTo($filePath), $this->equalTo(true))->willThrowException(new Exception); + $files->expects($this->once())->method('put')->with($this->equalTo($filePath), $this->equalTo($valueAfterIncrement)); + $result = $store->increment('foo'); + $this->assertIsInt($result); + $this->assertEquals(1, $result); } public function testIncrementDoesNotExtendCacheLife() @@ -273,4 +337,12 @@ protected function mockFilesystem() { return $this->createMock(Filesystem::class); } + + protected function getCachePath($key) + { + $hash = sha1($key); + $cache_dir = substr($hash, 0, 2).'/'.substr($hash, 2, 2); + + return __DIR__.'/'.$cache_dir.'/'.$hash; + } }
true
Other
laravel
framework
fdcd963158587e9c69980bbf53ad8e1c34d70d9f.json
add tests for cacheManager (#40981)
src/Illuminate/Cache/CacheManager.php
@@ -328,7 +328,7 @@ protected function getPrefix(array $config) * Get the cache connection configuration. * * @param string $name - * @return array + * @return array|null */ protected function getConfig($name) {
true
Other
laravel
framework
fdcd963158587e9c69980bbf53ad8e1c34d70d9f.json
add tests for cacheManager (#40981)
tests/Cache/CacheManagerTest.php
@@ -4,6 +4,9 @@ use Illuminate\Cache\ArrayStore; use Illuminate\Cache\CacheManager; +use Illuminate\Config\Repository; +use Illuminate\Container\Container; +use InvalidArgumentException; use Mockery as m; use PHPUnit\Framework\TestCase; @@ -72,4 +75,54 @@ public function testForgetDriverForgets() $cacheManager->forgetDriver('forget'); $this->assertNull($cacheManager->store('forget')->get('foo')); } + + public function testThrowExceptionWhenUnknownDriverIsUsed() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Driver [unknown_taxi_driver] is not supported.'); + + $userConfig = [ + 'cache' => [ + 'stores' => [ + 'my_store' => [ + 'driver' => 'unknown_taxi_driver', + ], + ], + ], + ]; + + $app = Container::getInstance(); + $app->bind('config', function () use ($userConfig) { + return new Repository($userConfig); + }); + + $cacheManager = new CacheManager($app); + + $cacheManager->store('my_store'); + } + + public function testThrowExceptionWhenUnknownStoreIsUsed() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Cache store [alien_store] is not defined.'); + + $userConfig = [ + 'cache' => [ + 'stores' => [ + 'my_store' => [ + 'driver' => 'array', + ], + ], + ], + ]; + + $app = Container::getInstance(); + $app->bind('config', function () use ($userConfig) { + return new Repository($userConfig); + }); + + $cacheManager = new CacheManager($app); + + $cacheManager->store('alien_store'); + } }
true
Other
laravel
framework
11251f24318ed806f07323faf747d7e318922723.json
Add filtering of the route list by domain (#40970)
src/Illuminate/Foundation/Console/RouteListCommand.php
@@ -212,9 +212,10 @@ protected function getMiddleware($route) */ protected function filterRoute(array $route) { - if (($this->option('name') && ! str_contains($route['name'], $this->option('name'))) || - $this->option('path') && ! str_contains($route['uri'], $this->option('path')) || - $this->option('method') && ! str_contains($route['method'], strtoupper($this->option('method')))) { + if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) || + ($this->option('path') && ! Str::contains($route['uri'], $this->option('path'))) || + ($this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) || + ($this->option('domain') && ! Str::contains($route['domain'], $this->option('domain')))) { return; } @@ -418,6 +419,7 @@ protected function getOptions() ['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'], ['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'], ['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'], + ['domain', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by domain'], ['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'], ['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'], ['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'],
false
Other
laravel
framework
3bfc5703728191b0fd6a6c07420ca881aef706a7.json
Update ExceptionHandler.php (#40956)
src/Illuminate/Contracts/Debug/ExceptionHandler.php
@@ -41,6 +41,8 @@ public function render($request, Throwable $e); * @param \Symfony\Component\Console\Output\OutputInterface $output * @param \Throwable $e * @return void + * + * @internal This method is not meant to be used or overwritten outside the framework. */ public function renderForConsole($output, Throwable $e); }
false
Other
laravel
framework
4a474ced7889979f50e794fff9091eace57dc5bd.json
Fix typo in method documentation (#40951)
src/Illuminate/Cache/DynamoDbStore.php
@@ -211,7 +211,7 @@ public function put($key, $value, $seconds) } /** - * Store multiple items in the cache for a given number of $seconds. + * Store multiple items in the cache for a given number of seconds. * * @param array $values * @param int $seconds
false
Other
laravel
framework
705642d1983443a94182973de3306b9144cee3bd.json
Apply fixes from StyleCI
src/Illuminate/Routing/Router.php
@@ -374,7 +374,7 @@ public function apiResource($name, $controller, array $options = []) * @return void */ public function group(array $attributes, $routes) - { + { foreach (Arr::wrap($routes) as $groupRoutes) { $this->updateGroupStack($attributes);
false
Other
laravel
framework
3ef58e60e27baf5bac0a43cb95560f33a156bae9.json
Fix Mailable->priority() (#40917) Fixes #40916
src/Illuminate/Mail/Mailable.php
@@ -488,7 +488,7 @@ public function locale($locale) public function priority($level = 3) { $this->callbacks[] = function ($message) use ($level) { - $message->setPriority($level); + $message->priority($level); }; return $this;
true
Other
laravel
framework
3ef58e60e27baf5bac0a43cb95560f33a156bae9.json
Fix Mailable->priority() (#40917) Fixes #40916
tests/Mail/MailMailableTest.php
@@ -2,11 +2,20 @@ namespace Illuminate\Tests\Mail; +use Illuminate\Contracts\View\Factory; use Illuminate\Mail\Mailable; +use Illuminate\Mail\Mailer; +use Illuminate\Mail\Transport\ArrayTransport; +use Mockery as m; use PHPUnit\Framework\TestCase; class MailMailableTest extends TestCase { + protected function tearDown(): void + { + m::close(); + } + public function testMailableSetsRecipientsCorrectly() { $mailable = new WelcomeMailableStub; @@ -417,6 +426,25 @@ public function testMailerMayBeSet() $this->assertSame('array', $mailable->mailer); } + + public function testMailablePriorityGetsSent() + { + $view = m::mock(Factory::class); + + $mailer = new Mailer('array', $view, new ArrayTransport); + + $mailable = new WelcomeMailableStub; + $mailable->to('hello@laravel.com'); + $mailable->from('taylor@laravel.com'); + $mailable->html('test content'); + + $mailable->priority(1); + + $sentMessage = $mailer->send($mailable); + + $this->assertSame('hello@laravel.com', $sentMessage->getEnvelope()->getRecipients()[0]->getAddress()); + $this->assertStringContainsString('X-Priority: 1 (Highest)', $sentMessage->toString()); + } } class WelcomeMailableStub extends Mailable
true
Other
laravel
framework
f2ce3d50073eedb49c806a6f2f0049b58b3b04bc.json
Fix publishing visibility (#40918)
src/Illuminate/Foundation/Console/VendorPublishCommand.php
@@ -11,6 +11,8 @@ use League\Flysystem\Filesystem as Flysystem; use League\Flysystem\Local\LocalFilesystemAdapter as LocalAdapter; use League\Flysystem\MountManager; +use League\Flysystem\UnixVisibility\PortableVisibilityConverter; +use League\Flysystem\Visibility; class VendorPublishCommand extends Command { @@ -243,9 +245,11 @@ protected function publishFile($from, $to) */ protected function publishDirectory($from, $to) { + $visibility = PortableVisibilityConverter::fromArray([], Visibility::PUBLIC); + $this->moveManagedFiles(new MountManager([ 'from' => new Flysystem(new LocalAdapter($from)), - 'to' => new Flysystem(new LocalAdapter($to)), + 'to' => new Flysystem(new LocalAdapter($to, $visibility)), ])); $this->status($from, $to, 'Directory');
false
Other
laravel
framework
ed70b724bd1d10230465bf5c8ae5453f5be40949.json
fix non-existing property
types/Database/Eloquent/Collection.php
@@ -135,7 +135,7 @@ assertType('User', $user); assertType('int', $int); - return $user->id; + return $user->primaryKey; })); assertType('Illuminate\Database\Eloquent\Collection<int, User>', $collection->unique('string'));
true
Other
laravel
framework
ed70b724bd1d10230465bf5c8ae5453f5be40949.json
fix non-existing property
types/Support/Collection.php
@@ -747,7 +747,7 @@ assertType('User', $user); assertType('int', $int); - return $user->id; + return $user->primaryKey; })); assertType('Illuminate\Support\Collection<string, string>', $collection->make(['string' => 'string'])->unique(function ($stringA, $stringB) { assertType('string', $stringA); @@ -761,7 +761,7 @@ assertType('User', $user); assertType('int', $int); - return $user->id; + return $user->primaryKey; })); assertType('Illuminate\Support\Collection<int, User>', $collection->values());
true
Other
laravel
framework
ed70b724bd1d10230465bf5c8ae5453f5be40949.json
fix non-existing property
types/Support/LazyCollection.php
@@ -745,7 +745,7 @@ assertType('User', $user); assertType('int', $int); - return $user->id; + return $user->primaryKey; })); assertType('Illuminate\Support\LazyCollection<string, string>', $collection->make(['string' => 'string'])->unique(function ($stringA, $stringB) { assertType('string', $stringA); @@ -759,7 +759,7 @@ assertType('User', $user); assertType('int', $int); - return $user->id; + return $user->primaryKey; })); assertType('Illuminate\Support\LazyCollection<int, User>', $collection->values());
true
Other
laravel
framework
368fabca7e936174eb10305d76c590ce67311417.json
Improve types on model factory methods
src/Illuminate/Database/Eloquent/Factories/Factory.php
@@ -148,7 +148,7 @@ abstract public function definition(); /** * Get a new factory instance for the given attributes. * - * @param (callable(): array<string, mixed>)|array<string, mixed> $attributes + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes * @return static */ public static function new($attributes = []) @@ -180,7 +180,7 @@ public function configure() /** * Get the raw attributes generated by the factory. * - * @param array<string, mixed> $attributes + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes * @param \Illuminate\Database\Eloquent\Model|null $parent * @return array<int|string, mixed> */ @@ -198,7 +198,7 @@ public function raw($attributes = [], ?Model $parent = null) /** * Create a single model and persist it to the database. * - * @param array<string, mixed> $attributes + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes * @return \Illuminate\Database\Eloquent\Model|TModel */ public function createOne($attributes = []) @@ -209,7 +209,7 @@ public function createOne($attributes = []) /** * Create a single model and persist it to the database. * - * @param array<string, mixed> $attributes + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes * @return \Illuminate\Database\Eloquent\Model|TModel */ public function createOneQuietly($attributes = []) @@ -248,7 +248,7 @@ public function createManyQuietly(iterable $records) /** * Create a collection of models and persist them to the database. * - * @param array<string, mixed> $attributes + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes * @param \Illuminate\Database\Eloquent\Model|null $parent * @return \Illuminate\Database\Eloquent\Collection<int, \Illuminate\Database\Eloquent\Model|TModel>|\Illuminate\Database\Eloquent\Model|TModel */ @@ -338,7 +338,7 @@ protected function createChildren(Model $model) /** * Make a single instance of the model. * - * @param (callable(): array<string, mixed>)|array<string, mixed> $attributes + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes * @return \Illuminate\Database\Eloquent\Model|TModel */ public function makeOne($attributes = []) @@ -349,7 +349,7 @@ public function makeOne($attributes = []) /** * Create a collection of models. * - * @param array<string, mixed> $attributes + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $attributes * @param \Illuminate\Database\Eloquent\Model|null $parent * @return \Illuminate\Database\Eloquent\Collection<int, \Illuminate\Database\Eloquent\Model|TModel>|\Illuminate\Database\Eloquent\Model|TModel */ @@ -469,7 +469,7 @@ protected function expandAttributes(array $definition) /** * Add a new state transformation to the model definition. * - * @param (callable(): array<string, mixed>)|array<string, mixed> $state + * @param (callable(array<string, mixed>): array<string, mixed>)|array<string, mixed> $state * @return static */ public function state($state)
false
Other
laravel
framework
cefd1c8a00d69aefb944c9c53f052039e6aa3d05.json
Apply fixes from StyleCI
src/Illuminate/Support/Str.php
@@ -918,6 +918,7 @@ public static function substrReplace($string, $replace, $offset = 0, $length = n public static function swap(array $map, $subject) { return strtr($subject, $map); + return str_replace(array_keys($map), array_values($map), $subject); }
false
Other
laravel
framework
2246744061de4bfd2d3a42d715e6b760015fa074.json
add test for cache Repository class (#40817)
tests/Cache/CacheRepositoryTest.php
@@ -205,6 +205,36 @@ public function testCacheAddCallsRedisStoreAdd() $this->assertTrue($repository->add('k', 'v', 60)); } + public function testAddMethodCanAcceptDateIntervals() + { + $storeWithAdd = m::mock(RedisStore::class); + $storeWithAdd->shouldReceive('add')->once()->with('k', 'v', 61)->andReturn(true); + $repository = new Repository($storeWithAdd); + $this->assertTrue($repository->add('k', 'v', DateInterval::createFromDateString('61 seconds'))); + + $storeWithoutAdd = m::mock(ArrayStore::class); + $this->assertFalse(method_exists(ArrayStore::class, 'add'), 'This store should not have add method on it.'); + $storeWithoutAdd->shouldReceive('get')->once()->with('k')->andReturn(null); + $storeWithoutAdd->shouldReceive('put')->once()->with('k', 'v', 60)->andReturn(true); + $repository = new Repository($storeWithoutAdd); + $this->assertTrue($repository->add('k', 'v', DateInterval::createFromDateString('60 seconds'))); + } + + public function testAddMethodCanAcceptDateTimeInterface() + { + $withAddStore = m::mock(RedisStore::class); + $withAddStore->shouldReceive('add')->once()->with('k', 'v', 61)->andReturn(true); + $repository = new Repository($withAddStore); + $this->assertTrue($repository->add('k', 'v', Carbon::now()->addSeconds(61))); + + $noAddStore = m::mock(ArrayStore::class); + $this->assertFalse(method_exists(ArrayStore::class, 'add'), 'This store should not have add method on it.'); + $noAddStore->shouldReceive('get')->once()->with('k')->andReturn(null); + $noAddStore->shouldReceive('put')->once()->with('k', 'v', 62)->andReturn(true); + $repository = new Repository($noAddStore); + $this->assertTrue($repository->add('k', 'v', Carbon::now()->addSeconds(62))); + } + public function testAddWithNullTTLRemembersItemForever() { $repo = $this->getRepository(); @@ -221,6 +251,8 @@ public function testAddWithDatetimeInPastOrZeroSecondsReturnsImmediately() $this->assertFalse($result); $result = $repo->add('foo', 'bar', Carbon::now()); $this->assertFalse($result); + $result = $repo->add('foo', 'bar', -1); + $this->assertFalse($result); } public function dataProviderTestGetSeconds()
false
Other
laravel
framework
c7f4c23e17013b9c6f86a8fd1d37a590e2ad29b4.json
Add tests for put method of FileStore (#40811)
tests/Cache/CacheFileStoreTest.php
@@ -62,7 +62,43 @@ public function testPutCreatesMissingDirectories() $this->assertTrue($result); } - public function testExpiredItemsReturnNull() + public function testPutWillConsiderZeroAsEternalTime() + { + $files = $this->mockFilesystem(); + + $hash = sha1('O--L / key'); + $filePath = __DIR__.'/'.substr($hash, 0, 2).'/'.substr($hash, 2, 2).'/'.$hash; + $ten9s = '9999999999'; // The "forever" time value. + $fileContents = $ten9s.serialize('gold'); + $exclusiveLock = true; + + $files->expects($this->once())->method('put')->with( + $this->equalTo($filePath), + $this->equalTo($fileContents), + $this->equalTo($exclusiveLock) // Ensure we do lock the file while putting. + )->willReturn(strlen($fileContents)); + + (new FileStore($files, __DIR__))->put('O--L / key', 'gold', 0); + } + + public function testPutWillConsiderBigValuesAsEternalTime() + { + $files = $this->mockFilesystem(); + + $hash = sha1('O--L / key'); + $filePath = __DIR__.'/'.substr($hash, 0, 2).'/'.substr($hash, 2, 2).'/'.$hash; + $ten9s = '9999999999'; // The "forever" time value. + $fileContents = $ten9s.serialize('gold'); + + $files->expects($this->once())->method('put')->with( + $this->equalTo($filePath), + $this->equalTo($fileContents), + ); + + (new FileStore($files, __DIR__))->put('O--L / key', 'gold', (int) $ten9s + 1); + } + + public function testExpiredItemsReturnNullAndGetDeleted() { $files = $this->mockFilesystem(); $contents = '0000000000';
false
Other
laravel
framework
1c15d0883bbe316f374c9f5e74a3a1e168184649.json
Create pull-requests.yml (#40808)
.github/workflows/pull-requests.yml
@@ -0,0 +1,64 @@ +name: Pull Requests + +# Credit: https://github.com/github/docs/blob/main/.github/workflows/notify-when-maintainers-cannot-edit.yaml + +on: + pull_request_target: + types: + - opened + +permissions: + pull-requests: write + +jobs: + uneditable: + if: github.repository == 'laravel/framework' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@2b34a689ec86a68d8ab9478298f91d5401337b7d + with: + script: | + const query = ` + query($number: Int!) { + repository(owner: "laravel", name: "framework") { + pullRequest(number: $number) { + headRepositoryOwner { + login + } + maintainerCanModify + } + } + } + `; + + const pullNumber = context.issue.number; + const variables = { number: pullNumber }; + + try { + console.log(`Check laravel/framework#${pullNumber} for maintainer edit access ...`); + + const result = await github.graphql(query, variables); + + console.log(JSON.stringify(result, null, 2)); + + const pullRequest = result.repository.pullRequest; + + if (pullRequest.headRepositoryOwner.login === 'laravel') { + console.log('PR owned by laravel'); + + return; + } + + if (!pullRequest.maintainerCanModify) { + console.log('PR not owned by Laravel and does not have maintainer edits enabled'); + + await github.issues.createComment({ + issue_number: pullNumber, + owner: 'laravel', + repo: 'framework', + body: "Thanks for submitting a PR!\n\nIn order to review and merge PRs most efficiently, we require that all PRs grant maintainer edit access before we review them. For information on how to do this, [see the relevant GitHub documentation](https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)." + }); + } + } catch(e) { + console.log(e); + }
false
Other
laravel
framework
870bc7d6c106a3391da90372d488b89da3bc8236.json
add directory visibility
src/Illuminate/Filesystem/FilesystemManager.php
@@ -271,9 +271,13 @@ protected function formatS3Config(array $config) */ protected function createFlysystem(FlysystemAdapter $adapter, array $config) { - $config = Arr::only($config, ['visibility', 'disable_asserts', 'url', 'temporary_url']); - - return new Flysystem($adapter, $config); + return new Flysystem($adapter, Arr::only($config, [ + 'directory_visibility', + 'disable_asserts', + 'temporary_url', + 'url', + 'visibility', + ])); } /**
false
Other
laravel
framework
5164e0e83ab7d580124c9b777f12c88d6c5ced06.json
Simplify mocking assertions. (#40786)
tests/Database/DatabaseConnectorTest.php
@@ -129,8 +129,8 @@ public function testPostgresSearchPathCommaSeparatedValueSupported() $config = ['host' => 'foo', 'database' => 'bar', 'search_path' => 'public, "user"', 'charset' => 'utf8']; $connector = $this->getMockBuilder('Illuminate\Database\Connectors\PostgresConnector')->setMethods(['createConnection', 'getOptions'])->getMock(); $connection = m::mock('stdClass'); - $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->will($this->returnValue(['options'])); - $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->will($this->returnValue($connection)); + $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->willReturn(['options']); + $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->willReturn($connection); $connection->shouldReceive('prepare')->once()->with('set names \'utf8\'')->andReturn($connection); $connection->shouldReceive('prepare')->once()->with('set search_path to "public", "user"')->andReturn($connection); $connection->shouldReceive('execute')->twice(); @@ -145,8 +145,8 @@ public function testPostgresSearchPathVariablesSupported() $config = ['host' => 'foo', 'database' => 'bar', 'search_path' => '"$user", public, user', 'charset' => 'utf8']; $connector = $this->getMockBuilder('Illuminate\Database\Connectors\PostgresConnector')->setMethods(['createConnection', 'getOptions'])->getMock(); $connection = m::mock('stdClass'); - $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->will($this->returnValue(['options'])); - $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->will($this->returnValue($connection)); + $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->willReturn(['options']); + $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->willReturn($connection); $connection->shouldReceive('prepare')->once()->with('set names \'utf8\'')->andReturn($connection); $connection->shouldReceive('prepare')->once()->with('set search_path to "$user", "public", "user"')->andReturn($connection); $connection->shouldReceive('execute')->twice();
true
Other
laravel
framework
5164e0e83ab7d580124c9b777f12c88d6c5ced06.json
Simplify mocking assertions. (#40786)
tests/Foundation/Testing/DatabaseMigrationsTest.php
@@ -46,7 +46,7 @@ private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName) public function testRefreshTestDatabaseDefault() { $this->traitObject - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('artisan') ->with('migrate:fresh', [ '--drop-views' => false, @@ -64,7 +64,7 @@ public function testRefreshTestDatabaseWithDropViewsOption() $this->traitObject->dropViews = true; $this->traitObject - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('artisan') ->with('migrate:fresh', [ '--drop-views' => true, @@ -82,7 +82,7 @@ public function testRefreshTestDatabaseWithDropTypesOption() $this->traitObject->dropTypes = true; $this->traitObject - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('artisan') ->with('migrate:fresh', [ '--drop-views' => false,
true
Other
laravel
framework
5164e0e83ab7d580124c9b777f12c88d6c5ced06.json
Simplify mocking assertions. (#40786)
tests/Foundation/Testing/RefreshDatabaseTest.php
@@ -46,7 +46,7 @@ private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName) public function testRefreshTestDatabaseDefault() { $this->traitObject - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('artisan') ->with('migrate:fresh', [ '--drop-views' => false, @@ -64,7 +64,7 @@ public function testRefreshTestDatabaseWithDropViewsOption() $this->traitObject->dropViews = true; $this->traitObject - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('artisan') ->with('migrate:fresh', [ '--drop-views' => true, @@ -82,7 +82,7 @@ public function testRefreshTestDatabaseWithDropTypesOption() $this->traitObject->dropTypes = true; $this->traitObject - ->expects($this->exactly(1)) + ->expects($this->once()) ->method('artisan') ->with('migrate:fresh', [ '--drop-views' => false,
true
Other
laravel
framework
5164e0e83ab7d580124c9b777f12c88d6c5ced06.json
Simplify mocking assertions. (#40786)
tests/Support/SupportNamespacedItemResolverTest.php
@@ -30,9 +30,7 @@ public function testParsedItemsAreCached() public function testParsedItemsMayBeFlushed() { $r = $this->getMockBuilder(NamespacedItemResolver::class)->onlyMethods(['parseBasicSegments', 'parseNamespacedSegments'])->getMock(); - $r->expects($this->once())->method('parseBasicSegments')->will( - $this->returnValue(['bar']) - ); + $r->expects($this->once())->method('parseBasicSegments')->willReturn(['bar']); $r->setParsedKey('foo.bar', ['foo']); $r->flushParsedKeys();
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
@@ -4,6 +4,7 @@ use Carbon\CarbonImmutable; use Carbon\CarbonInterface; +use DateTimeImmutable; use DateTimeInterface; use Illuminate\Contracts\Database\Eloquent\Castable; use Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes; @@ -1345,7 +1346,7 @@ protected function asTimestamp($value) */ protected function serializeDate(DateTimeInterface $date) { - return $date instanceof \DateTimeImmutable ? + return $date instanceof DateTimeImmutable ? CarbonImmutable::instance($date)->toJSON() : Carbon::instance($date)->toJSON(); }
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
src/Illuminate/Routing/RouteDependencyResolverTrait.php
@@ -7,6 +7,7 @@ use ReflectionFunctionAbstract; use ReflectionMethod; use ReflectionParameter; +use stdClass; trait RouteDependencyResolverTrait { @@ -42,7 +43,7 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA $values = array_values($parameters); - $skippableValue = new \stdClass; + $skippableValue = new stdClass; foreach ($reflector->getParameters() as $key => $parameter) { $instance = $this->transformDependency($parameter, $parameters, $skippableValue);
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php
@@ -3,6 +3,7 @@ namespace Illuminate\Tests\Database; use BadMethodCallException; +use Exception; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Database\Eloquent\SoftDeletes; @@ -212,7 +213,7 @@ public function testForceDeleteDoesntUpdateExistsPropertyIfFailed() public function newModelQuery() { return Mockery::spy(parent::newModelQuery(), function (Mockery\MockInterface $mock) { - $mock->shouldReceive('forceDelete')->andThrow(new \Exception()); + $mock->shouldReceive('forceDelete')->andThrow(new Exception()); }); } }; @@ -221,7 +222,7 @@ public function newModelQuery() try { $user->forceDelete(); - } catch (\Exception $exception) { + } catch (Exception $exception) { } $this->assertTrue($user->exists);
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
tests/Foundation/Testing/DatabaseMigrationsTest.php
@@ -5,7 +5,9 @@ use Illuminate\Contracts\Console\Kernel; use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\RefreshDatabaseState; +use Mockery; use PHPUnit\Framework\TestCase; +use ReflectionMethod; class DatabaseMigrationsTest extends TestCase { @@ -20,7 +22,7 @@ protected function setUp(): void 'beforeApplicationDestroyed', ]); - $kernelObj = \Mockery::mock(); + $kernelObj = Mockery::mock(); $kernelObj->shouldReceive('setArtisan') ->with(null); @@ -31,7 +33,7 @@ protected function setUp(): void private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName) { - $migrateFreshUsingReflection = new \ReflectionMethod( + $migrateFreshUsingReflection = new ReflectionMethod( get_class($this->traitObject), $methodName );
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
tests/Foundation/Testing/RefreshDatabaseTest.php
@@ -5,7 +5,9 @@ use Illuminate\Contracts\Console\Kernel; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabaseState; +use Mockery; use PHPUnit\Framework\TestCase; +use ReflectionMethod; class RefreshDatabaseTest extends TestCase { @@ -20,7 +22,7 @@ protected function setUp(): void 'beginDatabaseTransaction', ]); - $kernelObj = \Mockery::mock(); + $kernelObj = Mockery::mock(); $kernelObj->shouldReceive('setArtisan') ->with(null); @@ -31,7 +33,7 @@ protected function setUp(): void private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName) { - $migrateFreshUsingReflection = new \ReflectionMethod( + $migrateFreshUsingReflection = new ReflectionMethod( get_class($this->traitObject), $methodName );
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
tests/Foundation/Testing/Traits/CanConfigureMigrationCommandsTest.php
@@ -4,6 +4,7 @@ use Illuminate\Foundation\Testing\Traits\CanConfigureMigrationCommands; use PHPUnit\Framework\TestCase; +use ReflectionMethod; class CanConfigureMigrationCommandsTest extends TestCase { @@ -16,7 +17,7 @@ protected function setup(): void private function __reflectAndSetupAccessibleForProtectedTraitMethod($methodName) { - $migrateFreshUsingReflection = new \ReflectionMethod( + $migrateFreshUsingReflection = new ReflectionMethod( get_class($this->traitObject), $methodName );
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
tests/Integration/Database/EloquentStrictLoadingTest.php
@@ -8,6 +8,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Schema; +use RuntimeException; class EloquentStrictLoadingTest extends DatabaseTestCase { @@ -134,7 +135,7 @@ public function testStrictModeWithCustomCallbackOnLazyLoading() public function testStrictModeWithOverriddenHandlerOnLazyLoading() { - $this->expectException(\RuntimeException::class); + $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Violated'); EloquentStrictLoadingTestModel1WithCustomHandler::create(); @@ -171,7 +172,7 @@ public function modelTwos() protected function handleLazyLoadingViolation($key) { - throw new \RuntimeException("Violated {$key}"); + throw new RuntimeException("Violated {$key}"); } }
true
Other
laravel
framework
dccf13e2c831c990e96d4c62a229f5ce3c2208ea.json
Avoid FQCN in code. (#40789)
tests/Support/SupportHelpersTest.php
@@ -12,6 +12,7 @@ use LogicException; use Mockery as m; use PHPUnit\Framework\TestCase; +use ReflectionClass; use RuntimeException; use stdClass; use Traversable; @@ -377,11 +378,11 @@ public function testStr() $this->assertTrue($stringable->isEmpty()); $strAccessor = str(); - $this->assertTrue((new \ReflectionClass($strAccessor))->isAnonymous()); + $this->assertTrue((new ReflectionClass($strAccessor))->isAnonymous()); $this->assertSame($strAccessor->limit('string-value', 3), 'str...'); $strAccessor = str(); - $this->assertTrue((new \ReflectionClass($strAccessor))->isAnonymous()); + $this->assertTrue((new ReflectionClass($strAccessor))->isAnonymous()); $this->assertSame((string) $strAccessor, ''); }
true
Other
laravel
framework
6f4480b48125480feaa053445817a9c00103a5e1.json
add selected directive
src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php
@@ -305,6 +305,17 @@ public function compileEndOnce() return '<?php endif; ?>'; } + /** + * Compile a selected block into valid PHP. + * + * @param string $condition + * @return string + */ + protected function compileSelected($condition) + { + return "<?php if{$condition}: echo 'selected'; endif; ?>"; + } + /** * Compile a checked block into valid PHP. *
true
Other
laravel
framework
6f4480b48125480feaa053445817a9c00103a5e1.json
add selected directive
tests/View/Blade/BladeCheckedStatementsTest.php
@@ -4,6 +4,14 @@ class BladeCheckedStatementsTest extends AbstractBladeTestCase { + public function testSelectedStatementsAreCompiled() + { + $string = '<input @selected(name(foo(bar)))/>'; + $expected = "<input <?php if(name(foo(bar))): echo 'selected'; endif; ?>/>"; + + $this->assertEquals($expected, $this->compiler->compileString($string)); + } + public function testCheckedStatementsAreCompiled() { $string = '<input @checked(name(foo(bar)))/>';
true
Other
laravel
framework
84d433d7d7acd44cce5d9f0b7562439346e6fe19.json
add checked helper
src/Illuminate/Foundation/Testing/Concerns/InteractsWithRedis.php
@@ -76,10 +76,14 @@ public function setUpRedis() */ public function tearDownRedis() { - $this->redis['phpredis']->connection()->flushdb(); + if (isset($this->redis['phpredis'])) { + $this->redis['phpredis']->connection()->flushdb(); + } foreach ($this->redisDriverProvider() as $driver) { - $this->redis[$driver[0]]->connection()->disconnect(); + if (isset($this->redis[$driver[0]])) { + $this->redis[$driver[0]]->connection()->disconnect(); + } } }
true
Other
laravel
framework
84d433d7d7acd44cce5d9f0b7562439346e6fe19.json
add checked helper
src/Illuminate/View/Compilers/Concerns/CompilesConditionals.php
@@ -304,4 +304,15 @@ public function compileEndOnce() { return '<?php endif; ?>'; } + + /** + * Compile a checked block into valid PHP. + * + * @param string $condition + * @return string + */ + protected function compileChecked($condition) + { + return "<?php if{$condition}: echo 'checked'; endif; ?>"; + } }
true
Other
laravel
framework
84d433d7d7acd44cce5d9f0b7562439346e6fe19.json
add checked helper
tests/View/Blade/BladeCheckedStatementsTest.php
@@ -0,0 +1,14 @@ +<?php + +namespace Illuminate\Tests\View\Blade; + +class BladeCheckedStatementsTest extends AbstractBladeTestCase +{ + public function testCheckedStatementsAreCompiled() + { + $string = '<input @checked(name(foo(bar)))/>'; + $expected = "<input <?php if(name(foo(bar))): echo 'checked'; endif; ?>/>"; + + $this->assertEquals($expected, $this->compiler->compileString($string)); + } +}
true
Other
laravel
framework
442b6d0e7e086a5775c97ccd61111c75cd2d2037.json
Make PendingRequest conditionable (#40762)
src/Illuminate/Http/Client/PendingRequest.php
@@ -13,13 +13,14 @@ use Illuminate\Http\Client\Events\ResponseReceived; use Illuminate\Support\Collection; use Illuminate\Support\Str; +use Illuminate\Support\Traits\Conditionable; use Illuminate\Support\Traits\Macroable; use Psr\Http\Message\MessageInterface; use Symfony\Component\VarDumper\VarDumper; class PendingRequest { - use Macroable; + use Conditionable, Macroable; /** * The factory instance.
false
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Http/KernelTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Http; +namespace Illuminate\Tests\Foundation\Http; use Illuminate\Events\Dispatcher; use Illuminate\Foundation\Application;
true
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Http/Middleware/ConvertEmptyStringsToNullTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Http\Middleware; +namespace Illuminate\Tests\Foundation\Http\Middleware; use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull; use Illuminate\Http\Request;
true
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Http/Middleware/TransformsRequestTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Http\Middleware; +namespace Illuminate\Tests\Foundation\Http\Middleware; use Illuminate\Foundation\Http\Middleware\TransformsRequest; use Illuminate\Http\Request;
true
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Http/Middleware/TrimStringsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Http\Middleware; +namespace Illuminate\Tests\Foundation\Http\Middleware; use Illuminate\Foundation\Http\Middleware\TrimStrings; use Illuminate\Http\Request;
true
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Testing/Concerns/InteractsWithContainerTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Testing\Concerns; +namespace Illuminate\Tests\Foundation\Testing\Concerns; use Illuminate\Foundation\Mix; use Orchestra\Testbench\TestCase;
true
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Testing/Concerns/InteractsWithViewsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Testing\Concerns; +namespace Illuminate\Tests\Foundation\Testing\Concerns; use Illuminate\Foundation\Testing\Concerns\InteractsWithViews; use Illuminate\View\Component;
true
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Testing\Concerns; +namespace Illuminate\Tests\Foundation\Testing\Concerns; use Illuminate\Contracts\Routing\Registrar; use Illuminate\Contracts\Routing\UrlGenerator;
true
Other
laravel
framework
5ea6689a39fc05376cd20832b531e9cb1d71096e.json
Fix errored namespaces. (#40752)
tests/Foundation/Testing/WormholeTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Bootstrap\Testing; +namespace Illuminate\Tests\Foundation\Testing; use Carbon\CarbonImmutable; use Illuminate\Foundation\Testing\Wormhole;
true
Other
laravel
framework
4f5c5cc1ef773d8bac72fc9bd2ae178ce3991f9f.json
Apply fixes from StyleCI
src/Illuminate/Foundation/Console/ComponentMakeCommand.php
@@ -53,7 +53,7 @@ public function handle() return; } - + if (parent::handle() === false && ! $this->option('force')) { return false; } @@ -66,7 +66,7 @@ public function handle() /** * Write the view for the component. * - * @param callable|null $onSuccess + * @param callable|null $onSuccess * @return void */ protected function writeView($onSuccess = null)
false
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Auth/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Broadcasting/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Bus/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Cache/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Collections/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Conditionable/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Config/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Console/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Container/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Contracts/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Cookie/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Database/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Encryption/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Events/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Filesystem/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Hashing/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Http/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Log/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Macroable/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Mail/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Notifications/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Pagination/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Pipeline/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Queue/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Redis/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Routing/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Session/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Support/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Testing/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Translation/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/Validation/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
d69867d97506597c6fdf4dbb552cf457e0095723.json
Add .gitattributes to components (#40733)
src/Illuminate/View/.gitattributes
@@ -0,0 +1,2 @@ +/.github export-ignore +.gitattributes export-ignore
true
Other
laravel
framework
56d433aaec40e8383f28e8f0e835cd977845fcde.json
fix breaking change
src/Illuminate/Queue/QueueServiceProvider.php
@@ -235,7 +235,8 @@ protected function registerFailedJobServices() $this->app->singleton('queue.failer', function ($app) { $config = $app['config']['queue.failed']; - if (! isset($config['driver']) || $config['driver'] === 'null') { + if (array_key_exists('driver', $config) && + (is_null($config['driver']) || $config['driver'] === 'null')) { return new NullFailedJobProvider; }
false
Other
laravel
framework
b12f44c37bc057e98757743cd67ba47e934dac2a.json
return collection (#40699)
src/Illuminate/Support/Stringable.php
@@ -779,11 +779,11 @@ public function ucfirst() /** * Split a string by uppercase characters. * - * @return array + * @return \Illuminate\Support\Collection */ public function ucsplit() { - return Str::ucsplit($this->value); + return collect(Str::ucsplit($this->value)); } /**
false
Other
laravel
framework
498fdd2b40644bb48529c2530978555cf4b0766c.json
return array from ucsplit (#40694)
src/Illuminate/Support/Stringable.php
@@ -779,11 +779,11 @@ public function ucfirst() /** * Split a string by uppercase characters. * - * @return static + * @return array */ public function ucsplit() { - return new static(Str::ucsplit($this->value)); + return Str::ucsplit($this->value); } /**
false
Other
laravel
framework
f64cfa3f2ee711606723e6018e343eb2c39368cb.json
Fix conflict (#40619)
src/Illuminate/Auth/Access/Gate.php
@@ -239,7 +239,7 @@ public function resource($name, $class, array $abilities = null) protected function buildAbilityCallback($ability, $callback) { return function () use ($ability, $callback) { - if (Str::contains($callback, '@')) { + if (str_contains($callback, '@')) { [$class, $method] = Str::parseCallback($callback); } else { $class = $callback;
true