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
f0448d4df91dcec7c49b580d3fb96c21523c3b74.json
Apply fixes from StyleCI (#28824)
src/Illuminate/Database/Eloquent/Builder.php
@@ -966,7 +966,7 @@ public function applyScopes() continue; } - $builder->callScope(function (Builder $builder) use ($scope) { + $builder->callScope(function (self $builder) use ($scope) { // If the scope is a Closure we will just go ahead and call the scope with the // builder instance. The "callScope" method will properly group the clauses // that are added to this query so "where" clauses maintain proper logic.
true
Other
laravel
framework
f0448d4df91dcec7c49b580d3fb96c21523c3b74.json
Apply fixes from StyleCI (#28824)
src/Illuminate/Foundation/Application.php
@@ -1128,7 +1128,7 @@ public function isLocale($locale) public function registerCoreContainerAliases() { foreach ([ - 'app' => [\Illuminate\Foundation\Application::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], + 'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class], 'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class], 'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class], 'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
true
Other
laravel
framework
c9f957a8b07011b2a9d88cee24f5b0e4ed905e15.json
add index => viewAny to resourceAbilityMap
src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php
@@ -105,6 +105,7 @@ public function authorizeResource($model, $parameter = null, array $options = [] protected function resourceAbilityMap() { return [ + 'index' => 'viewAny', 'show' => 'view', 'create' => 'create', 'store' => 'create',
false
Other
laravel
framework
f96433678711ab3c8f31ce223454af3f7e9e3fd1.json
remove failing assertions because we are forcing the second argument of `containsAll()` to be an array, let's remove the assertions where a string value was still allowed
tests/Support/SupportStrTest.php
@@ -132,9 +132,7 @@ public function testStrContains() public function testStrContainsAll() { $this->assertTrue(Str::containsAll('taylor otwell', ['taylor', 'otwell'])); - $this->assertTrue(Str::containsAll('taylor otwell', 'taylor')); $this->assertTrue(Str::containsAll('taylor otwell', ['taylor'])); - $this->assertFalse(Str::containsAll('taylor otwell', 'xxx')); $this->assertFalse(Str::containsAll('taylor otwell', ['taylor', 'xxx'])); }
false
Other
laravel
framework
5db5288100817b036d315aa3941039280989a5c8.json
Apply fixes from StyleCI (#28812)
tests/Foundation/Http/Middleware/TrimStringsTest.php
@@ -2,9 +2,9 @@ namespace Illuminate\Tests\Foundation\Http\Middleware; -use Illuminate\Foundation\Http\Middleware\TrimStrings; use Illuminate\Http\Request; use PHPUnit\Framework\TestCase; +use Illuminate\Foundation\Http\Middleware\TrimStrings; use Symfony\Component\HttpFoundation\Request as SymfonyRequest; class TrimStringsTest extends TestCase
false
Other
laravel
framework
5a5d68b41a2ce6513b9782a6b1d7fcab5156a213.json
Add Input Facade methods hints
src/Illuminate/Http/Concerns/InteractsWithInput.php
@@ -269,7 +269,6 @@ public function query($key = null, $default = null) * * @param string|null $key * @param string|array|null $default - * * @return string|array|null */ public function post($key = null, $default = null)
true
Other
laravel
framework
5a5d68b41a2ce6513b9782a6b1d7fcab5156a213.json
Add Input Facade methods hints
src/Illuminate/Support/Facades/Input.php
@@ -3,6 +3,43 @@ namespace Illuminate\Support\Facades; /** + * @method static bool matchesType(string $actual, string $type) + * @method static bool isJson() + * @method static bool expectsJson() + * @method static bool wantsJson() + * @method static bool accepts(string|array $contentTypes) + * @method static bool prefers(string|array $contentTypes) + * @method static bool acceptsAnyContentType() + * @method static bool acceptsJson() + * @method static bool acceptsHtml() + * @method static string format($default = 'html') + * @method static string|array old(string|null $key = null, string|array|null $default = null) + * @method static void flash() + * @method static void flashOnly(array|mixed $keys) + * @method static void flashExcept(array|mixed $keys) + * @method static void flush() + * @method static string|array|null server(string|null $key = null, string|array|null $default = null) + * @method static bool hasHeader(string $key) + * @method static string|array|null header(string|null $key = null, string|array|null $default = null) + * @method static string|null bearerToken() + * @method static bool exists(string|array $key) + * @method static bool has(string|array $key) + * @method static bool hasAny(string|array $key) + * @method static bool filled(string|array $key) + * @method static bool anyFilled(string|array $key) + * @method static array keys() + * @method static array all(array|mixed|null $keys = null) + * @method static string|array|null input(string|null $key = null, string|array|null $default = null) + * @method static array only(array|mixed $keys) + * @method static array except(array|mixed $keys) + * @method static string|array|null query(string|null $key = null, string|array|null $default = null) + * @method static string|array|null post(string|null $key = null, string|array|null $default = null) + * @method static bool hasCookie(string $key) + * @method static string|array|null cookie(string|null $key = null, string|array|null $default = null) + * @method static array allFiles() + * @method static bool hasFile(string $key) + * @method static \Illuminate\Http\UploadedFile|\Illuminate\Http\UploadedFile[]|array|null file(string|null $key = null, mixed $default = null) + * @method static \Illuminate\Http\Request capture() * @method static \Illuminate\Http\Request instance() * @method static string method() * @method static string root() @@ -13,23 +50,28 @@ * @method static string decodedPath() * @method static string|null segment(int $index, string|null $default = null) * @method static array segments() - * @method static bool is(...$patterns) - * @method static bool routeIs(...$patterns) - * @method static bool fullUrlIs(...$patterns) + * @method static bool is(mixed ...$patterns) + * @method static bool routeIs(mixed ...$patterns) + * @method static bool fullUrlIs(mixed ...$patterns) * @method static bool ajax() * @method static bool pjax() + * @method static bool prefetch() * @method static bool secure() - * @method static string ip() + * @method static string|null ip() * @method static array ips() * @method static string userAgent() * @method static \Illuminate\Http\Request merge(array $input) * @method static \Illuminate\Http\Request replace(array $input) - * @method static \Symfony\Component\HttpFoundation\ParameterBag|mixed json(string $key = null, $default = null) + * @method static \Symfony\Component\HttpFoundation\ParameterBag|mixed json(string|null $key = null, mixed $default = null) + * @method static \Illuminate\Http\Request createFrom(\Illuminate\Http\Request $from, \Illuminate\Http\Request|null $to = null) + * @method static \Illuminate\Http\Request createFromBase(\Symfony\Component\HttpFoundation\Request $request) + * @method static \Illuminate\Http\Request duplicate(array|null $query = null, array|null $request = null, array|null $attributes = null, array|null $cookies = null, array|null $files = null, array|null $server = null) + * @method static mixed filterFiles(mixed $files) * @method static \Illuminate\Session\Store session() * @method static \Illuminate\Session\Store|null getSession() * @method static void setLaravelSession(\Illuminate\Contracts\Session\Session $session) * @method static mixed user(string|null $guard = null) - * @method static \Illuminate\Routing\Route|object|string route(string|null $param = null) + * @method static \Illuminate\Routing\Route|object|string route(string|null $param = null, string|null $default = null) * @method static string fingerprint() * @method static \Illuminate\Http\Request setJson(\Symfony\Component\HttpFoundation\ParameterBag $json) * @method static \Closure getUserResolver() @@ -39,7 +81,7 @@ * @method static array toArray() * @method static bool offsetExists(string $offset) * @method static mixed offsetGet(string $offset) - * @method static void offsetSet(string $offset, $value) + * @method static void offsetSet(string $offset, mixed $value) * @method static void offsetUnset(string $offset) * * @see \Illuminate\Http\Request
true
Other
laravel
framework
801cbdbbe187dee2021ba9c4f69e474a526354a6.json
Add Crypt Facade methods hints
src/Illuminate/Support/Facades/Crypt.php
@@ -3,10 +3,13 @@ namespace Illuminate\Support\Facades; /** - * @method static string encrypt($value, bool $serialize = true) + * @method static bool supported(string $key, string $cipher) + * @method static string generateKey(string $cipher) + * @method static string encrypt(mixed $value, bool $serialize = true) * @method static string encryptString(string $value) - * @method static string decrypt($payload, bool $unserialize = true) + * @method static mixed decrypt(mixed $payload, bool $unserialize = true) * @method static string decryptString(string $payload) + * @method static string getKey() * * @see \Illuminate\Encryption\Encrypter */
false
Other
laravel
framework
7f8db2a3e1dad10f4b933a86ba9d3e0706551d98.json
Add type-hints to Artisan Facade methods props
src/Illuminate/Support/Facades/Blade.php
@@ -3,20 +3,20 @@ namespace Illuminate\Support\Facades; /** - * @method static void compile($path = null) + * @method static void compile(string|null $path = null) * @method static string getPath() - * @method static void setPath($path) - * @method static string compileString($value) - * @method static string stripParentheses($expression) + * @method static void setPath(string $path) + * @method static string compileString(string $value) + * @method static string stripParentheses(string $expression) * @method static void extend(callable $compiler) * @method static array getExtensions() - * @method static void if($name, callable $callback) - * @method static bool check($name, ...$parameters) - * @method static void component($path, $alias = null) - * @method static void include($path, $alias = null) - * @method static void directive($name, callable $handler) + * @method static void if(string $name, callable $callback) + * @method static bool check(string $name, array ...$parameters) + * @method static void component(string $path, string|null $alias = null) + * @method static void include(string $path, string|null $alias = null) + * @method static void directive(string $name, callable $handler) * @method static array getCustomDirectives() - * @method static void setEchoFormat($format) + * @method static void setEchoFormat(string $format) * @method static void withDoubleEncoding() * @method static void withoutDoubleEncoding() *
false
Other
laravel
framework
00d1aeb38f319f6621cbda88f6f90c445880af3f.json
Add hints for Artisan Facade methods
src/Illuminate/Support/Facades/Artisan.php
@@ -5,11 +5,12 @@ use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract; /** - * @method static int handle(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output = null) - * @method static int call(string $command, array $parameters = [], $outputBuffer = null) - * @method static int queue(string $command, array $parameters = []) + * @method static int handle(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface|null $output = null) + * @method static int call(string $command, array $parameters = [], \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer = null) + * @method static \Illuminate\Foundation\Bus\PendingDispatch queue(string $command, array $parameters = []) * @method static array all() * @method static string output() + * @method static void terminate(\Symfony\Component\Console\Input\InputInterface $input, int $status) * * @see \Illuminate\Contracts\Console\Kernel */
false
Other
laravel
framework
4d2ca2029a4fc02b0376bff786052f5be7d10c21.json
Add hints for App Facade methods
src/Illuminate/Support/Facades/App.php
@@ -5,15 +5,42 @@ /** * @method static string version() * @method static string basePath() - * @method static string environment() + * @method static string bootstrapPath(string $path = '') + * @method static string configPath(string $path = '') + * @method static string databasePath(string $path = '') + * @method static string environmentPath() + * @method static string resourcePath(string $path = '') + * @method static string storagePath(string $path = '') + * @method static string|bool environment(string|array ...$environments) + * @method static bool runningInConsole() + * @method static bool runningUnitTests() * @method static bool isDownForMaintenance() * @method static void registerConfiguredProviders() - * @method static \Illuminate\Support\ServiceProvider register(\Illuminate\Support\ServiceProvider|string $provider, array $options = [], bool $force = false) + * @method static \Illuminate\Support\ServiceProvider register(\Illuminate\Support\ServiceProvider|string $provider, bool $force = false) * @method static void registerDeferredProvider(string $provider, string $service = null) + * @method static \Illuminate\Support\ServiceProvider resolveProvider(string $provider) * @method static void boot() - * @method static void booting(mixed $callback) - * @method static void booted(mixed $callback) + * @method static void booting(callable $callback) + * @method static void booted(callable $callback) + * @method static void bootstrapWith(array $bootstrappers) + * @method static bool configurationIsCached() + * @method static string detectEnvironment(callable $callback) + * @method static string environmentFile() + * @method static string environmentFilePath() + * @method static string getCachedConfigPath() * @method static string getCachedServicesPath() + * @method static string getCachedPackagesPath() + * @method static string getCachedRoutesPath() + * @method static string getLocale() + * @method static string getNamespace() + * @method static array getProviders(\Illuminate\Support\ServiceProvider|string $provider) + * @method static bool hasBeenBootstrapped() + * @method static void loadDeferredProviders() + * @method static \Illuminate\Contracts\Foundation\Application loadEnvironmentFrom(string $file) + * @method static bool routesAreCached() + * @method static void setLocale(string $locale) + * @method static bool shouldSkipMiddleware() + * @method static void terminate() * * @see \Illuminate\Contracts\Foundation\Application */
false
Other
laravel
framework
ae478939655c2e01cd59c14aef6454c5a3a72e4a.json
Add boolean methods to Schema facade
src/Illuminate/Support/Facades/Schema.php
@@ -9,6 +9,9 @@ * @method static \Illuminate\Database\Schema\Builder table(string $table, \Closure $callback) * @method static \Illuminate\Database\Schema\Builder rename(string $from, string $to) * @method static void defaultStringLength(int $length) + * @method static bool hasTable(string $table) + * @method static bool hasColumn(string $table, string $column) + * @method static bool hasColumns(string $table, array $columns) * @method static \Illuminate\Database\Schema\Builder disableForeignKeyConstraints() * @method static \Illuminate\Database\Schema\Builder enableForeignKeyConstraints() * @method static void registerCustomDoctrineType(string $class, string $name, string $type)
false
Other
laravel
framework
8663082e67513d2ba1b7f0fbe868520d0bff67e8.json
add `@componentFirst` directive - add the compilation - add the `startComponentFirst` method, which uses the View Factory to find the first view given that actually exists. - add a test for the compilation.
src/Illuminate/View/Compilers/Concerns/CompilesComponents.php
@@ -45,4 +45,15 @@ protected function compileEndSlot() { return '<?php $__env->endSlot(); ?>'; } + + /** + * Compile the component-first statements into valid PHP. + * + * @param string $expression + * @return string + */ + protected function compileComponentFirst($expression) + { + return "<?php \$__env->startComponentFirst{$expression}; ?>"; + } }
true
Other
laravel
framework
8663082e67513d2ba1b7f0fbe868520d0bff67e8.json
add `@componentFirst` directive - add the compilation - add the `startComponentFirst` method, which uses the View Factory to find the first view given that actually exists. - add a test for the compilation.
src/Illuminate/View/Concerns/ManagesComponents.php
@@ -2,6 +2,7 @@ namespace Illuminate\View\Concerns; +use Illuminate\Support\Arr; use Illuminate\Support\HtmlString; trait ManagesComponents @@ -52,6 +53,22 @@ public function startComponent($name, array $data = []) } } + /** + * Get the first view that actually exists from the given list, and start a component. + * + * @param array $names + * @param array $data + * @return void + */ + public function startComponentFirst(array $names, array $data = []) + { + $name = Arr::first($names, function ($item) { + return $this->exists($item); + }); + + $this->startComponent($name, $data); + } + /** * Render the current component. *
true
Other
laravel
framework
8663082e67513d2ba1b7f0fbe868520d0bff67e8.json
add `@componentFirst` directive - add the compilation - add the `startComponentFirst` method, which uses the View Factory to find the first view given that actually exists. - add a test for the compilation.
tests/View/Blade/BladeComponentFirstTest.php
@@ -0,0 +1,12 @@ +<?php + +namespace Illuminate\Tests\View\Blade; + +class BladeComponentFirstTest extends AbstractBladeTestCase +{ + public function testComponentFirstsAreCompiled() + { + $this->assertEquals('<?php $__env->startComponentFirst(["one", "two"]); ?>', $this->compiler->compileString('@componentFirst(["one", "two"])')); + $this->assertEquals('<?php $__env->startComponentFirst(["one", "two"], ["foo" => "bar"]); ?>', $this->compiler->compileString('@componentFirst(["one", "two"], ["foo" => "bar"])')); + } +}
true
Other
laravel
framework
732686785d16968964e0216379eca4b4d781b0a1.json
Show members causing failure in array validation
src/Illuminate/Validation/Validator.php
@@ -655,9 +655,17 @@ public function invalid() $this->passes(); } - return array_intersect_key( + $invalid = array_intersect_key( $this->data, $this->attributesThatHaveMessages() ); + + $result = []; + $failed = Arr::only(Arr::dot($invalid), array_keys($this->failed())); + foreach ($failed as $key => $failure) { + Arr::set($result, $key, $failure); + } + + return $result; } /**
true
Other
laravel
framework
732686785d16968964e0216379eca4b4d781b0a1.json
Show members causing failure in array validation
tests/Validation/ValidationValidatorTest.php
@@ -4134,6 +4134,34 @@ public function testValidMethod() ]); } + public function testNestedInvalidMethod() + { + $trans = $this->getIlluminateArrayTranslator(); + $v = new Validator($trans, [ + 'testvalid' => 'filled', + 'testinvalid' => '', + 'records' => [ + 'ABC123', + 'ABC122', + 'ABB132', + 'ADCD23', + ], + ], [ + 'testvalid' => 'filled', + 'testinvalid' => 'filled', + 'records.*' => [ + 'required', + 'regex:/[A-F]{3}[0-9]{3}/', + ], + ]); + $this->assertEquals($v->invalid(), [ + 'testinvalid' => '', + 'records' => [ + 3 => 'ADCD23', + ], + ]); + } + public function testMultipleFileUploads() { $trans = $this->getIlluminateArrayTranslator();
true
Other
laravel
framework
50c35401f53e695d9b708700666248d481b9db8a.json
Fix StyleCI issue
src/Illuminate/Database/Schema/ColumnDefinition.php
@@ -2,8 +2,8 @@ namespace Illuminate\Database\Schema; -use Illuminate\Database\Query\Expression; use Illuminate\Support\Fluent; +use Illuminate\Database\Query\Expression; /** * @method ColumnDefinition after(string $column) Place the column "after" another column (MySQL)
false
Other
laravel
framework
e01f5483a70c853314ead2a3f0a3d075f5c3e42e.json
fix StyleCI issue
src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
@@ -313,7 +313,7 @@ public function compileDisableForeignKeyConstraints() } /** - * Compile the command to drop all foreign keys + * Compile the command to drop all foreign keys. * * @return string */
false
Other
laravel
framework
63a65598c09baec47989f63c839a292af3c7b108.json
change dropAllTables to compileDropAlltables
src/Illuminate/Database/Schema/Builder.php
@@ -267,18 +267,6 @@ public function disableForeignKeyConstraints() ); } - /** - * Drop all foreign keys from the database. - * - * @return void - * - * @throws \LogicException - */ - public function dropAllForeignKeys() - { - throw new LogicException('This database driver does not support dropping all foreign keys.'); - } - /** * Execute the blueprint to build / modify the table. *
true
Other
laravel
framework
63a65598c09baec47989f63c839a292af3c7b108.json
change dropAllTables to compileDropAlltables
src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
@@ -317,7 +317,7 @@ public function compileDisableForeignKeyConstraints() * * @return string */ - public function dropAllForeignKeys() + public function compileDropAllForeignKeys() { return "DECLARE @sql NVARCHAR(MAX) = N''; SELECT @sql += 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))
true
Other
laravel
framework
63a65598c09baec47989f63c839a292af3c7b108.json
change dropAllTables to compileDropAlltables
src/Illuminate/Database/Schema/SqlServerBuilder.php
@@ -11,7 +11,7 @@ class SqlServerBuilder extends Builder */ public function dropAllTables() { - $this->connection->statement($this->grammar->dropAllForeignKeys()); + $this->connection->statement($this->grammar->compileDropAllForeignKeys()); $this->connection->statement($this->grammar->compileDropAllTables()); } }
true
Other
laravel
framework
53081e92c6c25f99574b9022aec79d9bf8c63801.json
Fix database rules with WHERE clauses
src/Illuminate/Validation/Rules/DatabaseRule.php
@@ -166,7 +166,7 @@ public function queryCallbacks() protected function formatWheres() { return collect($this->wheres)->map(function ($where) { - return $where['column'].','.$where['value']; + return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; })->implode(','); } }
true
Other
laravel
framework
53081e92c6c25f99574b9022aec79d9bf8c63801.json
Fix database rules with WHERE clauses
tests/Validation/ValidationExistsRuleTest.php
@@ -37,11 +37,11 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule() { $rule = new Exists('table'); $rule->where('foo', 'bar'); - $this->assertEquals('exists:table,NULL,foo,bar', (string) $rule); + $this->assertEquals('exists:table,NULL,foo,"bar"', (string) $rule); $rule = new Exists('table', 'column'); $rule->where('foo', 'bar'); - $this->assertEquals('exists:table,column,foo,bar', (string) $rule); + $this->assertEquals('exists:table,column,foo,"bar"', (string) $rule); } public function testItChoosesValidRecordsUsingWhereInRule()
true
Other
laravel
framework
53081e92c6c25f99574b9022aec79d9bf8c63801.json
Fix database rules with WHERE clauses
tests/Validation/ValidationUniqueRuleTest.php
@@ -12,36 +12,40 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule() { $rule = new Unique('table'); $rule->where('foo', 'bar'); - $this->assertEquals('unique:table,NULL,NULL,id,foo,bar', (string) $rule); + $this->assertEquals('unique:table,NULL,NULL,id,foo,"bar"', (string) $rule); $rule = new Unique('table', 'column'); $rule->ignore('Taylor, Otwell', 'id_column'); $rule->where('foo', 'bar'); - $this->assertEquals('unique:table,column,"Taylor, Otwell",id_column,foo,bar', (string) $rule); + $this->assertEquals('unique:table,column,"Taylor, Otwell",id_column,foo,"bar"', (string) $rule); $rule = new Unique('table', 'column'); $rule->ignore('Taylor, Otwell"\'..-"', 'id_column'); $rule->where('foo', 'bar'); - $this->assertEquals('unique:table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,bar', (string) $rule); - $this->assertEquals('Taylor, Otwell"\'..-"', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,bar')[2])); - $this->assertEquals('id_column', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,bar')[3])); + $this->assertEquals('unique:table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"', (string) $rule); + $this->assertEquals('Taylor, Otwell"\'..-"', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"')[2])); + $this->assertEquals('id_column', stripslashes(str_getcsv('table,column,"Taylor, Otwell\"\\\'..-\"",id_column,foo,"bar"')[3])); $rule = new Unique('table', 'column'); $rule->ignore(null, 'id_column'); $rule->where('foo', 'bar'); - $this->assertEquals('unique:table,column,NULL,id_column,foo,bar', (string) $rule); + $this->assertEquals('unique:table,column,NULL,id_column,foo,"bar"', (string) $rule); $model = new EloquentModelStub(['id_column' => 1]); $rule = new Unique('table', 'column'); $rule->ignore($model); $rule->where('foo', 'bar'); - $this->assertEquals('unique:table,column,"1",id_column,foo,bar', (string) $rule); + $this->assertEquals('unique:table,column,"1",id_column,foo,"bar"', (string) $rule); $rule = new Unique('table', 'column'); $rule->ignore($model, 'id_column'); $rule->where('foo', 'bar'); - $this->assertEquals('unique:table,column,"1",id_column,foo,bar', (string) $rule); + $this->assertEquals('unique:table,column,"1",id_column,foo,"bar"', (string) $rule); + + $rule = new Unique('table'); + $rule->where('foo', '"bar"'); + $this->assertEquals('unique:table,NULL,NULL,id,foo,"""bar"""', (string) $rule); } }
true
Other
laravel
framework
f8e0662e377544dd0ce78328033f1da995947efb.json
create dropAllForeignKeys method for SQL Server
src/Illuminate/Database/Schema/Builder.php
@@ -267,6 +267,18 @@ public function disableForeignKeyConstraints() ); } + /** + * Drop all foreign keys from the database. + * + * @return void + * + * @throws \LogicException + */ + public function dropAllForeignKeys() + { + throw new LogicException('This database driver does not support dropping all foreign keys.'); + } + /** * Execute the blueprint to build / modify the table. *
true
Other
laravel
framework
f8e0662e377544dd0ce78328033f1da995947efb.json
create dropAllForeignKeys method for SQL Server
src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php
@@ -312,6 +312,22 @@ public function compileDisableForeignKeyConstraints() return 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";'; } + /** + * Compile the command to drop all foreign keys + * + * @return string + */ + public function dropAllForeignKeys() + { + return "DECLARE @sql NVARCHAR(MAX) = N''; + SELECT @sql += 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + + ' DROP CONSTRAINT ' + QUOTENAME(name) + ';' + FROM sys.foreign_keys; + + EXEC sp_executesql @sql;"; + } + /** * Create the column definition for a char type. *
true
Other
laravel
framework
f8e0662e377544dd0ce78328033f1da995947efb.json
create dropAllForeignKeys method for SQL Server
src/Illuminate/Database/Schema/SqlServerBuilder.php
@@ -11,10 +11,7 @@ class SqlServerBuilder extends Builder */ public function dropAllTables() { - $this->disableForeignKeyConstraints(); - + $this->connection->statement($this->grammar->dropAllForeignKeys()); $this->connection->statement($this->grammar->compileDropAllTables()); - - $this->enableForeignKeyConstraints(); } }
true
Other
laravel
framework
cc334d9cc46bf930603dd79d9ee169252c8305bd.json
Check presence of force flag in command signature
src/Illuminate/Console/ConfirmableTrait.php
@@ -22,7 +22,7 @@ public function confirmToProceed($warning = 'Application In Production!', $callb $shouldConfirm = $callback instanceof Closure ? call_user_func($callback) : $callback; if ($shouldConfirm) { - if ($this->option('force')) { + if ($this->hasOption('force') && $this->option('force')) { return true; }
false
Other
laravel
framework
9293fec485fdd2a176ce27f26b31fde6bb7eed54.json
Fix return type of Session Store save method
src/Illuminate/Contracts/Session/Session.php
@@ -36,7 +36,7 @@ public function start(); /** * Save the session data to storage. * - * @return bool + * @return void */ public function save();
true
Other
laravel
framework
9293fec485fdd2a176ce27f26b31fde6bb7eed54.json
Fix return type of Session Store save method
src/Illuminate/Session/Store.php
@@ -119,7 +119,7 @@ protected function prepareForUnserialize($data) /** * Save the session data to storage. * - * @return bool + * @return void */ public function save() {
true
Other
laravel
framework
d53cba6e66037342c4cc26b6d9c768c114d2a641.json
Add typehint for QueryException
src/Illuminate/Database/Connection.php
@@ -708,7 +708,7 @@ protected function getElapsedTime($start) * * @throws \Illuminate\Database\QueryException */ - protected function handleQueryException($e, $query, $bindings, Closure $callback) + protected function handleQueryException(QueryException $e, $query, $bindings, Closure $callback) { if ($this->transactions >= 1) { throw $e;
false
Other
laravel
framework
2bcb405ddc9ed69355513de5f2396dc658fd004d.json
fix cluster connecting
src/Illuminate/Redis/RedisManager.php
@@ -118,7 +118,9 @@ public function resolve($name = null) protected function resolveCluster($name) { return $this->connector()->connectToCluster( - $this->parseConnectionConfiguration($this->config['clusters'][$name]), + array_map(function ($config) { + return $this->parseConnectionConfiguration($config); + }, $this->config['clusters'][$name]), $this->config['clusters']['options'] ?? [], $this->config['options'] ?? [] );
false
Other
laravel
framework
ae9d74ca113019d8b46e605599821e9f9f4dd891.json
Remove unused Migrator $notes dynamic property
src/Illuminate/Database/Migrations/Migrator.php
@@ -94,8 +94,6 @@ public function __construct(MigrationRepositoryInterface $repository, */ public function run($paths = [], array $options = []) { - $this->notes = []; - // Once we grab all of the migration files for the path, we will compare them // against the migrations that have already been run for this package then // run each of the outstanding migrations against a database connection. @@ -213,8 +211,6 @@ protected function runUp($file, $batch, $pretend) */ public function rollback($paths = [], array $options = []) { - $this->notes = []; - // We want to pull in the last batch of migrations that ran on the previous // migration operation. We'll then reverse those migrations and run each // of them "down" to reverse the last migration "operation" which ran. @@ -294,8 +290,6 @@ protected function rollbackMigrations(array $migrations, $paths, array $options) */ public function reset($paths = [], $pretend = false) { - $this->notes = []; - // Next, we will reverse the migration list so we can run them back in the // correct order for resetting this database. This will allow us to get // the database back into its "empty" state ready for the migrations.
false
Other
laravel
framework
8fd18a33e56e4d16dd176a0342109844606fdbcd.json
update toResponse return type
src/Illuminate/Contracts/Support/Responsable.php
@@ -8,7 +8,7 @@ interface Responsable * Create an HTTP response that represents the object. * * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response + * @return \Symfony\Component\HttpFoundation\Response */ public function toResponse($request); }
false
Other
laravel
framework
ccae6f4837af5641a31a210fde7e6d49ccb35191.json
Drop Carbon v1 Carbon v1 is now warning to drop support and upgrade to v2 instead so it's best that we drop support for it in newer versions. See https://github.com/briannesbitt/Carbon/issues/1685
composer.json
@@ -25,7 +25,7 @@ "erusev/parsedown": "^1.7", "league/flysystem": "^1.0.8", "monolog/monolog": "^1.12", - "nesbot/carbon": "^1.26.3 || ^2.0", + "nesbot/carbon": "^2.0", "opis/closure": "^3.1", "psr/container": "^1.0", "psr/simple-cache": "^1.0",
true
Other
laravel
framework
ccae6f4837af5641a31a210fde7e6d49ccb35191.json
Drop Carbon v1 Carbon v1 is now warning to drop support and upgrade to v2 instead so it's best that we drop support for it in newer versions. See https://github.com/briannesbitt/Carbon/issues/1685
src/Illuminate/Support/composer.json
@@ -19,7 +19,7 @@ "ext-mbstring": "*", "doctrine/inflector": "^1.1", "illuminate/contracts": "5.9.*", - "nesbot/carbon": "^1.26.3 || ^2.0" + "nesbot/carbon": "^2.0" }, "conflict": { "tightenco/collect": "<5.5.33"
true
Other
laravel
framework
ccae6f4837af5641a31a210fde7e6d49ccb35191.json
Drop Carbon v1 Carbon v1 is now warning to drop support and upgrade to v2 instead so it's best that we drop support for it in newer versions. See https://github.com/briannesbitt/Carbon/issues/1685
tests/Support/DateFacadeTest.php
@@ -56,10 +56,6 @@ public function testUseClassName() public function testCarbonImmutable() { - if (! class_exists(CarbonImmutable::class)) { - $this->markTestSkipped('Test for Carbon 2 only'); - } - DateFactory::use(CarbonImmutable::class); $this->assertSame(CarbonImmutable::class, get_class(Date::now())); DateFactory::use(Carbon::class);
true
Other
laravel
framework
ccae6f4837af5641a31a210fde7e6d49ccb35191.json
Drop Carbon v1 Carbon v1 is now warning to drop support and upgrade to v2 instead so it's best that we drop support for it in newer versions. See https://github.com/briannesbitt/Carbon/issues/1685
tests/Support/SupportCarbonTest.php
@@ -5,7 +5,6 @@ use DateTime; use DateTimeInterface; use BadMethodCallException; -use Carbon\CarbonImmutable; use Illuminate\Support\Carbon; use PHPUnit\Framework\TestCase; use Carbon\Carbon as BaseCarbon; @@ -87,11 +86,7 @@ public function testCarbonAllowsCustomSerializer() public function testCarbonCanSerializeToJson() { - $this->assertSame(class_exists(CarbonImmutable::class) ? '2017-06-27T13:14:15.000000Z' : [ - 'date' => '2017-06-27 13:14:15.000000', - 'timezone_type' => 3, - 'timezone' => 'UTC', - ], $this->now->jsonSerialize()); + $this->assertSame('2017-06-27T13:14:15.000000Z', $this->now->jsonSerialize()); } public function testSetStateReturnsCorrectType()
true
Other
laravel
framework
fd77f752a2dd73e277f3b3187a9a9facf85913b6.json
Add fullpath option
src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php
@@ -17,7 +17,8 @@ class MigrateMakeCommand extends BaseCommand {--create= : The table to be created} {--table= : The table to migrate} {--path= : The location where the migration file should be created} - {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths}'; + {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths} + {--fullpath : Output the full path of the migration}'; /** * The console command description. @@ -105,9 +106,13 @@ public function handle() */ protected function writeMigration($name, $table, $create) { - $file = pathinfo($this->creator->create( + $file = $this->creator->create( $name, $this->getMigrationPath(), $table, $create - ), PATHINFO_FILENAME); + ); + + if (!$this->option('fullpath')) { + $file = pathinfo($file, PATHINFO_FILENAME); + } $this->line("<info>Created Migration:</info> {$file}"); }
false
Other
laravel
framework
5f1dc4e48a621418b76850b24895f3ad254dd771.json
Follow loadMorph syntax
src/Illuminate/Database/Eloquent/Relations/MorphTo.php
@@ -271,10 +271,10 @@ public function getDictionary() * * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ - public function withMorph(string $modelClass, array $with) + public function withMorph(array $with) { - $this->typedEagerLoads[$modelClass] = array_merge( - $this->typedEagerLoads[$modelClass] ?? [], + $this->typedEagerLoads = array_merge( + $this->typedEagerLoads, $with );
true
Other
laravel
framework
5f1dc4e48a621418b76850b24895f3ad254dd771.json
Follow loadMorph syntax
tests/Integration/Database/EloquentMorphEagerLoadingTest.php
@@ -50,7 +50,7 @@ public function test_with_morph_loading() { $comments = Comment::query() ->with(['commentable' => function (MorphTo $morphTo) { - $morphTo->withMorph(Post::class, ['user']); + $morphTo->withMorph([Post::class =>['user']]); }]) ->get();
true
Other
laravel
framework
544891bba4bb97a68f752fcde675bdb2c21c4cfc.json
Remove return type
src/Illuminate/Database/Eloquent/Relations/MorphTo.php
@@ -271,7 +271,7 @@ public function getDictionary() * * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ - public function withMorph(string $modelClass, array $with): self + public function withMorph(string $modelClass, array $with) { $this->typedEagerLoads[$modelClass] = array_merge( $this->typedEagerLoads[$modelClass] ?? [],
false
Other
laravel
framework
b39a01d2962edf2d114cf81c38f4b441479d4a4e.json
Fix styleCI errors
src/Illuminate/Database/Eloquent/Relations/MorphTo.php
@@ -38,7 +38,7 @@ class MorphTo extends BelongsTo protected $macroBuffer = []; /** - * A map of relations to load for each individual morph type + * A map of relations to load for each individual morph type. * * @var array */ @@ -264,7 +264,7 @@ public function getDictionary() } /** - * Specify which relations to load for a given morph type + * Specify which relations to load for a given morph type. * * @param string $modelClass * @param array $with
false
Other
laravel
framework
0b891475133e8e427a5ad61dc4be80a99ecf8424.json
Add support for typed eager loads
src/Illuminate/Database/Eloquent/Relations/MorphTo.php
@@ -37,6 +37,13 @@ class MorphTo extends BelongsTo */ protected $macroBuffer = []; + /** + * A map of relations to load for each individual morph type + * + * @var array + */ + protected $typedEagerLoads = []; + /** * Create a new morph to relationship instance. * @@ -111,7 +118,10 @@ protected function getResultsByType($type) $query = $this->replayMacros($instance->newQuery()) ->mergeConstraintsFrom($this->getQuery()) - ->with($this->getQuery()->getEagerLoads()); + ->with(array_merge( + $this->getQuery()->getEagerLoads(), + $this->typedEagerLoads[get_class($instance)] ?? [] + )); return $query->whereIn( $instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type) @@ -253,6 +263,24 @@ public function getDictionary() return $this->dictionary; } + /** + * Specify which relations to load for a given morph type + * + * @param string $modelClass + * @param array $with + * + * @return \Illuminate\Database\Eloquent\Relations\MorphTo + */ + public function withMorph(string $modelClass, array $with): self + { + $this->typedEagerLoads[$modelClass] = array_merge( + $this->typedEagerLoads[$modelClass] ?? [], + $with + ); + + return $this; + } + /** * Replay stored macro calls on the actual related instance. *
false
Other
laravel
framework
ab675d4718e7bd587ae91deb7231f90d34df5786.json
allow easier extending of url generator
src/Illuminate/Routing/RoutingServiceProvider.php
@@ -8,6 +8,7 @@ use Psr\Http\Message\ServerRequestInterface; use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; use Illuminate\Contracts\View\Factory as ViewFactoryContract; +use Illuminate\Contracts\Routing\UrlGenerator as UrlGeneratorContract; use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract; use Illuminate\Routing\Contracts\ControllerDispatcher as ControllerDispatcherContract; @@ -56,12 +57,14 @@ protected function registerUrlGenerator() // and all the registered routes will be available to the generator. $app->instance('routes', $routes); - $url = new UrlGenerator( + return new UrlGenerator( $routes, $app->rebinding( 'request', $this->requestRebinder() ), $app['config']['app.asset_url'] ); + }); + $this->app->extend('url', function (UrlGeneratorContract $url, $app) { // Next we will set a few service resolvers on the URL generator so it can // get the information it needs to function. This just provides some of // the convenience features to this URL generator like "signed" URLs.
false
Other
laravel
framework
fec2d82721bd1b143af00de54f11883876738186.json
Use proper link
README.md
@@ -38,7 +38,7 @@ In order to ensure that the Laravel community is welcoming to all, please review ## Security Vulnerabilities -Please review [our security policy](SECURITY.md) on how to report security vulnerabilities. +Please review [our security policy](https://github.com/laravel/framework/security/policy) on how to report security vulnerabilities. ## License
false
Other
laravel
framework
f970b65732ed0688434b277d25afaf5c28b57021.json
Add integration test.
tests/Redis/RedisConnectionTest.php
@@ -558,8 +558,9 @@ public function connections() $prefixedPhpredis = new RedisManager(new Application, 'phpredis', [ 'cluster' => false, 'default' => [ - 'host' => $host, - 'port' => $port, + 'url' => "redis://user@$host:$port", + 'host' => 'overwrittenByUrl', + 'port' => 'overwrittenByUrl', 'database' => 5, 'options' => ['prefix' => 'laravel:'], 'timeout' => 0.5,
false
Other
laravel
framework
c88de24605e68de0a411193c99d364d85af0417e.json
Parse url key in Redis configuration.
src/Illuminate/Redis/RedisManager.php
@@ -5,6 +5,7 @@ use InvalidArgumentException; use Illuminate\Contracts\Redis\Factory; use Illuminate\Redis\Connections\Connection; +use Illuminate\Support\ConfigurationUrlParser; /** * @mixin \Illuminate\Redis\Connections\Connection @@ -95,7 +96,9 @@ public function resolve($name = null) $options = $this->config['options'] ?? []; if (isset($this->config[$name])) { - return $this->connector()->connect($this->config[$name], $options); + return $this->connector()->connect( + $this->parseConnectionConfigWithUrl($this->config[$name]), $options + ); } if (isset($this->config['clusters'][$name])) { @@ -113,10 +116,10 @@ public function resolve($name = null) */ protected function resolveCluster($name) { - $clusterOptions = $this->config['clusters']['options'] ?? []; - return $this->connector()->connectToCluster( - $this->config['clusters'][$name], $clusterOptions, $this->config['options'] ?? [] + $this->parseConnectionConfigWithUrl($this->config['clusters'][$name]), + $this->config['clusters']['options'] ?? [], + $this->config['options'] ?? [] ); } @@ -153,6 +156,21 @@ protected function connector() } } + /** + * Parse the redis configuration, hydrating options using a redis configuration URL if possible. + * + * @param array $config + * @return array + */ + protected function parseConnectionConfigWithUrl($config) + { + $parsedConfig = (new ConfigurationUrlParser)->parseConfiguration($config); + + return array_filter($parsedConfig, function ($key) { + return !in_array($key, ['driver', 'username']); + }, ARRAY_FILTER_USE_KEY); + } + /** * Return all of the created connections. *
false
Other
laravel
framework
39c115ddca97217da748b90a1146d484d3c91f61.json
Add UrlParser to Support.
src/Illuminate/Database/DatabaseManager.php
@@ -4,6 +4,7 @@ use PDO; use Illuminate\Support\Arr; +use Illuminate\Support\ConfigurationUrlParser; use Illuminate\Support\Str; use InvalidArgumentException; use Illuminate\Database\Connectors\ConnectionFactory;
true
Other
laravel
framework
39c115ddca97217da748b90a1146d484d3c91f61.json
Add UrlParser to Support.
src/Illuminate/Support/ConfigurationUrlParser.php
@@ -0,0 +1,189 @@ +<?php + +namespace Illuminate\Support; + +use InvalidArgumentException; + +class ConfigurationUrlParser +{ + /** + * The drivers aliases map. + * + * @var array + */ + protected static $driverAliases = [ + 'mssql' => 'sqlsrv', + 'mysql2' => 'mysql', // RDS + 'postgres' => 'pgsql', + 'postgresql' => 'pgsql', + 'sqlite3' => 'sqlite', + ]; + + /** + * Parse the database configuration, hydrating options using a database configuration URL if possible. + * + * @param array|string $config + * @return array + */ + public function parseConfiguration($config) + { + if (is_string($config)) { + $config = ['url' => $config]; + } + + $url = $config['url'] ?? null; + + $config = Arr::except($config, 'url'); + + if (! $url) { + return $config; + } + + $parsedUrl = $this->parseUrl($url); + + return array_merge( + $config, + $this->getPrimaryOptions($parsedUrl), + $this->getQueryOptions($parsedUrl) + ); + } + + /** + * Get the primary database connection options. + * + * @param array $url + * @return array + */ + protected function getPrimaryOptions($url) + { + return array_filter([ + 'driver' => $this->getDriver($url), + 'database' => $this->getDatabase($url), + 'host' => $url['host'] ?? null, + 'port' => $url['port'] ?? null, + 'username' => $url['user'] ?? null, + 'password' => $url['pass'] ?? null, + ], function ($value) { + return ! is_null($value); + }); + } + + /** + * Get the database driver from the URL. + * + * @param array $url + * @return string|null + */ + protected function getDriver($url) + { + $alias = $url['scheme'] ?? null; + + if (! $alias) { + return; + } + + return static::$driverAliases[$alias] ?? $alias; + } + + /** + * Get the database name from the URL. + * + * @param array $url + * @return string|null + */ + protected function getDatabase($url) + { + $path = $url['path'] ?? null; + + return $path ? substr($path, 1) : null; + } + + /** + * Get all of the additional database options from the query string. + * + * @param array $url + * @return array + */ + protected function getQueryOptions($url) + { + $queryString = $url['query'] ?? null; + + if (! $queryString) { + return []; + } + + $query = []; + + parse_str($queryString, $query); + + return $this->parseStringsToNativeTypes($query); + } + + /** + * Parse the string URL to an array of components. + * + * @param string $url + * @return array + */ + protected function parseUrl($url) + { + $url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url); + + $parsedUrl = parse_url($url); + + if ($parsedUrl === false) { + throw new InvalidArgumentException('The database configuration URL is malformed.'); + } + + return $this->parseStringsToNativeTypes( + array_map('rawurldecode', $parsedUrl) + ); + } + + /** + * Convert string casted values to their native types. + * + * @param mixed $value + * @return mixed + */ + protected function parseStringsToNativeTypes($value) + { + if (is_array($value)) { + return array_map([$this, 'parseStringsToNativeTypes'], $value); + } + + if (! is_string($value)) { + return $value; + } + + $parsedValue = json_decode($value, true); + + if (json_last_error() === JSON_ERROR_NONE) { + return $parsedValue; + } + + return $value; + } + + /** + * Get all of the current drivers aliases. + * + * @return array + */ + public static function getDriverAliases() + { + return static::$driverAliases; + } + + /** + * Add the given driver alias to the driver aliases array. + * + * @param string $alias + * @param string $driver + * @return void + */ + public static function addDriverAlias($alias, $driver) + { + static::$driverAliases[$alias] = $driver; + } +}
true
Other
laravel
framework
39c115ddca97217da748b90a1146d484d3c91f61.json
Add UrlParser to Support.
tests/Support/ConfigurationUrlParserTest.php
@@ -0,0 +1,357 @@ +<?php + +namespace Illuminate\Tests\Support; + +use Illuminate\Support\ConfigurationUrlParser; +use PHPUnit\Framework\TestCase; + +class ConfigurationUrlParserTest extends TestCase +{ + /** + * @dataProvider databaseUrls + */ + public function testDatabaseUrlsAreParsed($config, $expectedOutput) + { + $this->assertEquals($expectedOutput, (new ConfigurationUrlParser)->parseConfiguration($config)); + } + + public function testDriversAliases() + { + $this->assertEquals([ + 'mssql' => 'sqlsrv', + 'mysql2' => 'mysql', + 'postgres' => 'pgsql', + 'postgresql' => 'pgsql', + 'sqlite3' => 'sqlite', + ], \Illuminate\Support\ConfigurationUrlParser::getDriverAliases()); + + ConfigurationUrlParser::addDriverAlias('some-particular-alias', 'mysql'); + + $this->assertEquals([ + 'mssql' => 'sqlsrv', + 'mysql2' => 'mysql', + 'postgres' => 'pgsql', + 'postgresql' => 'pgsql', + 'sqlite3' => 'sqlite', + 'some-particular-alias' => 'mysql', + ], ConfigurationUrlParser::getDriverAliases()); + + $this->assertEquals([ + 'driver' => 'mysql', + ], (new ConfigurationUrlParser)->parseConfiguration('some-particular-alias://null')); + } + + public function databaseUrls() + { + return [ + 'simple URL' => [ + 'mysql://foo:bar@localhost/baz', + [ + 'driver' => 'mysql', + 'username' => 'foo', + 'password' => 'bar', + 'host' => 'localhost', + 'database' => 'baz', + ], + ], + 'simple URL with port' => [ + 'mysql://foo:bar@localhost:134/baz', + [ + 'driver' => 'mysql', + 'username' => 'foo', + 'password' => 'bar', + 'host' => 'localhost', + 'port' => 134, + 'database' => 'baz', + ], + ], + 'sqlite relative URL with host' => [ + 'sqlite://localhost/foo/database.sqlite', + [ + 'database' => 'foo/database.sqlite', + 'driver' => 'sqlite', + 'host' => 'localhost', + ], + ], + 'sqlite absolute URL with host' => [ + 'sqlite://localhost//tmp/database.sqlite', + [ + 'database' => '/tmp/database.sqlite', + 'driver' => 'sqlite', + 'host' => 'localhost', + ], + ], + 'sqlite relative URL without host' => [ + 'sqlite:///foo/database.sqlite', + [ + 'database' => 'foo/database.sqlite', + 'driver' => 'sqlite', + ], + ], + 'sqlite absolute URL without host' => [ + 'sqlite:////tmp/database.sqlite', + [ + 'database' => '/tmp/database.sqlite', + 'driver' => 'sqlite', + ], + ], + 'sqlite memory' => [ + 'sqlite:///:memory:', + [ + 'database' => ':memory:', + 'driver' => 'sqlite', + ], + ], + 'params parsed from URL override individual params' => [ + [ + 'url' => 'mysql://foo:bar@localhost/baz', + 'password' => 'lulz', + 'driver' => 'sqlite', + ], + [ + 'username' => 'foo', + 'password' => 'bar', + 'host' => 'localhost', + 'database' => 'baz', + 'driver' => 'mysql', + ], + ], + 'params not parsed from URL but individual params are preserved' => [ + [ + 'url' => 'mysql://foo:bar@localhost/baz', + 'port' => 134, + ], + [ + 'username' => 'foo', + 'password' => 'bar', + 'host' => 'localhost', + 'port' => 134, + 'database' => 'baz', + 'driver' => 'mysql', + ], + ], + 'query params from URL are used as extra params' => [ + 'url' => 'mysql://foo:bar@localhost/database?charset=UTF-8', + [ + 'driver' => 'mysql', + 'database' => 'database', + 'host' => 'localhost', + 'username' => 'foo', + 'password' => 'bar', + 'charset' => 'UTF-8', + ], + ], + 'simple URL with driver set apart' => [ + [ + 'url' => '//foo:bar@localhost/baz', + 'driver' => 'sqlsrv', + ], + [ + 'username' => 'foo', + 'password' => 'bar', + 'host' => 'localhost', + 'database' => 'baz', + 'driver' => 'sqlsrv', + ], + ], + 'simple URL with percent encoding' => [ + 'mysql://foo%3A:bar%2F@localhost/baz+baz%40', + [ + 'username' => 'foo:', + 'password' => 'bar/', + 'host' => 'localhost', + 'database' => 'baz+baz@', + 'driver' => 'mysql', + ], + ], + 'simple URL with percent sign in password' => [ + 'mysql://foo:bar%25bar@localhost/baz', + [ + 'username' => 'foo', + 'password' => 'bar%bar', + 'host' => 'localhost', + 'database' => 'baz', + 'driver' => 'mysql', + ], + ], + 'URL with mssql alias driver' => [ + 'mssql://null', + [ + 'driver' => 'sqlsrv', + ], + ], + 'URL with sqlsrv alias driver' => [ + 'sqlsrv://null', + [ + 'driver' => 'sqlsrv', + ], + ], + 'URL with mysql alias driver' => [ + 'mysql://null', + [ + 'driver' => 'mysql', + ], + ], + 'URL with mysql2 alias driver' => [ + 'mysql2://null', + [ + 'driver' => 'mysql', + ], + ], + 'URL with postgres alias driver' => [ + 'postgres://null', + [ + 'driver' => 'pgsql', + ], + ], + 'URL with postgresql alias driver' => [ + 'postgresql://null', + [ + 'driver' => 'pgsql', + ], + ], + 'URL with pgsql alias driver' => [ + 'pgsql://null', + [ + 'driver' => 'pgsql', + ], + ], + 'URL with sqlite alias driver' => [ + 'sqlite://null', + [ + 'driver' => 'sqlite', + ], + ], + 'URL with sqlite3 alias driver' => [ + 'sqlite3://null', + [ + 'driver' => 'sqlite', + ], + ], + + 'URL with unknown driver' => [ + 'foo://null', + [ + 'driver' => 'foo', + ], + ], + 'Sqlite with foreign_key_constraints' => [ + 'sqlite:////absolute/path/to/database.sqlite?foreign_key_constraints=true', + [ + 'driver' => 'sqlite', + 'database' => '/absolute/path/to/database.sqlite', + 'foreign_key_constraints' => true, + ], + ], + + 'Most complex example with read and write subarrays all in string' => [ + 'mysql://root:@null/database?read[host][]=192.168.1.1&write[host][]=196.168.1.2&sticky=true&charset=utf8mb4&collation=utf8mb4_unicode_ci&prefix=', + [ + 'read' => [ + 'host' => ['192.168.1.1'], + ], + 'write' => [ + 'host' => ['196.168.1.2'], + ], + 'sticky' => true, + 'driver' => 'mysql', + 'database' => 'database', + 'username' => 'root', + 'password' => '', + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + ], + ], + + 'Full example from doc that prove that there isn\'t any Breaking Change' => [ + [ + 'driver' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'forge', + 'username' => 'forge', + 'password' => '', + 'unix_socket' => '', + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => ['foo' => 'bar'], + ], + [ + 'driver' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'forge', + 'username' => 'forge', + 'password' => '', + 'unix_socket' => '', + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => ['foo' => 'bar'], + ], + ], + + 'Full example from doc with url overwriting parameters' => [ + [ + 'url' => 'mysql://root:pass@db/local', + 'driver' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'forge', + 'username' => 'forge', + 'password' => '', + 'unix_socket' => '', + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => ['foo' => 'bar'], + ], + [ + 'driver' => 'mysql', + 'host' => 'db', + 'port' => '3306', + 'database' => 'local', + 'username' => 'root', + 'password' => 'pass', + 'unix_socket' => '', + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => ['foo' => 'bar'], + ], + ], + 'Redis Example' => [ + [ + // Coming directly from Heroku documentation + 'url' => 'redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111', + 'host' => '127.0.0.1', + 'password' => null, + 'port' => 6379, + 'database' => 0, + ], + [ + 'driver' => 'redis', + 'host' => 'ec2-111-1-1-1.compute-1.amazonaws.com', + 'port' => 111, + 'database' => 0, + 'username' => 'h', + 'password' => 'asdfqwer1234asdf', + ], + ], + ]; + } +}
true
Other
laravel
framework
eee81be200cb4aed8b43d4d7f6e3469a0bcd5a69.json
Remove UrlParser from database.
src/Illuminate/Database/ConfigurationUrlParser.php
@@ -1,190 +0,0 @@ -<?php - -namespace Illuminate\Database; - -use Illuminate\Support\Arr; -use InvalidArgumentException; - -class ConfigurationUrlParser -{ - /** - * The drivers aliases map. - * - * @var array - */ - protected static $driverAliases = [ - 'mssql' => 'sqlsrv', - 'mysql2' => 'mysql', // RDS - 'postgres' => 'pgsql', - 'postgresql' => 'pgsql', - 'sqlite3' => 'sqlite', - ]; - - /** - * Parse the database configuration, hydrating options using a database configuration URL if possible. - * - * @param array|string $config - * @return array - */ - public function parseConfiguration($config) - { - if (is_string($config)) { - $config = ['url' => $config]; - } - - $url = $config['url'] ?? null; - - $config = Arr::except($config, 'url'); - - if (! $url) { - return $config; - } - - $parsedUrl = $this->parseUrl($url); - - return array_merge( - $config, - $this->getPrimaryOptions($parsedUrl), - $this->getQueryOptions($parsedUrl) - ); - } - - /** - * Get the primary database connection options. - * - * @param array $url - * @return array - */ - protected function getPrimaryOptions($url) - { - return array_filter([ - 'driver' => $this->getDriver($url), - 'database' => $this->getDatabase($url), - 'host' => $url['host'] ?? null, - 'port' => $url['port'] ?? null, - 'username' => $url['user'] ?? null, - 'password' => $url['pass'] ?? null, - ], function ($value) { - return ! is_null($value); - }); - } - - /** - * Get the database driver from the URL. - * - * @param array $url - * @return string|null - */ - protected function getDriver($url) - { - $alias = $url['scheme'] ?? null; - - if (! $alias) { - return; - } - - return static::$driverAliases[$alias] ?? $alias; - } - - /** - * Get the database name from the URL. - * - * @param array $url - * @return string|null - */ - protected function getDatabase($url) - { - $path = $url['path'] ?? null; - - return $path ? substr($path, 1) : null; - } - - /** - * Get all of the additional database options from the query string. - * - * @param array $url - * @return array - */ - protected function getQueryOptions($url) - { - $queryString = $url['query'] ?? null; - - if (! $queryString) { - return []; - } - - $query = []; - - parse_str($queryString, $query); - - return $this->parseStringsToNativeTypes($query); - } - - /** - * Parse the string URL to an array of components. - * - * @param string $url - * @return array - */ - protected function parseUrl($url) - { - $url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url); - - $parsedUrl = parse_url($url); - - if ($parsedUrl === false) { - throw new InvalidArgumentException('The database configuration URL is malformed.'); - } - - return $this->parseStringsToNativeTypes( - array_map('rawurldecode', $parsedUrl) - ); - } - - /** - * Convert string casted values to their native types. - * - * @param mixed $value - * @return mixed - */ - protected function parseStringsToNativeTypes($value) - { - if (is_array($value)) { - return array_map([$this, 'parseStringsToNativeTypes'], $value); - } - - if (! is_string($value)) { - return $value; - } - - $parsedValue = json_decode($value, true); - - if (json_last_error() === JSON_ERROR_NONE) { - return $parsedValue; - } - - return $value; - } - - /** - * Get all of the current drivers aliases. - * - * @return array - */ - public static function getDriverAliases() - { - return static::$driverAliases; - } - - /** - * Add the given driver alias to the driver aliases array. - * - * @param string $alias - * @param string $driver - * @return void - */ - public static function addDriverAlias($alias, $driver) - { - static::$driverAliases[$alias] = $driver; - } -}
true
Other
laravel
framework
eee81be200cb4aed8b43d4d7f6e3469a0bcd5a69.json
Remove UrlParser from database.
tests/Database/DatabaseUrlParserTest.php
@@ -1,339 +0,0 @@ -<?php - -namespace Illuminate\Tests\Database; - -use PHPUnit\Framework\TestCase; -use Illuminate\Database\ConfigurationUrlParser; - -class DatabaseUrlParserTest extends TestCase -{ - /** - * @dataProvider databaseUrls - */ - public function testDatabaseUrlsAreParsed($config, $expectedOutput) - { - $this->assertEquals($expectedOutput, (new ConfigurationUrlParser)->parseConfiguration($config)); - } - - public function testDriversAliases() - { - $this->assertEquals([ - 'mssql' => 'sqlsrv', - 'mysql2' => 'mysql', - 'postgres' => 'pgsql', - 'postgresql' => 'pgsql', - 'sqlite3' => 'sqlite', - ], ConfigurationUrlParser::getDriverAliases()); - - ConfigurationUrlParser::addDriverAlias('some-particular-alias', 'mysql'); - - $this->assertEquals([ - 'mssql' => 'sqlsrv', - 'mysql2' => 'mysql', - 'postgres' => 'pgsql', - 'postgresql' => 'pgsql', - 'sqlite3' => 'sqlite', - 'some-particular-alias' => 'mysql', - ], ConfigurationUrlParser::getDriverAliases()); - - $this->assertEquals([ - 'driver' => 'mysql', - ], (new ConfigurationUrlParser)->parseConfiguration('some-particular-alias://null')); - } - - public function databaseUrls() - { - return [ - 'simple URL' => [ - 'mysql://foo:bar@localhost/baz', - [ - 'driver' => 'mysql', - 'username' => 'foo', - 'password' => 'bar', - 'host' => 'localhost', - 'database' => 'baz', - ], - ], - 'simple URL with port' => [ - 'mysql://foo:bar@localhost:134/baz', - [ - 'driver' => 'mysql', - 'username' => 'foo', - 'password' => 'bar', - 'host' => 'localhost', - 'port' => 134, - 'database' => 'baz', - ], - ], - 'sqlite relative URL with host' => [ - 'sqlite://localhost/foo/database.sqlite', - [ - 'database' => 'foo/database.sqlite', - 'driver' => 'sqlite', - 'host' => 'localhost', - ], - ], - 'sqlite absolute URL with host' => [ - 'sqlite://localhost//tmp/database.sqlite', - [ - 'database' => '/tmp/database.sqlite', - 'driver' => 'sqlite', - 'host' => 'localhost', - ], - ], - 'sqlite relative URL without host' => [ - 'sqlite:///foo/database.sqlite', - [ - 'database' => 'foo/database.sqlite', - 'driver' => 'sqlite', - ], - ], - 'sqlite absolute URL without host' => [ - 'sqlite:////tmp/database.sqlite', - [ - 'database' => '/tmp/database.sqlite', - 'driver' => 'sqlite', - ], - ], - 'sqlite memory' => [ - 'sqlite:///:memory:', - [ - 'database' => ':memory:', - 'driver' => 'sqlite', - ], - ], - 'params parsed from URL override individual params' => [ - [ - 'url' => 'mysql://foo:bar@localhost/baz', - 'password' => 'lulz', - 'driver' => 'sqlite', - ], - [ - 'username' => 'foo', - 'password' => 'bar', - 'host' => 'localhost', - 'database' => 'baz', - 'driver' => 'mysql', - ], - ], - 'params not parsed from URL but individual params are preserved' => [ - [ - 'url' => 'mysql://foo:bar@localhost/baz', - 'port' => 134, - ], - [ - 'username' => 'foo', - 'password' => 'bar', - 'host' => 'localhost', - 'port' => 134, - 'database' => 'baz', - 'driver' => 'mysql', - ], - ], - 'query params from URL are used as extra params' => [ - 'url' => 'mysql://foo:bar@localhost/database?charset=UTF-8', - [ - 'driver' => 'mysql', - 'database' => 'database', - 'host' => 'localhost', - 'username' => 'foo', - 'password' => 'bar', - 'charset' => 'UTF-8', - ], - ], - 'simple URL with driver set apart' => [ - [ - 'url' => '//foo:bar@localhost/baz', - 'driver' => 'sqlsrv', - ], - [ - 'username' => 'foo', - 'password' => 'bar', - 'host' => 'localhost', - 'database' => 'baz', - 'driver' => 'sqlsrv', - ], - ], - 'simple URL with percent encoding' => [ - 'mysql://foo%3A:bar%2F@localhost/baz+baz%40', - [ - 'username' => 'foo:', - 'password' => 'bar/', - 'host' => 'localhost', - 'database' => 'baz+baz@', - 'driver' => 'mysql', - ], - ], - 'simple URL with percent sign in password' => [ - 'mysql://foo:bar%25bar@localhost/baz', - [ - 'username' => 'foo', - 'password' => 'bar%bar', - 'host' => 'localhost', - 'database' => 'baz', - 'driver' => 'mysql', - ], - ], - 'URL with mssql alias driver' => [ - 'mssql://null', - [ - 'driver' => 'sqlsrv', - ], - ], - 'URL with sqlsrv alias driver' => [ - 'sqlsrv://null', - [ - 'driver' => 'sqlsrv', - ], - ], - 'URL with mysql alias driver' => [ - 'mysql://null', - [ - 'driver' => 'mysql', - ], - ], - 'URL with mysql2 alias driver' => [ - 'mysql2://null', - [ - 'driver' => 'mysql', - ], - ], - 'URL with postgres alias driver' => [ - 'postgres://null', - [ - 'driver' => 'pgsql', - ], - ], - 'URL with postgresql alias driver' => [ - 'postgresql://null', - [ - 'driver' => 'pgsql', - ], - ], - 'URL with pgsql alias driver' => [ - 'pgsql://null', - [ - 'driver' => 'pgsql', - ], - ], - 'URL with sqlite alias driver' => [ - 'sqlite://null', - [ - 'driver' => 'sqlite', - ], - ], - 'URL with sqlite3 alias driver' => [ - 'sqlite3://null', - [ - 'driver' => 'sqlite', - ], - ], - - 'URL with unknown driver' => [ - 'foo://null', - [ - 'driver' => 'foo', - ], - ], - 'Sqlite with foreign_key_constraints' => [ - 'sqlite:////absolute/path/to/database.sqlite?foreign_key_constraints=true', - [ - 'driver' => 'sqlite', - 'database' => '/absolute/path/to/database.sqlite', - 'foreign_key_constraints' => true, - ], - ], - - 'Most complex example with read and write subarrays all in string' => [ - 'mysql://root:@null/database?read[host][]=192.168.1.1&write[host][]=196.168.1.2&sticky=true&charset=utf8mb4&collation=utf8mb4_unicode_ci&prefix=', - [ - 'read' => [ - 'host' => ['192.168.1.1'], - ], - 'write' => [ - 'host' => ['196.168.1.2'], - ], - 'sticky' => true, - 'driver' => 'mysql', - 'database' => 'database', - 'username' => 'root', - 'password' => '', - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - ], - ], - - 'Full example from doc that prove that there isn\'t any Breaking Change' => [ - [ - 'driver' => 'mysql', - 'host' => '127.0.0.1', - 'port' => '3306', - 'database' => 'forge', - 'username' => 'forge', - 'password' => '', - 'unix_socket' => '', - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => ['foo' => 'bar'], - ], - [ - 'driver' => 'mysql', - 'host' => '127.0.0.1', - 'port' => '3306', - 'database' => 'forge', - 'username' => 'forge', - 'password' => '', - 'unix_socket' => '', - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => ['foo' => 'bar'], - ], - ], - - 'Full example from doc with url overwriting parameters' => [ - [ - 'url' => 'mysql://root:pass@db/local', - 'driver' => 'mysql', - 'host' => '127.0.0.1', - 'port' => '3306', - 'database' => 'forge', - 'username' => 'forge', - 'password' => '', - 'unix_socket' => '', - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => ['foo' => 'bar'], - ], - [ - 'driver' => 'mysql', - 'host' => 'db', - 'port' => '3306', - 'database' => 'local', - 'username' => 'root', - 'password' => 'pass', - 'unix_socket' => '', - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => ['foo' => 'bar'], - ], - ], - ]; - } -}
true
Other
laravel
framework
9b28de1cd6431b2aa17558755e71b10677da060d.json
Add tests for app environment helpers
tests/Foundation/FoundationApplicationTest.php
@@ -189,6 +189,30 @@ public function testEnvironment() $this->assertFalse($app->environment(['qux', 'bar'])); } + public function testEnvironmentHelpers() + { + $local = new Application; + $local['env'] = 'local'; + + $this->assertTrue($local->isLocal()); + $this->assertFalse($local->isProduction()); + $this->assertFalse($local->runningUnitTests()); + + $production = new Application; + $production['env'] = 'production'; + + $this->assertTrue($production->isProduction()); + $this->assertFalse($production->isLocal()); + $this->assertFalse($production->runningUnitTests()); + + $testing = new Application; + $testing['env'] = 'testing'; + + $this->assertTrue($testing->runningUnitTests()); + $this->assertFalse($testing->isLocal()); + $this->assertFalse($testing->isProduction()); + } + public function testMethodAfterLoadingEnvironmentAddsClosure() { $app = new Application;
false
Other
laravel
framework
e225b66a7916a9e964e5c09e7f749ca3be28c992.json
Add app()->isProduction() helper
src/Illuminate/Foundation/Application.php
@@ -519,6 +519,16 @@ public function isLocal() return $this['env'] === 'local'; } + /** + * Determine if application is in production environment. + * + * @return bool + */ + public function isProduction() + { + return $this['env'] === 'production'; + } + /** * Detect the application's current environment. *
false
Other
laravel
framework
c19ec3bd1351c7097d62ca60ffdfb581808e9c35.json
Add check for response status code being 204
src/Illuminate/Foundation/Testing/TestResponse.php
@@ -668,7 +668,7 @@ public function assertJsonValidationErrors($keys) */ public function assertJsonMissingValidationErrors($keys = null) { - if (empty($this->getContent())) { + if (empty($this->getContent()) && $this->getStatusCode() == 204) { PHPUnit::assertTrue(true); return $this;
true
Other
laravel
framework
c19ec3bd1351c7097d62ca60ffdfb581808e9c35.json
Add check for response status code being 204
tests/Foundation/FoundationTestResponseTest.php
@@ -448,11 +448,18 @@ public function testAssertJsonMissingValidationErrorsWithoutArgumentCanFail() public function testAssertJsonMissingValidationErrorsOnAnEmptyResponse() { - $testResponse = TestResponse::fromBaseResponse( + $emptyTestResponse204 = TestResponse::fromBaseResponse( (new Response)->setContent('') ); + $emptyTestResponse204->setStatusCode(204); + $emptyTestResponse204->assertJsonMissingValidationErrors(); - $testResponse->assertJsonMissingValidationErrors(); + $this->expectException(AssertionFailedError::class); + + $emptyTestResponseNot204 = TestResponse::fromBaseResponse( + (new Response)->setContent('') + ); + $emptyTestResponseNot204->assertJsonMissingValidationErrors(); } public function testMacroable()
true
Other
laravel
framework
55e459049c09572998cbbb8e277224cf91cd4102.json
Use consistent uppercase for DOCTYPE This is in line with the Google HTML guide and with other files in the framework. https://google.github.io/styleguide/htmlcssguide.html#HTML_Validity
src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php
@@ -1,4 +1,4 @@ -<!doctype html> +<!DOCTYPE html> <html lang="en"> <head> <title>@yield('title')</title>
false
Other
laravel
framework
0e02d0be82795138768906da3ac4200397849cc2.json
Remove unnecessary type attribute These aren't necessary when css and js files are used: https://google.github.io/styleguide/htmlcssguide.html#type_Attributes
src/Illuminate/Auth/Console/stubs/make/views/layouts/app.stub
@@ -14,7 +14,7 @@ <!-- Fonts --> <link rel="dns-prefetch" href="//fonts.gstatic.com"> - <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> + <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet"> <!-- Styles --> <link href="{{ asset('css/app.css') }}" rel="stylesheet">
true
Other
laravel
framework
0e02d0be82795138768906da3ac4200397849cc2.json
Remove unnecessary type attribute These aren't necessary when css and js files are used: https://google.github.io/styleguide/htmlcssguide.html#type_Attributes
src/Illuminate/Foundation/Exceptions/views/illustrated-layout.blade.php
@@ -8,7 +8,7 @@ <!-- Fonts --> <link rel="dns-prefetch" href="//fonts.gstatic.com"> - <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> + <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet"> <!-- Styles --> <style>
true
Other
laravel
framework
0e02d0be82795138768906da3ac4200397849cc2.json
Remove unnecessary type attribute These aren't necessary when css and js files are used: https://google.github.io/styleguide/htmlcssguide.html#type_Attributes
src/Illuminate/Foundation/Exceptions/views/minimal.blade.php
@@ -8,7 +8,7 @@ <!-- Fonts --> <link rel="dns-prefetch" href="//fonts.gstatic.com"> - <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> + <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet"> <!-- Styles --> <style>
true
Other
laravel
framework
254c0b16b59f1fe50a35cac0c7b69c67ea654016.json
add test case for empty $name
tests/Filesystem/FilesystemAdapterTest.php
@@ -58,6 +58,17 @@ public function testDownloadNonAsciiFilename() $files = new FilesystemAdapter($this->filesystem); $response = $files->download('file.txt', 'пиздюк.txt'); $this->assertInstanceOf(StreamedResponse::class, $response); + $this->assertEquals("attachment; filename=pizdyuk.txt; filename*=utf-8''%D0%BF%D0%B8%D0%B7%D0%B4%D1%8E%D0%BA.txt", $response->headers->get('content-disposition')); + } + + public function testDownloadNonAsciiEmptyFilename() + { + setlocale(LC_ALL,'en_US.UTF-8'); + + $this->filesystem->write('пиздюк.txt', 'Hello World'); + $files = new FilesystemAdapter($this->filesystem); + $response = $files->download('пиздюк.txt'); + $this->assertInstanceOf(StreamedResponse::class, $response); $this->assertEquals('attachment; filename=pizdyuk.txt; filename*=utf-8\'\'%D0%BF%D0%B8%D0%B7%D0%B4%D1%8E%D0%BA.txt', $response->headers->get('content-disposition')); }
false
Other
laravel
framework
998d4b88f50e9ab655834a31f3af36e9f7bd301a.json
Add html as a new valid extension for views.
src/Illuminate/View/Factory.php
@@ -66,6 +66,7 @@ class Factory implements FactoryContract 'blade.php' => 'blade', 'php' => 'php', 'css' => 'file', + 'html' => 'file', ]; /**
true
Other
laravel
framework
998d4b88f50e9ab655834a31f3af36e9f7bd301a.json
Add html as a new valid extension for views.
src/Illuminate/View/FileViewFinder.php
@@ -40,7 +40,7 @@ class FileViewFinder implements ViewFinderInterface * * @var array */ - protected $extensions = ['blade.php', 'php', 'css']; + protected $extensions = ['blade.php', 'php', 'css', 'html']; /** * Create a new file view loader instance.
true
Other
laravel
framework
998d4b88f50e9ab655834a31f3af36e9f7bd301a.json
Add html as a new valid extension for views.
tests/View/ViewFileViewFinderTest.php
@@ -39,6 +39,7 @@ public function testDirectoryCascadingFileLoading() $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.blade.php')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.php')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.css')->andReturn(false); + $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.html')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/nested/foo.blade.php')->andReturn(true); $this->assertEquals(__DIR__.'/nested/foo.blade.php', $finder->find('foo')); @@ -70,6 +71,7 @@ public function testDirectoryCascadingNamespacedFileLoading() $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.blade.php')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.php')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.css')->andReturn(false); + $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.html')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/bar/bar/baz.blade.php')->andReturn(true); $this->assertEquals(__DIR__.'/bar/bar/baz.blade.php', $finder->find('foo::bar.baz')); @@ -83,6 +85,7 @@ public function testExceptionThrownWhenViewNotFound() $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.blade.php')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.php')->andReturn(false); $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.css')->andReturn(false); + $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.html')->andReturn(false); $finder->find('foo'); } @@ -119,7 +122,7 @@ public function testAddingExtensionsReplacesOldOnes() $finder->addExtension('baz'); $finder->addExtension('baz'); - $this->assertCount(4, $finder->getExtensions()); + $this->assertCount(5, $finder->getExtensions()); } public function testPassingViewWithHintReturnsTrue()
true
Other
laravel
framework
ee4d8af4123f2e8a574c87a058948fd9dc7084c7.json
Apply fixes from StyleCI (#28537)
src/Illuminate/Cache/FileStore.php
@@ -190,7 +190,7 @@ protected function getPayload($key) $data = unserialize(substr($contents, 10)); } catch (Exception $e) { $this->forget($key); - + return $this->emptyPayload(); }
false
Other
laravel
framework
5de1d43c72b1f9d6161def6a6c343c9bf663fbac.json
Provide notification callback with Swift message
src/Illuminate/Notifications/Channels/MailChannel.php
@@ -137,6 +137,8 @@ protected function buildMessage($mailMessage, $notifiable, $notification, $messa if (! is_null($message->priority)) { $mailMessage->setPriority($message->priority); } + + $this->runCallbacks($mailMessage, $message); } /** @@ -225,4 +227,20 @@ protected function addAttachments($mailMessage, $message) $mailMessage->attachData($attachment['data'], $attachment['name'], $attachment['options']); } } + + /** + * Run the callbacks for the message. + * + * @param \Illuminate\Mail\Message $mailMessage + * @param \Illuminate\Notifications\Messages\MailMessage $message + * @return $this + */ + protected function runCallbacks($mailMessage, $message) + { + foreach ($message->callbacks as $callback) { + $callback($mailMessage->getSwiftMessage()); + } + + return $this; + } }
true
Other
laravel
framework
5de1d43c72b1f9d6161def6a6c343c9bf663fbac.json
Provide notification callback with Swift message
src/Illuminate/Notifications/Messages/MailMessage.php
@@ -73,6 +73,13 @@ class MailMessage extends SimpleMessage implements Renderable */ public $rawAttachments = []; + /** + * The callbacks for the message. + * + * @var array + */ + public $callbacks = []; + /** * Priority level of the message. * @@ -224,6 +231,19 @@ public function attachData($data, $name, array $options = []) return $this; } + /** + * Add a callback for the message. + * + * @param callable $callback + * @return $this + */ + public function withSwiftMessage($callback) + { + $this->callbacks[] = $callback; + + return $this; + } + /** * Set the priority of this message. *
true
Other
laravel
framework
5de1d43c72b1f9d6161def6a6c343c9bf663fbac.json
Provide notification callback with Swift message
tests/Notifications/NotificationMailMessageTest.php
@@ -74,4 +74,16 @@ public function testReplyToIsSetCorrectly() $this->assertSame([['test@example.com', null], ['test@example.com', 'Test']], $message->replyTo); } + + public function testCallbackIsSetCorrectly() + { + $callback = function () { + // + }; + + $message = new MailMessage; + $message->withSwiftMessage($callback); + + $this->assertSame([$callback], $message->callbacks); + } }
true
Other
laravel
framework
3627f33df082c988f84dd421ff97daf1c800eadf.json
Update the phpdoc of the id method to accept uuid When using Uuid as primary key, the PHPStorm and static analysis tools like PHPStan catch the advertise that auth()->id() is not an string, but it is when using Uuid.
src/Illuminate/Contracts/Auth/Guard.php
@@ -28,7 +28,7 @@ public function user(); /** * Get the ID for the currently authenticated user. * - * @return int|null + * @return int|string|null */ public function id();
false
Other
laravel
framework
7c23b7479e734eb22fa2befeaf9738876891c48a.json
Apply fixes from StyleCI (#28527)
src/Illuminate/Filesystem/Filesystem.php
@@ -254,7 +254,7 @@ public function link($target, $link) $mode = $this->isDirectory($target) ? 'J' : 'H'; - exec("mklink /{$mode} ".escapeshellarg($link)." ".escapeshellarg($target)); + exec("mklink /{$mode} ".escapeshellarg($link).' '.escapeshellarg($target)); } /**
false
Other
laravel
framework
44c3feb604944599ad1c782a9942981c3991fa31.json
use escapeshellarg on windows symlink
src/Illuminate/Filesystem/Filesystem.php
@@ -254,7 +254,7 @@ public function link($target, $link) $mode = $this->isDirectory($target) ? 'J' : 'H'; - exec("mklink /{$mode} \"{$link}\" \"{$target}\""); + exec("mklink /{$mode} ".escapeshellarg($link)." ".escapeshellarg($target)); } /**
false
Other
laravel
framework
f4e8d5c1f1b72e24baac33c336233cca24230783.json
support flush db on clusters
src/Illuminate/Redis/Connections/PhpRedisConnection.php
@@ -4,6 +4,7 @@ use Redis; use Closure; +use RedisCluster; use Illuminate\Contracts\Redis\Connection as ConnectionContract; /** @@ -388,6 +389,22 @@ public function createSubscription($channels, Closure $callback, $method = 'subs // } + /** + * Flush the selected Redis database. + * + * @return void + */ + public function flushdb() + { + if (! $this->client instanceof RedisCluster) { + return $this->command('flushdb'); + } + + foreach ($this->client->_masters() as [$host, $port]) { + tap(new Redis)->connect($host, $port)->flushDb(); + } + } + /** * Execute a raw command. *
true
Other
laravel
framework
f4e8d5c1f1b72e24baac33c336233cca24230783.json
support flush db on clusters
src/Illuminate/Redis/Connections/PredisConnection.php
@@ -3,6 +3,8 @@ namespace Illuminate\Redis\Connections; use Closure; +use Predis\Command\ServerFlushDatabase; +use Predis\Connection\Aggregate\PredisCluster; use Illuminate\Contracts\Redis\Connection as ConnectionContract; /** @@ -43,4 +45,20 @@ public function createSubscription($channels, Closure $callback, $method = 'subs unset($loop); } + + /** + * Flush the selected Redis database. + * + * @return void + */ + public function flushdb() + { + if (! $this->client->getConnection() instanceof PredisCluster) { + return $this->command('flushdb'); + } + + foreach ($this->getConnection() as $node) { + $node->executeCommand(new ServerFlushDatabase); + } + } }
true
Other
laravel
framework
5b6f297b6cec5c92fd42aed5802dddded905e587.json
Update docblock for connectionName
src/Illuminate/Queue/Jobs/Job.php
@@ -48,6 +48,8 @@ abstract class Job /** * The name of the connection the job belongs to. + * + * @var string */ protected $connectionName;
false
Other
laravel
framework
12e82c5155687082dc5c444e0438f59d2fc901b9.json
Fix a styling issue.
tests/Database/DatabaseSchemaBlueprintIntegrationTest.php
@@ -95,15 +95,15 @@ public function testChangingColumnWithCollationWorks() 'DROP TABLE users', 'CREATE TABLE users (age INTEGER NOT NULL COLLATE RTRIM)', 'INSERT INTO users (age) SELECT age FROM __temp__users', - 'DROP TABLE __temp__users' + 'DROP TABLE __temp__users', ]; $expected2 = [ 'CREATE TEMPORARY TABLE __temp__users AS SELECT age FROM users', 'DROP TABLE users', 'CREATE TABLE users (age INTEGER NOT NULL COLLATE NOCASE)', 'INSERT INTO users (age) SELECT age FROM __temp__users', - 'DROP TABLE __temp__users' + 'DROP TABLE __temp__users', ]; $this->assertEquals($expected, $queries);
false
Other
laravel
framework
40d3ba829988fbc0389be8e20952f5acecd2d94e.json
Fix a styling issue.
tests/Database/DatabaseSchemaBlueprintIntegrationTest.php
@@ -78,28 +78,34 @@ public function testChangingColumnWithCollationWorks() $this->db->connection()->getSchemaBuilder()->create('users', function ($table) { $table->string('age'); }); + $blueprint = new Blueprint('users', function ($table) { $table->integer('age')->collation('RTRIM')->change(); }); + $blueprint2 = new Blueprint('users', function ($table) { $table->integer('age')->collation('NOCASE')->change(); }); + $queries = $blueprint->toSql($this->db->connection(), new SQLiteGrammar); $queries2 = $blueprint2->toSql($this->db->connection(), new SQLiteGrammar); + $expected = [ 'CREATE TEMPORARY TABLE __temp__users AS SELECT age FROM users', 'DROP TABLE users', 'CREATE TABLE users (age INTEGER NOT NULL COLLATE RTRIM)', 'INSERT INTO users (age) SELECT age FROM __temp__users', 'DROP TABLE __temp__users' ]; + $expected2 = [ 'CREATE TEMPORARY TABLE __temp__users AS SELECT age FROM users', 'DROP TABLE users', 'CREATE TABLE users (age INTEGER NOT NULL COLLATE NOCASE)', 'INSERT INTO users (age) SELECT age FROM __temp__users', 'DROP TABLE __temp__users' ]; + $this->assertEquals($expected, $queries); $this->assertEquals($expected2, $queries2); }
false
Other
laravel
framework
0770e7a122f1fc75a55da5dfc26963df5cadfa44.json
Apply fixes from StyleCI (#28511)
src/Illuminate/Foundation/Events/DiscoverEvents.php
@@ -68,7 +68,7 @@ protected static function classFromFile(SplFileInfo $file, $basePath) $class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR); return str_replace( - [DIRECTORY_SEPARATOR, ucfirst(basename(app()->path()))."\\"], + [DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'], ['\\', app()->getNamespace()], ucfirst(Str::replaceLast('.php', '', $class)) );
false
Other
laravel
framework
0e52e470933b02163519ce96fce15711ba164ae1.json
Fix validation with multiple passes() calls
src/Illuminate/Validation/Validator.php
@@ -267,6 +267,8 @@ public function passes() $this->distinctValues = []; + $this->failedRules = []; + // We'll spin through each rule, validating the attributes attached to that // rule. Any error messages will be added to the containers with each of // the other error messages, returning true if we don't have messages.
true
Other
laravel
framework
0e52e470933b02163519ce96fce15711ba164ae1.json
Fix validation with multiple passes() calls
tests/Validation/ValidationValidatorTest.php
@@ -4413,6 +4413,14 @@ public function testValidatedNotValidateTwiceData() $this->assertEquals(1, $validateCount); } + public function testMultiplePassesCalls() + { + $trans = $this->getIlluminateArrayTranslator(); + $v = new Validator($trans, [], ['foo' => 'string|required']); + $this->assertFalse($v->passes()); + $this->assertFalse($v->passes()); + } + /** * @dataProvider validUuidList */
true
Other
laravel
framework
691cac5c8e3f542ac0c509193fd41d6480d695df.json
Use CanResetPassword contract
src/Illuminate/Auth/Notifications/ResetPassword.php
@@ -47,7 +47,7 @@ public function via($notifiable) /** * Build the mail representation of the notification. * - * @param mixed $notifiable + * @param \Illuminate\Contracts\Auth\CanResetPassword $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) @@ -59,7 +59,7 @@ public function toMail($notifiable) return (new MailMessage) ->subject(Lang::getFromJson('Reset Password Notification')) ->line(Lang::getFromJson('You are receiving this email because we received a password reset request for your account.')) - ->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', ['token' => $this->token, 'email' => $notifiable->email], false))) + ->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', ['token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset()], false))) ->line(Lang::getFromJson('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.users.expire')])) ->line(Lang::getFromJson('If you did not request a password reset, no further action is required.')); }
false
Other
laravel
framework
f08ef78444a6db54ce11329503543a7a14e15439.json
Use faker_locale config
src/Illuminate/Foundation/Testing/WithFaker.php
@@ -42,6 +42,6 @@ protected function faker($locale = null) */ protected function makeFaker($locale = null) { - return Factory::create($locale ?? Factory::DEFAULT_LOCALE); + return Factory::create($locale ?? config('app.faker_locale', Factory::DEFAULT_LOCALE)); } }
false
Other
laravel
framework
0fd627be7d66eb053b991d22c5d5e859284c8dce.json
Pass notifiable email through reset link
src/Illuminate/Auth/Notifications/ResetPassword.php
@@ -59,7 +59,7 @@ public function toMail($notifiable) return (new MailMessage) ->subject(Lang::getFromJson('Reset Password Notification')) ->line(Lang::getFromJson('You are receiving this email because we received a password reset request for your account.')) - ->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', ['token' => $this->token], false))) + ->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', ['token' => $this->token, 'email' => $notifiable->email], false))) ->line(Lang::getFromJson('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.users.expire')])) ->line(Lang::getFromJson('If you did not request a password reset, no further action is required.')); }
false
Other
laravel
framework
d13803151750232417c5ad2e749dd440e6f3cfce.json
Define router property of route:list command
src/Illuminate/Foundation/Console/RouteListCommand.php
@@ -27,11 +27,11 @@ class RouteListCommand extends Command protected $description = 'List all registered routes'; /** - * An array of all the registered routes. + * The router instance. * - * @var \Illuminate\Routing\RouteCollection + * @var \Illuminate\Routing\Router */ - protected $routes; + protected $router; /** * The table headers for the command.
false
Other
laravel
framework
f987a6db9bd7905e87eb399fc9b408818b153439.json
Reset webpack file for none preset When using the none preset and previously react was chosen the webpack config file would still point to the react js compiler. Instead we should reset this file back to the JS compiler. Fixes https://github.com/laravel/framework/issues/28461
src/Illuminate/Foundation/Console/Presets/None.php
@@ -15,6 +15,7 @@ public static function install() { static::updatePackages(); static::updateBootstrapping(); + static::updateWebpackConfiguration(); tap(new Filesystem, function ($filesystem) { $filesystem->deleteDirectory(resource_path('js/components')); @@ -58,4 +59,14 @@ protected static function updateBootstrapping() 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
f987a6db9bd7905e87eb399fc9b408818b153439.json
Reset webpack file for none preset When using the none preset and previously react was chosen the webpack config file would still point to the react js compiler. Instead we should reset this file back to the JS compiler. Fixes https://github.com/laravel/framework/issues/28461
src/Illuminate/Foundation/Console/Presets/none-stubs/webpack.mix.js
@@ -0,0 +1,15 @@ +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
5fad1041f790ed4c1c565c1bc85a9ac2072d7a8e.json
Improve route:list command
src/Illuminate/Foundation/Console/RouteListCommand.php
@@ -210,12 +210,32 @@ protected function getColumns() } if ($columns = $this->option('columns')) { - return array_intersect($availableColumns, $columns); + return array_intersect($availableColumns, $this->parseColumns($columns)); } return $availableColumns; } + /** + * Parse the exact listing of columns. + * + * @param array $columns + * @return array + */ + protected function parseColumns(array $columns) + { + $results = []; + + foreach ($columns as $i => $column) { + if (Str::contains($column, ',')) { + $results = array_merge($results, explode(',', $column)); + } else { + $results[] = $column; + } + } + + return $results; + } /** * Get the console command options. *
false
Other
laravel
framework
6587e78383c4ecc8d7f3791f54cf6f536a1fc089.json
add schedule cache method
src/Illuminate/Foundation/Console/Kernel.php
@@ -99,14 +99,25 @@ public function __construct(Application $app, Dispatcher $events) protected function defineConsoleSchedule() { $this->app->singleton(Schedule::class, function ($app) { - return new Schedule($this->scheduleTimezone()); + return (new Schedule($this->scheduleTimezone())) + ->useCache($this->scheduleCache()); }); $schedule = $this->app->make(Schedule::class); $this->schedule($schedule); } + /** + * Get the name of the cache store that should manage scheduling mutexes. + * + * @return string + */ + protected function scheduleCache() + { + return $_ENV['SCHEDULE_CACHE_DRIVER'] ?? null; + } + /** * Run the console application. *
false
Other
laravel
framework
48f8a90c10b8490d0e442a8f0cf258471208009f.json
Remove unused import
src/Illuminate/Filesystem/FilesystemAdapter.php
@@ -7,7 +7,6 @@ use Illuminate\Support\Arr; use Illuminate\Support\Str; use InvalidArgumentException; -use Illuminate\Support\Carbon; use Illuminate\Http\UploadedFile; use Illuminate\Support\Collection; use League\Flysystem\AdapterInterface;
false
Other
laravel
framework
c41ade97c174af2034980aa277bff39593db58bb.json
Remove Rackspace support for Filesystem We're removing this driver because we feel that general interest in it is declining and this isn't used by any of Laravel's core services themselves. We're encouraging the community to release a package for this if there's any interest in continued use of it.
src/Illuminate/Filesystem/FilesystemAdapter.php
@@ -17,7 +17,6 @@ use League\Flysystem\AwsS3v3\AwsS3Adapter; use League\Flysystem\Cached\CachedAdapter; use League\Flysystem\FileNotFoundException; -use League\Flysystem\Rackspace\RackspaceAdapter; use League\Flysystem\Adapter\Local as LocalAdapter; use Symfony\Component\HttpFoundation\StreamedResponse; use Illuminate\Contracts\Filesystem\Cloud as CloudFilesystemContract; @@ -400,8 +399,6 @@ public function url($path) return $this->driver->getUrl($path); } elseif ($adapter instanceof AwsS3Adapter) { return $this->getAwsUrl($adapter, $path); - } elseif ($adapter instanceof RackspaceAdapter) { - return $this->getRackspaceUrl($adapter, $path); } elseif ($adapter instanceof LocalAdapter) { return $this->getLocalUrl($path); } else { @@ -456,18 +453,6 @@ protected function getAwsUrl($adapter, $path) ); } - /** - * Get the URL for the file at the given path. - * - * @param \League\Flysystem\Rackspace\RackspaceAdapter $adapter - * @param string $path - * @return string - */ - protected function getRackspaceUrl($adapter, $path) - { - return (string) $adapter->getContainer()->getObject($path)->getPublicUrl(); - } - /** * Get the URL for the file at the given path. * @@ -519,8 +504,6 @@ public function temporaryUrl($path, $expiration, array $options = []) return $adapter->getTemporaryUrl($path, $expiration, $options); } elseif ($adapter instanceof AwsS3Adapter) { return $this->getAwsTemporaryUrl($adapter, $path, $expiration, $options); - } elseif ($adapter instanceof RackspaceAdapter) { - return $this->getRackspaceTemporaryUrl($adapter, $path, $expiration, $options); } else { throw new RuntimeException('This driver does not support creating temporary URLs.'); } @@ -549,24 +532,6 @@ public function getAwsTemporaryUrl($adapter, $path, $expiration, $options) )->getUri(); } - /** - * Get a temporary URL for the file at the given path. - * - * @param \League\Flysystem\Rackspace\RackspaceAdapter $adapter - * @param string $path - * @param \DateTimeInterface $expiration - * @param array $options - * @return string - */ - public function getRackspaceTemporaryUrl($adapter, $path, $expiration, $options) - { - return $adapter->getContainer()->getObject($path)->getTemporaryUrl( - Carbon::now()->diffInSeconds($expiration), - $options['method'] ?? 'GET', - $options['forcePublicUrl'] ?? true - ); - } - /** * Concatenate a path to a URL. *
true
Other
laravel
framework
c41ade97c174af2034980aa277bff39593db58bb.json
Remove Rackspace support for Filesystem We're removing this driver because we feel that general interest in it is declining and this isn't used by any of Laravel's core services themselves. We're encouraging the community to release a package for this if there's any interest in continued use of it.
src/Illuminate/Filesystem/FilesystemManager.php
@@ -4,7 +4,6 @@ use Closure; use Aws\S3\S3Client; -use OpenCloud\Rackspace; use Illuminate\Support\Arr; use InvalidArgumentException; use League\Flysystem\AdapterInterface; @@ -13,7 +12,6 @@ use League\Flysystem\Cached\CachedAdapter; use League\Flysystem\Filesystem as Flysystem; use League\Flysystem\Adapter\Ftp as FtpAdapter; -use League\Flysystem\Rackspace\RackspaceAdapter; use League\Flysystem\Adapter\Local as LocalAdapter; use League\Flysystem\AwsS3v3\AwsS3Adapter as S3Adapter; use League\Flysystem\Cached\Storage\Memory as MemoryStore; @@ -226,41 +224,6 @@ protected function formatS3Config(array $config) return $config; } - /** - * Create an instance of the Rackspace driver. - * - * @param array $config - * @return \Illuminate\Contracts\Filesystem\Cloud - */ - public function createRackspaceDriver(array $config) - { - $client = new Rackspace($config['endpoint'], [ - 'username' => $config['username'], 'apiKey' => $config['key'], - ], $config['options'] ?? []); - - $root = $config['root'] ?? null; - - return $this->adapt($this->createFlysystem( - new RackspaceAdapter($this->getRackspaceContainer($client, $config), $root), $config - )); - } - - /** - * Get the Rackspace Cloud Files container. - * - * @param \OpenCloud\Rackspace $client - * @param array $config - * @return \OpenCloud\ObjectStore\Resource\Container - */ - protected function getRackspaceContainer(Rackspace $client, array $config) - { - $urlType = $config['url_type'] ?? null; - - $store = $client->objectStoreService('cloudFiles', $config['region'], $urlType); - - return $store->getContainer($config['container']); - } - /** * Create a Flysystem instance with the given adapter. *
true
Other
laravel
framework
c41ade97c174af2034980aa277bff39593db58bb.json
Remove Rackspace support for Filesystem We're removing this driver because we feel that general interest in it is declining and this isn't used by any of Laravel's core services themselves. We're encouraging the community to release a package for this if there's any interest in continued use of it.
src/Illuminate/Filesystem/composer.json
@@ -33,7 +33,6 @@ "league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (^1.0).", "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0)." }, "config": {
true
Other
laravel
framework
e2461f19c3b951f7cbb4b424601cad1f6553774a.json
Remove Mandrill and SparkPost mail drivers We're removing these drivers because we feel that general interest in these is declining and these aren't used by any of Laravel's core services themselves. We're encouraging the community to release packages for these if there's any interest in continued use of them.
composer.json
@@ -120,7 +120,7 @@ "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", "filp/whoops": "Required for friendly error pages in development (^2.1.4).", "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (^6.0).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.0).", "laravel/tinker": "Required to use the tinker console command (^1.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
true
Other
laravel
framework
e2461f19c3b951f7cbb4b424601cad1f6553774a.json
Remove Mandrill and SparkPost mail drivers We're removing these drivers because we feel that general interest in these is declining and these aren't used by any of Laravel's core services themselves. We're encouraging the community to release packages for these if there's any interest in continued use of them.
src/Illuminate/Mail/Transport/MandrillTransport.php
@@ -1,105 +0,0 @@ -<?php - -namespace Illuminate\Mail\Transport; - -use Swift_Mime_SimpleMessage; -use GuzzleHttp\ClientInterface; - -class MandrillTransport extends Transport -{ - /** - * Guzzle client instance. - * - * @var \GuzzleHttp\ClientInterface - */ - protected $client; - - /** - * The Mandrill API key. - * - * @var string - */ - protected $key; - - /** - * Create a new Mandrill transport instance. - * - * @param \GuzzleHttp\ClientInterface $client - * @param string $key - * @return void - */ - public function __construct(ClientInterface $client, $key) - { - $this->key = $key; - $this->client = $client; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) - { - $this->beforeSendPerformed($message); - - $this->client->request('POST', 'https://mandrillapp.com/api/1.0/messages/send-raw.json', [ - 'form_params' => [ - 'key' => $this->key, - 'to' => $this->getTo($message), - 'raw_message' => $message->toString(), - 'async' => true, - ], - ]); - - $this->sendPerformed($message); - - return $this->numberOfRecipients($message); - } - - /** - * Get all the addresses this message should be sent to. - * - * Note that Mandrill still respects CC, BCC headers in raw message itself. - * - * @param \Swift_Mime_SimpleMessage $message - * @return array - */ - protected function getTo(Swift_Mime_SimpleMessage $message) - { - $to = []; - - if ($message->getTo()) { - $to = array_merge($to, array_keys($message->getTo())); - } - - if ($message->getCc()) { - $to = array_merge($to, array_keys($message->getCc())); - } - - if ($message->getBcc()) { - $to = array_merge($to, array_keys($message->getBcc())); - } - - return $to; - } - - /** - * Get the API key being used by the transport. - * - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Set the API key being used by the transport. - * - * @param string $key - * @return string - */ - public function setKey($key) - { - return $this->key = $key; - } -}
true
Other
laravel
framework
e2461f19c3b951f7cbb4b424601cad1f6553774a.json
Remove Mandrill and SparkPost mail drivers We're removing these drivers because we feel that general interest in these is declining and these aren't used by any of Laravel's core services themselves. We're encouraging the community to release packages for these if there's any interest in continued use of them.
src/Illuminate/Mail/Transport/SparkPostTransport.php
@@ -1,169 +0,0 @@ -<?php - -namespace Illuminate\Mail\Transport; - -use Swift_Mime_SimpleMessage; -use GuzzleHttp\ClientInterface; - -class SparkPostTransport extends Transport -{ - /** - * Guzzle client instance. - * - * @var \GuzzleHttp\ClientInterface - */ - protected $client; - - /** - * The SparkPost API key. - * - * @var string - */ - protected $key; - - /** - * The SparkPost transmission options. - * - * @var array - */ - protected $options = []; - - /** - * Create a new SparkPost transport instance. - * - * @param \GuzzleHttp\ClientInterface $client - * @param string $key - * @param array $options - * @return void - */ - public function __construct(ClientInterface $client, $key, $options = []) - { - $this->key = $key; - $this->client = $client; - $this->options = $options; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null) - { - $this->beforeSendPerformed($message); - - $recipients = $this->getRecipients($message); - - $message->setBcc([]); - - $response = $this->client->request('POST', $this->getEndpoint(), [ - 'headers' => [ - 'Authorization' => $this->key, - ], - 'json' => array_merge([ - 'recipients' => $recipients, - 'content' => [ - 'email_rfc822' => $message->toString(), - ], - ], $this->options), - ]); - - $message->getHeaders()->addTextHeader( - 'X-SparkPost-Transmission-ID', $this->getTransmissionId($response) - ); - - $this->sendPerformed($message); - - return $this->numberOfRecipients($message); - } - - /** - * Get all the addresses this message should be sent to. - * - * Note that SparkPost still respects CC, BCC headers in raw message itself. - * - * @param \Swift_Mime_SimpleMessage $message - * @return array - */ - protected function getRecipients(Swift_Mime_SimpleMessage $message) - { - $recipients = []; - - foreach ((array) $message->getTo() as $email => $name) { - $recipients[] = ['address' => compact('name', 'email')]; - } - - foreach ((array) $message->getCc() as $email => $name) { - $recipients[] = ['address' => compact('name', 'email')]; - } - - foreach ((array) $message->getBcc() as $email => $name) { - $recipients[] = ['address' => compact('name', 'email')]; - } - - return $recipients; - } - - /** - * Get the transmission ID from the response. - * - * @param \GuzzleHttp\Psr7\Response $response - * @return string - */ - protected function getTransmissionId($response) - { - return object_get( - json_decode($response->getBody()->getContents()), 'results.id' - ); - } - - /** - * Get the API key being used by the transport. - * - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Set the API key being used by the transport. - * - * @param string $key - * @return string - */ - public function setKey($key) - { - return $this->key = $key; - } - - /** - * Get the SparkPost API endpoint. - * - * @return string - */ - public function getEndpoint() - { - return $this->getOptions()['endpoint'] ?? 'https://api.sparkpost.com/api/v1/transmissions'; - } - - /** - * Get the transmission options being used by the transport. - * - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * Set the transmission options being used by the transport. - * - * @param array $options - * @return array - */ - public function setOptions(array $options) - { - return $this->options = $options; - } -}
true
Other
laravel
framework
e2461f19c3b951f7cbb4b424601cad1f6553774a.json
Remove Mandrill and SparkPost mail drivers We're removing these drivers because we feel that general interest in these is declining and these aren't used by any of Laravel's core services themselves. We're encouraging the community to release packages for these if there's any interest in continued use of them.
src/Illuminate/Mail/TransportManager.php
@@ -14,8 +14,6 @@ use Postmark\Transport as PostmarkTransport; use Illuminate\Mail\Transport\ArrayTransport; use Illuminate\Mail\Transport\MailgunTransport; -use Illuminate\Mail\Transport\MandrillTransport; -use Illuminate\Mail\Transport\SparkPostTransport; use Swift_SendmailTransport as SendmailTransport; class TransportManager extends Manager @@ -126,34 +124,6 @@ protected function createMailgunDriver() ); } - /** - * Create an instance of the Mandrill Swift Transport driver. - * - * @return \Illuminate\Mail\Transport\MandrillTransport - */ - protected function createMandrillDriver() - { - $config = $this->app['config']->get('services.mandrill', []); - - return new MandrillTransport( - $this->guzzle($config), $config['secret'] - ); - } - - /** - * Create an instance of the SparkPost Swift Transport driver. - * - * @return \Illuminate\Mail\Transport\SparkPostTransport - */ - protected function createSparkPostDriver() - { - $config = $this->app['config']->get('services.sparkpost', []); - - return new SparkPostTransport( - $this->guzzle($config), $config['secret'], $config['options'] ?? [] - ); - } - /** * Create an instance of the Postmark Swift Transport driver. *
true
Other
laravel
framework
e2461f19c3b951f7cbb4b424601cad1f6553774a.json
Remove Mandrill and SparkPost mail drivers We're removing these drivers because we feel that general interest in these is declining and these aren't used by any of Laravel's core services themselves. We're encouraging the community to release packages for these if there's any interest in continued use of them.
src/Illuminate/Mail/composer.json
@@ -36,7 +36,7 @@ }, "suggest": { "aws/aws-sdk-php": "Required to use the SES mail driver (^3.0).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (^6.0).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver (^6.0).", "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." }, "config": {
true
Other
laravel
framework
e9e63be1dcad45735e7bb7f074a0f86cfab67a07.json
apply code style
tests/Integration/Routing/PreviousUrlTest.php
@@ -2,6 +2,8 @@ namespace Illuminate\Tests\Integration\Routing; +use Orchestra\Testbench\TestCase; +use Illuminate\Support\Facades\Route; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Session\SessionServiceProvider; use Illuminate\Support\Facades\Route;
false
Other
laravel
framework
ccf9d4a5bd10f2c976c341f3b7fdae09403719e1.json
pass verification URL to callback
src/Illuminate/Auth/Notifications/VerifyEmail.php
@@ -37,17 +37,16 @@ public function via($notifiable) */ public function toMail($notifiable) { + $verificationUrl = $this->verificationUrl($notifiable); + if (static::$toMailCallback) { - return call_user_func(static::$toMailCallback, $notifiable); + return call_user_func(static::$toMailCallback, $notifiable, $verificationUrl); } return (new MailMessage) ->subject(Lang::getFromJson('Verify Email Address')) ->line(Lang::getFromJson('Please click the button below to verify your email address.')) - ->action( - Lang::getFromJson('Verify Email Address'), - $this->verificationUrl($notifiable) - ) + ->action(Lang::getFromJson('Verify Email Address'), $verificationUrl) ->line(Lang::getFromJson('If you did not create an account, no further action is required.')); }
false