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
53f3a817ea90964688948ed144e8bdb686a3662f.json
Fix postgres grammar for nested json arrays.
tests/Database/DatabaseQueryBuilderTest.php
@@ -2625,6 +2625,10 @@ public function testPostgresWrappingJson() $builder->select('*')->from('users')->where('items->price->in_usd', '=', 1)->where('items->age', '=', 2); $this->assertSame('select * from "users" where "items"->\'price\'->>\'in_usd\' = ? and "items"->>\'age\' = ?', $builder->toSql()); + $builder = $this->getPostgresBuilder(); + $builder->select('*')->from('users')->where('items->prices->0', '=', 1)->where('items->age', '=', 2); + $this->assertSame('select * from "users" where "items"->\'prices\'->>0 = ? and "items"->>\'age\' = ?', $builder->toSql()); + $builder = $this->getPostgresBuilder(); $builder->select('*')->from('users')->where('items->available', '=', true); $this->assertSame('select * from "users" where ("items"->\'available\')::jsonb = \'true\'::jsonb', $builder->toSql());
true
Other
laravel
framework
2c32afbf5b2c6df43070257029178ef94a794157.json
Allow builder instance as subquery in where Use isQueryable-method instead of checking if column is Closure
src/Illuminate/Database/Query/Builder.php
@@ -658,7 +658,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' // If the column is a Closure instance and there is an operator value, we will // assume the developer wants to run a subquery and then compare the result // of that subquery with the given value that was provided to the method. - if ($column instanceof Closure && ! is_null($operator)) { + if ($this->isQueryable($column) && ! is_null($operator)) { [$sub, $bindings] = $this->createSub($column); return $this->addBinding($bindings, 'where')
true
Other
laravel
framework
2c32afbf5b2c6df43070257029178ef94a794157.json
Allow builder instance as subquery in where Use isQueryable-method instead of checking if column is Closure
tests/Integration/Database/QueryBuilderTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Integration\Database\EloquentBelongsToManyTest; +namespace Illuminate\Tests\Integration\Database; use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Database\Schema\Blueprint; @@ -102,6 +102,15 @@ public function testWhereValueSubQuery() $this->assertTrue(DB::table('posts')->where($subQuery, '!=', 'Does not match')->exists()); } + public function testWhereValueSubQueryBuilder() + { + $subQuery = DB::table('posts')->selectRaw("'Sub query value'"); + + $this->assertTrue(DB::table('posts')->where($subQuery, 'Sub query value')->exists()); + $this->assertFalse(DB::table('posts')->where($subQuery, 'Does not match')->exists()); + $this->assertTrue(DB::table('posts')->where($subQuery, '!=', 'Does not match')->exists()); + } + public function testWhereDate() { $this->assertSame(1, DB::table('posts')->whereDate('created_at', '2018-01-02')->count());
true
Other
laravel
framework
6aa3a468dab0f0ed93640221cc4a082176b95e7a.json
Simplify check for wildcard listeners (#31436)
src/Illuminate/Events/Dispatcher.php
@@ -117,13 +117,7 @@ public function hasListeners($eventName) */ public function hasWildcardListeners($eventName) { - foreach ($this->wildcards as $key => $listeners) { - if (Str::is($key, $eventName)) { - return true; - } - } - - return false; + return Str::is(array_keys($this->wildcards), $eventName); } /**
false
Other
laravel
framework
3cca78e9c1e26b694eb27f3d3ff522f2d6de1d98.json
Apply fixes from StyleCI (#31429)
src/Illuminate/Auth/AuthManager.php
@@ -4,9 +4,7 @@ use Closure; use Illuminate\Contracts\Auth\Factory as FactoryContract; -use Illuminate\Support\Str; use InvalidArgumentException; -use LogicException; class AuthManager implements FactoryContract {
true
Other
laravel
framework
3cca78e9c1e26b694eb27f3d3ff522f2d6de1d98.json
Apply fixes from StyleCI (#31429)
tests/Auth/AuthTokenGuardTest.php
@@ -2,12 +2,9 @@ namespace Illuminate\Tests\Auth; -use Illuminate\Auth\AuthManager; use Illuminate\Auth\TokenGuard; -use Illuminate\Container\Container; use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Http\Request; -use LogicException; use Mockery as m; use PHPUnit\Framework\TestCase;
true
Other
laravel
framework
dfff0dd133eff56b93dbc27f61f15fb4882fcfbc.json
allow colon as first separator
src/Illuminate/View/Compilers/ComponentTagCompiler.php
@@ -71,7 +71,7 @@ protected function compileOpeningTags(string $value) $pattern = "/ < \s* - x-([\w\-\:\.]*) + x[-\:]([\w\-\:\.]*) (?<attributes> (?: \s+ @@ -111,7 +111,7 @@ protected function compileSelfClosingTags(string $value) $pattern = "/ < \s* - x-([\w\-\:\.]*) + x[-\:]([\w\-\:\.]*) \s* (?<attributes> (?: @@ -223,7 +223,7 @@ protected function partitionDataAndAttributes($class, array $attributes) */ protected function compileClosingTags(string $value) { - return preg_replace("/<\/\s*x-[\w\-\:\.]*\s*>/", '@endcomponentClass', $value); + return preg_replace("/<\/\s*x[-\:][\w\-\:\.]*\s*>/", '@endcomponentClass', $value); } /**
true
Other
laravel
framework
dfff0dd133eff56b93dbc27f61f15fb4882fcfbc.json
allow colon as first separator
tests/View/Blade/BladeComponentTagCompilerTest.php
@@ -42,6 +42,14 @@ public function testColonNestedComponentParsing() <?php \$component->withAttributes([]); ?>@endcomponentClass", trim($result)); } + public function testColonStartingNestedComponentParsing() + { + $result = (new ComponentTagCompiler(['foo:alert' => TestAlertComponent::class]))->compileTags('<x:foo:alert></x-foo:alert>'); + + $this->assertEquals("@component('Illuminate\Tests\View\Blade\TestAlertComponent', []) +<?php \$component->withAttributes([]); ?>@endcomponentClass", trim($result)); + } + public function testSelfClosingComponentsCanBeCompiled() { $result = (new ComponentTagCompiler(['alert' => TestAlertComponent::class]))->compileTags('<div><x-alert/></div>');
true
Other
laravel
framework
763e0b24ba27f9d3afe1bfde3f368ac16be4cc94.json
use dots as folder separator
src/Illuminate/View/Compilers/ComponentTagCompiler.php
@@ -190,7 +190,7 @@ public function guessClassName(string $component) $componentPieces = array_map(function ($componentPiece) { return ucfirst(Str::camel($componentPiece)); - }, explode(':', $component)); + }, explode('.', $component)); return $namespace.'View\\Components\\'.implode('\\', $componentPieces); }
true
Other
laravel
framework
763e0b24ba27f9d3afe1bfde3f368ac16be4cc94.json
use dots as folder separator
tests/View/Blade/BladeComponentTagCompilerTest.php
@@ -72,7 +72,7 @@ public function testClassNamesCanBeGuessedWithNamespaces() $app->shouldReceive('getNamespace')->andReturn('App\\'); Container::setInstance($container); - $result = (new ComponentTagCompiler([]))->guessClassName('base:alert'); + $result = (new ComponentTagCompiler([]))->guessClassName('base.alert'); $this->assertEquals("App\View\Components\Base\Alert", trim($result));
true
Other
laravel
framework
ce6465dd5eeabaf4cbfc1c71cbec6178be6026d8.json
Apply fixes from StyleCI
src/Illuminate/Support/Testing/Fakes/BusFake.php
@@ -178,7 +178,8 @@ public function dispatched($command, $callback = null) * @param callable|null $callback * @return \Illuminate\Support\Collection */ - public function dispatchedAfterResponse(string $command, $callback = null) { + public function dispatchedAfterResponse(string $command, $callback = null) + { if (! $this->hasDispatchedAfterResponse($command)) { return collect(); }
false
Other
laravel
framework
95a8f05bb9b6769dfdad58eb550777b59f398b5b.json
Remove serializer option for now (#31417)
src/Illuminate/Redis/Connectors/PhpRedisConnector.php
@@ -98,10 +98,6 @@ protected function createClient(array $config) $client->setOption(Redis::OPT_READ_TIMEOUT, $config['read_timeout']); } - if (! empty($config['serializer'])) { - $client->setOption(Redis::OPT_SERIALIZER, $config['serializer']); - } - if (! empty($config['scan'])) { $client->setOption(Redis::OPT_SCAN, $config['scan']); } @@ -160,16 +156,12 @@ protected function createRedisClusterInstance(array $servers, array $options) $client->setOption(RedisCluster::OPT_PREFIX, $options['prefix']); } - if (! empty($options['serializer'])) { - $client->setOption(RedisCluster::OPT_SERIALIZER, $options['serializer']); - } - - if (! empty($config['scan'])) { - $client->setOption(RedisCluster::OPT_SCAN, $config['scan']); + if (! empty($options['scan'])) { + $client->setOption(RedisCluster::OPT_SCAN, $options['scan']); } - if (! empty($config['failover'])) { - $client->setOption(RedisCluster::OPT_SLAVE_FAILOVER, $config['failover']); + if (! empty($options['failover'])) { + $client->setOption(RedisCluster::OPT_SLAVE_FAILOVER, $options['failover']); } }); }
false
Other
laravel
framework
641972afcc9fa6ed9a36d27b280511ceac2ec506.json
change docblock on the dispatcher contact (#31399)
src/Illuminate/Contracts/Events/Dispatcher.php
@@ -8,7 +8,7 @@ interface Dispatcher * Register an event listener with the dispatcher. * * @param string|array $events - * @param mixed $listener + * @param \Closure|string $listener * @return void */ public function listen($events, $listener);
false
Other
laravel
framework
66f8086c920653111b232cf8e0a9036e9de8ebdf.json
allow colons in component names
src/Illuminate/View/Compilers/ComponentTagCompiler.php
@@ -71,7 +71,7 @@ protected function compileOpeningTags(string $value) $pattern = "/ < \s* - x-([\w\-]*) + x-([\w\-\:]*) (?<attributes> (?: \s+ @@ -111,7 +111,7 @@ protected function compileSelfClosingTags(string $value) $pattern = "/ < \s* - x-([\w\-]*) + x-([\w\-\:]*) \s* (?<attributes> (?: @@ -223,7 +223,7 @@ protected function partitionDataAndAttributes($class, array $attributes) */ protected function compileClosingTags(string $value) { - return preg_replace("/<\/\s*x-[\w\-]*\s*>/", '@endcomponentClass', $value); + return preg_replace("/<\/\s*x-[\w\-\:]*\s*>/", '@endcomponentClass', $value); } /**
false
Other
laravel
framework
4bf2b8aee7209e93ddc9ffae38f3d79ce3d288f3.json
update component stub
src/Illuminate/Foundation/Console/stubs/view-component.stub
@@ -19,10 +19,10 @@ class DummyClass extends Component /** * Get the view / contents that represent the component. * - * @return string + * @return \Illuminate\View\View|string */ - public function view() + public function render() { - return 'DummyView'; + return view('DummyView'); } }
false
Other
laravel
framework
b10ee6cc91a8e9f5edab9661fa48fb084f0e1ce6.json
add default link this matches the current link/target combo so users who do not update their `filesystems.php` config still get the same functionality.
src/Illuminate/Foundation/Console/StorageLinkCommand.php
@@ -27,7 +27,7 @@ class StorageLinkCommand extends Command */ public function handle() { - foreach ($this->laravel['config']['filesystems.links'] ?? [] as $link => $target) { + foreach ($this->laravel['config']['filesystems.links'] ?? [public_path('storage') => storage_path('app/public')] as $link => $target) { if (file_exists($link)) { $this->error("The [$link] link already exists."); } else {
false
Other
laravel
framework
e8f9bbebe96963cdb87d4be07c73ae15765614f9.json
Update ViewComponents to a subdirectory (#31336)
src/Illuminate/Foundation/Console/ComponentMakeCommand.php
@@ -104,7 +104,7 @@ protected function getStub() */ protected function getDefaultNamespace($rootNamespace) { - return $rootNamespace.'\ViewComponents'; + return $rootNamespace.'\View\Components'; } /**
true
Other
laravel
framework
e8f9bbebe96963cdb87d4be07c73ae15765614f9.json
Update ViewComponents to a subdirectory (#31336)
src/Illuminate/View/Compilers/BladeCompiler.php
@@ -525,8 +525,8 @@ public function check($name, ...$parameters) public function component($class, $alias = null, $prefix = '') { if (is_null($alias)) { - $alias = Str::contains($class, '\\ViewComponents\\') - ? collect(explode('\\', Str::after($class, '\\ViewComponents\\')))->map(function ($segment) { + $alias = Str::contains($class, '\\View\\Components\\') + ? collect(explode('\\', Str::after($class, '\\View\\Components\\')))->map(function ($segment) { return Str::kebab($segment); })->implode(':') : Str::kebab(class_basename($class));
true
Other
laravel
framework
e8f9bbebe96963cdb87d4be07c73ae15765614f9.json
Update ViewComponents to a subdirectory (#31336)
src/Illuminate/View/Compilers/ComponentTagCompiler.php
@@ -192,7 +192,7 @@ public function guessClassName(string $component) return ucfirst(Str::camel($componentPiece)); }, explode(':', $component)); - return $namespace.'ViewComponents\\'.implode('\\', $componentPieces); + return $namespace.'View\\Components\\'.implode('\\', $componentPieces); } /**
true
Other
laravel
framework
e8f9bbebe96963cdb87d4be07c73ae15765614f9.json
Update ViewComponents to a subdirectory (#31336)
tests/View/Blade/BladeComponentTagCompilerTest.php
@@ -41,7 +41,7 @@ public function testClassNamesCanBeGuessed() $result = (new ComponentTagCompiler([]))->guessClassName('alert'); - $this->assertEquals("App\ViewComponents\Alert", trim($result)); + $this->assertEquals("App\View\Components\Alert", trim($result)); Container::setInstance(null); } @@ -55,7 +55,7 @@ public function testClassNamesCanBeGuessedWithNamespaces() $result = (new ComponentTagCompiler([]))->guessClassName('base:alert'); - $this->assertEquals("App\ViewComponents\Base\Alert", trim($result)); + $this->assertEquals("App\View\Components\Base\Alert", trim($result)); Container::setInstance(null); }
true
Other
laravel
framework
e8f9bbebe96963cdb87d4be07c73ae15765614f9.json
Update ViewComponents to a subdirectory (#31336)
tests/View/ViewBladeCompilerTest.php
@@ -193,13 +193,13 @@ public function testComponentAliasesCanBeConventionallyDetermined() $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); - $compiler->component('App\ViewComponents\Forms\Input'); - $this->assertEquals(['forms:input' => 'App\ViewComponents\Forms\Input'], $compiler->getClassComponentAliases()); + $compiler->component('App\View\Components\Forms\Input'); + $this->assertEquals(['forms:input' => 'App\View\Components\Forms\Input'], $compiler->getClassComponentAliases()); $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); - $compiler->component('App\ViewComponents\Forms\Input', null, 'prefix'); - $this->assertEquals(['prefix-forms:input' => 'App\ViewComponents\Forms\Input'], $compiler->getClassComponentAliases()); + $compiler->component('App\View\Components\Forms\Input', null, 'prefix'); + $this->assertEquals(['prefix-forms:input' => 'App\View\Components\Forms\Input'], $compiler->getClassComponentAliases()); } protected function getFiles()
true
Other
laravel
framework
9cba528a36893789f88f7aff71cbf75ba6a56841.json
remove renderable from component
src/Illuminate/View/Component.php
@@ -4,14 +4,13 @@ use Closure; use Illuminate\Container\Container; -use Illuminate\Contracts\Support\Renderable; use Illuminate\Support\Facades\View; use Illuminate\Support\Str; use ReflectionClass; use ReflectionMethod; use ReflectionProperty; -abstract class Component implements Renderable +abstract class Component { /** * That properties / methods that should not be exposed to the component.
false
Other
laravel
framework
6f8b87eee17114f1cf0ff896db9fdcc31f0fc8f0.json
Add assertion with empty chain
src/Illuminate/Support/Testing/Fakes/QueueFake.php
@@ -94,6 +94,23 @@ public function assertPushedWithChain($job, $expectedChain = [], $callback = nul : $this->assertPushedWithChainOfClasses($job, $expectedChain, $callback); } + /** + * Assert if a job was pushed with empty chain based on a truth-test callback. + * + * @param string $job + * @param callable|null $callback + * @return void + */ + public function assertPushedWithEmptyChain($job, $callback = null) + { + PHPUnit::assertTrue( + $this->pushed($job, $callback)->isNotEmpty(), + "The expected [{$job}] job was not pushed." + ); + + $this->assertPushedWithChainOfClasses($job, [], $callback); + } + /** * Assert if a job was pushed with chained jobs based on a truth-test callback. *
true
Other
laravel
framework
6f8b87eee17114f1cf0ff896db9fdcc31f0fc8f0.json
Add assertion with empty chain
tests/Support/SupportTestingQueueFakeTest.php
@@ -138,6 +138,13 @@ public function testAssertPushedWithChainUsingClassesOrObjectsArray() ]); } + public function testAssertPushedWithEmptyChain() + { + $this->fake->push(new JobWithChainStub([])); + + $this->fake->assertPushedWithEmptyChain(JobWithChainStub::class); + } + public function testAssertPushedWithChainSameJobDifferentChains() { $this->fake->push(new JobWithChainStub([
true
Other
laravel
framework
05227c32f3ae4619d141b2cd5a4918cb13ad944b.json
add validate with bag method
src/Illuminate/Validation/Validator.php
@@ -377,6 +377,25 @@ public function validate() return $this->validated(); } + /** + * Run the validator's rules against its data. + * + * @param string $errorBag + * @return array + * + * @throws \Illuminate\Validation\ValidationException + */ + public function validateWithBag(string $errorBag) + { + try { + return $this->validate(); + } catch (ValidationException $e) { + $e->errorBag = $errorBag; + + throw $e; + } + } + /** * Get the attributes and values that were validated. *
false
Other
laravel
framework
464ddd66543d500efb63a6e52a5cffe7d5cabd9d.json
add doc block
src/Illuminate/Routing/Route.php
@@ -502,6 +502,12 @@ public function bindingFieldFor($parameter) return $this->bindingFields[$parameter] ?? null; } + /** + * Get the parent parameter of the given parameter. + * + * @param string $parameter + * @return string + */ public function parentOfParameter($parameter) { $key = array_search($parameter, array_keys($this->parameters));
false
Other
laravel
framework
fc3a5a9aefc9747c7921364a63a5e838ea174723.json
remove unused imports
tests/Integration/Database/MigrateWithRealpathTest.php
@@ -2,11 +2,6 @@ namespace Illuminate\Tests\Integration\Database; -use Illuminate\Database\Events\MigrationEnded; -use Illuminate\Database\Events\MigrationsEnded; -use Illuminate\Database\Events\MigrationsStarted; -use Illuminate\Database\Events\MigrationStarted; -use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Schema; class MigrateWithRealpathTest extends DatabaseTestCase
false
Other
laravel
framework
dba3cbecbc1d695bb87534c413f3966f06afc96e.json
add no migrations event
src/Illuminate/Database/Events/NoMigrations.php
@@ -0,0 +1,24 @@ +<?php + +namespace Illuminate\Database\Events; + +class NoMigrations +{ + /** + * The migration method that was called. + * + * @var string + */ + public $method; + + /** + * Create a new event instance. + * + * @param string $method + * @return void + */ + public function __construct($method) + { + $this->method = $method; + } +}
true
Other
laravel
framework
dba3cbecbc1d695bb87534c413f3966f06afc96e.json
add no migrations event
src/Illuminate/Database/Migrations/Migrator.php
@@ -9,6 +9,7 @@ use Illuminate\Database\Events\MigrationsEnded; use Illuminate\Database\Events\MigrationsStarted; use Illuminate\Database\Events\MigrationStarted; +use Illuminate\Database\Events\NoMigrations; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Arr; use Illuminate\Support\Collection; @@ -139,6 +140,8 @@ public function runPending(array $migrations, array $options = []) // aren't, we will just make a note of it to the developer so they're aware // that all of the migrations have been run against this database system. if (count($migrations) === 0) { + $this->fireMigrationEvent(new NoMigrations('up')); + $this->note('<info>Nothing to migrate.</info>'); return; @@ -221,6 +224,8 @@ public function rollback($paths = [], array $options = []) $migrations = $this->getMigrationsForRollback($options); if (count($migrations) === 0) { + $this->fireMigrationEvent(new NoMigrations('down')); + $this->note('<info>Nothing to rollback.</info>'); return [];
true
Other
laravel
framework
dba3cbecbc1d695bb87534c413f3966f06afc96e.json
add no migrations event
tests/Integration/Database/MigrateWithRealpathTest.php
@@ -40,27 +40,4 @@ public function testMigrationsHasTheMigratedTable() 'batch' => 1, ]); } - - public function testMigrationEventsAreFired() - { - Event::fake(); - - Event::listen(MigrationsStarted::class, function ($event) { - return $this->assertInstanceOf(MigrationsStarted::class, $event); - }); - - Event::listen(MigrationsEnded::class, function ($event) { - return $this->assertInstanceOf(MigrationsEnded::class, $event); - }); - - Event::listen(MigrationStarted::class, function ($event) { - return $this->assertInstanceOf(MigrationStarted::class, $event); - }); - - Event::listen(MigrationEnded::class, function ($event) { - return $this->assertInstanceOf(MigrationEnded::class, $event); - }); - - $this->artisan('migrate'); - } }
true
Other
laravel
framework
dba3cbecbc1d695bb87534c413f3966f06afc96e.json
add no migrations event
tests/Integration/Database/MigratorEventsTest.php
@@ -0,0 +1,71 @@ +<?php + +namespace Illuminate\Tests\Integration\Database; + +use Illuminate\Database\Events\MigrationEnded; +use Illuminate\Database\Events\MigrationsEnded; +use Illuminate\Database\Events\MigrationsStarted; +use Illuminate\Database\Events\MigrationStarted; +use Illuminate\Database\Events\NoMigrations; +use Illuminate\Database\Migrations\Migration; +use Illuminate\Support\Facades\Event; + +class MigratorEventsTest extends DatabaseTestCase +{ + protected function migrateOptions() + { + return [ + '--path' => realpath(__DIR__.'/stubs/'), + '--realpath' => true, + ]; + } + + public function testMigrationEventsAreFired() + { + Event::fake(); + + $this->artisan('migrate', $this->migrateOptions()); + $this->artisan('migrate:rollback', $this->migrateOptions()); + + Event::assertDispatched(MigrationsStarted::class, 2); + Event::assertDispatched(MigrationsEnded::class, 2); + Event::assertDispatched(MigrationStarted::class, 2); + Event::assertDispatched(MigrationEnded::class, 2); + } + + public function testMigrationEventsContainTheMigrationAndMethod() + { + Event::fake(); + + $this->artisan('migrate', $this->migrateOptions()); + $this->artisan('migrate:rollback', $this->migrateOptions()); + + Event::assertDispatched(MigrationStarted::class, function ($event) { + return $event->method == 'up' && $event->migration instanceof Migration; + }); + Event::assertDispatched(MigrationStarted::class, function ($event) { + return $event->method == 'down' && $event->migration instanceof Migration; + }); + Event::assertDispatched(MigrationEnded::class, function ($event) { + return $event->method == 'up' && $event->migration instanceof Migration; + }); + Event::assertDispatched(MigrationEnded::class, function ($event) { + return $event->method == 'down' && $event->migration instanceof Migration; + }); + } + + public function testTheNoMigrationEventIsFiredWhenNothingToMigrate() + { + Event::fake(); + + $this->artisan('migrate'); + $this->artisan('migrate:rollback'); + + Event::assertDispatched(NoMigrations::class, function ($event) { + return $event->method == 'up'; + }); + Event::assertDispatched(NoMigrations::class, function ($event) { + return $event->method == 'down'; + }); + } +}
true
Other
laravel
framework
6d9a0b1fc1be82a538e29f8a8ab17d4db69dc213.json
remove temporary variable (#31250)
src/Illuminate/View/Engines/CompilerEngine.php
@@ -61,12 +61,10 @@ public function get($path, array $data = []) $this->compiler->compile($path); } - $compiled = $this->compiler->getCompiledPath($path); - // Once we have the path to the compiled file, we will evaluate the paths with // typical PHP just like any other templates. We also keep a stack of views // which have been rendered for right exception messages to be generated. - $results = $this->evaluatePath($compiled, $data); + $results = $this->evaluatePath($this->compiler->getCompiledPath($path), $data); array_pop($this->lastCompiled);
false
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Auth/Access/HandlesAuthorization.php
@@ -19,7 +19,7 @@ protected function allow($message = null, $code = null) /** * Throws an unauthorized exception. * - * @param string $message + * @param string|null $message * @param mixed|null $code * @return \Illuminate\Auth\Access\Response */
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Cookie/CookieJar.php
@@ -118,7 +118,7 @@ public function hasQueued($key, $path = null) * * @param string $key * @param mixed $default - * @param string $path + * @param string|null $path * @return \Symfony\Component\HttpFoundation\Cookie */ public function queued($key, $default = null, $path = null)
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Database/Concerns/BuildsQueries.php
@@ -117,8 +117,8 @@ public function chunkById($count, callable $callback, $column = null, $alias = n * * @param callable $callback * @param int $count - * @param string $column - * @param string $alias + * @param string|null $column + * @param string|null $alias * @return bool */ public function eachById(callable $callback, $count = 1000, $column = null, $alias = null)
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Database/Eloquent/Builder.php
@@ -703,7 +703,7 @@ public function pluck($column, $key = null) /** * Paginate the given query. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page @@ -730,7 +730,7 @@ public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', /** * Paginate the given query into a simple paginator. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
@@ -48,8 +48,8 @@ trait HasRelationships * Define a one-to-one relationship. * * @param string $related - * @param string $foreignKey - * @param string $localKey + * @param string|null $foreignKey + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function hasOne($related, $foreignKey = null, $localKey = null) @@ -125,9 +125,9 @@ protected function newHasOneThrough(Builder $query, Model $farParent, Model $thr * * @param string $related * @param string $name - * @param string $type - * @param string $id - * @param string $localKey + * @param string|null $type + * @param string|null $id + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\MorphOne */ public function morphOne($related, $name, $type = null, $id = null, $localKey = null) @@ -162,9 +162,9 @@ protected function newMorphOne(Builder $query, Model $parent, $type, $id, $local * Define an inverse one-to-one or many relationship. * * @param string $related - * @param string $foreignKey - * @param string $ownerKey - * @param string $relation + * @param string|null $foreignKey + * @param string|null $ownerKey + * @param string|null $relation * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function belongsTo($related, $foreignKey = null, $ownerKey = null, $relation = null) @@ -213,10 +213,10 @@ protected function newBelongsTo(Builder $query, Model $child, $foreignKey, $owne /** * Define a polymorphic, inverse one-to-one or many relationship. * - * @param string $name - * @param string $type - * @param string $id - * @param string $ownerKey + * @param string|null $name + * @param string|null $type + * @param string|null $id + * @param string|null $ownerKey * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null) @@ -318,8 +318,8 @@ protected function guessBelongsToRelation() * Define a one-to-many relationship. * * @param string $related - * @param string $foreignKey - * @param string $localKey + * @param string|null $foreignKey + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function hasMany($related, $foreignKey = null, $localKey = null) @@ -397,9 +397,9 @@ protected function newHasManyThrough(Builder $query, Model $farParent, Model $th * * @param string $related * @param string $name - * @param string $type - * @param string $id - * @param string $localKey + * @param string|null $type + * @param string|null $id + * @param string|null $localKey * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function morphMany($related, $name, $type = null, $id = null, $localKey = null) @@ -437,12 +437,12 @@ protected function newMorphMany(Builder $query, Model $parent, $type, $id, $loca * Define a many-to-many relationship. * * @param string $related - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey - * @param string $relation + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey + * @param string|null $relation * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null, @@ -502,11 +502,11 @@ protected function newBelongsToMany(Builder $query, Model $parent, $table, $fore * * @param string $related * @param string $name - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey * @param bool $inverse * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ @@ -554,7 +554,7 @@ public function morphToMany($related, $name, $table = null, $foreignPivotKey = n * @param string $relatedPivotKey * @param string $parentKey * @param string $relatedKey - * @param string $relationName + * @param string|null $relationName * @param bool $inverse * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ @@ -571,11 +571,11 @@ protected function newMorphToMany(Builder $query, Model $parent, $name, $table, * * @param string $related * @param string $name - * @param string $table - * @param string $foreignPivotKey - * @param string $relatedPivotKey - * @param string $parentKey - * @param string $relatedKey + * @param string|null $table + * @param string|null $foreignPivotKey + * @param string|null $relatedPivotKey + * @param string|null $parentKey + * @param string|null $relatedKey * @return \Illuminate\Database\Eloquent\Relations\MorphToMany */ public function morphedByMany($related, $name, $table = null, $foreignPivotKey = null,
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
@@ -344,7 +344,7 @@ public function as($accessor) * Set a where clause for a pivot table column. * * @param string $column - * @param string $operator + * @param string|null $operator * @param mixed $value * @param string $boolean * @return $this @@ -376,7 +376,7 @@ public function wherePivotIn($column, $values, $boolean = 'and', $not = false) * Set an "or where" clause for a pivot table column. * * @param string $column - * @param string $operator + * @param string|null $operator * @param mixed $value * @return $this */ @@ -681,7 +681,7 @@ protected function aliasedPivotColumns() /** * Get a paginator for the "select" statement. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page @@ -699,7 +699,7 @@ public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', /** * Paginate the given query into a simple paginator. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
@@ -373,7 +373,7 @@ public function get($columns = ['*']) /** * Get a paginator for the "select" statement. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int $page @@ -389,7 +389,7 @@ public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', /** * Paginate the given query into a simple paginator. * - * @param int $perPage + * @param int|null $perPage * @param array $columns * @param string $pageName * @param int|null $page
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Database/Eloquent/Relations/MorphToMany.php
@@ -42,7 +42,7 @@ class MorphToMany extends BelongsToMany * @param string $relatedPivotKey * @param string $parentKey * @param string $relatedKey - * @param string $relationName + * @param string|null $relationName * @param bool $inverse * @return void */
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Foundation/helpers.php
@@ -918,7 +918,7 @@ function __($key = null, $replace = [], $locale = null) /** * Generate a url for the application. * - * @param string $path + * @param string|null $path * @param mixed $parameters * @param bool|null $secure * @return \Illuminate\Contracts\Routing\UrlGenerator|string
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Support/Facades/Cookie.php
@@ -25,7 +25,7 @@ public static function has($key) /** * Retrieve a cookie from the request. * - * @param string $key + * @param string|null $key * @param mixed $default * @return string|array|null */
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Support/MessageBag.php
@@ -150,8 +150,8 @@ public function hasAny($keys = []) /** * Get the first message from the message bag for a given key. * - * @param string $key - * @param string $format + * @param string|null $key + * @param string|null $format * @return string */ public function first($key = null, $format = null)
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Support/ServiceProvider.php
@@ -227,8 +227,8 @@ protected function addPublishGroup($group, $paths) /** * Get the paths to publish. * - * @param string $provider - * @param string $group + * @param string|null $provider + * @param string|null $group * @return array */ public static function pathsToPublish($provider = null, $group = null)
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Support/Str.php
@@ -281,7 +281,7 @@ public static function kebab($value) * Return the length of the given string. * * @param string $value - * @param string $encoding + * @param string|null $encoding * @return int */ public static function length($value, $encoding = null)
true
Other
laravel
framework
9f0af8433eaae7a59e297229ca84d998e0e56edf.json
Fix param types in docblocks (#31252)
src/Illuminate/Support/Traits/EnumeratesValues.php
@@ -825,7 +825,7 @@ protected function getArrayableItems($items) * Get an operator checker callback. * * @param string $key - * @param string $operator + * @param string|string $operator * @param mixed $value * @return \Closure */
true
Other
laravel
framework
8a8eed4d157102ef77527891ac1d8f8e85e7afee.json
add method to ensure a directory exists
src/Illuminate/Filesystem/Filesystem.php
@@ -459,6 +459,21 @@ public function directories($directory) return $directories; } + /** + * Ensure a directory exists. + * + * @param string $path + * @param int $mode + * @param bool $recursive + * @return void + */ + public function ensureDirectoryExists($path, $mode = 0755, $recursive = true) + { + if (! $this->isDirectory($path)) { + $this->makeDirectory($path, $mode, $recursive); + } + } + /** * Create a directory. *
false
Other
laravel
framework
7b7861d0df900520182764db7943049327ee554d.json
Serialize values in array cache store (#23079)
src/Illuminate/Cache/ArrayStore.php
@@ -45,7 +45,7 @@ public function get($key) return; } - return $item['value']; + return unserialize($item['value']); } /** @@ -59,7 +59,7 @@ public function get($key) public function put($key, $value, $seconds) { $this->storage[$key] = [ - 'value' => $value, + 'value' => serialize($value), 'expiresAt' => $this->calculateExpiration($seconds), ]; @@ -77,7 +77,7 @@ public function increment($key, $value = 1) { if ($existing = $this->get($key)) { return tap(((int) $existing) + $value, function ($incremented) use ($key) { - $this->storage[$key]['value'] = $incremented; + $this->storage[$key]['value'] = serialize($incremented); }); }
true
Other
laravel
framework
7b7861d0df900520182764db7943049327ee554d.json
Serialize values in array cache store (#23079)
tests/Cache/CacheArrayStoreTest.php
@@ -194,4 +194,16 @@ public function testAnotherOwnerCanForceReleaseALock() $this->assertTrue($wannabeOwner->acquire()); } + + public function testValuesAreNotStoredByReference() + { + $store = new ArrayStore; + $object = new \stdClass; + $object->foo = true; + + $store->put('object', $object, 10); + $object->bar = true; + + $this->assertObjectNotHasAttribute('bar', $store->get('object')); + } }
true
Other
laravel
framework
60e43aca9229827d692e9e041d08bf1f90478e62.json
fix bug in data parsing
src/Illuminate/View/Component.php
@@ -63,7 +63,7 @@ public function data() return [$method->getName() => $this->createVariableFromMethod($method)]; }); - return $publicProperties->merge($publicMethods)->toArray(); + return $publicProperties->merge($publicMethods)->all(); } /**
false
Other
laravel
framework
dc2b6cca647044a7041616ea3e45e27b9123d0d8.json
remove unused property (#31244)
src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php
@@ -9,13 +9,6 @@ trait InteractsWithPivotTable { - /** - * The cached copy of the currently attached pivot models. - * - * @var \Illuminate\Database\Eloquent\Collection - */ - private $currentlyAttached; - /** * Toggles a model (or models) from the parent. * @@ -479,7 +472,7 @@ protected function detachUsingCustomClass($ids) */ protected function getCurrentlyAttachedPivots() { - return $this->currentlyAttached ?: $this->newPivotQuery()->get()->map(function ($record) { + return $this->newPivotQuery()->get()->map(function ($record) { $class = $this->using ? $this->using : Pivot::class; return (new $class)->setRawAttributes((array) $record, true);
false
Other
laravel
framework
7c3867fa6703ed49cfae623d8b1702f5af684ccd.json
Add shallow option for resource routes
src/Illuminate/Routing/PendingResourceRegistration.php
@@ -153,6 +153,19 @@ public function middleware($middleware) return $this; } + /** + * Set the shallow option for a resource. + * + * @param boolean $shallow + * @return \Illuminate\Routing\PendingResourceRegistration + */ + public function shallow($shallow = true) + { + $this->options['shallow'] = $shallow; + + return $this; + } + /** * Register the resource route. *
true
Other
laravel
framework
7c3867fa6703ed49cfae623d8b1702f5af684ccd.json
Add shallow option for resource routes
src/Illuminate/Routing/ResourceRegistrar.php
@@ -230,6 +230,9 @@ protected function addResourceStore($name, $base, $controller, $options) */ protected function addResourceShow($name, $base, $controller, $options) { + + $name = $this->getNameWithShallowness($name, $options); + $uri = $this->getResourceUri($name).'/{'.$base.'}'; $action = $this->getResourceAction($name, $controller, 'show', $options); @@ -248,6 +251,8 @@ protected function addResourceShow($name, $base, $controller, $options) */ protected function addResourceEdit($name, $base, $controller, $options) { + $name = $this->getNameWithShallowness($name, $options); + $uri = $this->getResourceUri($name).'/{'.$base.'}/'.static::$verbs['edit']; $action = $this->getResourceAction($name, $controller, 'edit', $options); @@ -266,6 +271,8 @@ protected function addResourceEdit($name, $base, $controller, $options) */ protected function addResourceUpdate($name, $base, $controller, $options) { + $name = $this->getNameWithShallowness($name, $options); + $uri = $this->getResourceUri($name).'/{'.$base.'}'; $action = $this->getResourceAction($name, $controller, 'update', $options); @@ -284,6 +291,8 @@ protected function addResourceUpdate($name, $base, $controller, $options) */ protected function addResourceDestroy($name, $base, $controller, $options) { + $name = $this->getNameWithShallowness($name, $options); + $uri = $this->getResourceUri($name).'/{'.$base.'}'; $action = $this->getResourceAction($name, $controller, 'destroy', $options); @@ -401,6 +410,22 @@ protected function getResourceRouteName($resource, $method, $options) return trim(sprintf('%s%s.%s', $prefix, $name, $method), '.'); } + /** + * Get the name for a given resource with shallowness applied when needed. + * + * @param string $name + * @param array $options + * @return string + */ + protected function getNameWithShallowness($name, $options) + { + if (isset($options['shallow']) && $options['shallow']) { + return last(explode(".", $name)); + } else { + return $name; + } + } + /** * Set or unset the unmapped global parameters to singular. *
true
Other
laravel
framework
7c3867fa6703ed49cfae623d8b1702f5af684ccd.json
Add shallow option for resource routes
tests/Routing/RouteRegistrarTest.php
@@ -335,6 +335,17 @@ public function testCanExcludeMethodsOnRegisteredResource() $this->assertTrue($this->router->getRoutes()->hasNamedRoute('users.destroy')); } + public function testCanSetShallowOptionOnRegisteredResource() + { + $this->router->resource('users.tasks', RouteRegistrarControllerStub::class)->shallow(); + + $this->assertCount(7, $this->router->getRoutes()); + + $this->assertTrue($this->router->getRoutes()->hasNamedRoute('users.tasks.index')); + $this->assertTrue($this->router->getRoutes()->hasNamedRoute('tasks.show')); + $this->assertFalse($this->router->getRoutes()->hasNamedRoute('users.tasks.show')); + } + public function testCanExcludeMethodsOnRegisteredApiResource() { $this->router->apiResource('users', RouteRegistrarControllerStub::class)
true
Other
laravel
framework
7c3867fa6703ed49cfae623d8b1702f5af684ccd.json
Add shallow option for resource routes
tests/Routing/RoutingRouteTest.php
@@ -1182,6 +1182,41 @@ public function testInvalidActionException() $router->dispatch(Request::create('/')); } + public function testShallowResourceRouting() + { + $router = $this->getRouter(); + $router->resource('foo.bar', 'FooController', ['shallow' => true]); + $routes = $router->getRoutes(); + $routes = $routes->getRoutes(); + + $this->assertSame('foo/{foo}/bar', $routes[0]->uri()); + $this->assertSame('foo/{foo}/bar/create', $routes[1]->uri()); + $this->assertSame('foo/{foo}/bar', $routes[2]->uri()); + + $this->assertSame('bar/{bar}', $routes[3]->uri()); + $this->assertSame('bar/{bar}/edit', $routes[4]->uri()); + $this->assertSame('bar/{bar}', $routes[5]->uri()); + $this->assertSame('bar/{bar}', $routes[6]->uri()); + + $router = $this->getRouter(); + $router->resource('foo', 'FooController'); + $router->resource('foo.bar.baz', 'FooController', ['shallow' => true]); + $routes = $router->getRoutes(); + $routes = $routes->getRoutes(); + + $this->assertSame('foo', $routes[0]->uri()); + $this->assertSame('foo/create', $routes[1]->uri()); + $this->assertSame('foo', $routes[2]->uri()); + $this->assertSame('foo/{foo}', $routes[3]->uri()); + $this->assertSame('foo/{foo}/edit', $routes[4]->uri()); + $this->assertSame('foo/{foo}', $routes[5]->uri()); + $this->assertSame('foo/{foo}', $routes[6]->uri()); + + $this->assertSame('foo/{foo}/bar/{bar}/baz', $routes[7]->uri()); + $this->assertSame('foo/{foo}/bar/{bar}/baz/create', $routes[8]->uri()); + $this->assertSame('foo/{foo}/bar/{bar}/baz', $routes[9]->uri()); + } + public function testResourceRouting() { $router = $this->getRouter();
true
Other
laravel
framework
7355d0193f34c4514aeb5499528d91396a307a09.json
allow skipping for expired views add a new boolean on the `CompilerEngine` that lets us turn off checking if views are expired and recompiling them.
src/Illuminate/View/Engines/CompilerEngine.php
@@ -22,15 +22,24 @@ class CompilerEngine extends PhpEngine */ protected $lastCompiled = []; + /** + * Flag to check expired views. + * + * @var bool + */ + protected $checkExpiredViews; + /** * Create a new Blade view engine instance. * * @param \Illuminate\View\Compilers\CompilerInterface $compiler + * @param bool $checkExpiredViews * @return void */ - public function __construct(CompilerInterface $compiler) + public function __construct(CompilerInterface $compiler, $checkExpiredViews = true) { $this->compiler = $compiler; + $this->checkExpiredViews = $checkExpiredViews; } /** @@ -47,7 +56,7 @@ public function get($path, array $data = []) // If this given view has expired, which means it has simply been edited since // it was last compiled, we will re-compile the views so we can evaluate a // fresh copy of the view. We'll pass the compiler the path of the view. - if ($this->compiler->isExpired($path)) { + if ($this->checkExpiredViews && $this->compiler->isExpired($path)) { $this->compiler->compile($path); }
true
Other
laravel
framework
7355d0193f34c4514aeb5499528d91396a307a09.json
allow skipping for expired views add a new boolean on the `CompilerEngine` that lets us turn off checking if views are expired and recompiling them.
src/Illuminate/View/ViewServiceProvider.php
@@ -150,7 +150,7 @@ public function registerPhpEngine($resolver) public function registerBladeEngine($resolver) { $resolver->register('blade', function () { - return new CompilerEngine($this->app['blade.compiler']); + return new CompilerEngine($this->app['blade.compiler'], $this->app['config']['view.check_compiled']); }); } }
true
Other
laravel
framework
7355d0193f34c4514aeb5499528d91396a307a09.json
allow skipping for expired views add a new boolean on the `CompilerEngine` that lets us turn off checking if views are expired and recompiling them.
tests/View/ViewCompilerEngineTest.php
@@ -38,8 +38,20 @@ public function testViewsAreNotRecompiledIfTheyAreNotExpired() ', $results); } - protected function getEngine() + public function testViewsAreNotRecompiledIfWeDoNotWantThemRecompiled() { - return new CompilerEngine(m::mock(CompilerInterface::class)); + $engine = $this->getEngine(false); + $engine->getCompiler()->shouldReceive('getCompiledPath')->with(__DIR__.'/fixtures/foo.php')->andReturn(__DIR__.'/fixtures/basic.php'); + $engine->getCompiler()->shouldReceive('isExpired')->never(); + $engine->getCompiler()->shouldReceive('compile')->never(); + $results = $engine->get(__DIR__.'/fixtures/foo.php'); + + $this->assertSame('Hello World +', $results); + } + + protected function getEngine($checkExpiredViews = true) + { + return new CompilerEngine(m::mock(CompilerInterface::class), $checkExpiredViews); } }
true
Other
laravel
framework
f3e92bac8b0bc12776e2693917d5cfe4076e835b.json
remove unused variable (#31191)
src/Illuminate/View/Compilers/BladeCompiler.php
@@ -157,7 +157,7 @@ protected function appendFilePath($contents) protected function getOpenAndClosingPhpTokens($contents) { return collect(token_get_all($contents)) - ->pluck($tokenNumber = 0) + ->pluck(0) ->filter(function ($token) { return in_array($token, [T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG]); });
false
Other
laravel
framework
faa26d25017f86eee58daf9de586774374bc8ec2.json
Fix linting issues
src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
@@ -191,22 +191,22 @@ public function compileDropAllTables() public function compileDropColumn(Blueprint $blueprint, Fluent $command) { $columns = $this->wrapArray($command->columns); - $dropExistingConstraintsSql = $this->compileDropDefaultConstraint($blueprint, $command).';'; + $dropExistingConstraintsSql = $this->compileDropDefaultConstraint($blueprint, $command).';'; return $dropExistingConstraintsSql.'alter table '.$this->wrapTable($blueprint).' drop column '.implode(', ', $columns); } - + /** * Compile a drop default constraint command. * * @param \Illuminate\Database\Schema\Blueprint $blueprint * @param \Illuminate\Support\Fluent $command * @return string */ - public function compileDropDefaultConstraint(Blueprint $blueprint, Fluent $command) + public function compileDropDefaultConstraint(Blueprint $blueprint, Fluent $command) { $tableName = $blueprint->getTable(); - $columnSql = "'" . implode("','", $command->columns) . "'"; + $columnSql = "'".implode("','", $command->columns)."'"; $sql = "DECLARE @sql NVARCHAR(MAX) = '';"; $sql .= "SELECT @sql += 'ALTER TABLE [dbo].[$tableName] DROP CONSTRAINT ' + OBJECT_NAME([default_object_id]) + ';' "; $sql .= 'FROM SYS.COLUMNS ';
false
Other
laravel
framework
db7ee7e2be959b572ee57837f78a14ae47e47967.json
add createMany to factoryBuilder
src/Illuminate/Database/Eloquent/FactoryBuilder.php
@@ -190,6 +190,20 @@ public function create(array $attributes = []) return $results; } + /** + * Create a collection of models and persist them to the database. + * + * @param iterable $records + * @return mixed + */ + public function createMany(iterable $records) + { + $instances = array_map(function ($attribute) { + return $this->create($attribute); + }, $records); + return new Collection($instances); + } + /** * Set the connection name on the results and store them. *
true
Other
laravel
framework
db7ee7e2be959b572ee57837f78a14ae47e47967.json
add createMany to factoryBuilder
tests/Integration/Database/EloquentFactoryBuilderTest.php
@@ -176,6 +176,25 @@ public function testCreatingCollectionOfModels() $this->assertCount(0, FactoryBuildableUser::find($instances->pluck('id')->toArray())); } + public function testCreateManyCollectionOfModels() + { + $users = factory(FactoryBuildableUser::class)->createMany([ + [ + 'name' => 'Taylor', + ], + [ + 'name' => 'John' + ], + [ + 'name' => 'Doe' + ], + ]); + $this->assertInstanceOf(Collection::class, $users); + $this->assertCount(3, $users); + $this->assertCount(3, FactoryBuildableUser::find($users->pluck('id')->toArray())); + $this->assertEquals(['Taylor', 'John', 'Doe'], $users->pluck('name')->toArray()); + } + public function testCreatingModelsWithCallableState() { $server = factory(FactoryBuildableServer::class)->create();
true
Other
laravel
framework
418dfb0d387a6922285a39bedbd96c8870111074.json
fix a few bugs
src/Illuminate/View/Compilers/ComponentTagCompiler.php
@@ -75,7 +75,7 @@ protected function compileOpeningTags(string $value) (?<attributes> (?: \s+ - [\w\-:\.]+ + [^\s\=]+ ( = (?: @@ -116,7 +116,7 @@ protected function compileSelfClosingTags(string $value) (?<attributes> (?: \s+ - [\w\-:\.]+ + [^\s\=]+ ( = (?: @@ -248,7 +248,7 @@ protected function getAttributesFromAttributeString(string $attributeString) $attributeString = $this->parseBindAttributes($attributeString); $pattern = '/ - (?<attribute>[\w\.:-]+) + (?<attribute>[^\s\=]+) ( = (?<value> @@ -268,7 +268,7 @@ protected function getAttributesFromAttributeString(string $attributeString) } return collect($matches)->mapWithKeys(function ($match) { - $attribute = Str::camel($match['attribute']); + $attribute = $match['attribute']; $value = $match['value'] ?? null; if (is_null($value)) { @@ -300,7 +300,7 @@ protected function parseBindAttributes(string $attributeString) $pattern = "/ (?:^|\s+) # start of the string or whitespace between attributes : # attribute needs to start with a semicolon - ([\w-]+) # match the actual attribute name + ([^\s\=]+) # match the actual attribute name = # only match attributes that have a value /xm";
false
Other
laravel
framework
2fb52cb0258a6f0328958018183fd0d84c262d5a.json
add `dumpSession` method to TestResponse (#31131) similar to `dumpHeaders` this dumps either all or selected keys from the session. useful for debugging tests.
src/Illuminate/Foundation/Testing/TestResponse.php
@@ -1168,6 +1168,23 @@ public function dumpHeaders() return $this; } + /** + * Dump the session from the response. + * + * @param array $keys + * @return $this + */ + public function dumpSession($keys = null) + { + if (is_array($keys)) { + dump($this->session()->only($keys)); + } else { + dump($this->session()->all()); + } + + return $this; + } + /** * Get the streamed content from the response. *
false
Other
laravel
framework
7c116138df46dfa19e48664a6f36f9283d896550.json
Add loadFactoriesFrom method
src/Illuminate/Support/ServiceProvider.php
@@ -4,6 +4,7 @@ use Illuminate\Console\Application as Artisan; use Illuminate\Contracts\Support\DeferrableProvider; +use Illuminate\Database\Eloquent\Factory as ModelFactory; abstract class ServiceProvider { @@ -143,6 +144,21 @@ protected function loadMigrationsFrom($paths) }); } + /** + * Register an Eloquent model factory path. + * + * @param array|string $paths + * @return void + */ + protected function loadFactoriesFrom($paths) + { + $this->callAfterResolving(ModelFactory::class, function ($factory) use ($paths) { + foreach ((array) $paths as $path) { + $factory->load($path); + } + }); + } + /** * Setup an after resolving listener, or fire immediately if already resolved. *
false
Other
laravel
framework
d5c46e5f7b07fb6524a16f88c809ca9f2f7789f3.json
Refresh the cache event dispatcher when faked
src/Illuminate/Cache/CacheManager.php
@@ -277,6 +277,15 @@ protected function setEventDispatcher(Repository $repository): void ); } + /** + * Refreshes the event dispatcher of all resolved repositories + * with the currently bound event dispatcher implementation. + */ + public function refreshEventDispatcher() + { + array_map([$this, 'setEventDispatcher'], $this->stores); + } + /** * Get the cache prefix. *
true
Other
laravel
framework
d5c46e5f7b07fb6524a16f88c809ca9f2f7789f3.json
Refresh the cache event dispatcher when faked
src/Illuminate/Support/Facades/Event.php
@@ -38,6 +38,7 @@ public static function fake($eventsToFake = []) static::swap($fake = new EventFake(static::getFacadeRoot(), $eventsToFake)); Model::setEventDispatcher($fake); + Cache::refreshEventDispatcher(); return $fake; }
true
Other
laravel
framework
d5c46e5f7b07fb6524a16f88c809ca9f2f7789f3.json
Refresh the cache event dispatcher when faked
tests/Support/SupportFacadesEventTest.php
@@ -2,9 +2,14 @@ namespace Illuminate\Tests\Support; +use Illuminate\Cache\CacheManager; +use Illuminate\Cache\Events\CacheMissed; +use Illuminate\Config\Repository as ConfigRepository; use Illuminate\Container\Container; +use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Database\Eloquent\Model; use Illuminate\Events\Dispatcher; +use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Facade; use Illuminate\Support\Testing\Fakes\EventFake; @@ -23,6 +28,9 @@ protected function setUp(): void $container = new Container; $container->instance('events', $this->events); + $container->alias('events', DispatcherContract::class); + $container->instance('cache', new CacheManager($container)); + $container->instance('config', new ConfigRepository($this->getCacheConfig())); Facade::setFacadeApplication($container); } @@ -57,6 +65,33 @@ public function testFakeForSwapsDispatchers() $this->assertSame($this->events, Event::getFacadeRoot()); $this->assertSame($this->events, Model::getEventDispatcher()); } + + public function testFakeSwapsDispatchersInResolvedCacheRepositories() + { + $arrayRepository = Cache::store('array'); + + $this->events->shouldReceive('dispatch')->once(); + $arrayRepository->get('foo'); + + Event::fake(); + + $arrayRepository->get('bar'); + + Event::assertDispatched(CacheMissed::class); + } + + protected function getCacheConfig() + { + return [ + 'cache' => [ + 'stores' => [ + 'array' => [ + 'driver' => 'array' + ] + ] + ] + ]; + } } class FakeForStub
true
Other
laravel
framework
850425d1bd5bde3fc4ecbe47459ca9060d4de2a4.json
Add integration tests
tests/Integration/Database/EloquentMySqlConnectionTest.php
@@ -0,0 +1,91 @@ +<?php + +namespace Illuminate\Database; + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; +use Orchestra\Testbench\TestCase; + +class EloquentMySqlConnectionTest extends TestCase +{ + const TABLE = 'player'; + const FLOAT_COL = 'float_col'; + const JSON_COL = 'json_col'; + + const FLOAT_VAL = 0.2; + + protected function getEnvironmentSetUp($app) + { + $app['config']->set('app.debug', 'true'); + + // Database configuration + $app['config']->set('database.default', 'testbench'); + + $app['config']->set('database.connections.testbench', [ + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'username' => 'root', + 'password' => '', + 'database' => 'forge', + 'prefix' => '', + ]); + } + + protected function setUp(): void + { + parent::setUp(); + + if (! Schema::hasTable(self::TABLE)) { + Schema::create(self::TABLE, function (Blueprint $table) { + $table->json(self::JSON_COL)->nullable(); + $table->float(self::FLOAT_COL)->nullable(); + }); + } + } + + protected function tearDown(): void + { + DB::table(self::TABLE)->truncate(); + + parent::tearDown(); + } + + /** + * @dataProvider floatComparisonsDataProvider + * + * @param float $value the value to compare against the JSON value + * @param string $operator the comparison operator to use. e.g. '<', '>', '=' + * @param bool $shouldMatch true if the comparison should match, false if not + */ + public function testJsonFloatComparison(float $value, string $operator, bool $shouldMatch): void + { + DB::table(self::TABLE)->insert([self::JSON_COL => '{"rank":'.self::FLOAT_VAL.'}']); + $this->assertSame( + $shouldMatch, + DB::table(self::TABLE)->where(self::JSON_COL.'->rank', $operator, $value)->exists(), + self::JSON_COL.'->rank should '.($shouldMatch ? '' : 'not ')."be $operator $value" + ); + } + + public function floatComparisonsDataProvider(): array + { + return [ + [0.2, '=', true], + [0.2, '>', false], + [0.2, '<', false], + [0.1, '=', false], + [0.1, '<', false], + [0.1, '>', true], + [0.3, '=', false], + [0.3, '<', true], + [0.3, '>', false], + ]; + } + + public function testFloatValueStoredCorrectly(): void + { + DB::table(self::TABLE)->insert([self::FLOAT_COL => self::FLOAT_VAL]); + $this->assertEquals(self::FLOAT_VAL, DB::table(self::TABLE)->value(self::FLOAT_COL)); + } +}
false
Other
laravel
framework
3a513ad935e95fc45179adca6c8edf5b745a1493.json
Apply fixes from StyleCI (#31097)
src/Illuminate/Auth/Notifications/ResetPassword.php
@@ -61,7 +61,7 @@ public function toMail($notifiable) } else { $url = url(config('app.url').route('password.reset', [ 'token' => $this->token, - 'email' => $notifiable->getEmailForPasswordReset() + 'email' => $notifiable->getEmailForPasswordReset(), ], false)); }
false
Other
laravel
framework
917ee514d4bbd4162b6ddb385c643df97dcfa7d3.json
Remove all indentation.
src/Illuminate/Mail/resources/views/html/button.blade.php
@@ -1,19 +1,19 @@ <table class="action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation"> - <tr> - <td align="center"> - <table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation"> - <tr> - <td align="center"> - <table border="0" cellpadding="0" cellspacing="0" role="presentation"> - <tr> - <td> - <a href="{{ $url }}" class="button button-{{ $color ?? 'primary' }}" target="_blank">{{ $slot }}</a> - </td> - </tr> - </table> - </td> - </tr> - </table> - </td> - </tr> +<tr> +<td align="center"> +<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation"> +<tr> +<td align="center"> +<table border="0" cellpadding="0" cellspacing="0" role="presentation"> +<tr> +<td> +<a href="{{ $url }}" class="button button-{{ $color ?? 'primary' }}" target="_blank">{{ $slot }}</a> +</td> +</tr> +</table> +</td> +</tr> +</table> +</td> +</tr> </table>
true
Other
laravel
framework
917ee514d4bbd4162b6ddb385c643df97dcfa7d3.json
Remove all indentation.
src/Illuminate/Mail/resources/views/html/header.blade.php
@@ -1,7 +1,7 @@ <tr> - <td class="header"> - <a href="{{ $url }}"> - {{ $slot }} - </a> - </td> +<td class="header"> +<a href="{{ $url }}"> +{{ $slot }} +</a> +</td> </tr>
true
Other
laravel
framework
917ee514d4bbd4162b6ddb385c643df97dcfa7d3.json
Remove all indentation.
src/Illuminate/Mail/resources/views/html/layout.blade.php
@@ -1,54 +1,54 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1.0" /> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> - <style> - @media only screen and (max-width: 600px) { - .inner-body { - width: 100% !important; - } +<style> +@media only screen and (max-width: 600px) { +.inner-body { +width: 100% !important; +} - .footer { - width: 100% !important; - } - } +.footer { +width: 100% !important; +} +} - @media only screen and (max-width: 500px) { - .button { - width: 100% !important; - } - } - </style> +@media only screen and (max-width: 500px) { +.button { +width: 100% !important; +} +} +</style> - <table class="wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation"> - <tr> - <td align="center"> - <table class="content" width="100%" cellpadding="0" cellspacing="0" role="presentation"> - {{ $header ?? '' }} +<table class="wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation"> +<tr> +<td align="center"> +<table class="content" width="100%" cellpadding="0" cellspacing="0" role="presentation"> +{{ $header ?? '' }} - <!-- Email Body --> - <tr> - <td class="body" width="100%" cellpadding="0" cellspacing="0"> - <table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation"> - <!-- Body content --> - <tr> - <td class="content-cell"> - {{ Illuminate\Mail\Markdown::parse($slot) }} +<!-- Email Body --> +<tr> +<td class="body" width="100%" cellpadding="0" cellspacing="0"> +<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation"> +<!-- Body content --> +<tr> +<td class="content-cell"> +{{ Illuminate\Mail\Markdown::parse($slot) }} - {{ $subcopy ?? '' }} - </td> - </tr> - </table> - </td> - </tr> +{{ $subcopy ?? '' }} +</td> +</tr> +</table> +</td> +</tr> - {{ $footer ?? '' }} - </table> - </td> - </tr> - </table> +{{ $footer ?? '' }} +</table> +</td> +</tr> +</table> </body> </html>
true
Other
laravel
framework
917ee514d4bbd4162b6ddb385c643df97dcfa7d3.json
Remove all indentation.
src/Illuminate/Mail/resources/views/html/message.blade.php
@@ -1,27 +1,27 @@ @component('mail::layout') - {{-- Header --}} - @slot('header') - @component('mail::header', ['url' => config('app.url')]) - {{ config('app.name') }} - @endcomponent - @endslot +{{-- Header --}} +@slot('header') +@component('mail::header', ['url' => config('app.url')]) +{{ config('app.name') }} +@endcomponent +@endslot - {{-- Body --}} - {{ $slot }} +{{-- Body --}} +{{ $slot }} - {{-- Subcopy --}} - @isset($subcopy) - @slot('subcopy') - @component('mail::subcopy') - {{ $subcopy }} - @endcomponent - @endslot - @endisset +{{-- Subcopy --}} +@isset($subcopy) +@slot('subcopy') +@component('mail::subcopy') +{{ $subcopy }} +@endcomponent +@endslot +@endisset - {{-- Footer --}} - @slot('footer') - @component('mail::footer') - © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') - @endcomponent - @endslot +{{-- Footer --}} +@slot('footer') +@component('mail::footer') +© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') +@endcomponent +@endslot @endcomponent
true
Other
laravel
framework
917ee514d4bbd4162b6ddb385c643df97dcfa7d3.json
Remove all indentation.
src/Illuminate/Mail/resources/views/html/promotion.blade.php
@@ -1,7 +1,7 @@ <table class="promotion" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation"> - <tr> - <td align="center"> - {{ Illuminate\Mail\Markdown::parse($slot) }} - </td> - </tr> +<tr> +<td align="center"> +{{ Illuminate\Mail\Markdown::parse($slot) }} +</td> +</tr> </table>
true
Other
laravel
framework
39985508183c017d5e3ed234996b0239b743e572.json
use local config options if possible
src/Illuminate/Mail/MailManager.php
@@ -249,11 +249,12 @@ protected function createSendmailTransport(array $config) /** * Create an instance of the Amazon SES Swift Transport driver. * + * @param array $config * @return \Illuminate\Mail\Transport\SesTransport */ - protected function createSesTransport() + protected function createSesTransport(array $config) { - $config = array_merge($this->app['config']->get('services.ses', []), [ + $config = array_merge($this->app['config']->get($config['service'] ?? 'services.ses', []), [ 'version' => 'latest', 'service' => 'email', ]); @@ -291,11 +292,12 @@ protected function createMailTransport() /** * Create an instance of the Mailgun Swift Transport driver. * + * @param array $config * @return \Illuminate\Mail\Transport\MailgunTransport */ - protected function createMailgunTransport() + protected function createMailgunTransport(array $config) { - $config = $this->app['config']->get('services.mailgun', []); + $config = $this->app['config']->get($config['service'] ?? 'services.mailgun', []); return new MailgunTransport( $this->guzzle($config), @@ -308,12 +310,13 @@ protected function createMailgunTransport() /** * Create an instance of the Postmark Swift Transport driver. * + * @param array $config * @return \Swift_Transport */ - protected function createPostmarkTransport() + protected function createPostmarkTransport(array $config) { return tap(new PostmarkTransport( - $this->app['config']->get('services.postmark.token') + $config['token'] ?? $this->app['config']->get('services.postmark.token') ), function ($transport) { $transport->registerPlugin(new ThrowExceptionOnFailurePlugin()); });
false
Other
laravel
framework
4e33586e6cf6baf3a857e8ec6bd6de2ae4f93ad9.json
Fix undefined property in WithFaker (#31083)
src/Illuminate/Foundation/Testing/WithFaker.php
@@ -45,7 +45,7 @@ protected function makeFaker($locale = null) { $locale = $locale ?? config('app.faker_locale', Factory::DEFAULT_LOCALE); - if ($this->app->bound(Generator::class)) { + if (isset($this->app) && $this->app->bound(Generator::class)) { return $this->app->make(Generator::class, [$locale]); }
false
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/PresetCommand.php
@@ -1,96 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console; - -use Illuminate\Console\Command; -use InvalidArgumentException; - -class PresetCommand extends Command -{ - /** - * The console command signature. - * - * @var string - */ - protected $signature = 'preset - { type : The preset type (none, bootstrap, vue, react) } - { --option=* : Pass an option to the preset command }'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Swap the front-end scaffolding for the application'; - - /** - * Execute the console command. - * - * @return void - * - * @throws \InvalidArgumentException - */ - public function handle() - { - if (static::hasMacro($this->argument('type'))) { - return call_user_func(static::$macros[$this->argument('type')], $this); - } - - if (! in_array($this->argument('type'), ['none', 'bootstrap', 'vue', 'react'])) { - throw new InvalidArgumentException('Invalid preset.'); - } - - return $this->{$this->argument('type')}(); - } - - /** - * Install the "fresh" preset. - * - * @return void - */ - protected function none() - { - Presets\None::install(); - - $this->info('Frontend scaffolding removed successfully.'); - } - - /** - * Install the "bootstrap" preset. - * - * @return void - */ - protected function bootstrap() - { - Presets\Bootstrap::install(); - - $this->info('Bootstrap scaffolding installed successfully.'); - $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); - } - - /** - * Install the "vue" preset. - * - * @return void - */ - protected function vue() - { - Presets\Vue::install(); - - $this->info('Vue scaffolding installed successfully.'); - $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); - } - - /** - * Install the "react" preset. - * - * @return void - */ - protected function react() - { - Presets\React::install(); - - $this->info('React scaffolding installed successfully.'); - $this->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); - } -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/Bootstrap.php
@@ -1,44 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Presets; - -class Bootstrap extends Preset -{ - /** - * Install the preset. - * - * @return void - */ - public static function install() - { - static::updatePackages(); - static::updateSass(); - static::removeNodeModules(); - } - - /** - * Update the given package array. - * - * @param array $packages - * @return array - */ - protected static function updatePackageArray(array $packages) - { - return [ - 'bootstrap' => '^4.0.0', - 'jquery' => '^3.2', - 'popper.js' => '^1.12', - ] + $packages; - } - - /** - * Update the Sass files for the application. - * - * @return void - */ - protected static function updateSass() - { - copy(__DIR__.'/bootstrap-stubs/_variables.scss', resource_path('sass/_variables.scss')); - copy(__DIR__.'/bootstrap-stubs/app.scss', resource_path('sass/app.scss')); - } -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/None.php
@@ -1,72 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Presets; - -use Illuminate\Filesystem\Filesystem; - -class None extends Preset -{ - /** - * Install the preset. - * - * @return void - */ - public static function install() - { - static::updatePackages(); - static::updateBootstrapping(); - static::updateWebpackConfiguration(); - - tap(new Filesystem, function ($filesystem) { - $filesystem->deleteDirectory(resource_path('js/components')); - $filesystem->delete(resource_path('sass/_variables.scss')); - $filesystem->deleteDirectory(base_path('node_modules')); - $filesystem->deleteDirectory(public_path('css')); - $filesystem->deleteDirectory(public_path('js')); - }); - } - - /** - * Update the given package array. - * - * @param array $packages - * @return array - */ - protected static function updatePackageArray(array $packages) - { - unset( - $packages['bootstrap'], - $packages['jquery'], - $packages['popper.js'], - $packages['vue'], - $packages['vue-template-compiler'], - $packages['@babel/preset-react'], - $packages['react'], - $packages['react-dom'] - ); - - return $packages; - } - - /** - * Write the stubs for the Sass and JavaScript files. - * - * @return void - */ - protected static function updateBootstrapping() - { - file_put_contents(resource_path('sass/app.scss'), ''.PHP_EOL); - copy(__DIR__.'/none-stubs/app.js', resource_path('js/app.js')); - copy(__DIR__.'/none-stubs/bootstrap.js', resource_path('js/bootstrap.js')); - } - - /** - * Update the Webpack configuration. - * - * @return void - */ - protected static function updateWebpackConfiguration() - { - copy(__DIR__.'/none-stubs/webpack.mix.js', base_path('webpack.mix.js')); - } -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/Preset.php
@@ -1,64 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Presets; - -use Illuminate\Filesystem\Filesystem; - -class Preset -{ - /** - * Ensure the component directories we need exist. - * - * @return void - */ - protected static function ensureComponentDirectoryExists() - { - $filesystem = new Filesystem; - - if (! $filesystem->isDirectory($directory = resource_path('js/components'))) { - $filesystem->makeDirectory($directory, 0755, true); - } - } - - /** - * Update the "package.json" file. - * - * @param bool $dev - * @return void - */ - protected static function updatePackages($dev = true) - { - if (! file_exists(base_path('package.json'))) { - return; - } - - $configurationKey = $dev ? 'devDependencies' : 'dependencies'; - - $packages = json_decode(file_get_contents(base_path('package.json')), true); - - $packages[$configurationKey] = static::updatePackageArray( - array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : [] - ); - - ksort($packages[$configurationKey]); - - file_put_contents( - base_path('package.json'), - json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL - ); - } - - /** - * Remove the installed Node modules. - * - * @return void - */ - protected static function removeNodeModules() - { - tap(new Filesystem, function ($files) { - $files->deleteDirectory(base_path('node_modules')); - - $files->delete(base_path('yarn.lock')); - }); - } -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/React.php
@@ -1,76 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Presets; - -use Illuminate\Filesystem\Filesystem; -use Illuminate\Support\Arr; - -class React extends Preset -{ - /** - * Install the preset. - * - * @return void - */ - public static function install() - { - static::ensureComponentDirectoryExists(); - static::updatePackages(); - static::updateWebpackConfiguration(); - static::updateBootstrapping(); - static::updateComponent(); - static::removeNodeModules(); - } - - /** - * Update the given package array. - * - * @param array $packages - * @return array - */ - protected static function updatePackageArray(array $packages) - { - return [ - '@babel/preset-react' => '^7.0.0', - 'react' => '^16.2.0', - 'react-dom' => '^16.2.0', - ] + Arr::except($packages, ['vue', 'vue-template-compiler']); - } - - /** - * Update the Webpack configuration. - * - * @return void - */ - protected static function updateWebpackConfiguration() - { - copy(__DIR__.'/react-stubs/webpack.mix.js', base_path('webpack.mix.js')); - } - - /** - * Update the example component. - * - * @return void - */ - protected static function updateComponent() - { - (new Filesystem)->delete( - resource_path('js/components/ExampleComponent.vue') - ); - - copy( - __DIR__.'/react-stubs/Example.js', - resource_path('js/components/Example.js') - ); - } - - /** - * Update the bootstrapping files. - * - * @return void - */ - protected static function updateBootstrapping() - { - copy(__DIR__.'/react-stubs/app.js', resource_path('js/app.js')); - } -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/Vue.php
@@ -1,76 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Presets; - -use Illuminate\Filesystem\Filesystem; -use Illuminate\Support\Arr; - -class Vue extends Preset -{ - /** - * Install the preset. - * - * @return void - */ - public static function install() - { - static::ensureComponentDirectoryExists(); - static::updatePackages(); - static::updateWebpackConfiguration(); - static::updateBootstrapping(); - static::updateComponent(); - static::removeNodeModules(); - } - - /** - * Update the given package array. - * - * @param array $packages - * @return array - */ - protected static function updatePackageArray(array $packages) - { - return ['vue' => '^2.5.17'] + Arr::except($packages, [ - '@babel/preset-react', - 'react', - 'react-dom', - ]); - } - - /** - * Update the Webpack configuration. - * - * @return void - */ - protected static function updateWebpackConfiguration() - { - copy(__DIR__.'/vue-stubs/webpack.mix.js', base_path('webpack.mix.js')); - } - - /** - * Update the example component. - * - * @return void - */ - protected static function updateComponent() - { - (new Filesystem)->delete( - resource_path('js/components/Example.js') - ); - - copy( - __DIR__.'/vue-stubs/ExampleComponent.vue', - resource_path('js/components/ExampleComponent.vue') - ); - } - - /** - * Update the bootstrapping files. - * - * @return void - */ - protected static function updateBootstrapping() - { - copy(__DIR__.'/vue-stubs/app.js', resource_path('js/app.js')); - } -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/_variables.scss
@@ -1,19 +0,0 @@ -// Body -$body-bg: #f8fafc; - -// Typography -$font-family-sans-serif: 'Nunito', sans-serif; -$font-size-base: 0.9rem; -$line-height-base: 1.6; - -// Colors -$blue: #3490dc; -$indigo: #6574cd; -$purple: #9561e2; -$pink: #f66d9b; -$red: #e3342f; -$orange: #f6993f; -$yellow: #ffed4a; -$green: #38c172; -$teal: #4dc0b5; -$cyan: #6cb2eb;
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/bootstrap-stubs/app.scss
@@ -1,13 +0,0 @@ -// Fonts -@import url('https://fonts.googleapis.com/css?family=Nunito'); - -// Variables -@import 'variables'; - -// Bootstrap -@import '~bootstrap/scss/bootstrap'; - -.navbar-laravel { - background-color: #fff; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/none-stubs/app.js
@@ -1,7 +0,0 @@ -/** - * First, we will load all of this project's Javascript utilities and other - * dependencies. Then, we will be ready to develop a robust and powerful - * application frontend using useful Laravel and JavaScript libraries. - */ - -require('./bootstrap');
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/none-stubs/bootstrap.js
@@ -1,42 +0,0 @@ -window._ = require('lodash'); - -/** - * We'll load the axios HTTP library which allows us to easily issue requests - * to our Laravel back-end. This library automatically handles sending the - * CSRF token as a header based on the value of the "XSRF" token cookie. - */ - -window.axios = require('axios'); - -window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; - -/** - * Next we will register the CSRF Token as a common header with Axios so that - * all outgoing HTTP requests automatically have it attached. This is just - * a simple convenience so we don't have to attach every token manually. - */ - -let token = document.head.querySelector('meta[name="csrf-token"]'); - -if (token) { - window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; -} else { - console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); -} - -/** - * Echo exposes an expressive API for subscribing to channels and listening - * for events that are broadcast by Laravel. Echo and event broadcasting - * allows your team to easily build robust real-time web applications. - */ - -// import Echo from 'laravel-echo' - -// window.Pusher = require('pusher-js'); - -// window.Echo = new Echo({ -// broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, -// encrypted: true -// });
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/none-stubs/webpack.mix.js
@@ -1,15 +0,0 @@ -const mix = require('laravel-mix'); - -/* - |-------------------------------------------------------------------------- - | Mix Asset Management - |-------------------------------------------------------------------------- - | - | Mix provides a clean, fluent API for defining some Webpack build steps - | for your Laravel application. By default, we are compiling the Sass - | file for the application as well as bundling up all the JS files. - | - */ - -mix.js('resources/js/app.js', 'public/js') - .sass('resources/sass/app.scss', 'public/css');
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/react-stubs/Example.js
@@ -1,24 +0,0 @@ -import React, { Component } from 'react'; -import ReactDOM from 'react-dom'; - -export default class Example extends Component { - render() { - return ( - <div className="container"> - <div className="row justify-content-center"> - <div className="col-md-8"> - <div className="card"> - <div className="card-header">Example Component</div> - - <div className="card-body">I'm an example component!</div> - </div> - </div> - </div> - </div> - ); - } -} - -if (document.getElementById('example')) { - ReactDOM.render(<Example />, document.getElementById('example')); -}
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/react-stubs/app.js
@@ -1,15 +0,0 @@ -/** - * First we will load all of this project's JavaScript dependencies which - * includes React and other helpers. It's a great starting point while - * building robust, powerful web applications using React + Laravel. - */ - -require('./bootstrap'); - -/** - * Next, we will create a fresh React component instance and attach it to - * the page. Then, you may begin adding components to this application - * or customize the JavaScript scaffolding to fit your unique needs. - */ - -require('./components/Example');
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/react-stubs/webpack.mix.js
@@ -1,15 +0,0 @@ -const mix = require('laravel-mix'); - -/* - |-------------------------------------------------------------------------- - | Mix Asset Management - |-------------------------------------------------------------------------- - | - | Mix provides a clean, fluent API for defining some Webpack build steps - | for your Laravel application. By default, we are compiling the Sass - | file for the application as well as bundling up all the JS files. - | - */ - -mix.react('resources/js/app.js', 'public/js') - .sass('resources/sass/app.scss', 'public/css');
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/vue-stubs/ExampleComponent.vue
@@ -1,23 +0,0 @@ -<template> - <div class="container"> - <div class="row justify-content-center"> - <div class="col-md-8"> - <div class="card"> - <div class="card-header">Example Component</div> - - <div class="card-body"> - I'm an example component. - </div> - </div> - </div> - </div> - </div> -</template> - -<script> - export default { - mounted() { - console.log('Component mounted.') - } - } -</script>
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js
@@ -1,32 +0,0 @@ -/** - * First we will load all of this project's JavaScript dependencies which - * includes Vue and other libraries. It is a great starting point when - * building robust, powerful web applications using Vue and Laravel. - */ - -require('./bootstrap'); - -window.Vue = require('vue'); - -/** - * The following block of code may be used to automatically register your - * Vue components. It will recursively scan this directory for the Vue - * components and automatically register them with their "basename". - * - * Eg. ./components/ExampleComponent.vue -> <example-component></example-component> - */ - -// const files = require.context('./', true, /\.vue$/i) -// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)) - -Vue.component('example-component', require('./components/ExampleComponent.vue').default); - -/** - * Next, we will create a fresh Vue application instance and attach it to - * the page. Then, you may begin adding components to this application - * or customize the JavaScript scaffolding to fit your unique needs. - */ - -const app = new Vue({ - el: '#app', -});
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Console/Presets/vue-stubs/webpack.mix.js
@@ -1,15 +0,0 @@ -const mix = require('laravel-mix'); - -/* - |-------------------------------------------------------------------------- - | Mix Asset Management - |-------------------------------------------------------------------------- - | - | Mix provides a clean, fluent API for defining some Webpack build steps - | for your Laravel application. By default, we are compiling the Sass - | file for the application as well as bundling up all the JS files. - | - */ - -mix.js('resources/js/app.js', 'public/js') - .sass('resources/sass/app.scss', 'public/css');
true
Other
laravel
framework
e658f7e0fe3212919b837fbd0eb25c2ddaa979e7.json
remove preset commands that are now in laravel/ui
src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
@@ -38,7 +38,6 @@ use Illuminate\Foundation\Console\OptimizeCommand; use Illuminate\Foundation\Console\PackageDiscoverCommand; use Illuminate\Foundation\Console\PolicyMakeCommand; -use Illuminate\Foundation\Console\PresetCommand; use Illuminate\Foundation\Console\ProviderMakeCommand; use Illuminate\Foundation\Console\RequestMakeCommand; use Illuminate\Foundation\Console\ResourceMakeCommand; @@ -93,7 +92,6 @@ class ArtisanServiceProvider extends ServiceProvider implements DeferrableProvid 'Optimize' => 'command.optimize', 'OptimizeClear' => 'command.optimize.clear', 'PackageDiscover' => 'command.package.discover', - 'Preset' => 'command.preset', 'QueueFailed' => 'command.queue.failed', 'QueueFlush' => 'command.queue.flush', 'QueueForget' => 'command.queue.forget', @@ -586,18 +584,6 @@ protected function registerPolicyMakeCommand() }); } - /** - * Register the command. - * - * @return void - */ - protected function registerPresetCommand() - { - $this->app->singleton('command.preset', function () { - return new PresetCommand; - }); - } - /** * Register the command. *
true
Other
laravel
framework
fa463b0998853faadc302ed21c4dd704c99144cc.json
check main mail config for from
src/Illuminate/Mail/MailManager.php
@@ -373,7 +373,7 @@ protected function guzzle(array $config) */ protected function setGlobalAddress($mailer, array $config, string $type) { - $address = Arr::get($config, $type); + $address = Arr::get($config, $type, $this->app['config']['mail.'.$type]); if (is_array($address) && isset($address['address'])) { $mailer->{'always'.Str::studly($type)}($address['address'], $address['name']);
false
Other
laravel
framework
f0d4ca01bb3505ccb8b5b24cea851389b7de79e5.json
fix composer file
src/Illuminate/Testing/composer.json
@@ -33,7 +33,7 @@ "suggest": { "illuminate/console": "Required to assert console commands (^7.0).", "illuminate/database": "Required to assert databases (^7.0).", - "illuminate/http": "Required to assert responses (^7.0).", + "illuminate/http": "Required to assert responses (^7.0)." }, "config": { "sort-packages": true
false
Other
laravel
framework
ba562657ab6f44117645e77cef0f946441b15a37.json
Apply fixes from StyleCI (#31062)
src/Illuminate/Support/Stringable.php
@@ -85,7 +85,7 @@ public function afterLast($search) */ public function append(...$values) { - return new static($this->value . implode('', $values)); + return new static($this->value.implode('', $values)); } /** @@ -304,7 +304,7 @@ public function match($pattern) { preg_match($pattern, $this->value, $matches); - if (!$matches) { + if (! $matches) { return new static; } @@ -369,7 +369,7 @@ public function pluralStudly($count = 2) */ public function prepend(...$values) { - return new static(implode('', $values) . $this->value); + return new static(implode('', $values).$this->value); } /**
false
Other
laravel
framework
1aa66d78726bcaf3ff648d1bc318f157cab3df82.json
Apply fixes from StyleCI (#31057)
src/Illuminate/Support/Stringable.php
@@ -3,7 +3,6 @@ namespace Illuminate\Support; use Closure; -use Illuminate\Support\Str; use Illuminate\Support\Traits\Macroable; class Stringable
true
Other
laravel
framework
1aa66d78726bcaf3ff648d1bc318f157cab3df82.json
Apply fixes from StyleCI (#31057)
tests/Support/SupportStringableTest.php
@@ -5,7 +5,7 @@ use Illuminate\Support\Stringable; use PHPUnit\Framework\TestCase; -class SupportStrTest extends TestCase +class SupportStringableTest extends TestCase { public function testMatch() {
true