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
a7a0c65b3d2ee1eae68d3d7e749ba41aba7caa72.json
Apply fixes from StyleCI (#27127)
tests/Integration/Cache/DynamoDbStoreTest.php
@@ -2,9 +2,7 @@ namespace Illuminate\Tests\Integration\Cache; -use Memcached; use Illuminate\Support\Str; -use Illuminate\Support\Carbon; use Orchestra\Testbench\TestCase; use Illuminate\Support\Facades\Cache;
true
Other
laravel
framework
5475631046088ff7fe5c5f8e5c83fe54f9c84893.json
Add Test for removeColumn
tests/Database/DatabaseSchemaBlueprintTest.php
@@ -134,4 +134,19 @@ public function testUnsignedDecimalTable() $blueprint = clone $base; $this->assertEquals(['alter table `users` add `money` decimal(10, 2) unsigned not null'], $blueprint->toSql($connection, new MySqlGrammar)); } + + public function testRemoveColumn() + { + $base = new Blueprint('users', function ($table) { + $table->string('foo'); + $table->string('remove_this'); + $table->removeColumn('remove_this'); + }); + + $connection = m::mock(Connection::class); + + $blueprint = clone $base; + + $this->assertEquals(['alter table `users` add `foo` varchar(255) not null'], $blueprint->toSql($connection, new MySqlGrammar)); + } }
false
Other
laravel
framework
be70858192281f00006adc1a76c5e136476063f4.json
Stop email re-verification with same link If a user reopen the given email verification link, the `email_verified_at` column is being updated. While in should not be updated when the email is verified before (by same provided link).
src/Illuminate/Foundation/Auth/VerifiesEmails.php
@@ -35,7 +35,7 @@ public function verify(Request $request) if ($request->route('id') != $request->user()->getKey()) { throw new AuthorizationException; } - + if ($request->user()->hasVerifiedEmail()) { return redirect($this->redirectPath()); }
false
Other
laravel
framework
f7b6362c6e46e759859a048cef02ff59a172329b.json
Stop email reverification with same link If a user reopen the given email verification link, the `email_verified_at` column is being updated. While in should not be updated when the email is verified before (by same provided link).
src/Illuminate/Foundation/Auth/VerifiesEmails.php
@@ -35,6 +35,10 @@ public function verify(Request $request) if ($request->route('id') != $request->user()->getKey()) { throw new AuthorizationException; } + + if ($request->user()->hasVerifiedEmail()) { + return redirect($this->redirectPath()); + } if ($request->user()->markEmailAsVerified()) { event(new Verified($request->user()));
false
Other
laravel
framework
4c3b4664c1d860425d6d9d06d1bdd1eb009cdc73.json
Fix style ci
tests/Integration/Http/ResourceTest.php
@@ -695,7 +695,7 @@ public function work() 'id' => 1, 'title' => 'Test Title 1', ])); - + return $this->filter([ new MergeValue($postResource), 'user' => 'test user',
false
Other
laravel
framework
e5bf6463cf3debfed29efe879a7a4ff3455cc1f9.json
Add 'deprecated' docblock to 'defer' property
src/Illuminate/Support/ServiceProvider.php
@@ -17,6 +17,8 @@ abstract class ServiceProvider /** * Indicates if loading of the provider is deferred. * + * @deprecated 5.8 Implement the \Illuminate\Contracts\Support\Deferred interface instead. + * * @var bool */ protected $defer = false;
false
Other
laravel
framework
36f7df7d589d095cea44d856a597e44d8eeccdf6.json
Add Deferred interface for service providers
src/Illuminate/Contracts/Support/Deferred.php
@@ -0,0 +1,13 @@ +<?php + +namespace Illuminate\Contracts\Support; + +interface Deferred +{ + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides(); +}
true
Other
laravel
framework
36f7df7d589d095cea44d856a597e44d8eeccdf6.json
Add Deferred interface for service providers
src/Illuminate/Support/ServiceProvider.php
@@ -3,6 +3,7 @@ namespace Illuminate\Support; use Illuminate\Console\Application as Artisan; +use Illuminate\Contracts\Support\Deferred; abstract class ServiceProvider { @@ -297,6 +298,6 @@ public function when() */ public function isDeferred() { - return $this->defer; + return $this->defer || $this instanceof Deferred; } }
true
Other
laravel
framework
14b1b506d3cb14bf7aa70e8134f32416c9ef0f0f.json
Add original parameters to Route
src/Illuminate/Routing/Route.php
@@ -98,6 +98,13 @@ class Route */ public $compiled; + /** + * The matched parameters' original state. + * + * @var array + */ + protected $originalParameters; + /** * The router instance used by the route. * @@ -300,6 +307,8 @@ public function bind(Request $request) $this->parameters = (new RouteParameterBinder($this)) ->parameters($request); + $this->originalParameters = $this->parameters; + return $this; } @@ -340,6 +349,18 @@ public function parameter($name, $default = null) return Arr::get($this->parameters(), $name, $default); } + /** + * Get original value of a given parameter from the route. + * + * @param string $name + * @param mixed $default + * @return string|object + */ + public function originalParameter($name, $default = null) + { + return Arr::get($this->originalParameters(), $name, $default); + } + /** * Set a parameter to the given value. * @@ -383,6 +404,22 @@ public function parameters() throw new LogicException('Route is not bound.'); } + /** + * Get the key / value list of original parameters for the route. + * + * @return array + * + * @throws \LogicException + */ + public function originalParameters() + { + if (isset($this->originalParameters)) { + return $this->originalParameters; + } + + throw new LogicException('Route is not bound.'); + } + /** * Get the key / value list of parameters without null values. *
false
Other
laravel
framework
50a69b7a5e94ea187a4c689087e659d85eedb456.json
Introduce restoreLock function
src/Illuminate/Cache/MemcachedStore.php
@@ -198,6 +198,18 @@ public function lock($name, $seconds = 0, $owner = null) return new MemcachedLock($this->memcached, $this->prefix.$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); + } + /** * Remove an item from the cache. *
true
Other
laravel
framework
50a69b7a5e94ea187a4c689087e659d85eedb456.json
Introduce restoreLock function
src/Illuminate/Cache/RedisStore.php
@@ -178,6 +178,18 @@ public function lock($name, $seconds = 0, $owner = null) return new RedisLock($this->connection(), $this->prefix.$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); + } + /** * Remove an item from the cache. *
true
Other
laravel
framework
50a69b7a5e94ea187a4c689087e659d85eedb456.json
Introduce restoreLock function
src/Illuminate/Contracts/Cache/LockProvider.php
@@ -9,7 +9,17 @@ interface LockProvider * * @param string $name * @param int $seconds + * @param string|null $owner * @return \Illuminate\Contracts\Cache\Lock */ - public function lock($name, $seconds = 0); + public function lock($name, $seconds = 0, $owner = null); + + /** + * Restore a lock instance using the owner identifier. + * + * @param string $name + * @param string $owner + * @return \Illuminate\Contracts\Cache\Lock + */ + public function restoreLock($name, $owner); }
true
Other
laravel
framework
50a69b7a5e94ea187a4c689087e659d85eedb456.json
Introduce restoreLock function
tests/Integration/Cache/MemcachedCacheLockTest.php
@@ -105,7 +105,7 @@ public function test_memcached_locks_can_be_released_using_owner_token() $this->assertTrue($firstLock->get()); $owner = $firstLock->getOwner(); - $secondLock = Cache::store('memcached')->lock('foo', 10, $owner); + $secondLock = Cache::store('memcached')->restoreLock('foo', $owner); $secondLock->release(); $this->assertTrue(Cache::store('memcached')->lock('foo')->get());
true
Other
laravel
framework
50a69b7a5e94ea187a4c689087e659d85eedb456.json
Introduce restoreLock function
tests/Integration/Cache/RedisCacheLockTest.php
@@ -80,7 +80,7 @@ public function test_redis_locks_can_be_released_using_owner_token() $this->assertTrue($firstLock->get()); $owner = $firstLock->getOwner(); - $secondLock = Cache::store('redis')->lock('foo', 10, $owner); + $secondLock = Cache::store('redis')->restoreLock('foo', $owner); $secondLock->release(); $this->assertTrue(Cache::store('redis')->lock('foo')->get());
true
Other
laravel
framework
8c7e45305c2f83089b2a47f63d95e051531a1221.json
Write the dotenv to stderr rather than stdout
src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php
@@ -6,6 +6,7 @@ use Dotenv\Exception\InvalidFileException; use Symfony\Component\Console\Input\ArgvInput; use Illuminate\Contracts\Foundation\Application; +use Symfony\Component\Console\Output\ConsoleOutput; class LoadEnvironmentVariables { @@ -26,8 +27,7 @@ public function bootstrap(Application $app) try { Dotenv::create($app->environmentPath(), $app->environmentFile())->safeLoad(); } catch (InvalidFileException $e) { - echo 'The environment file is invalid: '.$e->getMessage(); - die(1); + $this->writeErrorAndDie($e); } } @@ -73,4 +73,20 @@ protected function setEnvironmentFilePath($app, $file) return false; } + + /** + * Write the error information to the screen and exit. + * + * @param \Dotenv\Exception\InvalidFileException $e + * @return void + */ + protected function writeErrorAndDie(InvalidFileException $e) + { + $output = (new ConsoleOutput())->getErrorOutput(); + + $output->writeln('The environment file is invalid!'); + $output->writeln($e->getMessage()); + + die(1); + } }
false
Other
laravel
framework
ab06a52f31f40583bf831ef8402b072c41f6c38f.json
Apply fixes from StyleCI (#27033)
src/Illuminate/Console/Command.php
@@ -243,7 +243,7 @@ protected function context() 'no-ansi', 'no-interaction', 'quiet', - 'verbose' + 'verbose', ]))->mapWithKeys(function ($value, $key) { return ["--{$key}" => $value]; })->filter()->all();
false
Other
laravel
framework
0db883741e948c472d8b1fc8448658fad0587e9f.json
Apply fixes from StyleCI (#27011)
src/Illuminate/Console/Command.php
@@ -239,7 +239,7 @@ protected function createInputFromArguments(array $arguments) protected function context() { $options = Arr::only($this->option(), ['no-interaction', 'ansi', 'no-ansi', 'quiet', 'verbose']); - + collect($options)->mapWithKeys(function ($value, $key) { return ["--{$key}" => $value]; })->all();
false
Other
laravel
framework
54f002434adc0f800d500c204aa0f524fc7a96ea.json
remove brittle message check
src/Illuminate/Database/Query/Builder.php
@@ -1793,8 +1793,9 @@ public function orHavingRaw($sql, array $bindings = []) public function orderBy($column, $direction = 'asc') { $direction = strtolower($direction); + if (! in_array($direction, ['asc', 'desc'], true)) { - throw new InvalidArgumentException('Invalid value of direction.'); + throw new InvalidArgumentException('Order direction must be "asc" or "desc".'); } $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [
true
Other
laravel
framework
54f002434adc0f800d500c204aa0f524fc7a96ea.json
remove brittle message check
tests/Database/DatabaseQueryBuilderTest.php
@@ -985,7 +985,6 @@ public function testOrderBys() public function testOrderByInvalidDirectionParam() { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Invalid value of direction.'); $builder = $this->getBuilder(); $builder->select('*')->from('users')->orderBy('age', 'asec');
true
Other
laravel
framework
6bbb0bc1f41cd35bb82dae5e28ca24853311f9e3.json
fix style in orderBy
src/Illuminate/Database/Query/Builder.php
@@ -1792,7 +1792,7 @@ public function orHavingRaw($sql, array $bindings = []) */ public function orderBy($column, $direction = 'asc') { - if (!in_array(strtolower($direction), ['asc', 'desc'], true)) { + if (! in_array(strtolower($direction), ['asc', 'desc'], true)) { throw new InvalidArgumentException('Invalid value of direction.'); }
false
Other
laravel
framework
87cf8f1b38b6e9c3e99048e0956b5f622434d0d9.json
Fix style ci
tests/Support/SupportCollectionTest.php
@@ -558,7 +558,7 @@ public function testWhereNotBetween() $c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]); $this->assertEquals([['v' => 1]], $c->whereNotBetween('v', [2, 4])->values()->all()); - $this->assertEquals([['v' => 2], ['v' => 3], ['v' => 3], ['v' => 4] ], $c->whereNotBetween('v', [-1, 1])->values()->all()); + $this->assertEquals([['v' => 2], ['v' => 3], ['v' => 3], ['v' => 4]], $c->whereNotBetween('v', [-1, 1])->values()->all()); $this->assertEquals([['v' => 1], ['v' => '2'], ['v' => '4']], $c->whereNotBetween('v', [3, 3])->values()->all()); }
false
Other
laravel
framework
1663b4ff2b1a530ec6002f1467d1541b8b0d732c.json
Add whereNotBetween method to Collection object
src/Illuminate/Support/Collection.php
@@ -690,6 +690,20 @@ public function whereBetween($key, $values) return $this->where($key, '>=', reset($values))->where($key, '<=', end($values)); } + /** + * Filter items where the given key not between values. + * + * @param string $key + * @param array $values + * @return static + */ + public function whereNotBetween($key, $values) + { + return $this->filter(function ($item) use ($key, $values) { + return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values); + }); + } + /** * Filter items by the given key value pair. *
true
Other
laravel
framework
1663b4ff2b1a530ec6002f1467d1541b8b0d732c.json
Add whereNotBetween method to Collection object
tests/Support/SupportCollectionTest.php
@@ -553,6 +553,15 @@ public function testBetween() $this->assertEquals([['v' => 3], ['v' => '3']], $c->whereBetween('v', [3, 3])->values()->all()); } + public function testWhereNotBetween() + { + $c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]); + + $this->assertEquals([['v' => 1]], $c->whereNotBetween('v', [2, 4])->values()->all()); + $this->assertEquals([['v' => 2], ['v' => 3], ['v' => 3], ['v' => 4] ], $c->whereNotBetween('v', [-1, 1])->values()->all()); + $this->assertEquals([['v' => 1], ['v' => '2'], ['v' => '4']], $c->whereNotBetween('v', [3, 3])->values()->all()); + } + public function testFlatten() { // Flat arrays are unaffected
true
Other
laravel
framework
66d8568d3dd69e468abaaf66d58018c15d0b4dda.json
Apply fixes from StyleCI (#27027)
src/Illuminate/Database/Eloquent/Builder.php
@@ -853,7 +853,7 @@ public function decrement($column, $amount = 1, array $extra = []) */ protected function addUpdatedAtColumn(array $values) { - if (! $this->model->usesTimestamps() || + if (! $this->model->usesTimestamps() || is_null($this->model->getUpdatedAtColumn())) { return $values; }
false
Other
laravel
framework
09f9596a482a8789ecfa5b04de6e8d609b903251.json
Remove duplicate code
src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php
@@ -310,21 +310,6 @@ protected function setForeignAttributesForCreate(Model $model) $model->setAttribute($this->getForeignKeyName(), $this->getParentKey()); } - /** - * Perform an update on all the related models. - * - * @param array $attributes - * @return int - */ - public function update(array $attributes) - { - if ($this->related->usesTimestamps() && ! is_null($this->relatedUpdatedAt())) { - $attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestampString(); - } - - return $this->query->update($attributes); - } - /** * Add the constraints for a relationship query. *
true
Other
laravel
framework
09f9596a482a8789ecfa5b04de6e8d609b903251.json
Remove duplicate code
tests/Database/DatabaseEloquentHasManyTest.php
@@ -163,27 +163,6 @@ public function testUpdateOrCreateMethodCreatesNewModelWithForeignKeySet() $this->assertInstanceOf(Model::class, $relation->updateOrCreate(['foo'], ['bar'])); } - public function testUpdateMethodUpdatesModelsWithTimestamps() - { - $relation = $this->getRelation(); - $relation->getRelated()->shouldReceive('usesTimestamps')->once()->andReturn(true); - $relation->getRelated()->shouldReceive('freshTimestampString')->once()->andReturn(100); - $relation->getRelated()->shouldReceive('getUpdatedAtColumn')->andReturn('updated_at'); - $relation->getQuery()->shouldReceive('update')->once()->with(['foo' => 'bar', 'updated_at' => 100])->andReturn('results'); - - $this->assertEquals('results', $relation->update(['foo' => 'bar'])); - } - - public function testUpdateMethodUpdatesModelsWithNullUpdatedAt() - { - $relation = $this->getRelation(); - $relation->getRelated()->shouldReceive('usesTimestamps')->once()->andReturn(true); - $relation->getRelated()->shouldReceive('getUpdatedAtColumn')->andReturn(null); - $relation->getQuery()->shouldReceive('update')->once()->with(['foo' => 'bar'])->andReturn('results'); - - $this->assertEquals('results', $relation->update(['foo' => 'bar'])); - } - public function testRelationIsProperlyInitialized() { $relation = $this->getRelation();
true
Other
laravel
framework
09f9596a482a8789ecfa5b04de6e8d609b903251.json
Remove duplicate code
tests/Database/DatabaseEloquentHasOneTest.php
@@ -129,27 +129,6 @@ public function testCreateMethodProperlyCreatesNewModel() $this->assertEquals($created, $relation->create(['name' => 'taylor'])); } - public function testUpdateMethodUpdatesModelsWithTimestamps() - { - $relation = $this->getRelation(); - $relation->getRelated()->shouldReceive('usesTimestamps')->once()->andReturn(true); - $relation->getRelated()->shouldReceive('freshTimestampString')->once()->andReturn(100); - $relation->getRelated()->shouldReceive('getUpdatedAtColumn')->andReturn('updated_at'); - $relation->getQuery()->shouldReceive('update')->once()->with(['foo' => 'bar', 'updated_at' => 100])->andReturn('results'); - - $this->assertEquals('results', $relation->update(['foo' => 'bar'])); - } - - public function testUpdateMethodUpdatesModelsWithNullUpdatedAt() - { - $relation = $this->getRelation(); - $relation->getRelated()->shouldReceive('usesTimestamps')->once()->andReturn(true); - $relation->getRelated()->shouldReceive('getUpdatedAtColumn')->andReturn(null); - $relation->getQuery()->shouldReceive('update')->once()->with(['foo' => 'bar'])->andReturn('results'); - - $this->assertEquals('results', $relation->update(['foo' => 'bar'])); - } - public function testRelationIsProperlyInitialized() { $relation = $this->getRelation();
true
Other
laravel
framework
e1e4c0ddaaef1fb9af117b877eb408fd9b5fa784.json
Fix broken db command code
src/Illuminate/Database/Console/Migrations/FreshCommand.php
@@ -47,13 +47,13 @@ public function handle() $this->info('Dropped all tables successfully.'); - $this->call('migrate', [ + $this->call('migrate', array_filter([ '--database' => $database, '--path' => $this->input->getOption('path'), '--realpath' => $this->input->getOption('realpath'), '--force' => true, '--step' => $this->option('step'), - ]); + ])); if ($this->needsSeeding()) { $this->runSeeder($database); @@ -104,11 +104,11 @@ protected function needsSeeding() */ protected function runSeeder($database) { - $this->call('db:seed', [ + $this->call('db:seed', array_filter([ '--database' => $database, '--class' => $this->option('seeder') ?: 'DatabaseSeeder', - '--force' => $this->option('force'), - ]); + '--force' => true, + ])); } /**
true
Other
laravel
framework
e1e4c0ddaaef1fb9af117b877eb408fd9b5fa784.json
Fix broken db command code
src/Illuminate/Database/Console/Migrations/MigrateCommand.php
@@ -89,9 +89,9 @@ protected function prepareDatabase() $this->migrator->setConnection($this->option('database')); if (! $this->migrator->repositoryExists()) { - $this->call( - 'migrate:install', ['--database' => $this->option('database')] - ); + $this->call('migrate:install', array_filter([ + '--database' => $this->option('database'), + ])); } } }
true
Other
laravel
framework
e1e4c0ddaaef1fb9af117b877eb408fd9b5fa784.json
Fix broken db command code
src/Illuminate/Database/Console/Migrations/RefreshCommand.php
@@ -42,28 +42,26 @@ public function handle() $path = $this->input->getOption('path'); - $force = $this->input->getOption('force'); - // If the "step" option is specified it means we only want to rollback a small // number of migrations before migrating again. For example, the user might // only rollback and remigrate the latest four migrations instead of all. $step = $this->input->getOption('step') ?: 0; if ($step > 0) { - $this->runRollback($database, $path, $step, $force); + $this->runRollback($database, $path, $step); } else { - $this->runReset($database, $path, $force); + $this->runReset($database, $path); } // The refresh command is essentially just a brief aggregate of a few other of // the migration commands and just provides a convenient wrapper to execute // them in succession. We'll also see if we need to re-seed the database. - $this->call('migrate', [ + $this->call('migrate', array_filter([ '--database' => $database, '--path' => $path, '--realpath' => $this->input->getOption('realpath'), - '--force' => $force, - ]); + '--force' => true, + ])); if ($this->needsSeeding()) { $this->runSeeder($database); @@ -75,37 +73,35 @@ public function handle() * * @param string $database * @param string $path - * @param bool $step - * @param bool $force + * @param int $step * @return void */ - protected function runRollback($database, $path, $step, $force) + protected function runRollback($database, $path, $step) { - $this->call('migrate:rollback', [ + $this->call('migrate:rollback', array_filter([ '--database' => $database, '--path' => $path, '--realpath' => $this->input->getOption('realpath'), '--step' => $step, - '--force' => $force, - ]); + '--force' => true, + ])); } /** * Run the reset command. * * @param string $database * @param string $path - * @param bool $force * @return void */ - protected function runReset($database, $path, $force) + protected function runReset($database, $path) { - $this->call('migrate:reset', [ + $this->call('migrate:reset', array_filter([ '--database' => $database, '--path' => $path, '--realpath' => $this->input->getOption('realpath'), - '--force' => $force, - ]); + '--force' => true, + ])); } /** @@ -126,11 +122,11 @@ protected function needsSeeding() */ protected function runSeeder($database) { - $this->call('db:seed', [ + $this->call('db:seed', array_filter([ '--database' => $database, '--class' => $this->option('seeder') ?: 'DatabaseSeeder', - '--force' => $this->option('force'), - ]); + '--force' => true, + ])); } /**
true
Other
laravel
framework
e1e4c0ddaaef1fb9af117b877eb408fd9b5fa784.json
Fix broken db command code
tests/Database/DatabaseMigrationMigrateCommandTest.php
@@ -45,7 +45,7 @@ public function testMigrationRepositoryCreatedWhenNecessary() $migrator->shouldReceive('setOutput')->once()->andReturn($migrator); $migrator->shouldReceive('run')->once()->with([__DIR__.DIRECTORY_SEPARATOR.'migrations'], ['pretend' => false, 'step' => false]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(false); - $command->expects($this->once())->method('call')->with($this->equalTo('migrate:install'), $this->equalTo(['--database' => null])); + $command->expects($this->once())->method('call')->with($this->equalTo('migrate:install'), $this->equalTo([])); $this->runCommand($command); }
true
Other
laravel
framework
e1e4c0ddaaef1fb9af117b877eb408fd9b5fa784.json
Fix broken db command code
tests/Database/DatabaseMigrationRefreshCommandTest.php
@@ -38,8 +38,8 @@ public function testRefreshCommandCallsCommandsWithProperArguments() $console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand); $quote = DIRECTORY_SEPARATOR == '\\' ? '"' : "'"; - $resetCommand->shouldReceive('run')->with(new InputMatcher("--database --path --realpath --force {$quote}migrate:reset{$quote}"), m::any()); - $migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --path --realpath --force migrate'), m::any()); + $resetCommand->shouldReceive('run')->with(new InputMatcher("--force=1 {$quote}migrate:reset{$quote}"), m::any()); + $migrateCommand->shouldReceive('run')->with(new InputMatcher('--force=1 migrate'), m::any()); $this->runCommand($command); } @@ -61,8 +61,8 @@ public function testRefreshCommandCallsCommandsWithStep() $console->shouldReceive('find')->with('migrate')->andReturn($migrateCommand); $quote = DIRECTORY_SEPARATOR == '\\' ? '"' : "'"; - $rollbackCommand->shouldReceive('run')->with(new InputMatcher("--database --path --realpath --step=2 --force {$quote}migrate:rollback{$quote}"), m::any()); - $migrateCommand->shouldReceive('run')->with(new InputMatcher('--database --path --realpath --force migrate'), m::any()); + $rollbackCommand->shouldReceive('run')->with(new InputMatcher("--step=2 --force=1 {$quote}migrate:rollback{$quote}"), m::any()); + $migrateCommand->shouldReceive('run')->with(new InputMatcher('--force=1 migrate'), m::any()); $this->runCommand($command, ['--step' => 2]); }
true
Other
laravel
framework
8f2aeb345a4ce88f0515ae0bdef477d40380f17e.json
Use the Str::lower method directly
src/Illuminate/Support/Str.php
@@ -428,7 +428,7 @@ public static function slug($title, $separator = '-', $language = 'en') $title = str_replace('@', $separator.'at'.$separator, $title); // Remove all characters that are not the separator, letters, numbers, or whitespace. - $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title)); + $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', static::lower($title)); // Replace all separator characters and whitespace by a single separator $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);
false
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/401.blade.php
@@ -1,11 +1,5 @@ -@extends('errors::illustrated-layout') +@extends('errors::minimal') -@section('code', '401') @section('title', __('Unauthorized')) - -@section('image') -<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> -</div> -@endsection - -@section('message', __('Sorry, you are not authorized to access this page.')) +@section('code', '401') +@section('message', __('Unauthorized'))
true
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/403.blade.php
@@ -1,11 +1,5 @@ -@extends('errors::illustrated-layout') +@extends('errors::minimal') -@section('code', '403') @section('title', __('Forbidden')) - -@section('image') -<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> -</div> -@endsection - -@section('message', __($exception->getMessage() ?: __('Sorry, you are forbidden from accessing this page.'))) +@section('code', '403') +@section('message', __('Forbidden'))
true
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/404.blade.php
@@ -1,11 +1,5 @@ -@extends('errors::illustrated-layout') +@extends('errors::minimal') +@section('title', __('Not Found')) @section('code', '404') -@section('title', __('Page Not Found')) - -@section('image') -<div style="background-image: url({{ asset('/svg/404.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> -</div> -@endsection - -@section('message', __('Sorry, the page you are looking for could not be found.')) +@section('message', __('Not Found'))
true
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/419.blade.php
@@ -1,11 +1,5 @@ -@extends('errors::illustrated-layout') +@extends('errors::minimal') -@section('code', '419') @section('title', __('Page Expired')) - -@section('image') -<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> -</div> -@endsection - -@section('message', __('Sorry, your session has expired. Please refresh and try again.')) +@section('code', '419') +@section('message', __('Page Expired'))
true
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/429.blade.php
@@ -1,11 +1,5 @@ -@extends('errors::illustrated-layout') +@extends('errors::minimal') -@section('code', '429') @section('title', __('Too Many Requests')) - -@section('image') -<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> -</div> -@endsection - -@section('message', __('Sorry, you are making too many requests to our servers.')) +@section('code', '429') +@section('message', __('Too Many Requests'))
true
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/500.blade.php
@@ -1,11 +1,5 @@ -@extends('errors::illustrated-layout') +@extends('errors::minimal') +@section('title', __('Server Error')) @section('code', '500') -@section('title', __('Error')) - -@section('image') -<div style="background-image: url({{ asset('/svg/500.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> -</div> -@endsection - -@section('message', __('Whoops, something went wrong on our servers.')) +@section('message', __('Server Error'))
true
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/503.blade.php
@@ -1,11 +1,5 @@ -@extends('errors::illustrated-layout') +@extends('errors::minimal') -@section('code', '503') @section('title', __('Service Unavailable')) - -@section('image') -<div style="background-image: url({{ asset('/svg/503.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center"> -</div> -@endsection - -@section('message', __($exception->getMessage() ?: __('Sorry, we are doing some maintenance. Please check back soon.'))) +@section('code', '503') +@section('message', __('Service Unavailable'))
true
Other
laravel
framework
83ca9a7706a8091de9da17cb687a0852c9ef1960.json
use minimal error layout
src/Illuminate/Foundation/Exceptions/views/minimal.blade.php
@@ -0,0 +1,62 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <title>@yield('title')</title> + + <!-- Fonts --> + <link rel="dns-prefetch" href="//fonts.gstatic.com"> + <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> + + <!-- Styles --> + <style> + html, body { + background-color: #fff; + color: #636b6f; + font-family: 'Nunito', sans-serif; + font-weight: 100; + height: 100vh; + margin: 0; + } + + .full-height { + height: 100vh; + } + + .flex-center { + align-items: center; + display: flex; + justify-content: center; + } + + .position-ref { + position: relative; + } + + .code { + border-right: 2px solid; + font-size: 26px; + padding: 0 15px 0 15px; + text-align: center; + } + + .message { + font-size: 18px; + text-align: center; + } + </style> + </head> + <body> + <div class="flex-center position-ref full-height"> + <div class="code"> + @yield('code') + </div> + + <div class="message" style="padding: 10px;"> + @yield('message') + </div> + </div> + </body> +</html>
true
Other
laravel
framework
b81c4cef61996a579ee172c3fefe4f6ec663bb19.json
Replace deprecated phpunit methods
tests/Database/DatabaseEloquentModelTest.php
@@ -732,7 +732,7 @@ public function testToArray() $model->setRelation('multi', new BaseCollection); $array = $model->toArray(); - $this->assertInternalType('array', $array); + $this->assertIsArray($array); $this->assertEquals('foo', $array['name']); $this->assertEquals('baz', $array['names'][0]['bar']); $this->assertEquals('boom', $array['names'][1]['bam']); @@ -1521,8 +1521,8 @@ public function testModelAttributesAreCastedWhenPresentInCastsArray() $this->assertInternalType('boolean', $model->boolAttribute); $this->assertInternalType('boolean', $model->booleanAttribute); $this->assertInternalType('object', $model->objectAttribute); - $this->assertInternalType('array', $model->arrayAttribute); - $this->assertInternalType('array', $model->jsonAttribute); + $this->assertIsArray($model->arrayAttribute); + $this->assertIsArray($model->jsonAttribute); $this->assertTrue($model->boolAttribute); $this->assertFalse($model->booleanAttribute); $this->assertEquals($obj, $model->objectAttribute); @@ -1542,8 +1542,8 @@ public function testModelAttributesAreCastedWhenPresentInCastsArray() $this->assertInternalType('boolean', $arr['boolAttribute']); $this->assertInternalType('boolean', $arr['booleanAttribute']); $this->assertInternalType('object', $arr['objectAttribute']); - $this->assertInternalType('array', $arr['arrayAttribute']); - $this->assertInternalType('array', $arr['jsonAttribute']); + $this->assertIsArray($arr['arrayAttribute']); + $this->assertIsArray($arr['jsonAttribute']); $this->assertTrue($arr['boolAttribute']); $this->assertFalse($arr['booleanAttribute']); $this->assertEquals($obj, $arr['objectAttribute']);
true
Other
laravel
framework
b81c4cef61996a579ee172c3fefe4f6ec663bb19.json
Replace deprecated phpunit methods
tests/Http/HttpMimeTypeTest.php
@@ -29,7 +29,7 @@ public function testMimeTypeFromExtensionExistsFalse() public function testGetAllMimeTypes() { - $this->assertInternalType('array', MimeType::get()); + $this->assertIsArray(MimeType::get()); $this->assertArraySubset(['jpg' => 'image/jpeg'], MimeType::get()); }
true
Other
laravel
framework
b81c4cef61996a579ee172c3fefe4f6ec663bb19.json
Replace deprecated phpunit methods
tests/Mail/MailableQueuedTest.php
@@ -49,7 +49,7 @@ public function testQueuedMailableWithAttachmentSent() $mailable = new MailableQueableStub; $attachmentOption = ['mime' => 'image/jpeg', 'as' => 'bar.jpg']; $mailable->attach('foo.jpg', $attachmentOption); - $this->assertInternalType('array', $mailable->attachments); + $this->assertIsArray($mailable->attachments); $this->assertCount(1, $mailable->attachments); $this->assertEquals($mailable->attachments[0]['options'], $attachmentOption); $queueFake->assertNothingPushed(); @@ -80,7 +80,7 @@ public function testQueuedMailableWithAttachmentFromDiskSent() $mailable->attachFromStorage('/', 'foo.jpg', $attachmentOption); - $this->assertInternalType('array', $mailable->diskAttachments); + $this->assertIsArray($mailable->diskAttachments); $this->assertCount(1, $mailable->diskAttachments); $this->assertEquals($mailable->diskAttachments[0]['options'], $attachmentOption);
true
Other
laravel
framework
b81c4cef61996a579ee172c3fefe4f6ec663bb19.json
Replace deprecated phpunit methods
tests/Routing/RoutingRouteTest.php
@@ -309,7 +309,7 @@ public function testRouteGetAction() return 'foo'; })->name('foo'); - $this->assertInternalType('array', $route->getAction()); + $this->assertIsArray($route->getAction()); $this->assertArrayHasKey('as', $route->getAction()); $this->assertEquals('foo', $route->getAction('as')); $this->assertNull($route->getAction('unknown_property'));
true
Other
laravel
framework
b81c4cef61996a579ee172c3fefe4f6ec663bb19.json
Replace deprecated phpunit methods
tests/Support/SupportArrTest.php
@@ -436,31 +436,31 @@ public function testRandom() $this->assertContains($random, ['foo', 'bar', 'baz']); $random = Arr::random(['foo', 'bar', 'baz'], 0); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(0, $random); $random = Arr::random(['foo', 'bar', 'baz'], 1); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(1, $random); $this->assertContains($random[0], ['foo', 'bar', 'baz']); $random = Arr::random(['foo', 'bar', 'baz'], 2); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(2, $random); $this->assertContains($random[0], ['foo', 'bar', 'baz']); $this->assertContains($random[1], ['foo', 'bar', 'baz']); $random = Arr::random(['foo', 'bar', 'baz'], '0'); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(0, $random); $random = Arr::random(['foo', 'bar', 'baz'], '1'); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(1, $random); $this->assertContains($random[0], ['foo', 'bar', 'baz']); $random = Arr::random(['foo', 'bar', 'baz'], '2'); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(2, $random); $this->assertContains($random[0], ['foo', 'bar', 'baz']); $this->assertContains($random[1], ['foo', 'bar', 'baz']); @@ -469,11 +469,11 @@ public function testRandom() public function testRandomOnEmptyArray() { $random = Arr::random([], 0); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(0, $random); $random = Arr::random([], '0'); - $this->assertInternalType('array', $random); + $this->assertIsArray($random); $this->assertCount(0, $random); }
true
Other
laravel
framework
b81c4cef61996a579ee172c3fefe4f6ec663bb19.json
Replace deprecated phpunit methods
tests/Support/SupportCollectionTest.php
@@ -1453,7 +1453,7 @@ public function testMapToDictionary() $this->assertInstanceOf(Collection::class, $groups); $this->assertEquals(['A' => [1], 'B' => [2, 4], 'C' => [3]], $groups->toArray()); - $this->assertInternalType('array', $groups['A']); + $this->assertIsArray($groups['A']); } public function testMapToDictionaryWithNumericKeys()
true
Other
laravel
framework
b310b1ec45d0097ac1cee30b26c7bdd2e139090d.json
use arr class
src/Illuminate/Filesystem/FilesystemAdapter.php
@@ -4,6 +4,7 @@ use RuntimeException; use Illuminate\Http\File; +use Illuminate\Support\Arr; use Illuminate\Support\Str; use InvalidArgumentException; use Illuminate\Support\Carbon; @@ -55,7 +56,7 @@ public function __construct(FilesystemInterface $driver) */ public function assertExists($path) { - $paths = array_wrap($path); + $paths = Arr::wrap($path); foreach ($paths as $path) { PHPUnit::assertTrue( @@ -74,7 +75,7 @@ public function assertExists($path) */ public function assertMissing($path) { - $paths = array_wrap($path); + $paths = Arr::wrap($path); foreach ($paths as $path) { PHPUnit::assertFalse(
false
Other
laravel
framework
7c699802c00e798f8f9f2874d19eea6e4ea0124c.json
Fix tests for windows environments
tests/Integration/Mail/RenderingMailWithLocaleTest.php
@@ -31,14 +31,14 @@ public function testMailableRendersInDefaultLocale() { $mail = new RenderedTestMail; - $this->assertEquals("name\n", $mail->render()); + $this->assertEquals('name'.PHP_EOL, $mail->render()); } public function testMailableRendersInSelectedLocale() { $mail = (new RenderedTestMail)->locale('es'); - $this->assertEquals("nombre\n", $mail->render()); + $this->assertEquals('nombre'.PHP_EOL, $mail->render()); } public function testMailableRendersInAppSelectedLocale() @@ -47,7 +47,7 @@ public function testMailableRendersInAppSelectedLocale() $mail = new RenderedTestMail; - $this->assertEquals("nombre\n", $mail->render()); + $this->assertEquals('nombre'.PHP_EOL, $mail->render()); } }
false
Other
laravel
framework
627ce3458eeaa02e47793756cbf4e9498648e8cf.json
Remove sudo configuration from Travis CI This will became not available in the future: https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration
.travis.yml
@@ -18,8 +18,6 @@ matrix: - php: 7.3 env: setup=lowest -sudo: false - cache: directories: - $HOME/.composer/cache
false
Other
laravel
framework
6fad0fbe62235a070d1ed7248c73bfbc11932656.json
Use Ubuntu 16.04
.travis.yml
@@ -1,3 +1,4 @@ +dist: xenial language: php env:
false
Other
laravel
framework
c7cbd6d24443d7da7fc81ec56935f21b40f45229.json
Add method 'isReleased' to queue job contract
src/Illuminate/Contracts/Queue/Job.php
@@ -33,6 +33,13 @@ public function fire(); */ public function release($delay = 0); + /** + * Determine if the job was released back into the queue. + * + * @return bool + */ + public function isReleased(); + /** * Delete the job from the queue. *
true
Other
laravel
framework
c7cbd6d24443d7da7fc81ec56935f21b40f45229.json
Add method 'isReleased' to queue job contract
tests/Queue/QueueWorkerTest.php
@@ -416,6 +416,11 @@ public function release($delay = 0) $this->releaseAfter = $delay; } + public function isReleased() + { + return $this->released; + } + public function isDeletedOrReleased() { return $this->deleted || $this->released;
true
Other
laravel
framework
2f01bd8862f8d65e49836a1039f668ee0aeb0e10.json
Add method 'hasFailed' to queue job contract
src/Illuminate/Contracts/Queue/Job.php
@@ -61,6 +61,13 @@ public function isDeletedOrReleased(); */ public function attempts(); + /** + * Determine if the job has been marked as a failure. + * + * @return bool + */ + public function hasFailed(); + /** * Mark the job as "failed". *
true
Other
laravel
framework
2f01bd8862f8d65e49836a1039f668ee0aeb0e10.json
Add method 'hasFailed' to queue job contract
tests/Queue/QueueWorkerTest.php
@@ -438,6 +438,11 @@ public function failed($e) $this->failedWith = $e; } + public function hasFailed() + { + return $this->failed; + } + public function getName() { return 'WorkerFakeJob';
true
Other
laravel
framework
a31bb681c53fe9f0b9eec68afbaff903691a625c.json
Add method 'markAsFailed' to queue job contract
src/Illuminate/Contracts/Queue/Job.php
@@ -61,6 +61,13 @@ public function isDeletedOrReleased(); */ public function attempts(); + /** + * Mark the job as "failed". + * + * @return void + */ + public function markAsFailed(); + /** * Process an exception that caused the job to fail. *
true
Other
laravel
framework
a31bb681c53fe9f0b9eec68afbaff903691a625c.json
Add method 'markAsFailed' to queue job contract
tests/Queue/QueueWorkerTest.php
@@ -426,6 +426,11 @@ public function attempts() return $this->attempts; } + public function markAsFailed() + { + $this->failed = true; + } + public function failed($e) { $this->markAsFailed();
true
Other
laravel
framework
fae67da8ad12017ac592c774fb88419d489ba816.json
Remove unnecessary code (#26903)
src/Illuminate/Database/Eloquent/Relations/BelongsTo.php
@@ -132,13 +132,6 @@ protected function getEagerModelKeys(array $models) } } - // If there are no keys that were not null we will just return an array with null - // so this query wont fail plus returns zero results, which should be what the - // developer expects to happen in this situation. Otherwise we'll sort them. - if (count($keys) === 0) { - return [null]; - } - sort($keys); return array_values(array_unique($keys));
true
Other
laravel
framework
fae67da8ad12017ac592c774fb88419d489ba816.json
Remove unnecessary code (#26903)
tests/Database/DatabaseEloquentBelongsToTest.php
@@ -160,15 +160,15 @@ public function testDefaultEagerConstraintsWhenIncrementing() $relation = $this->getRelation(); $relation->getRelated()->shouldReceive('getKeyName')->andReturn('id'); $relation->getRelated()->shouldReceive('getKeyType')->andReturn('int'); - $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', m::mustBe([null])); + $relation->getQuery()->shouldReceive('whereIntegerInRaw')->once()->with('relation.id', m::mustBe([])); $models = [new MissingEloquentBelongsToModelStub, new MissingEloquentBelongsToModelStub]; $relation->addEagerConstraints($models); } public function testDefaultEagerConstraintsWhenIncrementingAndNonIntKeyType() { $relation = $this->getRelation(null, false, 'string'); - $relation->getQuery()->shouldReceive('whereIn')->once()->with('relation.id', m::mustBe([null])); + $relation->getQuery()->shouldReceive('whereIn')->once()->with('relation.id', m::mustBe([])); $models = [new MissingEloquentBelongsToModelStub, new MissingEloquentBelongsToModelStub]; $relation->addEagerConstraints($models); } @@ -177,7 +177,7 @@ public function testDefaultEagerConstraintsWhenNotIncrementing() { $relation = $this->getRelation(null, false); $relation->getRelated()->shouldReceive('getKeyName')->andReturn('id'); - $relation->getQuery()->shouldReceive('whereIn')->once()->with('relation.id', m::mustBe([null])); + $relation->getQuery()->shouldReceive('whereIn')->once()->with('relation.id', m::mustBe([])); $models = [new MissingEloquentBelongsToModelStub, new MissingEloquentBelongsToModelStub]; $relation->addEagerConstraints($models); }
true
Other
laravel
framework
3913c10a54a967d1a6b4e0fc3b162da4054121fb.json
Fix doc-blocks (#26869)
src/Illuminate/Translation/Translator.php
@@ -94,7 +94,7 @@ public function has($key, $locale = null, $fallback = true) * @param string $key * @param array $replace * @param string $locale - * @return string|array|null + * @return string|array */ public function trans($key, array $replace = [], $locale = null) { @@ -108,7 +108,7 @@ public function trans($key, array $replace = [], $locale = null) * @param array $replace * @param string|null $locale * @param bool $fallback - * @return string|array|null + * @return string|array */ public function get($key, array $replace = [], $locale = null, $fallback = true) { @@ -144,7 +144,7 @@ public function get($key, array $replace = [], $locale = null, $fallback = true) * @param string $key * @param array $replace * @param string $locale - * @return string|array|null + * @return string|array */ public function getFromJson($key, array $replace = [], $locale = null) {
false
Other
laravel
framework
d4de66f78e30519cf5f03e177efc8fb25c2e26bd.json
Fix container docblock (#26856)
src/Illuminate/Container/Container.php
@@ -602,6 +602,8 @@ public function makeWith($abstract, array $parameters = []) * @param string $abstract * @param array $parameters * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function make($abstract, array $parameters = []) { @@ -630,6 +632,8 @@ public function get($id) * @param string $abstract * @param array $parameters * @return mixed + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function resolve($abstract, $parameters = []) { @@ -816,6 +820,8 @@ public function build($concrete) * * @param array $dependencies * @return array + * + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function resolveDependencies(array $dependencies) {
false
Other
laravel
framework
9aea079a6c6ed15dd5f764d05dd75c7325fdd50f.json
remove extra alias the `Swift_SendmailTransport` is aliased to both `MailTransport` and `SendmailTransport`. We can have both the 'mail' and 'sendmail' drivers build up the same class, and remove the need for the extra alias. I think this also makes it more obvious to the reader that the 'mail' driver doesn't really exist anymore and is actually using sendmail.
src/Illuminate/Mail/TransportManager.php
@@ -11,7 +11,6 @@ use Illuminate\Mail\Transport\LogTransport; use Illuminate\Mail\Transport\SesTransport; use Illuminate\Mail\Transport\ArrayTransport; -use Swift_SendmailTransport as MailTransport; use Illuminate\Mail\Transport\MailgunTransport; use Illuminate\Mail\Transport\MandrillTransport; use Illuminate\Mail\Transport\SparkPostTransport; @@ -105,7 +104,7 @@ protected function addSesCredentials(array $config) */ protected function createMailDriver() { - return new MailTransport; + return new SendmailTransport; } /**
false
Other
laravel
framework
4dd5ff245b9c7ac93816adb1e6e577cb9cac0204.json
Update docblock with correct spacing
src/Illuminate/Validation/Concerns/ReplacesAttributes.php
@@ -473,10 +473,10 @@ protected function replaceDimensions($message, $attribute, $rule, $parameters) /** * Replace all place-holders for the starts_with rule. * - * @param string $message - * @param string $attribute - * @param string $rule - * @param array $parameters + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters * @return string */ protected function replaceStartsWith($message, $attribute, $rule, $parameters)
false
Other
laravel
framework
f5f900b2bac0b14c4256dcf8beb28f0450531bd5.json
Apply fixes from StyleCI (#26835)
tests/Console/ConsoleEventSchedulerTest.php
@@ -6,7 +6,6 @@ use Illuminate\Console\Command; use PHPUnit\Framework\TestCase; use Illuminate\Container\Container; -use Illuminate\Config\Repository as Config; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\EventMutex; use Illuminate\Console\Scheduling\CacheEventMutex;
false
Other
laravel
framework
ddd7e2e26edc19cd45d83d9b48832f8165297607.json
Fix typehint in auth stub (#26830) * Fix typehint in auth stub * Update HomeController.stub
src/Illuminate/Auth/Console/stubs/make/controllers/HomeController.stub
@@ -19,7 +19,7 @@ class HomeController extends Controller /** * Show the application dashboard. * - * @return \Illuminate\Http\Response + * @return \Illuminate\Contracts\Support\Renderable */ public function index() {
false
Other
laravel
framework
ab50ddc42ce8177cbce03d43cbe22b7f9445326e.json
Improve comments (#26804)
src/Illuminate/Database/Eloquent/Builder.php
@@ -1114,9 +1114,9 @@ protected function parseWithRelations(array $relations) $results = []; foreach ($relations as $name => $constraints) { - // If the "relation" value is actually a numeric key, we can assume that no - // constraints have been specified for the eager load and we'll just put - // an empty Closure with the loader so that we can treat all the same. + // If the "name" value is a numeric key, we can assume that no + // constraints have been specified. We'll just put an empty + // Closure there, so that we can treat them all the same. if (is_numeric($name)) { $name = $constraints; @@ -1127,9 +1127,9 @@ protected function parseWithRelations(array $relations) }]; } - // We need to separate out any nested includes. Which allows the developers + // We need to separate out any nested includes, which allows the developers // to load deep relationships using "dots" without stating each level of - // the relationship with its own key in the array of eager load names. + // the relationship with its own key in the array of eager-load names. $results = $this->addNestedWiths($name, $results); $results[$name] = $constraints;
false
Other
laravel
framework
0f9886d0cb17c9d756068e09743f871003cf1b45.json
Fix hidden commands
src/Illuminate/Console/Command.php
@@ -116,6 +116,14 @@ public function __construct() } } + /** + * {@inheritdoc} + */ + public function isHidden() + { + return $this->hidden; + } + /** * Configure the console command using a fluent definition. *
false
Other
laravel
framework
49dad6f80092711af5e72a04c0f480feadd26a91.json
Use two spaces for DocBlock params
src/Illuminate/Database/Query/Grammars/Grammar.php
@@ -795,7 +795,7 @@ public function compileInsertGetId(Builder $query, $values, $sequence) * Compile an insert statement with subquery into SQL. * * @param \Illuminate\Database\Query\Builder $query - * @param array $columns + * @param array $columns * @param string $sql * @return string */
false
Other
laravel
framework
d5d50a85262480feeff29de00bcc68a08dc883a1.json
Allow 7.3 failures (#26739)
.travis.yml
@@ -16,8 +16,6 @@ matrix: - php: 7.3 - php: 7.3 env: setup=lowest - allow_failures: - - php: 7.3 sudo: false
false
Other
laravel
framework
da09db73f3c3b4ecf788870896d84c73cd574107.json
add return type into phpDoc
src/Illuminate/Database/Query/Builder.php
@@ -2563,6 +2563,7 @@ public function insertGetId(array $values, $sequence = null) * * @param array $columns * @param \Closure|\Illuminate\Database\Query\Builder|string $query + * @return bool */ public function insertSub(array $columns, $query) {
false
Other
laravel
framework
d50b93d7d1e18fafe7b99c03206d5c4c989f74bb.json
add implementation of Builder::insertSub()
src/Illuminate/Database/Query/Builder.php
@@ -2566,6 +2566,12 @@ public function insertGetId(array $values, $sequence = null) */ public function insertSub(array $columns, $query) { + [$sql, $bindings] = $this->createSub($query); + + return $this->connection->insert( + $this->grammar->compileInsertSub($this, $columns, $sql), + $this->cleanBindings($bindings) + ); } /**
true
Other
laravel
framework
d50b93d7d1e18fafe7b99c03206d5c4c989f74bb.json
add implementation of Builder::insertSub()
src/Illuminate/Database/Query/Grammars/Grammar.php
@@ -791,6 +791,15 @@ public function compileInsertGetId(Builder $query, $values, $sequence) return $this->compileInsert($query, $values); } + public function compileInsertSub(Builder $query, array $columns, string $sql) + { + $table = $this->wrapTable($query->from); + + $columns_string = $this->columnize($columns); + + return "insert into $table ($columns_string) $sql"; + } + /** * Compile an update statement into SQL. *
true
Other
laravel
framework
d50b93d7d1e18fafe7b99c03206d5c4c989f74bb.json
add implementation of Builder::insertSub()
tests/Database/DatabaseQueryBuilderTest.php
@@ -1678,11 +1678,11 @@ public function testInsertMethod() public function testInsertSubMethod() { $builder = $this->getBuilder(); - $builder->getConnection()->shouldReceive('insert')->once()->with('insert into "users" ("email") select "address" from "emails" where "created_at" > ?', ['2018-01-01'])->andReturn(true); - $result = $builder->from('users')->insertSub( - ['email'], + $builder->getConnection()->shouldReceive('insert')->once()->with('insert into "table1" ("foo") select "bar" from "table2" where "foreign_id" = ?', [5])->andReturn(true); + $result = $builder->from('table1')->insertSub( + ['foo'], function (Builder $query) { - $query->from('emails')->select(['address'])->where('created_at', '>', '2018-01-01'); + $query->select(['bar'])->from('table2')->where('foreign_id', '=', 5); } ); $this->assertTrue($result);
true
Other
laravel
framework
cf188c7fb6cadbd53c3971f56e6fd3252281d87e.json
Fix return type in Cache contract
src/Illuminate/Cache/RedisTaggedCache.php
@@ -23,13 +23,13 @@ class RedisTaggedCache extends TaggedCache * @param string $key * @param mixed $value * @param \DateTime|float|int|null $minutes - * @return void + * @return bool */ public function put($key, $value, $minutes = null) { $this->pushStandardKeys($this->tags->getNamespace(), $key); - parent::put($key, $value, $minutes); + return parent::put($key, $value, $minutes); } /** @@ -65,13 +65,13 @@ public function decrement($key, $value = 1) * * @param string $key * @param mixed $value - * @return void + * @return bool */ public function forever($key, $value) { $this->pushForeverKeys($this->tags->getNamespace(), $key); - parent::forever($key, $value); + return parent::forever($key, $value); } /**
true
Other
laravel
framework
cf188c7fb6cadbd53c3971f56e6fd3252281d87e.json
Fix return type in Cache contract
src/Illuminate/Contracts/Cache/Repository.php
@@ -39,7 +39,7 @@ public function pull($key, $default = null); * @param string $key * @param mixed $value * @param \DateTimeInterface|\DateInterval|float|int $minutes - * @return void + * @return bool */ public function put($key, $value, $minutes); @@ -76,7 +76,7 @@ public function decrement($key, $value = 1); * * @param string $key * @param mixed $value - * @return void + * @return bool */ public function forever($key, $value);
true
Other
laravel
framework
7f0b1836a93b7b7ffe285bd8e46b5159fbc62b43.json
Add TestResponse to return type (#26722) It can both return a Response or TestResponse based on the return type.
src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
@@ -434,7 +434,7 @@ protected function extractFilesFromDataArray(&$data) * Follow a redirect chain until a non-redirect is received. * * @param \Illuminate\Http\Response $response - * @return \Illuminate\Http\Response + * @return \Illuminate\Http\Response|\Illuminate\Foundation\Testing\TestResponse */ protected function followRedirects($response) {
false
Other
laravel
framework
2b9e8215a460f406c691fd25d172d4dcd436d3f3.json
Use Str::random instead of uniqid
src/Illuminate/Cache/Lock.php
@@ -5,6 +5,7 @@ use Illuminate\Support\InteractsWithTime; use Illuminate\Contracts\Cache\Lock as LockContract; use Illuminate\Contracts\Cache\LockTimeoutException; +use Illuminate\Support\Str; abstract class Lock implements LockContract { @@ -123,7 +124,7 @@ public function block($seconds, $callback = null) */ public function safe() { - return $this->scoped(uniqid()); + return $this->scoped(Str::random()); } /**
false
Other
laravel
framework
28b8cb91251f0643f2aa61072c0554edeabce21b.json
Add option for scoped Cache locks Before this change out of order releases of the same cache lock could lead to situation where client A acquired the lock, took longer than the timeout, which made client B successfully acquire the lock. If A now finishes while B is still holding the lock A will release the lock that does not belong to it. This fix introduces a unique value that is written as the cache value to stop A from deleting B's lock.
src/Illuminate/Cache/Lock.php
@@ -24,6 +24,13 @@ abstract class Lock implements LockContract */ protected $seconds; + /** + * A (usually) random string that acts as scope identifier of this lock. + * + * @var string + */ + protected $scope; + /** * Create a new lock instance. * @@ -51,6 +58,13 @@ abstract public function acquire(); */ abstract public function release(); + /** + * Returns the value written into the driver for this lock. + * + * @return mixed + */ + abstract protected function getValue(); + /** * Attempt to acquire the lock. * @@ -101,4 +115,61 @@ public function block($seconds, $callback = null) return true; } + + /** + * Secures this lock against out of order releases of expired clients. + * + * @return Lock + */ + public function safe() + { + return $this->scoped(uniqid()); + } + + /** + * Secures this lock against out of order releases of expired clients. + * + * @param string $scope + * @return Lock + */ + public function scoped($scope) + { + $this->scope = $scope; + + return $this; + } + + /** + * Determines whether this is a client scoped lock. + * + * @return bool + */ + protected function isScoped() + { + return ! is_null($this->scope); + } + + /** + * Returns the value that should be written into the cache. + * + * @return mixed + */ + protected function value() + { + return $this->isScoped() ? serialize($this->scope) : 1; + } + + /** + * Determines whether this lock is allowed to release the lock in the driver. + * + * @return bool + */ + protected function canRelease() + { + if (! $this->isScoped()) { + return true; + } + + return unserialize($this->getValue()) === $this->scope; + } }
true
Other
laravel
framework
28b8cb91251f0643f2aa61072c0554edeabce21b.json
Add option for scoped Cache locks Before this change out of order releases of the same cache lock could lead to situation where client A acquired the lock, took longer than the timeout, which made client B successfully acquire the lock. If A now finishes while B is still holding the lock A will release the lock that does not belong to it. This fix introduces a unique value that is written as the cache value to stop A from deleting B's lock.
src/Illuminate/Cache/MemcachedLock.php
@@ -34,7 +34,7 @@ public function __construct($memcached, $name, $seconds) public function acquire() { return $this->memcached->add( - $this->name, 1, $this->seconds + $this->name, $this->value(), $this->seconds ); } @@ -45,6 +45,18 @@ public function acquire() */ public function release() { - $this->memcached->delete($this->name); + if ($this->canRelease()) { + $this->memcached->delete($this->name); + } + } + + /** + * Returns the value written into the driver for this lock. + * + * @return mixed + */ + protected function getValue() + { + return $this->memcached->get($this->name); } }
true
Other
laravel
framework
28b8cb91251f0643f2aa61072c0554edeabce21b.json
Add option for scoped Cache locks Before this change out of order releases of the same cache lock could lead to situation where client A acquired the lock, took longer than the timeout, which made client B successfully acquire the lock. If A now finishes while B is still holding the lock A will release the lock that does not belong to it. This fix introduces a unique value that is written as the cache value to stop A from deleting B's lock.
src/Illuminate/Cache/RedisLock.php
@@ -33,7 +33,7 @@ public function __construct($redis, $name, $seconds) */ public function acquire() { - $result = $this->redis->setnx($this->name, 1); + $result = $this->redis->setnx($this->name, $this->value()); if ($result === 1 && $this->seconds > 0) { $this->redis->expire($this->name, $this->seconds); @@ -49,6 +49,18 @@ public function acquire() */ public function release() { - $this->redis->del($this->name); + if ($this->canRelease()) { + $this->redis->del($this->name); + } + } + + /** + * Returns the value written into the driver for this lock. + * + * @return string + */ + protected function getValue() + { + return $this->redis->get($this->name); } }
true
Other
laravel
framework
28b8cb91251f0643f2aa61072c0554edeabce21b.json
Add option for scoped Cache locks Before this change out of order releases of the same cache lock could lead to situation where client A acquired the lock, took longer than the timeout, which made client B successfully acquire the lock. If A now finishes while B is still holding the lock A will release the lock that does not belong to it. This fix introduces a unique value that is written as the cache value to stop A from deleting B's lock.
src/Illuminate/Contracts/Cache/Lock.php
@@ -27,4 +27,11 @@ public function block($seconds, $callback = null); * @return void */ public function release(); + + /** + * Secures this lock against out of order releases of expired clients. + * + * @return mixed + */ + public function safe(); }
true
Other
laravel
framework
28b8cb91251f0643f2aa61072c0554edeabce21b.json
Add option for scoped Cache locks Before this change out of order releases of the same cache lock could lead to situation where client A acquired the lock, took longer than the timeout, which made client B successfully acquire the lock. If A now finishes while B is still holding the lock A will release the lock that does not belong to it. This fix introduces a unique value that is written as the cache value to stop A from deleting B's lock.
tests/Integration/Cache/MemcachedCacheLockTest.php
@@ -80,4 +80,45 @@ public function test_locks_throw_timeout_if_block_expires() return 'taylor'; })); } + + public function test_memcached_locks_are_released_safely() + { + Cache::store('memcached')->lock('bar')->release(); + + $firstLock = Cache::store('memcached')->lock('bar', 1)->safe(); + $this->assertTrue($firstLock->acquire()); + sleep(2); + + $secondLock = Cache::store('memcached')->lock('bar', 10)->safe(); + $this->assertTrue($secondLock->acquire()); + + $firstLock->release(); + + $this->assertTrue(Cache::store('memcached')->has('bar')); + } + + public function test_safe_memcached_locks_are_exclusive() + { + Cache::store('memcached')->lock('bar')->release(); + + $firstLock = Cache::store('memcached')->lock('bar', 10)->safe(); + $this->assertTrue($firstLock->acquire()); + + $secondLock = Cache::store('memcached')->lock('bar', 10)->safe(); + $this->assertFalse($secondLock->acquire()); + } + + public function test_safe_memcached_locks_can_be_released_by_original_owner() + { + Cache::store('memcached')->lock('bar')->release(); + + $firstLock = Cache::store('memcached')->lock('bar', 10)->safe(); + $this->assertTrue($firstLock->acquire()); + + $secondLock = Cache::store('memcached')->lock('bar', 10)->safe(); + $this->assertFalse($secondLock->acquire()); + + $firstLock->release(); + $this->assertFalse(Cache::store('memcached')->has('bar')); + } }
true
Other
laravel
framework
28b8cb91251f0643f2aa61072c0554edeabce21b.json
Add option for scoped Cache locks Before this change out of order releases of the same cache lock could lead to situation where client A acquired the lock, took longer than the timeout, which made client B successfully acquire the lock. If A now finishes while B is still holding the lock A will release the lock that does not belong to it. This fix introduces a unique value that is written as the cache value to stop A from deleting B's lock.
tests/Integration/Cache/RedisCacheLockTest.php
@@ -51,4 +51,45 @@ public function test_redis_locks_can_block_for_seconds() Cache::store('redis')->lock('foo')->release(); $this->assertTrue(Cache::store('redis')->lock('foo', 10)->block(1)); } + + public function test_redis_locks_are_released_safely() + { + Cache::store('redis')->lock('bar')->release(); + + $firstLock = Cache::store('redis')->lock('bar', 1)->safe(); + $this->assertTrue($firstLock->acquire()); + sleep(2); + + $secondLock = Cache::store('redis')->lock('bar', 10)->safe(); + $this->assertTrue($secondLock->acquire()); + + $firstLock->release(); + + $this->assertTrue(Cache::store('redis')->has('bar')); + } + + public function test_safe_redis_locks_are_exclusive() + { + Cache::store('redis')->lock('bar')->release(); + + $firstLock = Cache::store('redis')->lock('bar', 10)->safe(); + $this->assertTrue($firstLock->acquire()); + + $secondLock = Cache::store('redis')->lock('bar', 10)->safe(); + $this->assertFalse($secondLock->acquire()); + } + + public function test_safe_redis_locks_can_be_released_by_original_owner() + { + Cache::store('redis')->lock('bar')->release(); + + $firstLock = Cache::store('redis')->lock('bar', 10)->safe(); + $this->assertTrue($firstLock->acquire()); + + $secondLock = Cache::store('redis')->lock('bar', 10)->safe(); + $this->assertFalse($secondLock->acquire()); + + $firstLock->release(); + $this->assertFalse(Cache::store('redis')->has('bar')); + } }
true
Other
laravel
framework
76dd0c70cac9bdc575b1738fd6a3609a02c0ad51.json
Release cache lock if callback fails (#26654)
src/Illuminate/Cache/Lock.php
@@ -62,9 +62,11 @@ public function get($callback = null) $result = $this->acquire(); if ($result && is_callable($callback)) { - return tap($callback(), function () { + try { + return $callback(); + } finally { $this->release(); - }); + } } return $result;
false
Other
laravel
framework
a3965d1007f7493c3e31dc34af9a109408addaa4.json
Use FQCN in sync methods DocBlocks (#26639)
src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php
@@ -64,7 +64,7 @@ public function toggle($ids, $touch = true) /** * Sync the intermediate tables with a list of IDs without detaching. * - * @param \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|array|Model $ids + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids * @return array */ public function syncWithoutDetaching($ids) @@ -75,7 +75,7 @@ public function syncWithoutDetaching($ids) /** * Sync the intermediate tables with a list of IDs or collection of models. * - * @param \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection|array|Model $ids + * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids * @param bool $detaching * @return array */
false
Other
laravel
framework
f2e14602e9601e2ddce3d597a72a2bcfb445b587.json
Fix return type
src/Illuminate/Auth/Access/Gate.php
@@ -451,7 +451,7 @@ protected function callBeforeCallbacks($user, $ability, array $arguments) * @param string $ability * @param array $arguments * @param bool $result - * @return void + * @return bool|null */ protected function callAfterCallbacks($user, $ability, array $arguments, $result) {
false
Other
laravel
framework
1ca55a1e5c2c0d3ba853998f1781cfa23bb9a646.json
Add relationship getters (#26607)
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
@@ -1021,6 +1021,16 @@ public function getQualifiedRelatedPivotKeyName() return $this->table.'.'.$this->relatedPivotKey; } + /** + * Get the parent key for the relationship. + * + * @return string + */ + public function getParentKeyName() + { + return $this->parentKey; + } + /** * Get the fully qualified parent key name for the relation. * @@ -1031,6 +1041,16 @@ public function getQualifiedParentKeyName() return $this->parent->qualifyColumn($this->parentKey); } + /** + * Get the related key for the relationship. + * + * @return string + */ + public function getRelatedKeyName() + { + return $this->relatedKey; + } + /** * Get the intermediate table for the relationship. *
true
Other
laravel
framework
1ca55a1e5c2c0d3ba853998f1781cfa23bb9a646.json
Add relationship getters (#26607)
src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
@@ -536,6 +536,16 @@ public function getQualifiedFarKeyName() return $this->getQualifiedForeignKeyName(); } + /** + * Get the foreign key on the "through" model. + * + * @return string + */ + public function getFirstKeyName() + { + return $this->firstKey; + } + /** * Get the qualified foreign key on the "through" model. * @@ -546,6 +556,16 @@ public function getQualifiedFirstKeyName() return $this->throughParent->qualifyColumn($this->firstKey); } + /** + * Get the foreign key on the related model. + * + * @return string + */ + public function getForeignKeyName() + { + return $this->secondKey; + } + /** * Get the qualified foreign key on the related model. * @@ -556,6 +576,16 @@ public function getQualifiedForeignKeyName() return $this->related->qualifyColumn($this->secondKey); } + /** + * Get the local key on the far parent model. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } + /** * Get the qualified local key on the far parent model. * @@ -565,4 +595,14 @@ public function getQualifiedLocalKeyName() { return $this->farParent->qualifyColumn($this->localKey); } + + /** + * Get the local key on the intermediary model. + * + * @return string + */ + public function getSecondLocalKeyName() + { + return $this->secondLocalKey; + } }
true
Other
laravel
framework
1ca55a1e5c2c0d3ba853998f1781cfa23bb9a646.json
Add relationship getters (#26607)
src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php
@@ -422,4 +422,14 @@ public function getQualifiedForeignKeyName() { return $this->foreignKey; } + + /** + * Get the local key for the relationship. + * + * @return string + */ + public function getLocalKeyName() + { + return $this->localKey; + } }
true
Other
laravel
framework
1ca55a1e5c2c0d3ba853998f1781cfa23bb9a646.json
Add relationship getters (#26607)
src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
@@ -181,4 +181,14 @@ public function getMorphClass() { return $this->morphClass; } + + /** + * Get the indicator for a reverse relationship. + * + * @return bool + */ + public function getInverse() + { + return $this->inverse; + } }
true
Other
laravel
framework
5f6d9a431c4fcedcbae969ba95d266604be54060.json
add starts with validation (#26612)
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
@@ -1504,6 +1504,19 @@ public function validateSometimes() return true; } + /** + * Validate the attribute starts with a given substring. + * + * @param string $attribute + * @param mixed $value + * @param array $parameters + * @return bool + */ + public function validateStartsWith($attribute, $value, $parameters) + { + return Str::startsWith($value, $parameters); + } + /** * Validate that an attribute is a string. *
true
Other
laravel
framework
5f6d9a431c4fcedcbae969ba95d266604be54060.json
add starts with validation (#26612)
tests/Validation/ValidationValidatorTest.php
@@ -1198,6 +1198,21 @@ public function testValidateAccepted() $this->assertTrue($v->passes()); } + public function testValidateStartsWith() + { + $trans = $this->getIlluminateArrayTranslator(); + $v = new Validator($trans, ['x' => 'hello world'], ['x' => 'starts_with:hello']); + $this->assertTrue($v->passes()); + + $trans = $this->getIlluminateArrayTranslator(); + $v = new Validator($trans, ['x' => 'hello world'], ['x' => 'starts_with:world']); + $this->assertFalse($v->passes()); + + $trans = $this->getIlluminateArrayTranslator(); + $v = new Validator($trans, ['x' => 'hello world'], ['x' => 'starts_with:world,hello']); + $this->assertTrue($v->passes()); + } + public function testValidateString() { $trans = $this->getIlluminateArrayTranslator();
true
Other
laravel
framework
a64a900607f110bd365a0265dddd8278badfbed8.json
Fix duplicate validation issue (#26604) This will prevent validation from happening twice. Fixes https://github.com/laravel/framework/issues/25736
src/Illuminate/Foundation/Http/FormRequest.php
@@ -172,7 +172,7 @@ protected function failedAuthorization() */ public function validated() { - return $this->getValidatorInstance()->validate(); + return $this->getValidatorInstance()->validated(); } /**
true
Other
laravel
framework
a64a900607f110bd365a0265dddd8278badfbed8.json
Fix duplicate validation issue (#26604) This will prevent validation from happening twice. Fixes https://github.com/laravel/framework/issues/25736
src/Illuminate/Validation/Validator.php
@@ -315,6 +315,22 @@ public function validate() throw new ValidationException($this); } + return $this->validated(); + } + + /** + * Return validated value. + * + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validated() + { + if ($this->invalid()) { + throw new ValidationException($this); + } + $results = []; $missingValue = Str::random(10);
true
Other
laravel
framework
a64a900607f110bd365a0265dddd8278badfbed8.json
Fix duplicate validation issue (#26604) This will prevent validation from happening twice. Fixes https://github.com/laravel/framework/issues/25736
tests/Validation/ValidationValidatorTest.php
@@ -4265,6 +4265,37 @@ public function testValidateReturnsValidatedDataNestedArrayRules() $this->assertEquals(['nested' => [['bar' => 'baz'], ['bar' => 'baz2']]], $data); } + public function testValidateAndValidatedData() + { + $post = ['first' => 'john', 'preferred'=>'john', 'last' => 'doe', 'type' => 'admin']; + + $v = new Validator($this->getIlluminateArrayTranslator(), $post, ['first' => 'required', 'preferred'=> 'required']); + $v->sometimes('type', 'required', function () { + return false; + }); + $data = $v->validate(); + $validatedData = $v->validated(); + + $this->assertEquals(['first' => 'john', 'preferred' => 'john'], $data); + $this->assertEquals($data, $validatedData); + } + + public function testValidatedNotValidateTwiceData() + { + $post = ['first' => 'john', 'preferred'=>'john', 'last' => 'doe', 'type' => 'admin']; + + $validateCount = 0; + $v = new Validator($this->getIlluminateArrayTranslator(), $post, ['first' => 'required', 'preferred'=> 'required']); + $v->after(function () use (&$validateCount) { + $validateCount++; + }); + $data = $v->validate(); + $v->validated(); + + $this->assertEquals(['first' => 'john', 'preferred' => 'john'], $data); + $this->assertEquals(1, $validateCount); + } + /** * @dataProvider validUuidList */
true
Other
laravel
framework
ef89ad7dd1890206f2ab6f28ab6331619990edbc.json
Add date_equals validation message (#26584)
src/Illuminate/Validation/Concerns/ReplacesAttributes.php
@@ -434,6 +434,20 @@ protected function replaceAfterOrEqual($message, $attribute, $rule, $parameters) return $this->replaceBefore($message, $attribute, $rule, $parameters); } + /** + * Replace all place-holders for the date_equals rule. + * + * @param string $message + * @param string $attribute + * @param string $rule + * @param array $parameters + * @return string + */ + protected function replaceDateEquals($message, $attribute, $rule, $parameters) + { + return $this->replaceBefore($message, $attribute, $rule, $parameters); + } + /** * Replace all place-holders for the dimensions rule. *
false
Other
laravel
framework
19f2245c6d7c87daf784f94b169f0dd4d98f0ca4.json
use env super global
src/Illuminate/Foundation/Application.php
@@ -515,10 +515,11 @@ public function detectEnvironment(Closure $callback) */ public function runningInConsole() { - return env( - 'LARAVEL_RUNNING_IN_CONSOLE', - php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg' - ); + if (isset($_ENV['APP_RUNNING_IN_CONSOLE'])) { + return $_ENV['APP_RUNNING_IN_CONSOLE'] === 'true'; + } + + return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; } /**
false
Other
laravel
framework
a36906ab8a141f1f497a0667196935e41970ae51.json
add env override for running in console
src/Illuminate/Foundation/Application.php
@@ -515,7 +515,10 @@ public function detectEnvironment(Closure $callback) */ public function runningInConsole() { - return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; + return env( + 'LARAVEL_RUNNING_IN_CONSOLE', + php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg' + ); } /**
false
Other
laravel
framework
315c291b954c6bcd113d7fd3a66c3f9ce37d480d.json
Fix StyleCI failures
src/Illuminate/Foundation/Auth/VerifiesEmails.php
@@ -23,13 +23,13 @@ public function show(Request $request) : view('auth.verify'); } - /** - * Mark the authenticated user's email address as verified. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - * @throws AuthorizationException - */ + /** + * Mark the authenticated user's email address as verified. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + * @throws AuthorizationException + */ public function verify(Request $request) { if ($request->route('id') != $request->user()->getKey()) {
false
Other
laravel
framework
9a2912403435c0ffd6a8648dcbf84f9bccbb56f7.json
Move comment to correct line (#26520) The comment is meant for the if statement and not the dropStaleInstances call above it. Signed-off-by: Dries Vints <dries.vints@gmail.com>
src/Illuminate/Container/Container.php
@@ -221,11 +221,11 @@ public function isAlias($name) */ public function bind($abstract, $concrete = null, $shared = false) { + $this->dropStaleInstances($abstract); + // If no concrete type was given, we will simply set the concrete type to the // abstract type. After that, the concrete type to be registered as shared // without being forced to state their classes in both of the parameters. - $this->dropStaleInstances($abstract); - if (is_null($concrete)) { $concrete = $abstract; }
false