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 | b6b56c679435481faf435dd3435b118696aeefe5.json | Fix engine issueing
Fix that a view (`welcomeblade.php`) would run the `BladeEngine` instead of the `PhpEngine`. | src/Illuminate/View/Factory.php | @@ -308,7 +308,7 @@ protected function getExtension($path)
$extensions = array_keys($this->extensions);
return Arr::first($extensions, function ($key, $value) use ($path) {
- return Str::endsWith($path, $value);
+ return Str::endsWith($path, '.'.$value);
});
}
| false |
Other | laravel | framework | c908ea659d8cea35f9376b428efb3188c895017a.json | return null on empty credentials | src/Illuminate/Auth/EloquentUserProvider.php | @@ -86,20 +86,22 @@ public function updateRememberToken(UserContract $user, $token)
*/
public function retrieveByCredentials(array $credentials)
{
+ if (empty($credentials)) {
+ return;
+ }
+
// First we will add each credential element to the query as a where clause.
... | true |
Other | laravel | framework | c908ea659d8cea35f9376b428efb3188c895017a.json | return null on empty credentials | tests/View/ViewBladeCompilerTest.php | @@ -577,7 +577,7 @@ public function testIncludeIfsAreCompiled()
{
$compiler = new BladeCompiler($this->getFiles(), __DIR__);
$this->assertEquals('<?php if ($__env->exists(\'foo\')) echo $__env->make(\'foo\', array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>', $compile... | true |
Other | laravel | framework | 8b578b8ca1444653f01b415edbe43f5cb579a9aa.json | fix coding style | src/Illuminate/Database/DetectsLostConnections.php | @@ -28,7 +28,7 @@ protected function causedByLostConnection(Exception $e)
'SSL connection has been closed unexpectedly',
'Deadlock found when trying to get lock',
'Error writing data to the connection',
- 'Resource deadlock avoided'
+ 'Resource deadlock avoid... | false |
Other | laravel | framework | 76189fe7c8dafe8a1be63aab032c174db10f0ac2.json | fix variable name and docblock | src/Illuminate/Foundation/helpers.php | @@ -329,20 +329,21 @@ function dispatch($job)
* Get the path to a versioned Elixir file.
*
* @param string $file
+ * @param string $buildDirectory
* @return string
*
* @throws \InvalidArgumentException
*/
- function elixir($file, $customFolder = 'build')
+ functio... | false |
Other | laravel | framework | 027b14da1669ea1b92781ec7d9b178dbcdd905c6.json | Seperate push from section | src/Illuminate/View/Compilers/BladeCompiler.php | @@ -833,7 +833,7 @@ protected function compileInclude($expression)
*/
protected function compileStack($expression)
{
- return "<?php echo \$__env->yieldContent{$expression}; ?>";
+ return "<?php echo \$__env->yieldPushContent{$expression}; ?>";
}
/**
@@ -844,7 +844,7 @@ protect... | true |
Other | laravel | framework | 027b14da1669ea1b92781ec7d9b178dbcdd905c6.json | Seperate push from section | src/Illuminate/View/Factory.php | @@ -84,13 +84,27 @@ class Factory implements FactoryContract
*/
protected $sections = [];
+ /**
+ * All of the finished, captured push sections.
+ *
+ * @var array
+ */
+ protected $pushContentsStack = [];
+
/**
* The stack of in-progress sections.
*
* @var arra... | true |
Other | laravel | framework | f4fd485846df1e75435c8097499c2266ba356cd0.json | remove old method | src/Illuminate/Foundation/Application.php | @@ -1104,20 +1104,6 @@ public function flush()
$this->loadedProviders = [];
}
- /**
- * Get the used kernel object.
- *
- * @return \Illuminate\Contracts\Console\Kernel|\Illuminate\Contracts\Http\Kernel
- */
- protected function getKernel()
- {
- $kernelContract = $this->... | false |
Other | laravel | framework | 6a09db676e53f95f07c7ff252dd1842fea053fdc.json | add empty lines | src/Illuminate/Filesystem/Filesystem.php | @@ -38,6 +38,7 @@ public function get($path, $lock = false)
if ($lock) {
return $this->sharedGet($path, $lock);
}
+
return file_get_contents($path);
}
@@ -62,6 +63,7 @@ public function sharedGet($path)
}
fclose($handle);
... | false |
Other | laravel | framework | 0b3bc1b6202c4baefd7c29f6a27948192a7cdbd3.json | Add shared locks to Filesystem and Cache/FileStore | src/Illuminate/Cache/FileStore.php | @@ -63,7 +63,7 @@ protected function getPayload($key)
// just return null. Otherwise, we'll get the contents of the file and get
// the expiration UNIX timestamps from the start of the file's contents.
try {
- $expire = substr($contents = $this->files->get($path), 0, 10);
+ ... | true |
Other | laravel | framework | 0b3bc1b6202c4baefd7c29f6a27948192a7cdbd3.json | Add shared locks to Filesystem and Cache/FileStore | src/Illuminate/Filesystem/Filesystem.php | @@ -27,19 +27,44 @@ public function exists($path)
* Get the contents of a file.
*
* @param string $path
+ * @param bool $lock
* @return string
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
- public function get($path)
+ public function get(... | true |
Other | laravel | framework | 0b3bc1b6202c4baefd7c29f6a27948192a7cdbd3.json | Add shared locks to Filesystem and Cache/FileStore | tests/Filesystem/FilesystemTest.php | @@ -289,4 +289,33 @@ public function testMakeDirectory()
$this->assertFileExists(__DIR__.'/foo');
@rmdir(__DIR__.'/foo');
}
+
+ public function testSharedGet()
+ {
+ $content = '';
+ for ($i = 0; $i < 1000000; ++$i) {
+ $content .= $i;
+ }
+ $result = ... | true |
Other | laravel | framework | 638e32ab500150b36956bc9942c5c9719883071d.json | Add `failed()` on InteractsWithQueue.
Allow to failed a job when using InteractsWithQueue instead of just
deleting the job.
Signed-off-by: crynobone <crynobone@gmail.com> | src/Illuminate/Queue/InteractsWithQueue.php | @@ -13,6 +13,16 @@ trait InteractsWithQueue
*/
protected $job;
+ /**
+ * Get the number of times the job has been attempted.
+ *
+ * @return int
+ */
+ public function attempts()
+ {
+ return $this->job ? $this->job->attempts() : 1;
+ }
+
/**
* Delete the job f... | false |
Other | laravel | framework | f3d8d99f585c2e9470974938afdbf47f9153d882.json | move method. formatting. | src/Illuminate/Support/Collection.php | @@ -542,6 +542,17 @@ public function merge($items)
return new static(array_merge($this->items, $this->getArrayableItems($items)));
}
+ /**
+ * Create a collection by using this collection for keys and another for its values.
+ *
+ * @param mixed $values
+ * @return static
+ */
+... | false |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | src/Illuminate/Auth/SessionGuard.php | @@ -734,7 +734,7 @@ public function getLastAttempted()
*/
public function getName()
{
- return 'login_'.$this->name.'_'.sha1(get_class($this));
+ return 'login_'.$this->name.'_'.sha1(static::class);
}
/**
@@ -744,7 +744,7 @@ public function getName()
*/
public functi... | true |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | src/Illuminate/Database/Eloquent/Model.php | @@ -288,7 +288,7 @@ public function __construct(array $attributes = [])
*/
protected function bootIfNotBooted()
{
- $class = get_class($this);
+ $class = static::class;
if (! isset(static::$booted[$class])) {
static::$booted[$class] = true;
@@ -318,9 +318,9 @@ prote... | true |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | src/Illuminate/Database/Query/Builder.php | @@ -2156,7 +2156,7 @@ public function __call($method, $parameters)
return $this->dynamicWhere($method, $parameters);
}
- $className = get_class($this);
+ $className = static::class;
throw new BadMethodCallException("Call to undefined method {$className}::{$method}()");
... | true |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | src/Illuminate/Foundation/Auth/AuthenticatesUsers.php | @@ -206,7 +206,7 @@ public function loginUsername()
protected function isUsingThrottlesLoginsTrait()
{
return in_array(
- ThrottlesLogins::class, class_uses_recursive(get_class($this))
+ ThrottlesLogins::class, class_uses_recursive(static::class)
);
}
| true |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | src/Illuminate/Foundation/Testing/TestCase.php | @@ -92,7 +92,7 @@ protected function refreshApplication()
*/
protected function setUpTraits()
{
- $uses = array_flip(class_uses_recursive(get_class($this)));
+ $uses = array_flip(class_uses_recursive(static::class));
if (isset($uses[DatabaseTransactions::class])) {
... | true |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | src/Illuminate/Support/ServiceProvider.php | @@ -104,7 +104,7 @@ protected function loadTranslationsFrom($path, $namespace)
*/
protected function publishes(array $paths, $group = null)
{
- $class = get_class($this);
+ $class = static::class;
if (! array_key_exists($class, static::$publishes)) {
static::$publis... | true |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | src/Illuminate/Support/Traits/Macroable.php | @@ -50,7 +50,7 @@ public static function __callStatic($method, $parameters)
{
if (static::hasMacro($method)) {
if (static::$macros[$method] instanceof Closure) {
- return call_user_func_array(Closure::bind(static::$macros[$method], null, get_called_class()), $parameters);
+ ... | true |
Other | laravel | framework | e8c0d702acf20f486fc973ddd4070c5da9a65a7c.json | Make use of static::class | tests/Database/DatabaseEloquentModelTest.php | @@ -1467,12 +1467,12 @@ class EloquentModelBootingTestStub extends Model
{
public static function unboot()
{
- unset(static::$booted[get_called_class()]);
+ unset(static::$booted[static::class]);
}
public static function isBooted()
{
- return array_key_exists(get_called_... | true |
Other | laravel | framework | 1c88528b0a855b0ab4e7777aea4aa0ee838468c2.json | change method order | src/Illuminate/Foundation/Application.php | @@ -305,6 +305,16 @@ public function basePath()
return $this->basePath;
}
+ /**
+ * Get the path to the bootstrap directory.
+ *
+ * @return string
+ */
+ public function bootstrapPath()
+ {
+ return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap';
+ }
+
/**
... | false |
Other | laravel | framework | ddb937e78959e365e56c4cf5933f066511de0e83.json | Prefer dist installs instead of clones | .travis.yml | @@ -21,8 +21,8 @@ matrix:
sudo: false
install:
- - if [[ $setup = 'basic' ]]; then travis_retry composer install --no-interaction --prefer-source; fi
- - if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-source --no-interaction --prefer-stable; fi
- - if [[ $setup = 'lowest' ]]; then travis_... | false |
Other | laravel | framework | af0523ee848d055a0c991ddb28bc4677b0b5f7fe.json | fix method order | src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php | @@ -295,6 +295,88 @@ protected function hasSource($text)
return preg_match("/$pattern/i", $this->html());
}
+ /**
+ * Assert that an element is present on the page.
+ *
+ * @param string $selector
+ * @param array $attributes
+ * @return void
+ */
+ public function seeE... | false |
Other | laravel | framework | e226fed6ce59e7dc19ea334dff75107364ebda77.json | fix setting order. | src/Illuminate/Queue/Events/JobExceptionOccurred.php | @@ -45,7 +45,7 @@ public function __construct($connectionName, $job, $data, $exception)
{
$this->job = $job;
$this->data = $data;
- $this->connectionName = $connectionName;
$this->exception = $exception;
+ $this->connectionName = $connectionName;
}
} | false |
Other | laravel | framework | 466e0e1cd026fa456b189d45975ae7c7adf3e53f.json | Use getters instead of hardcoded values | src/Illuminate/Foundation/Console/KeyGenerateCommand.php | @@ -37,7 +37,7 @@ public function fire()
return $this->line('<comment>'.$key.'</comment>');
}
- $path = base_path('.env');
+ $path = $app->environmentPath().'/'.$app->environmentFile();
if (file_exists($path)) {
$content = str_replace('APP_KEY='.$app['config... | false |
Other | laravel | framework | 17d6293ba52093ff71f464da7785206dde148158.json | Add isLocale method | src/Illuminate/Foundation/Application.php | @@ -1020,6 +1020,17 @@ public function setLocale($locale)
$this['events']->fire('locale.changed', [$locale]);
}
+ /**
+ * Determine if application locale equals the given locale.
+ *
+ * @param string $locale
+ * @return bool
+ */
+ public function isLocale($locale)
+ {
+ ... | false |
Other | laravel | framework | efafba186a2787ad0642d4ff27cf618dc2191e10.json | Remove return since this is a void method. | src/Illuminate/Database/Schema/Blueprint.php | @@ -779,7 +779,7 @@ public function timestampTz($column)
*/
public function nullableTimestamps()
{
- return $this->timestamps();
+ $this->timestamps();
}
/** | false |
Other | laravel | framework | f68ea56a3f8e44e37ea8740c3fb9bf691d12ff51.json | Add method Application::bootstrapPath() | src/Illuminate/Foundation/Application.php | @@ -282,6 +282,7 @@ protected function bindPathsInContainer()
$this->instance('path.public', $this->publicPath());
$this->instance('path.storage', $this->storagePath());
$this->instance('path.database', $this->databasePath());
+ $this->instance('path.bootstrap', $this->bootstrapPath())... | true |
Other | laravel | framework | f68ea56a3f8e44e37ea8740c3fb9bf691d12ff51.json | Add method Application::bootstrapPath() | src/Illuminate/Foundation/Console/AppNameCommand.php | @@ -247,7 +247,7 @@ protected function replaceIn($path, $search, $replace)
*/
protected function getBootstrapPath()
{
- return $this->laravel->basePath().'/bootstrap/app.php';
+ return $this->laravel->bootstrapPath().'/app.php';
}
/** | true |
Other | laravel | framework | f68ea56a3f8e44e37ea8740c3fb9bf691d12ff51.json | Add method Application::bootstrapPath() | src/Illuminate/Foundation/Console/ConfigCacheCommand.php | @@ -66,7 +66,7 @@ public function fire()
*/
protected function getFreshConfiguration()
{
- $app = require $this->laravel->basePath().'/bootstrap/app.php';
+ $app = require $this->laravel->bootstrapPath().'/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();... | true |
Other | laravel | framework | f68ea56a3f8e44e37ea8740c3fb9bf691d12ff51.json | Add method Application::bootstrapPath() | src/Illuminate/Foundation/Console/IlluminateCaster.php | @@ -30,6 +30,7 @@ class IlluminateCaster
'langPath',
'publicPath',
'storagePath',
+ 'bootstrapPath',
];
/** | true |
Other | laravel | framework | f68ea56a3f8e44e37ea8740c3fb9bf691d12ff51.json | Add method Application::bootstrapPath() | src/Illuminate/Foundation/Console/RouteCacheCommand.php | @@ -75,7 +75,7 @@ public function fire()
*/
protected function getFreshApplicationRoutes()
{
- $app = require $this->laravel->basePath().'/bootstrap/app.php';
+ $app = require $this->laravel->bootstrapPath().'/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstra... | true |
Other | laravel | framework | d3e81bdb525c3c1dc8f9683eb537ad85f0f6cc21.json | Correct docblock @return types | src/Illuminate/Foundation/Application.php | @@ -434,7 +434,7 @@ public function environmentFile()
* Get or check the current application environment.
*
* @param mixed
- * @return string
+ * @return string|bool
*/
public function environment()
{ | true |
Other | laravel | framework | d3e81bdb525c3c1dc8f9683eb537ad85f0f6cc21.json | Correct docblock @return types | src/Illuminate/Queue/Queue.php | @@ -140,7 +140,7 @@ protected function prepareQueueableEntity($value)
*
* @param \Closure $job
* @param mixed $data
- * @return string
+ * @return array
*/
protected function createClosurePayload($job, $data)
{ | true |
Other | laravel | framework | a82df4e4b88eb548e899bc73bd7270d4301c59d9.json | extract files from json data in test helper. | src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php | @@ -7,6 +7,7 @@
use Illuminate\Http\Request;
use Illuminate\Contracts\View\View;
use PHPUnit_Framework_Assert as PHPUnit;
+use Symfony\Component\HttpFoundation\File\UploadedFile as SymfonyUploadedFile;
trait MakesHttpRequests
{
@@ -56,6 +57,16 @@ public function withoutMiddleware()
*/
public function ... | false |
Other | laravel | framework | 57787cbc3aa853701b42bf9a5d9017b4e13ac823.json | fix boolean check | src/Illuminate/Database/Connectors/SqlServerConnector.php | @@ -94,7 +94,7 @@ protected function getSqlSrvDsn(array $config)
$arguments['ApplicationIntent'] = 'ReadOnly';
}
- if (isset($config['pooling']) && $config['pooling'] == false) {
+ if (isset($config['pooling']) && $config['pooling'] === false) {
$arguments['ConnectionP... | false |
Other | laravel | framework | 73eddfa09c4a7d238e29d2e74692b8455fc1ceb7.json | Add tests for data_get with ArrayAccess object | tests/Support/SupportHelpersTest.php | @@ -356,6 +356,9 @@ public function testDataGetWithNestedArrays()
$this->assertEquals(['taylor', 'abigail', 'dayle'], data_get($array, '*.name'));
$this->assertEquals(['taylorotwell@gmail.com', null, null], data_get($array, '*.email', 'irrelevant'));
+ $arrayAccess = new SupportTestArrayAcces... | false |
Other | laravel | framework | aceef36ebcc2e1e3bd9f10f628cf0f8ce4537d26.json | Add tests for data_get with null values | tests/Support/SupportHelpersTest.php | @@ -325,22 +325,24 @@ public function testDataGet()
{
$object = (object) ['users' => ['name' => ['Taylor', 'Otwell']]];
$array = [(object) ['users' => [(object) ['name' => 'Taylor']]]];
- $dottedArray = ['users' => ['first.name' => 'Taylor']];
- $arrayAccess = new SupportTestArrayAc... | false |
Other | laravel | framework | c6a84451d6771cea7d528e4303319c4c299105a7.json | Simplify code in data_get() | src/Illuminate/Support/helpers.php | @@ -421,17 +421,9 @@ function data_get($target, $key, $default = null)
return in_array('*', $key) ? Arr::collapse($result) : $result;
}
- if (Arr::accessible($target)) {
- if (! Arr::exists($target, $segment)) {
- return value($default);
- ... | false |
Other | laravel | framework | cd2b514f818efedd32fb9f89bcd463e2ed8d4a46.json | Remove unneeded test in Arr::has
This test changes nothing, so remove it for simplification
and consistency with code of Arr::get | src/Illuminate/Support/Arr.php | @@ -288,7 +288,7 @@ public static function get($array, $key, $default = null)
*/
public static function has($array, $key)
{
- if (empty($array) || is_null($key)) {
+ if (is_null($key)) {
return false;
}
| false |
Other | laravel | framework | 9b464ea677b583752b32ba52dada2a31db8522f6.json | Fix coding style | src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php | @@ -649,6 +649,7 @@ protected function getSelectedValue($selector)
if ($element == 'input') {
$value = $this->getCheckedValueFromRadioGroup($field);
+
return $value ? [$value] : [];
}
| false |
Other | laravel | framework | 41aec8abcc86e1bee4d72c3bb86173368458df11.json | Make use of Arr::exists in Arr::has/get
Unify codebase and fixes minor discrepancies with "key.with.dots + null value" | src/Illuminate/Support/Arr.php | @@ -264,7 +264,7 @@ public static function get($array, $key, $default = null)
return $array;
}
- if (isset($array[$key])) {
+ if (static::exists($array, $key)) {
return $array[$key];
}
@@ -292,7 +292,7 @@ public static function has($array, $key)
... | false |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/Database/Eloquent/Collection.php | @@ -20,7 +20,7 @@ public function find($key, $default = null)
$key = $key->getKey();
}
- return Arr::first($this->items, function ($itemKey, $model) use ($key) {
+ return Arr::first($this->items, function ($model) use ($key) {
return $model->getKey() == $key;
... | true |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/Database/Eloquent/Model.php | @@ -387,7 +387,7 @@ public static function getGlobalScope($scope)
return isset($modelScopes[$scope]) ? $modelScopes[$scope] : null;
}
- return Arr::first($modelScopes, function ($key, $value) use ($scope) {
+ return Arr::first($modelScopes, function ($value) use ($scope) {
... | true |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/Foundation/Application.php | @@ -559,7 +559,7 @@ public function getProvider($provider)
{
$name = is_string($provider) ? $provider : get_class($provider);
- return Arr::first($this->serviceProviders, function ($key, $value) use ($name) {
+ return Arr::first($this->serviceProviders, function ($value) use ($name) {
... | true |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/Foundation/EnvironmentDetector.php | @@ -62,8 +62,8 @@ protected function detectConsoleEnvironment(Closure $callback, array $args)
*/
protected function getEnvironmentArgument(array $args)
{
- return Arr::first($args, function ($k, $v) {
- return Str::startsWith($v, '--env');
+ return Arr::first($args, function ($v... | true |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/Routing/Route.php | @@ -567,7 +567,7 @@ protected function parseAction($action)
*/
protected function findCallable(array $action)
{
- return Arr::first($action, function ($key, $value) {
+ return Arr::first($action, function ($value, $key) {
return is_callable($value) && is_numeric($key);
... | true |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/Routing/RouteCollection.php | @@ -229,7 +229,7 @@ protected function methodNotAllowed(array $others)
*/
protected function check(array $routes, $request, $includingMethod = true)
{
- return Arr::first($routes, function ($key, $value) use ($request, $includingMethod) {
+ return Arr::first($routes, function ($value) use ... | true |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/Routing/RouteDependencyResolverTrait.php | @@ -95,7 +95,7 @@ protected function transformDependency(ReflectionParameter $parameter, $paramete
*/
protected function alreadyInParameters($class, array $parameters)
{
- return ! is_null(Arr::first($parameters, function ($key, $value) use ($class) {
+ return ! is_null(Arr::first($paramet... | true |
Other | laravel | framework | 41b4dd009463bd26c8322857340925692bb83301.json | Update all uses of first() | src/Illuminate/View/Factory.php | @@ -307,7 +307,7 @@ protected function getExtension($path)
{
$extensions = array_keys($this->extensions);
- return Arr::first($extensions, function ($key, $value) use ($path) {
+ return Arr::first($extensions, function ($value) use ($path) {
return Str::endsWith($path, $value)... | true |
Other | laravel | framework | 1349d70b659732c4592bef8901312a2840cef536.json | rename some methods. | src/Illuminate/Validation/Validator.php | @@ -1167,10 +1167,10 @@ protected function validateNotIn($attribute, $value, $parameters)
*/
protected function validateDistinct($attribute, $value, $parameters)
{
- $rawAttribute = $this->getRawAttribute($attribute);
+ $attributeName = $this->getPrimaryAttribute($attribute);
- $d... | false |
Other | laravel | framework | 7d7b73231bbb6c5c1916ff4263b207f18b9342c9.json | Preserve numeric keys in callback for Arr::last | src/Illuminate/Support/Arr.php | @@ -158,7 +158,7 @@ public static function last($array, callable $callback = null, $default = null)
return empty($array) ? value($default) : end($array);
}
- return static::first(array_reverse($array), $callback, $default);
+ return static::first(array_reverse($array, true), $callb... | true |
Other | laravel | framework | 7d7b73231bbb6c5c1916ff4263b207f18b9342c9.json | Preserve numeric keys in callback for Arr::last | tests/Support/SupportArrTest.php | @@ -83,6 +83,9 @@ public function testLast()
$last = Arr::last($array, function ($key, $value) { return $value < 250; });
$this->assertEquals(200, $last);
+ $last = Arr::last($array, function ($key, $value) { return $key < 2; });
+ $this->assertEquals(200, $last);
+
$this->ass... | true |
Other | laravel | framework | 7d7b73231bbb6c5c1916ff4263b207f18b9342c9.json | Preserve numeric keys in callback for Arr::last | tests/Support/SupportCollectionTest.php | @@ -25,6 +25,8 @@ public function testLastWithCallback()
$data = new Collection([100, 200, 300]);
$result = $data->last(function ($key, $value) { return $value < 250; });
$this->assertEquals(200, $result);
+ $result = $data->last(function ($key, $value) { return $key < 2; });
+ ... | true |
Other | laravel | framework | d3efa151cf1922b891134bffaf952533ad51e6a7.json | Replace attributes for arrays in validation | src/Illuminate/Validation/Validator.php | @@ -1932,8 +1932,8 @@ protected function getAttribute($attribute)
// The developer may dynamically specify the array of custom attributes
// on this Validator instance. If the attribute exists in this array
// it takes precedence over all other ways we can pull attributes.
- if (isset(... | true |
Other | laravel | framework | d3efa151cf1922b891134bffaf952533ad51e6a7.json | Replace attributes for arrays in validation | tests/Validation/ValidationValidatorTest.php | @@ -180,6 +180,23 @@ public function testAttributeNamesAreReplaced()
$this->assertEquals('NAME is required!', $v->messages()->first('name'));
}
+ public function testAttributeNamesAreReplacedInArrays()
+ {
+ $trans = $this->getRealTranslator();
+ $trans->addResource('array', ['valida... | true |
Other | laravel | framework | 6cf3819120fbc949ee2040c116f403f74562d9df.json | Improve test for mail Message class. | tests/Mail/MailMessageTest.php | @@ -1,6 +1,7 @@
<?php
use Mockery as m;
+use Illuminate\Mail\Message;
class MailMessageTest extends PHPUnit_Framework_TestCase
{
@@ -9,6 +10,93 @@ public function tearDown()
m::close();
}
+ public function testFromMethod()
+ {
+ $swift = m::mock(Swift_Mime_Message::class);
+ ... | false |
Other | laravel | framework | b6c3743e606cd68eba55b4be8c1e1877630c9c51.json | change method order | src/Illuminate/Filesystem/Filesystem.php | @@ -170,36 +170,36 @@ public function name($path)
}
/**
- * Extract the file extension from a file path.
+ * Extract the trailing name component from a file path.
*
* @param string $path
* @return string
*/
- public function extension($path)
+ public function basename... | false |
Other | laravel | framework | 9be2b500eaa5833628046d096410f23948f454fe.json | Rewrite conditionals to be more intuitive | src/Illuminate/Support/Arr.php | @@ -269,12 +269,12 @@ public static function get($array, $key, $default = null)
}
foreach (explode('.', $key) as $segment) {
- if ((! is_array($array) || ! array_key_exists($segment, $array)) &&
- (! $array instanceof ArrayAccess || ! $array->offsetExists($segment))) {
+ ... | false |
Other | laravel | framework | 2f01353e7f72e1ac910f260af5a85e58e7946833.json | Add typehint for consistency | src/Illuminate/Support/helpers.php | @@ -195,7 +195,7 @@ function array_has($array, $key)
* @param mixed $default
* @return mixed
*/
- function array_last($array, $callback = null, $default = null)
+ function array_last($array, callable $callback = null, $default = null)
{
return Arr::last($array, $callback, $defaul... | false |
Other | laravel | framework | 88a61f5fdb5a7c397b3fc06618f1f65992eb845d.json | Fix StyleCI issue | src/Illuminate/Support/Arr.php | @@ -154,7 +154,7 @@ public static function exists($array, $key)
public static function first($array, callable $callback = null, $default = null)
{
if (is_null($callback)) {
- return !empty($array) ? reset($array) : value($default);
+ return empty($array) ? value($default) : rese... | false |
Other | laravel | framework | f3a216471239bc112b91f3d5ae2ccce7b3e9b706.json | Fix Scheduling\Event tests on Windows | tests/Console/Scheduling/EventTest.php | @@ -6,31 +6,37 @@ class EventTest extends PHPUnit_Framework_TestCase
{
public function testBuildCommand()
{
+ $quote = (DIRECTORY_SEPARATOR == '\\') ? '"' : "'";
+
$event = new Event('php -i');
$defaultOutput = (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null';
- $this->as... | false |
Other | laravel | framework | cd0af1093647b6447475f3b0c858cf10d3b9f48c.json | Make $callback optional for helper functions too | src/Illuminate/Support/helpers.php | @@ -123,7 +123,7 @@ function array_except($array, $keys)
* @param mixed $default
* @return mixed
*/
- function array_first($array, callable $callback, $default = null)
+ function array_first($array, callable $callback = null, $default = null)
{
return Arr::first($array, $callback... | false |
Other | laravel | framework | 00dbd7a24f4515aa502b4029b4eb54127bc95d8b.json | Make callback optional for first() and last() | src/Illuminate/Support/Arr.php | @@ -151,10 +151,10 @@ public static function exists($array, $key)
* @param mixed $default
* @return mixed
*/
- public static function first($array, callable $callback, $default = null)
+ public static function first($array, callable $callback = null, $default = null)
{
foreach ($... | false |
Other | laravel | framework | d2efcaa2280399917ef6ad211feb85f30e796e8c.json | Use sprintf because it's easier to read | tests/View/ViewBladeCompilerTest.php | @@ -208,8 +208,8 @@ public function testCommentsAreCompiled()
*/ ?>';
$this->assertEquals($expected, $compiler->compileString($string));
- $string = '{{-- this is an ' . str_repeat('extremely ', 100) . 'long comment --}}';
- $expected = '<?php /* this is an ' . str_repeat('extremely ', 100) . ... | false |
Other | laravel | framework | 64d71c1982ac866e80c2332fb4114d6d7ea054dc.json | Add tests for Str::is with stringable objects | tests/Support/SupportStrTest.php | @@ -93,6 +93,12 @@ public function testIs()
$this->assertFalse(Str::is('/', '/a'));
$this->assertTrue(Str::is('foo/*', 'foo/bar/baz'));
$this->assertTrue(Str::is('*/foo', 'blah/baz/foo'));
+
+ $valueObject = new StringableObjectStub('foo/bar/baz');
+ $patternObject = new Stringa... | false |
Other | laravel | framework | 1178f619426b2ac689f3d8163db36d3c841fe163.json | Register swiftmailer before mailer
Fix CS | src/Illuminate/Mail/MailServiceProvider.php | @@ -21,9 +21,9 @@ class MailServiceProvider extends ServiceProvider
*/
public function register()
{
- $this->app->singleton('mailer', function ($app) {
- $this->registerSwiftMailer();
+ $this->registerSwiftMailer();
+ $this->app->singleton('mailer', function ($app) {
... | false |
Other | laravel | framework | 169f9d414b256ae741bb5c69cf9ec6a9a298a3fb.json | Make the rule work without parameters | src/Illuminate/Validation/Validator.php | @@ -127,6 +127,13 @@ class Validator implements ValidatorContract
*/
protected $replacers = [];
+ /**
+ * The array of rules with asterisks.
+ *
+ * @var array
+ */
+ protected $implicitAttributes = [];
+
/**
* The size related validation rules.
*
@@ -290,6 +297,7 @@ ... | true |
Other | laravel | framework | 169f9d414b256ae741bb5c69cf9ec6a9a298a3fb.json | Make the rule work without parameters | tests/Validation/ValidationValidatorTest.php | @@ -1037,19 +1037,31 @@ public function testValidateNoDuplicates()
{
$trans = $this->getRealTranslator();
- $v = new Validator($trans, ['foo' => ['foo', 'foo']], ['foo.*' => 'no_duplicates:foo.*']);
+ $v = new Validator($trans, ['foo' => ['foo', 'foo']], ['foo.*' => 'no_duplicates']);
... | true |
Other | laravel | framework | 5b057e4d840d63e265268112be40074ceec076b2.json | Add tests for Arr::get/has with null values | tests/Support/SupportArrayTest.php | @@ -137,6 +137,11 @@ public function testGet()
$value = Arr::get($array, 'products.desk');
$this->assertEquals(['price' => 100], $value);
+ // Test null array values
+ $array = ['foo' => null, 'bar' => ['baz' => null]];
+ $this->assertNull(Arr::get($array, 'foo', 'default'));
+ ... | false |
Other | laravel | framework | ef90fbb6f5d0bfd5bc6cfcc469d0221112f361d6.json | Rewrite the check to work on PHP < 5.6.0 and hhvm | src/Illuminate/Validation/Validator.php | @@ -1127,9 +1127,13 @@ protected function validateNotIn($attribute, $value, $parameters)
*/
protected function validateNoDuplicates($attribute, $value, $parameters)
{
- $data = array_filter(Arr::dot($this->data), function ($key) use ($attribute, $parameters) {
- return $key != $attribu... | false |
Other | laravel | framework | ad431e0267bb41eb97182bfdc33fe7853ef089a9.json | Add test for Request method() method. | tests/Http/HttpRequestTest.php | @@ -18,6 +18,30 @@ public function testInstanceMethod()
$this->assertSame($request, $request->instance());
}
+ public function testMethodMethod()
+ {
+ $request = Request::create('', 'GET');
+ $this->assertSame('GET', $request->method());
+
+ $request = Request::create('', 'HE... | false |
Other | laravel | framework | 2f2f293ba232d69a8cb0b5ac81d78878b8d987af.json | Make whereIn defalut to loose comparison | src/Illuminate/Support/Collection.php | @@ -267,23 +267,23 @@ protected function operatorForWhere($key, $operator, $value)
* @param bool $strict
* @return static
*/
- public function whereIn($key, array $values, $strict = true)
+ public function whereIn($key, array $values, $strict = false)
{
return $this->filter(funct... | true |
Other | laravel | framework | 2f2f293ba232d69a8cb0b5ac81d78878b8d987af.json | Make whereIn defalut to loose comparison | tests/Support/SupportCollectionTest.php | @@ -330,13 +330,13 @@ public function testWhere()
public function testWhereIn()
{
$c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]);
- $this->assertEquals([['v' => 1], ['v' => 3]], $c->whereIn('v', [1, 3])->values()->all());
+ $this->assertEquals([['v' ... | true |
Other | laravel | framework | 1f21898515f8a049b4f4529351fc427690795d8f.json | Reorganize operators in most-used order | src/Illuminate/Support/Collection.php | @@ -247,13 +247,13 @@ protected function operatorForWhere($key, $operator, $value)
default:
case '=':
case '==': return $retrieved == $value;
- case '===': return $retrieved === $value;
- case '<=': return $retrieved <= $value;
- ... | false |
Other | laravel | framework | 8499b3a9774729bc1ebb3058f8c7c8a98d8e647d.json | Add DateTimeImmutable as valid date to Model.php
DateTimeImmutable behaves just like the DateTime object, so it should be considered as a valid date object when returning a Carbon date object. | src/Illuminate/Database/Eloquent/Model.php | @@ -2934,6 +2934,12 @@ protected function asDateTime($value)
if ($value instanceof DateTime) {
return Carbon::instance($value);
}
+
+ // If the value is a DateTimeImmutable instance, also skip the rest of these
+ // checks. Just return the DateTimeImmutable right awa... | false |
Other | laravel | framework | 83c3c56df9ec1ee764134021ce055db7bdc26038.json | Add operator support to collection@where | src/Illuminate/Support/Collection.php | @@ -215,16 +215,19 @@ public function filter(callable $callback = null)
* Filter items by the given key value pair.
*
* @param string $key
+ * @param mixed $operator
* @param mixed $value
- * @param bool $strict
* @return static
*/
- public function where($key, $va... | true |
Other | laravel | framework | 83c3c56df9ec1ee764134021ce055db7bdc26038.json | Add operator support to collection@where | tests/Support/SupportCollectionTest.php | @@ -275,7 +275,56 @@ public function testFilter()
public function testWhere()
{
$c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]);
- $this->assertEquals([['v' => 3]], $c->where('v', 3)->values()->all());
+
+ $this->assertEquals(
+ [['v' => 3]... | true |
Other | laravel | framework | 8964f375093904b05a426a664255ecaf73bdfd02.json | Fix current URI used by Crawler in tests | src/Illuminate/Foundation/Testing/InteractsWithPages.php | @@ -64,7 +64,7 @@ protected function makeRequest($method, $uri, $parameters = [], $cookies = [], $
$this->currentUri = $this->app->make('request')->fullUrl();
- $this->crawler = new Crawler($this->response->getContent(), $uri);
+ $this->crawler = new Crawler($this->response->getContent(), $th... | false |
Other | laravel | framework | d576bedd3f0f70c9df6dcecb2f44057ee92234fe.json | Change fresh() parameter type
The $with parameter _always_ gets sent to Model::with() so it makes sense to mirror the type. | src/Illuminate/Database/Eloquent/Model.php | @@ -648,10 +648,10 @@ public static function all($columns = ['*'])
/**
* Reload a fresh model instance from the database.
*
- * @param array $with
+ * @param array|string $with
* @return $this|null
*/
- public function fresh(array $with = [])
+ public function fresh($with ... | false |
Other | laravel | framework | a7cf9a11a1f3a379af89856b84a156f8b25bb724.json | Allow array of validation rules on validateWith. | src/Illuminate/Foundation/Validation/ValidatesRequests.php | @@ -20,14 +20,18 @@ trait ValidatesRequests
/**
* Run the validation routine against the given validator.
*
- * @param \Illuminate\Contracts\Validation\Validator $validator
+ * @param \Illuminate\Contracts\Validation\Validator|array $validator
* @param \Illuminate\Http\Request|null ... | false |
Other | laravel | framework | 0fe971b5dc41bb5afe51a530dcc17ed3d58ce19f.json | Add seeText and dontSeeText methods | src/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.php | @@ -208,7 +208,47 @@ protected function crawler()
}
/**
- * Assert that a given string is seen on the page.
+ * Get the HTML from the current context or the full response.
+ *
+ * @return string
+ */
+ protected function html()
+ {
+ return $this->crawler()
+ ? $t... | true |
Other | laravel | framework | 0fe971b5dc41bb5afe51a530dcc17ed3d58ce19f.json | Add seeText and dontSeeText methods | tests/Foundation/FoundationInteractsWithPagesTest.php | @@ -52,6 +52,19 @@ public function testDontSee()
$this->dontSee('Webmasters');
}
+ public function testSeeTextAndDontSeeText()
+ {
+ $this->setCrawler('<p>Laravel is a <strong>PHP Framework</strong>.');
+
+ // The methods see and dontSee compare against the HTML.
+ $this->see(... | true |
Other | laravel | framework | 6a4a91832775bcdeb0a387664eaa36c3189db196.json | add guestMiddleware method | src/Illuminate/Foundation/Auth/AuthenticatesUsers.php | @@ -178,6 +178,16 @@ public function logout()
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
}
+ /**
+ * Get the guest middleware for the application.
+ */
+ public function guestMiddleware()
+ {
+ $guard = $this->getGuard();
+
... | false |
Other | laravel | framework | 0c0654394c277576f20a8b45f5077f6800b47237.json | remove unneeded line | src/Illuminate/Auth/Console/MakeAuthCommand.php | @@ -55,8 +55,7 @@ public function fire()
file_put_contents(
app_path('Http/Controllers/HomeController.php'),
- $this->compileControllerStub(),
- FILE_TEXT
+ $this->compileControllerStub()
);
$this->info('Updated Rou... | false |
Other | laravel | framework | 33c16b0c866b32911a1f6cc5cb6916d6d037e813.json | add default parameters to route (fixes #12185) | src/Illuminate/Routing/Route.php | @@ -551,7 +551,7 @@ public function bindParameters(Request $request)
);
}
- return $this->parameters = $this->replaceDefaults($params);
+ return $this->parameters = $this->fillDefaults($this->replaceDefaults($params));
}
/**
@@ -615,6 +615,23 @@ protected function repla... | false |
Other | laravel | framework | a280ddbbb1de5a3fc676b03b19c8ee8b81ba1f0d.json | add failing unit test for #12185 | tests/Routing/RoutingRouteTest.php | @@ -196,6 +196,16 @@ public function testNonGreedyMatches()
$this->assertEquals('bar', $route->parameter('foo', 'bar'));
}
+ public function testRouteParametersDefaultValue()
+ {
+ $router = $this->getRouter();
+ $router->get('foo/{bar?}', ['uses' => 'RouteTestControllerWithParameter... | false |
Other | laravel | framework | 3ef916aace74a4bbc7370bcabf47c7b5282e943f.json | Use newInstance in Builder | src/Illuminate/Database/Eloquent/Builder.php | @@ -142,7 +142,7 @@ public function findOrNew($id, $columns = ['*'])
return $model;
}
- return $this->newModel();
+ return $this->model->newInstance();
}
/**
@@ -157,7 +157,7 @@ public function firstOrNew(array $attributes)
return $instance;
}
- ... | false |
Other | laravel | framework | 6f3b61b5fd71c0d9632ac48d1473e3832ee019b8.json | Add windows support for withoutOverlapping | src/Illuminate/Console/Scheduling/Event.php | @@ -200,22 +200,36 @@ public function buildCommand()
$redirect = $this->shouldAppendOutput ? ' >> ' : ' > ';
if ($this->withoutOverlapping) {
- $command = '(touch '.$this->mutexPath().'; '.$this->command.'; rm '.$this->mutexPath().')'.$redirect.$output.' 2>&1 &';
+ if ($this->i... | false |
Other | laravel | framework | 2fdb5d13d05f771877dcdd9a44cb8e6d403cd8ac.json | add setCollection method to the Paginator | src/Illuminate/Pagination/AbstractPaginator.php | @@ -427,6 +427,19 @@ public function getCollection()
return $this->items;
}
+ /**
+ * Set the paginator's underlying collection.
+ *
+ * @param \Illuminate\Support\Collection $collection
+ * @return $this
+ */
+ public function setCollection(\Illuminate\Support\Collection $col... | false |
Other | laravel | framework | e84f0a4b5cb8ff976392a45b645397a7ba7db065.json | Add a validate method to the validation factory | src/Illuminate/Validation/Factory.php | @@ -111,6 +111,22 @@ public function make(array $data, array $rules, array $messages = [], array $cus
return $validator;
}
+ /**
+ * Validate the given data against the provided rules.
+ *
+ * @param array $data
+ * @param array $rules
+ * @param array $messages
+ * @par... | false |
Other | laravel | framework | 8a73322ef2c56fa70d68d18a0fdc5265582539de.json | Add public validate method to the validator | src/Illuminate/Foundation/Exceptions/Handler.php | @@ -102,8 +102,8 @@ public function render($request, Exception $e)
$e = new NotFoundHttpException($e->getMessage(), $e);
} elseif ($e instanceof AuthorizationException) {
$e = new HttpException(403, $e->getMessage());
- } elseif ($e instanceof ValidationException && $e->getResp... | true |
Other | laravel | framework | 8a73322ef2c56fa70d68d18a0fdc5265582539de.json | Add public validate method to the validator | src/Illuminate/Validation/ValidationException.php | @@ -9,7 +9,7 @@ class ValidationException extends Exception
/**
* The validator instance.
*
- * @var \Illuminate\Validation\Validator
+ * @var \Illuminate\Contracts\Validation\Validator
*/
public $validator;
@@ -23,7 +23,7 @@ class ValidationException extends Exception
/**
... | true |
Other | laravel | framework | 8a73322ef2c56fa70d68d18a0fdc5265582539de.json | Add public validate method to the validator | src/Illuminate/Validation/Validator.php | @@ -334,7 +334,7 @@ public function passes()
// the other error messages, returning true if we don't have messages.
foreach ($this->rules as $attribute => $rules) {
foreach ($rules as $rule) {
- $this->validate($attribute, $rule);
+ $this->validateAttribute($... | true |
Other | laravel | framework | 8665024c290a19c02e4ebf95059aed62f7351208.json | Create tests for validation validate method | tests/Validation/ValidationValidatorTest.php | @@ -50,6 +50,25 @@ public function testSometimesWorksOnArrays()
$this->assertTrue($v->passes());
}
+ /**
+ * @expectedException \Illuminate\Validation\ValidationException
+ */
+ public function testValidateThrowsOnFail()
+ {
+ $trans = $this->getRealTranslator();
+ $v = ne... | false |
Other | laravel | framework | a96ea3c8c95657832f3d534d42db4b5efc7b8515.json | Add file() method to response factory. | src/Illuminate/Routing/ResponseFactory.php | @@ -137,6 +137,23 @@ public function download($file, $name = null, array $headers = [], $disposition
return $response;
}
+ /**
+ * Return the raw contents of a binary file.
+ *
+ * @param \SplFileInfo|string $file
+ * @param string $mime
+ * @param array $headers
+ * @return \... | false |
Other | laravel | framework | 551cebeb143d43d23b57fe9c9dfaba4464243ac8.json | change whereDate method for Postgres | src/Illuminate/Database/Query/Grammars/PostgresGrammar.php | @@ -44,7 +44,7 @@ protected function whereDate(Builder $query, $where)
{
$value = $this->parameter($where['value']);
- return $this->wrap($where['column']).' '.$where['operator'].' '.$value.'::date';
+ return $this->wrap($where['column']).'::date '.$where['operator'].' '.$value;
}
... | true |
Other | laravel | framework | 551cebeb143d43d23b57fe9c9dfaba4464243ac8.json | change whereDate method for Postgres | tests/Database/DatabaseQueryBuilderTest.php | @@ -161,7 +161,7 @@ public function testWhereDatePostgres()
{
$builder = $this->getPostgresBuilder();
$builder->select('*')->from('users')->whereDate('created_at', '=', '2015-12-21');
- $this->assertEquals('select * from "users" where "created_at" = ?::date', $builder->toSql());
+ $... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.