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
76f6da4dab1e9e4847362a2b2b0c428e25805f0c.json
Add support to LIKE BINARY I added "like binary" in $operators to support operator when use "where" and others functions
src/Illuminate/Database/Query/Builder.php
@@ -172,7 +172,7 @@ class Builder { */ protected $operators = array( '=', '<', '>', '<=', '>=', '<>', '!=', - 'like', 'not like', 'between', 'ilike', + 'like', 'like binary', 'not like', 'between', 'ilike', '&', '|', '^', '<<', '>>', 'rlike', 'regexp', 'not regexp', '~', '~*', '!~', '!~*', 'similar to',
false
Other
laravel
framework
11c0d7bb08b767f7746867f3bdee141c9cc7e5b3.json
Support atomic add on Memcached driver.
src/Illuminate/Cache/MemcachedStore.php
@@ -60,6 +60,19 @@ public function put($key, $value, $minutes) $this->memcached->set($this->prefix.$key, $value, $minutes * 60); } + /** + * Store an item in the cache if the key doesn't exist. + * + * @param string $key + * @param mixed $value + * @param int $minutes + * @return bool + */ + public function add($key, $value, $minutes) + { + return $this->memcached->add($this->prefix.$key, $value, $minutes * 60); + } + /** * Increment the value of an item in the cache. *
true
Other
laravel
framework
11c0d7bb08b767f7746867f3bdee141c9cc7e5b3.json
Support atomic add on Memcached driver.
src/Illuminate/Cache/Repository.php
@@ -154,6 +154,11 @@ public function put($key, $value, $minutes) */ public function add($key, $value, $minutes) { + if (method_exists($this->store, 'add')) + { + return $this->store->add($key, $value, $minutes); + } + if (is_null($this->get($key))) { $this->put($key, $value, $minutes); return true;
true
Other
laravel
framework
50380ce3b5e06d099546b0a66edf50bfb85423a9.json
add array key.
src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
@@ -84,7 +84,7 @@ public function postLogin(Request $request) return redirect($this->loginPath()) ->withInput($request->only('email', 'remember')) ->withErrors([ - $this->getFailedLoginMesssage(), + 'email' => $this->getFailedLoginMesssage(), ]); }
false
Other
laravel
framework
7d4421ebb479d66e7672ac763c221e86d0191b95.json
Fix coding style
src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
@@ -81,7 +81,7 @@ protected function getConfigurationFiles(Application $app) /** * Get the configuration file nesting path. * - * @param \Symfony\Component\Finder\SplFileInfo $file + * @param \Symfony\Component\Finder\SplFileInfo $file * @return string */ private function getConfigurationNesting(SplFileInfo $file)
false
Other
laravel
framework
a2930ed0ee792783950125467907ba496031bb95.json
Restore original value of pretending.
src/Illuminate/Database/Connection.php
@@ -532,11 +532,13 @@ public function transactionLevel() */ public function pretend(Closure $callback) { + $loggingQueries = $this->loggingQueries; + $this->enableQueryLog(); - + $this->pretending = true; - $this->queryLog = array(); + $this->queryLog = []; // Basically to make the database connection "pretend", we will just return // the default values for all the query methods, then we will return an @@ -545,6 +547,8 @@ public function pretend(Closure $callback) $this->pretending = false; + $this->loggingQueries = $loggingQueries; + return $this->queryLog; }
false
Other
laravel
framework
6b13ac843d5046a41e62cc4ff318caebd01eeef5.json
Fix method order.
src/Illuminate/Foundation/helpers.php
@@ -243,22 +243,6 @@ function get($uri, $action) } } -if ( ! function_exists('resource')) -{ - /** - * Route a resource to a controller. - * - * @param string $name - * @param string $controller - * @param array $options - * @return void - */ - function resource($name, $controller, array $options = []) - { - return app('router')->resource($name, $controller, $options); - } -} - if ( ! function_exists('info')) { /** @@ -384,6 +368,22 @@ function redirect($to = null, $status = 302, $headers = array(), $secure = null) } } +if ( ! function_exists('resource')) +{ + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return void + */ + function resource($name, $controller, array $options = []) + { + return app('router')->resource($name, $controller, $options); + } +} + if ( ! function_exists('response')) { /**
false
Other
laravel
framework
f00a88fccfabfed5a20176d91db358f88fc87f86.json
Remove deprecated class from optimize.
src/Illuminate/Foundation/Console/Optimize/config.php
@@ -102,7 +102,6 @@ $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Arr.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/Str.php', $basePath.'/vendor/symfony/debug/Symfony/Component/Debug/ErrorHandler.php', - $basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Config/Repository.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php', $basePath.'/vendor/laravel/framework/src/Illuminate/Config/FileLoader.php',
false
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
.php_cs
@@ -8,5 +8,5 @@ $finder = Symfony\Component\Finder\Finder::create() ->ignoreVCS(true); return Symfony\CS\Config\Config::create() - ->fixers(['-psr2']) + ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) ->finder($finder);
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Cache/Console/stubs/cache.stub
@@ -3,31 +3,30 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class CreateCacheTable extends Migration { +class CreateCacheTable extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('cache', function(Blueprint $table) - { - $table->string('key')->unique(); - $table->text('value'); - $table->integer('expiration'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('cache'); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('cache', function (Blueprint $table) { + $table->string('key')->unique(); + $table->text('value'); + $table->integer('expiration'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('cache'); + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Database/Migrations/stubs/blank.stub
@@ -3,26 +3,26 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class DummyClass extends Migration { +class DummyClass extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - // - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + // + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Database/Migrations/stubs/create.stub
@@ -3,30 +3,29 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class DummyClass extends Migration { +class DummyClass extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('{{table}}', function(Blueprint $table) - { - $table->increments('id'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('{{table}}'); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('{{table}}', function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('{{table}}'); + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Database/Migrations/stubs/update.stub
@@ -3,32 +3,30 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class DummyClass extends Migration { +class DummyClass extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::table('{{table}}', function(Blueprint $table) - { - // - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('{{table}}', function(Blueprint $table) - { - // - }); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table('{{table}}', function (Blueprint $table) { + // + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('{{table}}', function (Blueprint $table) { + // + }); + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/command-handler.stub
@@ -1,30 +1,29 @@ <?php namespace DummyNamespace; use DummyFullCommand; - use Illuminate\Queue\InteractsWithQueue; -class DummyClass { - - /** - * Create the command handler. - * - * @return void - */ - public function __construct() - { - // - } +class DummyClass +{ - /** - * Handle the command. - * - * @param DummyCommand $command - * @return void - */ - public function handle(DummyCommand $command) - { - // - } + /** + * Create the command handler. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Handle the command. + * + * @param DummyCommand $command + * @return void + */ + public function handle(DummyCommand $command) + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/command-queued-with-handler.stub
@@ -1,23 +1,22 @@ <?php namespace DummyNamespace; use DummyRootNamespaceCommands\Command; - use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldBeQueued; -class DummyClass extends Command implements ShouldBeQueued { - - use InteractsWithQueue, SerializesModels; +class DummyClass extends Command implements ShouldBeQueued +{ - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - // - } + use InteractsWithQueue, SerializesModels; + /** + * Create a new command instance. + * + * @return void + */ + public function __construct() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/command-queued.stub
@@ -1,34 +1,33 @@ <?php namespace DummyNamespace; use DummyRootNamespaceCommands\Command; - use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Bus\SelfHandling; use Illuminate\Contracts\Queue\ShouldBeQueued; -class DummyClass extends Command implements SelfHandling, ShouldBeQueued { - - use InteractsWithQueue, SerializesModels; +class DummyClass extends Command implements SelfHandling, ShouldBeQueued +{ - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - // - } + use InteractsWithQueue, SerializesModels; - /** - * Execute the command. - * - * @return void - */ - public function handle() - { - // - } + /** + * Create a new command instance. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Execute the command. + * + * @return void + */ + public function handle() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/command-with-handler.stub
@@ -2,16 +2,16 @@ use DummyRootNamespaceCommands\Command; -class DummyClass extends Command { - - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - // - } +class DummyClass extends Command +{ + /** + * Create a new command instance. + * + * @return void + */ + public function __construct() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/command.stub
@@ -1,29 +1,28 @@ <?php namespace DummyNamespace; use DummyRootNamespaceCommands\Command; - use Illuminate\Contracts\Bus\SelfHandling; -class DummyClass extends Command implements SelfHandling { - - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - // - } +class DummyClass extends Command implements SelfHandling +{ - /** - * Execute the command. - * - * @return void - */ - public function handle() - { - // - } + /** + * Create a new command instance. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Execute the command. + * + * @return void + */ + public function handle() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/console.stub
@@ -4,64 +4,64 @@ use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; -class DummyClass extends Command { +class DummyClass extends Command +{ - /** - * The console command name. - * - * @var string - */ - protected $name = 'DummyCommand'; + /** + * The console command name. + * + * @var string + */ + protected $name = 'DummyCommand'; - /** - * The console command description. - * - * @var string - */ - protected $description = 'Command description.'; + /** + * The console command description. + * + * @var string + */ + protected $description = 'Command description.'; - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - } + /** + * Create a new command instance. + * + * @return void + */ + public function __construct() + { + parent::__construct(); + } - /** - * Execute the console command. - * - * @return mixed - */ - public function fire() - { - // - } + /** + * Execute the console command. + * + * @return mixed + */ + public function fire() + { + // + } - /** - * Get the console command arguments. - * - * @return array - */ - protected function getArguments() - { - return [ - ['example', InputArgument::REQUIRED, 'An example argument.'], - ]; - } - - /** - * Get the console command options. - * - * @return array - */ - protected function getOptions() - { - return [ - ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null], - ]; - } + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return [ + ['example', InputArgument::REQUIRED, 'An example argument.'], + ]; + } + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null], + ]; + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/event-handler-queued.stub
@@ -1,33 +1,32 @@ <?php namespace DummyNamespace; use DummyFullEvent; - use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldBeQueued; -class DummyClass implements ShouldBeQueued { - - use InteractsWithQueue; +class DummyClass implements ShouldBeQueued +{ - /** - * Create the event handler. - * - * @return void - */ - public function __construct() - { - // - } + use InteractsWithQueue; - /** - * Handle the event. - * - * @param DummyEvent $event - * @return void - */ - public function handle(DummyEvent $event) - { - // - } + /** + * Create the event handler. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Handle the event. + * + * @param DummyEvent $event + * @return void + */ + public function handle(DummyEvent $event) + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/event-handler.stub
@@ -1,31 +1,30 @@ <?php namespace DummyNamespace; use DummyFullEvent; - use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldBeQueued; -class DummyClass { - - /** - * Create the event handler. - * - * @return void - */ - public function __construct() - { - // - } +class DummyClass +{ - /** - * Handle the event. - * - * @param DummyEvent $event - * @return void - */ - public function handle(DummyEvent $event) - { - // - } + /** + * Create the event handler. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Handle the event. + * + * @param DummyEvent $event + * @return void + */ + public function handle(DummyEvent $event) + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/event.stub
@@ -1,21 +1,20 @@ <?php namespace DummyNamespace; use DummyRootNamespaceEvents\Event; - use Illuminate\Queue\SerializesModels; -class DummyClass extends Event { - - use SerializesModels; +class DummyClass extends Event +{ - /** - * Create a new event instance. - * - * @return void - */ - public function __construct() - { - // - } + use SerializesModels; + /** + * Create a new event instance. + * + * @return void + */ + public function __construct() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/fresh/welcome.stub
@@ -1,23 +1,23 @@ <?php namespace App\Http\Controllers; -class WelcomeController extends Controller { +class WelcomeController extends Controller +{ - /* - |-------------------------------------------------------------------------- - | Default Home Controller - |-------------------------------------------------------------------------- - | - | You may wish to use controllers instead of, or in addition to, Closure - | based routes. That's great! Here is an example controller method to - | get you started. To route to this controller, just add the route: - | - | $router->get('/', 'WelcomeController@index'); - | - */ - - public function index() - { - return view('welcome'); - } + /* + |-------------------------------------------------------------------------- + | Default Home Controller + |-------------------------------------------------------------------------- + | + | You may wish to use controllers instead of, or in addition to, Closure + | based routes. That's great! Here is an example controller method to + | get you started. To route to this controller, just add the route: + | + | $router->get('/', 'WelcomeController@index'); + | + */ + public function index() + { + return view('welcome'); + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/job-queued.stub
@@ -1,34 +1,33 @@ <?php namespace DummyNamespace; use DummyRootNamespaceJobs\Job; - use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Bus\SelfHandling; use Illuminate\Contracts\Queue\ShouldBeQueued; -class DummyClass extends Job implements SelfHandling, ShouldBeQueued { - - use InteractsWithQueue, SerializesModels; +class DummyClass extends Job implements SelfHandling, ShouldBeQueued +{ - /** - * Create a new job instance. - * - * @return void - */ - public function __construct() - { - // - } + use InteractsWithQueue, SerializesModels; - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - // - } + /** + * Create a new job instance. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/job.stub
@@ -1,29 +1,28 @@ <?php namespace DummyNamespace; use DummyRootNamespaceJobs\Job; - use Illuminate\Contracts\Bus\SelfHandling; -class DummyClass extends Job implements SelfHandling { - - /** - * Create a new job instance. - * - * @return void - */ - public function __construct() - { - // - } +class DummyClass extends Job implements SelfHandling +{ - /** - * Execute the job. - * - * @return void - */ - public function handle() - { - // - } + /** + * Create a new job instance. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/listener-queued.stub
@@ -1,33 +1,32 @@ <?php namespace DummyNamespace; use DummyFullEvent; - use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldBeQueued; -class DummyClass implements ShouldBeQueued { - - use InteractsWithQueue; +class DummyClass implements ShouldBeQueued +{ - /** - * Create the event listener. - * - * @return void - */ - public function __construct() - { - // - } + use InteractsWithQueue; - /** - * Handle the event. - * - * @param DummyEvent $event - * @return void - */ - public function handle(DummyEvent $event) - { - // - } + /** + * Create the event listener. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Handle the event. + * + * @param DummyEvent $event + * @return void + */ + public function handle(DummyEvent $event) + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/listener.stub
@@ -1,31 +1,30 @@ <?php namespace DummyNamespace; use DummyFullEvent; - use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldBeQueued; -class DummyClass { - - /** - * Create the event listener. - * - * @return void - */ - public function __construct() - { - // - } +class DummyClass +{ - /** - * Handle the event. - * - * @param DummyEvent $event - * @return void - */ - public function handle(DummyEvent $event) - { - // - } + /** + * Create the event listener. + * + * @return void + */ + public function __construct() + { + // + } + /** + * Handle the event. + * + * @param DummyEvent $event + * @return void + */ + public function handle(DummyEvent $event) + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/model.stub
@@ -2,8 +2,7 @@ use Illuminate\Database\Eloquent\Model; -class DummyClass extends Model { - - // - +class DummyClass extends Model +{ + // }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/provider.stub
@@ -2,26 +2,26 @@ use Illuminate\Support\ServiceProvider; -class DummyClass extends ServiceProvider { +class DummyClass extends ServiceProvider +{ - /** - * Bootstrap the application services. - * - * @return void - */ - public function boot() - { - // - } - - /** - * Register the application services. - * - * @return void - */ - public function register() - { - // - } + /** + * Bootstrap the application services. + * + * @return void + */ + public function boot() + { + // + } + /** + * Register the application services. + * + * @return void + */ + public function register() + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/request.stub
@@ -2,28 +2,28 @@ use DummyRootNamespaceHttp\Requests\Request; -class DummyClass extends Request { +class DummyClass extends Request +{ - /** - * Determine if the user is authorized to make this request. - * - * @return bool - */ - public function authorize() - { - return false; - } - - /** - * Get the validation rules that apply to the request. - * - * @return array - */ - public function rules() - { - return [ - // - ]; - } + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return false; + } + /** + * Get the validation rules that apply to the request. + * + * @return array + */ + public function rules() + { + return [ + // + ]; + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Foundation/Console/stubs/routes.stub
@@ -12,5 +12,5 @@ */ app('router')->setRoutes( - unserialize(base64_decode('{{routes}}')) + unserialize(base64_decode('{{routes}}')) );
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Queue/Console/stubs/failed_jobs.stub
@@ -3,33 +3,32 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class CreateFailedJobsTable extends Migration { +class CreateFailedJobsTable extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('failed_jobs', function(Blueprint $table) - { - $table->increments('id'); - $table->text('connection'); - $table->text('queue'); - $table->text('payload'); - $table->timestamp('failed_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('failed_jobs'); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('failed_jobs', function (Blueprint $table) { + $table->increments('id'); + $table->text('connection'); + $table->text('queue'); + $table->text('payload'); + $table->timestamp('failed_at'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('failed_jobs'); + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Queue/Console/stubs/jobs.stub
@@ -3,36 +3,35 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class CreateJobsTable extends Migration { +class CreateJobsTable extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('jobs', function(Blueprint $table) - { - $table->bigIncrements('id'); - $table->string('queue'); - $table->text('payload'); - $table->tinyInteger('attempts')->unsigned(); - $table->tinyInteger('reserved')->unsigned(); - $table->unsignedInteger('reserved_at')->nullable(); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('jobs'); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('jobs', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('queue'); + $table->text('payload'); + $table->tinyInteger('attempts')->unsigned(); + $table->tinyInteger('reserved')->unsigned(); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('jobs'); + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Routing/Console/stubs/controller.plain.stub
@@ -2,11 +2,10 @@ use DummyRootNamespaceHttp\Requests; use DummyRootNamespaceHttp\Controllers\Controller; - use Illuminate\Http\Request; -class DummyClass extends Controller { - - // +class DummyClass extends Controller +{ + // }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Routing/Console/stubs/controller.stub
@@ -2,83 +2,82 @@ use DummyRootNamespaceHttp\Requests; use DummyRootNamespaceHttp\Controllers\Controller; - use Illuminate\Http\Request; -class DummyClass extends Controller { - - /** - * Display a listing of the resource. - * - * @return Response - */ - public function index() - { - // - } +class DummyClass extends Controller +{ - /** - * Show the form for creating a new resource. - * - * @return Response - */ - public function create() - { - // - } + /** + * Display a listing of the resource. + * + * @return Response + */ + public function index() + { + // + } - /** - * Store a newly created resource in storage. - * - * @return Response - */ - public function store() - { - // - } + /** + * Show the form for creating a new resource. + * + * @return Response + */ + public function create() + { + // + } - /** - * Display the specified resource. - * - * @param int $id - * @return Response - */ - public function show($id) - { - // - } + /** + * Store a newly created resource in storage. + * + * @return Response + */ + public function store() + { + // + } - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return Response - */ - public function edit($id) - { - // - } + /** + * Display the specified resource. + * + * @param int $id + * @return Response + */ + public function show($id) + { + // + } - /** - * Update the specified resource in storage. - * - * @param int $id - * @return Response - */ - public function update($id) - { - // - } + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return Response + */ + public function edit($id) + { + // + } - /** - * Remove the specified resource from storage. - * - * @param int $id - * @return Response - */ - public function destroy($id) - { - // - } + /** + * Update the specified resource in storage. + * + * @param int $id + * @return Response + */ + public function update($id) + { + // + } + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return Response + */ + public function destroy($id) + { + // + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Routing/Console/stubs/middleware.stub
@@ -2,18 +2,18 @@ use Closure; -class DummyClass { - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - return $next($request); - } +class DummyClass +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + return $next($request); + } }
true
Other
laravel
framework
c0824c5d2acb46d35125062fa28a76fd0b29feac.json
Convert generators to PSR-2. Full framework later.
src/Illuminate/Session/Console/stubs/database.stub
@@ -2,31 +2,30 @@ use Illuminate\Database\Migrations\Migration; -class CreateSessionTable extends Migration { +class CreateSessionTable extends Migration +{ - /** - * Run the migrations. - * - * @return void - */ - public function up() - { - Schema::create('sessions', function($t) - { - $t->string('id')->unique(); - $t->text('payload'); - $t->integer('last_activity'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('sessions'); - } + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('sessions', function ($t) { + $t->string('id')->unique(); + $t->text('payload'); + $t->integer('last_activity'); + }); + } + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('sessions'); + } }
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/command-queued-with-handler.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceCommands\Command;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/command-queued.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceCommands\Command;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/command-with-handler.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceCommands\Command;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/command.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceCommands\Command;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/console.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputOption;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/event-handler-queued.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyFullEvent;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/event-handler.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyFullEvent;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/event.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceEvents\Event;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/job-queued.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceJobs\Job;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/job.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceJobs\Job;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/listener-queued.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyFullEvent;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/listener.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyFullEvent;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/model.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use Illuminate\Database\Eloquent\Model;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/provider.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use Illuminate\Support\ServiceProvider;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Foundation/Console/stubs/request.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceHttp\Requests\Request;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Routing/Console/stubs/controller.plain.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceHttp\Requests; use DummyRootNamespaceHttp\Controllers\Controller;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Routing/Console/stubs/controller.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use DummyRootNamespaceHttp\Requests; use DummyRootNamespaceHttp\Controllers\Controller;
true
Other
laravel
framework
622985a6088a152bb51ef9c006dd65a8bd26f6e2.json
Fix Dummy Namespace.
src/Illuminate/Routing/Console/stubs/middleware.stub
@@ -1,4 +1,4 @@ -<?php namespace DummyNamespace}; +<?php namespace DummyNamespace; use Closure;
true
Other
laravel
framework
8a7b33606d0421b34acc7d0bfa442b678de056f3.json
Add callable support to helpers and collection
src/Illuminate/Support/Arr.php
@@ -1,6 +1,5 @@ <?php namespace Illuminate\Support; -use Closure; use Illuminate\Support\Traits\Macroable; class Arr { @@ -28,13 +27,13 @@ public static function add($array, $key, $value) /** * Build a new array using a callback. * - * @param array $array - * @param \Closure $callback + * @param array $array + * @param callable $callback * @return array */ - public static function build($array, Closure $callback) + public static function build($array, callable $callback) { - $results = array(); + $results = []; foreach ($array as $key => $value) { @@ -54,7 +53,7 @@ public static function build($array, Closure $callback) */ public static function divide($array) { - return array(array_keys($array), array_values($array)); + return [array_keys($array), array_values($array)]; } /** @@ -66,7 +65,7 @@ public static function divide($array) */ public static function dot($array, $prepend = '') { - $results = array(); + $results = []; foreach ($array as $key => $value) { @@ -106,7 +105,7 @@ public static function fetch($array, $key) { foreach (explode('.', $key) as $segment) { - $results = array(); + $results = []; foreach ($array as $value) { @@ -125,12 +124,12 @@ public static function fetch($array, $key) /** * Return the first element in an array passing a given truth test. * - * @param array $array - * @param \Closure $callback - * @param mixed $default + * @param array $array + * @param callable $callback + * @param mixed $default * @return mixed */ - public static function first($array, $callback, $default = null) + public static function first($array, callable $callback, $default = null) { foreach ($array as $key => $value) { @@ -143,12 +142,12 @@ public static function first($array, $callback, $default = null) /** * Return the last element in an array passing a given truth test. * - * @param array $array - * @param \Closure $callback - * @param mixed $default + * @param array $array + * @param callable $callback + * @param mixed $default * @return mixed */ - public static function last($array, $callback, $default = null) + public static function last($array, callable $callback, $default = null) { return static::first(array_reverse($array), $callback, $default); } @@ -161,7 +160,7 @@ public static function last($array, $callback, $default = null) */ public static function flatten($array) { - $return = array(); + $return = []; array_walk_recursive($array, function($x) use (&$return) { $return[] = $x; }); @@ -275,7 +274,7 @@ public static function only($array, $keys) */ public static function pluck($array, $value, $key = null) { - $results = array(); + $results = []; foreach ($array as $item) { @@ -341,7 +340,7 @@ public static function set(&$array, $key, $value) // values at the correct depth. Then we'll keep digging into the array. if ( ! isset($array[$key]) || ! is_array($array[$key])) { - $array[$key] = array(); + $array[$key] = []; } $array =& $array[$key]; @@ -353,27 +352,27 @@ public static function set(&$array, $key, $value) } /** - * Sort the array using the given Closure. + * Sort the array using the given callback. * - * @param array $array - * @param \Closure $callback + * @param array $array + * @param callable $callback * @return array */ - public static function sort($array, Closure $callback) + public static function sort($array, callable $callback) { return Collection::make($array)->sortBy($callback)->all(); } /** - * Filter the array using the given Closure. + * Filter the array using the given callback. * - * @param array $array - * @param \Closure $callback + * @param array $array + * @param callable $callback * @return array */ - public static function where($array, Closure $callback) + public static function where($array, callable $callback) { - $filtered = array(); + $filtered = []; foreach ($array as $key => $value) {
true
Other
laravel
framework
8a7b33606d0421b34acc7d0bfa442b678de056f3.json
Add callable support to helpers and collection
src/Illuminate/Support/Collection.php
@@ -60,7 +60,7 @@ public function all() */ public function collapse() { - $results = array(); + $results = []; foreach ($this->items as $values) { @@ -111,10 +111,10 @@ public function diff($items) /** * Execute a callback over each item. * - * @param \Closure $callback + * @param callable $callback * @return $this */ - public function each(Closure $callback) + public function each(callable $callback) { array_map($callback, $this->items); @@ -135,10 +135,10 @@ public function fetch($key) /** * Run a filter over each of the items. * - * @param \Closure $callback + * @param callable $callback * @return static */ - public function filter(Closure $callback) + public function filter(callable $callback) { return new static(array_filter($this->items, $callback)); } @@ -175,11 +175,11 @@ public function whereLoose($key, $value) /** * Get the first item from the collection. * - * @param \Closure $callback + * @param callable $callback * @param mixed $default * @return mixed|null */ - public function first(Closure $callback = null, $default = null) + public function first(callable $callback = null, $default = null) { if (is_null($callback)) { @@ -238,50 +238,37 @@ public function get($key, $default = null) } /** - * Group an associative array by a field or Closure value. + * Group an associative array by a field or using a callback. * * @param callable|string $groupBy * @return static */ public function groupBy($groupBy) { - $results = array(); - - foreach ($this->items as $key => $value) + if ( ! $this->useAsCallable($groupBy)) { - $results[$this->getGroupByKey($groupBy, $key, $value)][] = $value; + return $this->groupBy($this->valueRetriever($groupBy)); } - return new static($results); - } + $results = []; - /** - * Get the "group by" key value. - * - * @param callable|string $groupBy - * @param string $key - * @param mixed $value - * @return string - */ - protected function getGroupByKey($groupBy, $key, $value) - { - if ( ! is_string($groupBy) && is_callable($groupBy)) + foreach ($this->items as $key => $value) { - return $groupBy($value, $key); + $results[$groupBy($value, $key)][] = $value; } - return data_get($value, $groupBy); + return new static($results); } /** - * Key an associative array by a field or using a closure. + * Key an associative array by a field or using a callback. * - * @param string|\Closure $keyBy + * @param callable|string $keyBy * @return static */ public function keyBy($keyBy) { - if ( ! $keyBy instanceof Closure) + if ( ! $this->useAsCallable($keyBy)) { return $this->keyBy($this->valueRetriever($keyBy)); } @@ -340,6 +327,17 @@ public function isEmpty() return empty($this->items); } + /** + * Determine if the given value is callable, but not a string. + * + * @param mixed $value + * @return bool + */ + protected function useAsCallable($value) + { + return ! is_string($value) && is_callable($value); + } + /** * Get the keys of the collection items. * @@ -375,10 +373,10 @@ public function lists($value, $key = null) /** * Run a map over each of the items. * - * @param \Closure $callback + * @param callable $callback * @return static */ - public function map(Closure $callback) + public function map(callable $callback) { return new static(array_map($callback, $this->items, array_keys($this->items))); } @@ -492,12 +490,12 @@ public function reduce(callable $callback, $initial = null) /** * Create a collection of all elements that do not pass a given truth test. * - * @param \Closure|mixed $callback + * @param callable|mixed $callback * @return static */ public function reject($callback) { - if ($callback instanceof Closure) + if ($this->useAsCallable($callback)) { return $this->filter(function($item) use ($callback) { @@ -590,30 +588,32 @@ public function chunk($size, $preserveKeys = false) /** * Sort through each item with a callback. * - * @param \Closure $callback + * @param callable $callback * @return $this */ - public function sort(Closure $callback) + public function sort(callable $callback) { uasort($this->items, $callback); return $this; } /** - * Sort the collection using the given Closure. + * Sort the collection using the given callback. * - * @param \Closure|string $callback + * @param callable|string $callback * @param int $options * @param bool $descending * @return $this */ public function sortBy($callback, $options = SORT_REGULAR, $descending = false) { - $results = array(); + $results = []; - if (is_string($callback)) $callback = - $this->valueRetriever($callback); + if ( ! $this->useAsCallable($callback)) + { + $callback = $this->valueRetriever($callback); + } // First we will loop through the items and get the comparator from a callback // function which we were given. Then, we will sort the returned values and @@ -640,9 +640,9 @@ public function sortBy($callback, $options = SORT_REGULAR, $descending = false) } /** - * Sort the collection in descending order using the given Closure. + * Sort the collection in descending order using the given callback. * - * @param \Closure|string $callback + * @param callable|string $callback * @param int $options * @return $this */ @@ -659,15 +659,15 @@ public function sortByDesc($callback, $options = SORT_REGULAR) * @param mixed $replacement * @return static */ - public function splice($offset, $length = 0, $replacement = array()) + public function splice($offset, $length = 0, $replacement = []) { return new static(array_splice($this->items, $offset, $length, $replacement)); } /** * Get the sum of the given values. * - * @param \Closure|null $callback + * @param callable|string|null $callback * @return mixed */ public function sum($callback = null) @@ -677,15 +677,14 @@ public function sum($callback = null) return array_sum($this->items); } - if (is_string($callback)) + if ( ! $this->useAsCallable($callback)) { $callback = $this->valueRetriever($callback); } return $this->reduce(function($result, $item) use ($callback) { return $result += $callback($item); - }, 0); } @@ -705,10 +704,10 @@ public function take($limit = null) /** * Transform each item in the collection using a callback. * - * @param \Closure $callback + * @param callable $callback * @return $this */ - public function transform(Closure $callback) + public function transform(callable $callback) { $this->items = array_map($callback, $this->items);
true
Other
laravel
framework
8a7b33606d0421b34acc7d0bfa442b678de056f3.json
Add callable support to helpers and collection
src/Illuminate/Support/helpers.php
@@ -52,11 +52,11 @@ function array_add($array, $key, $value) /** * Build a new array using a callback. * - * @param array $array - * @param \Closure $callback + * @param array $array + * @param callable $callback * @return array */ - function array_build($array, Closure $callback) + function array_build($array, callable $callback) { return Arr::build($array, $callback); } @@ -126,12 +126,12 @@ function array_fetch($array, $key) /** * Return the first element in an array passing a given truth test. * - * @param array $array - * @param \Closure $callback - * @param mixed $default + * @param array $array + * @param callable $callback + * @param mixed $default * @return mixed */ - function array_first($array, $callback, $default = null) + function array_first($array, callable $callback, $default = null) { return Arr::first($array, $callback, $default); } @@ -142,9 +142,9 @@ function array_first($array, $callback, $default = null) /** * Return the last element in an array passing a given truth test. * - * @param array $array - * @param \Closure $callback - * @param mixed $default + * @param array $array + * @param callable $callback + * @param mixed $default * @return mixed */ function array_last($array, $callback, $default = null) @@ -281,13 +281,13 @@ function array_set(&$array, $key, $value) if ( ! function_exists('array_sort')) { /** - * Sort the array using the given Closure. + * Sort the array using the given callback. * - * @param array $array - * @param \Closure $callback + * @param array $array + * @param callable $callback * @return array */ - function array_sort($array, Closure $callback) + function array_sort($array, callable $callback) { return Arr::sort($array, $callback); } @@ -296,13 +296,13 @@ function array_sort($array, Closure $callback) if ( ! function_exists('array_where')) { /** - * Filter the array using the given Closure. + * Filter the array using the given callback. * - * @param array $array - * @param \Closure $callback + * @param array $array + * @param callable $callback * @return array */ - function array_where($array, Closure $callback) + function array_where($array, callable $callback) { return Arr::where($array, $callback); }
true
Other
laravel
framework
db8950690187d49d5096e12b255e94de1017c5e4.json
Fix Http\Request::input() phpdoc @return Fix Http\Request::input() phpdoc @return type: method can return array instead of string
src/Illuminate/Http/Request.php
@@ -282,7 +282,7 @@ public function all() * * @param string $key * @param mixed $default - * @return string + * @return string|array */ public function input($key = null, $default = null) {
false
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Console/EventGenerateCommand.php
@@ -17,7 +17,7 @@ class EventGenerateCommand extends Command { * * @var string */ - protected $description = 'Generate the missing events and handlers based on registration'; + protected $description = 'Generate the missing events and listeners based on registration'; /** * Execute the console command. @@ -30,20 +30,20 @@ public function fire() 'Illuminate\Foundation\Support\Providers\EventServiceProvider' ); - foreach ($provider->listens() as $event => $handlers) + foreach ($provider->listens() as $event => $listeners) { if ( ! str_contains($event, '\\')) continue; $this->callSilent('make:event', ['name' => $event]); - foreach ($handlers as $handler) + foreach ($listeners as $listener) { - $this->callSilent('handler:event', ['name' => $handler, '--event' => $event]); + $this->callSilent('make:listener', ['name' => $listener, '--event' => $event]); } } - $this->info('Events and handlers generated successfully!'); + $this->info('Events and listeners generated successfully!'); } }
true
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Console/JobMakeCommand.php
@@ -0,0 +1,69 @@ +<?php namespace Illuminate\Foundation\Console; + +use Illuminate\Console\GeneratorCommand; +use Symfony\Component\Console\Input\InputOption; + +class JobMakeCommand extends GeneratorCommand { + + /** + * The console command name. + * + * @var string + */ + protected $name = 'make:job'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a new job class'; + + /** + * The type of class being generated. + * + * @var string + */ + protected $type = 'Job'; + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('queued')) + { + return __DIR__.'/stubs/job-queued.stub'; + } + else + { + return __DIR__.'/stubs/job.stub'; + } + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Jobs'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return array( + array('queued', null, InputOption::VALUE_NONE, 'Indicates that job should be queued.'), + ); + } + +}
true
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Console/ListenerMakeCommand.php
@@ -0,0 +1,99 @@ +<?php namespace Illuminate\Foundation\Console; + +use Illuminate\Console\GeneratorCommand; +use Symfony\Component\Console\Input\InputOption; + +class ListenerMakeCommand extends GeneratorCommand { + + /** + * The console command name. + * + * @var string + */ + protected $name = 'make:listener'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Create a new event listener class'; + + /** + * The type of class being generated. + * + * @var string + */ + protected $type = 'Listener'; + + /** + * Build the class with the given name. + * + * @param string $name + * @return string + */ + protected function buildClass($name) + { + $stub = parent::buildClass($name); + + $event = $this->option('event'); + + if ( ! starts_with($event, $this->getAppNamespace())) + { + $event = $this->getAppNamespace().'Events\\'.$event; + } + + $stub = str_replace( + '{{event}}', class_basename($event), $stub + ); + + $stub = str_replace( + '{{fullEvent}}', $event, $stub + ); + + return $stub; + } + + /** + * Get the stub file for the generator. + * + * @return string + */ + protected function getStub() + { + if ($this->option('queued')) + { + return __DIR__.'/stubs/listener-queued.stub'; + } + else + { + return __DIR__.'/stubs/listener.stub'; + } + } + + /** + * Get the default namespace for the class. + * + * @param string $rootNamespace + * @return string + */ + protected function getDefaultNamespace($rootNamespace) + { + return $rootNamespace.'\Listeners'; + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return array( + array('event', null, InputOption::VALUE_REQUIRED, 'The event class the being listened for.'), + + array('queued', null, InputOption::VALUE_NONE, 'Indicates the event listener should be queued.'), + ); + } + +}
true
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Console/stubs/job-queued.stub
@@ -0,0 +1,34 @@ +<?php namespace {{namespace}}; + +use {{rootNamespace}}Jobs\Job; + +use Illuminate\Queue\SerializesModels; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Contracts\Bus\SelfHandling; +use Illuminate\Contracts\Queue\ShouldBeQueued; + +class {{class}} extends Job implements SelfHandling, ShouldBeQueued { + + use InteractsWithQueue, SerializesModels; + + /** + * Create a new job instance. + * + * @return void + */ + public function __construct() + { + // + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + // + } + +}
true
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Console/stubs/job.stub
@@ -0,0 +1,29 @@ +<?php namespace {{namespace}}; + +use {{rootNamespace}}Jobs\Job; + +use Illuminate\Contracts\Bus\SelfHandling; + +class {{class}} extends Job implements SelfHandling { + + /** + * Create a new job instance. + * + * @return void + */ + public function __construct() + { + // + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + // + } + +}
true
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Console/stubs/listener-queued.stub
@@ -0,0 +1,33 @@ +<?php namespace {{namespace}}; + +use {{fullEvent}}; + +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Contracts\Queue\ShouldBeQueued; + +class {{class}} implements ShouldBeQueued { + + use InteractsWithQueue; + + /** + * Create the event listener. + * + * @return void + */ + public function __construct() + { + // + } + + /** + * Handle the event. + * + * @param {{event}} $event + * @return void + */ + public function handle({{event}} $event) + { + // + } + +}
true
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Console/stubs/listener.stub
@@ -0,0 +1,31 @@ +<?php namespace {{namespace}}; + +use {{fullEvent}}; + +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Contracts\Queue\ShouldBeQueued; + +class {{class}} { + + /** + * Create the event listener. + * + * @return void + */ + public function __construct() + { + // + } + + /** + * Handle the event. + * + * @param {{event}} $event + * @return void + */ + public function handle({{event}} $event) + { + // + } + +}
true
Other
laravel
framework
76cf3e76a66395e0ca4ec8dd08a8ccee3ee574f9.json
Tweak some jobs and names.
src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
@@ -5,6 +5,7 @@ use Illuminate\Foundation\Console\DownCommand; use Illuminate\Foundation\Console\ServeCommand; use Illuminate\Foundation\Console\TinkerCommand; +use Illuminate\Foundation\Console\JobMakeCommand; use Illuminate\Foundation\Console\AppNameCommand; use Illuminate\Foundation\Console\OptimizeCommand; use Illuminate\Foundation\Console\RouteListCommand; @@ -19,6 +20,7 @@ use Illuminate\Foundation\Console\EnvironmentCommand; use Illuminate\Foundation\Console\KeyGenerateCommand; use Illuminate\Foundation\Console\RequestMakeCommand; +use Illuminate\Foundation\Console\ListenerMakeCommand; use Illuminate\Foundation\Console\ProviderMakeCommand; use Illuminate\Foundation\Console\HandlerEventCommand; use Illuminate\Foundation\Console\ClearCompiledCommand; @@ -53,7 +55,9 @@ class ArtisanServiceProvider extends ServiceProvider { 'Environment' => 'command.environment', 'HandlerCommand' => 'command.handler.command', 'HandlerEvent' => 'command.handler.event', + 'JobMake' => 'command.job.make', 'KeyGenerate' => 'command.key.generate', + 'ListenerMake' => 'command.listener.make', 'ModelMake' => 'command.model.make', 'Optimize' => 'command.optimize', 'ProviderMake' => 'command.provider.make', @@ -240,6 +244,19 @@ protected function registerHandlerEventCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerJobMakeCommand() + { + $this->app->singleton('command.job.make', function($app) + { + return new JobMakeCommand($app['files']); + }); + } + /** * Register the command. * @@ -253,6 +270,19 @@ protected function registerKeyGenerateCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerListenerMakeCommand() + { + $this->app->singleton('command.listener.make', function($app) + { + return new ListenerMakeCommand($app['files']); + }); + } + /** * Register the command. *
true
Other
laravel
framework
11813cc991ae4871afdd08ee8b4e864740a230f0.json
Move null casting tests to main model tests file
tests/Database/DatabaseEloquentCastingSupportsNullableTest.php
@@ -1,141 +0,0 @@ -<?php - -use Illuminate\Database\Eloquent\Model; - -class DatabaseEloquentCastingSupportsNullableTest extends PHPUnit_Framework_TestCase { - - public function testCastingStringToInteger() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('integer', $model->getAttribute('string_to_integer_field')); - } - - - public function testCastingStringToFloat() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('float', $model->getAttribute('string_to_float_field')); - } - - - public function testCastingStringToBoolean() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('boolean', $model->getAttribute('string_to_boolean_field')); - } - - - public function testCastingStringToArray() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('array', $model->getAttribute('json_string_to_array_field')); - } - - - public function testCastIntegerToString() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('string', $model->getAttribute('integer_to_string_field')); - } - - - public function testCastIntegerToBoolean() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('boolean', $model->getAttribute('integer_to_boolean_field')); - } - - - public function testCastFloatToString() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('string', $model->getAttribute('float_to_string_field')); - } - - - public function testCastNullableToString() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('null', $model->getAttribute('nullable_to_string')); - } - - - public function testCastNullableToInteger() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('null', $model->getAttribute('nullable_to_integer')); - } - - - public function testCastNullableToFloat() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('null', $model->getAttribute('nullable_to_float')); - } - - - public function testCastNullableToBoolean() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('null', $model->getAttribute('nullable_to_boolean')); - } - - - public function testCastNullableToArray() - { - $model = new EloquentModelCastingNullableStub(); - - $this->assertInternalType('null', $model->getAttribute('nullable_to_array')); - } - -} - - -class EloquentModelCastingNullableStub extends Model { - - protected $table = 'stub'; - - protected $guarded = array(); - - protected $attributes = array( - 'string_to_integer_field' => '1', - 'string_to_float_field' => '1.0', - 'string_to_boolean_field' => '1', - 'json_string_to_array_field' => '{"foo": "bar"}', - 'integer_to_string_field' => 1, - 'integer_to_boolean_field' => 1, - 'float_to_string_field' => 1.2, - 'nullable_to_string' => null, - 'nullable_to_integer' => null, - 'nullable_to_float' => null, - 'nullable_to_boolean' => null, - 'nullable_to_array' => null, - ); - - protected $casts = array( - 'string_to_integer_field' => 'integer', - 'string_to_float_field' => 'float', - 'string_to_boolean_field' => 'boolean', - 'json_string_to_array_field' => 'array', - 'integer_to_string_field' => 'string', - 'integer_to_boolean_field' => 'boolean', - 'float_to_string_field' => 'string', - 'nullable_to_string' => 'string', - 'nullable_to_integer' => 'integer', - 'nullable_to_float' => 'float', - 'nullable_to_boolean' => 'boolean', - 'nullable_to_array' => 'array', - ); - -}
true
Other
laravel
framework
11813cc991ae4871afdd08ee8b4e864740a230f0.json
Move null casting tests to main model tests file
tests/Database/DatabaseEloquentModelTest.php
@@ -1152,6 +1152,40 @@ public function testModelAttributesAreCastedWhenPresentInCastsArray() } + public function testModelAttributeCastingPreservesNull() + { + $model = new EloquentModelCastingStub; + $model->first = null; + $model->second = null; + $model->third = null; + $model->fourth = null; + $model->fifth = null; + $model->sixth = null; + $model->seventh = null; + $model->eighth = null; + + $this->assertNull($model->first); + $this->assertNull($model->second); + $this->assertNull($model->third); + $this->assertNull($model->fourth); + $this->assertNull($model->fifth); + $this->assertNull($model->sixth); + $this->assertNull($model->seventh); + $this->assertNull($model->eighth); + + $array = $model->toArray(); + + $this->assertNull($array['first']); + $this->assertNull($array['second']); + $this->assertNull($array['third']); + $this->assertNull($array['fourth']); + $this->assertNull($array['fifth']); + $this->assertNull($array['sixth']); + $this->assertNull($array['seventh']); + $this->assertNull($array['eighth']); + } + + protected function addMockConnection($model) { $model->setConnectionResolver($resolver = m::mock('Illuminate\Database\ConnectionResolverInterface'));
true
Other
laravel
framework
2c31fd5954699613cba04eacedd2a942e28b8abf.json
Add resource helper.
src/Illuminate/Foundation/helpers.php
@@ -243,6 +243,22 @@ function get($uri, $action) } } +if ( ! function_exists('resource')) +{ + /** + * Route a resource to a controller. + * + * @param string $name + * @param string $controller + * @param array $options + * @return void + */ + function resource($name, $controller, array $options = []) + { + return app('router')->resource($name, $controller, $options); + } +} + if ( ! function_exists('info')) { /**
false
Other
laravel
framework
9ef5b650f7dd7643f0f9a13063ec9dc0e4e7d7a6.json
Fix two testing cases in PaginationPaginatorTest
tests/Pagination/PaginationPaginatorTest.php
@@ -73,11 +73,10 @@ public function testPresenterCanGetAUrlRangeForAWindowOfLinks() public function testBootstrapPresenterCanGeneratorLinksForSlider() { - return; $array = []; for ($i = 1; $i <= 13; $i++) $array[$i] = 'item'.$i; - $p = new LengthAwarePaginator($array, count($array), 7, 1); + $p = new LengthAwarePaginator($array, count($array), 1, 7); $presenter = new BootstrapPresenter($p); $this->assertEquals(trim(file_get_contents(__DIR__.'/fixtures/slider.html')), $presenter->render()); @@ -86,11 +85,10 @@ public function testBootstrapPresenterCanGeneratorLinksForSlider() public function testBootstrapPresenterCanGeneratorLinksForTooCloseToBeginning() { - return; $array = []; for ($i = 1; $i <= 13; $i++) $array[$i] = 'item'.$i; - $p = new LengthAwarePaginator($array, count($array), 2, 1); + $p = new LengthAwarePaginator($array, count($array), 1, 2); $presenter = new BootstrapPresenter($p); $this->assertEquals(trim(file_get_contents(__DIR__.'/fixtures/beginning.html')), $presenter->render());
false
Other
laravel
framework
99ed94ecc82c9424825f697513aaf4dd12288577.json
Render exception with Symfony console.
src/Illuminate/Foundation/Exceptions/Handler.php
@@ -3,6 +3,7 @@ use Exception; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Exception\HttpException; +use Symfony\Component\Console\Application as ConsoleApplication; use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer; use Illuminate\Contracts\Debug\ExceptionHandler as ExceptionHandlerContract; @@ -99,7 +100,7 @@ public function render($request, Exception $e) */ public function renderForConsole($output, Exception $e) { - $output->writeln((string) $e); + (new ConsoleApplication)->renderException($e, $output); } /**
false
Other
laravel
framework
d545979398ea73135254ee238e5e6d689b77bfb6.json
Pass composer instance into FailedTableCommand
src/Illuminate/Queue/ConsoleServiceProvider.php
@@ -51,7 +51,7 @@ public function register() $this->app->singleton('command.queue.failed-table', function($app) { - return new FailedTableCommand($app['files']); + return new FailedTableCommand($app['files'], $app['composer']); }); $this->commands(
false
Other
laravel
framework
981cb002042ad93af018bd02e368d22621137d48.json
Remove unnecessary test
tests/Support/SupportSerializableClosureTest.php
@@ -1,32 +0,0 @@ -<?php - -use SuperClosure\Serializer; - -class SupportSerializableClosureTest extends PHPUnit_Framework_TestCase { - - public function testClosureCanBeSerializedAndRebuilt() - { - $serialized = (new Serializer)->serialize(function() { return 'hello'; }); - - $unserialized = unserialize($serialized); - - $this->assertEquals('hello', $unserialized()); - } - - - public function testClosureCanBeSerializedAndRebuiltAndInheritState() - { - $a = 1; - $b = 1; - - $serialized = (new Serializer)->serialize(function($i) use ($a, $b) - { - return $a + $b + $i; - }); - - $unserialized = unserialize($serialized); - - $this->assertEquals(3, $unserialized(1)); - } - -}
false
Other
laravel
framework
ae6f1b0b7b616315ff99b25a790b991509d9b2ed.json
fix method separation
tests/Routing/RoutingRouteTest.php
@@ -555,6 +555,7 @@ public function testModelBindingWithCustomNullReturn() $this->assertEquals('missing', $router->dispatch(Request::create('foo/taylor', 'GET'))->getContent()); } + public function testModelBindingWithBindingClosure() { $router = $this->getRouter();
false
Other
laravel
framework
c3d3a52d670e1514ea9b9106c24982cb19d0280d.json
pass model binding value to callback
src/Illuminate/Routing/Router.php
@@ -911,7 +911,7 @@ public function model($key, $class, Closure $callback = null) // developer a little greater flexibility to decide what will happen. if ($callback instanceof Closure) { - return call_user_func($callback); + return call_user_func_array($callback, [$value]); } throw new NotFoundHttpException;
true
Other
laravel
framework
c3d3a52d670e1514ea9b9106c24982cb19d0280d.json
pass model binding value to callback
tests/Routing/RoutingRouteTest.php
@@ -555,6 +555,14 @@ public function testModelBindingWithCustomNullReturn() $this->assertEquals('missing', $router->dispatch(Request::create('foo/taylor', 'GET'))->getContent()); } + public function testModelBindingWithBindingClosure() + { + $router = $this->getRouter(); + $router->get('foo/{bar}', function($name) { return $name; }); + $router->model('bar', 'RouteModelBindingNullStub', function($value) { return (new RouteModelBindingClosureStub())->findAlternate($value); }); + $this->assertEquals('tayloralt', $router->dispatch(Request::create('foo/TAYLOR', 'GET'))->getContent()); + } + public function testGroupMerging() { @@ -886,6 +894,10 @@ class RouteModelBindingNullStub { public function find($value) {} } +class RouteModelBindingClosureStub { + public function findAlternate($value) { return strtolower($value) . "alt"; } +} + class RouteTestFilterStub { public function filter() {
true
Other
laravel
framework
1a59fa9d411387f92254411dd97eb512aa8f7063.json
Set the timezone if it is set for MySQL.
src/Illuminate/Database/Connectors/MySqlConnector.php
@@ -36,6 +36,16 @@ public function connect(array $config) $connection->prepare($names)->execute(); + // Next, we will check to see if a timezone has been specified in this config + // and if it has we will issue a statement to modify the timezone with the + // database. Setting this DB timezone is an optional configuration item. + if (isset($config['timezone'])) + { + $connection->prepare( + 'set time_zone="'.$config['timezone'].'"' + )->execute(); + } + // If the "strict" option has been configured for the connection we'll enable // strict mode on all of these tables. This enforces some extra rules when // using the MySQL database system and is a quicker way to enforce them.
false
Other
laravel
framework
80093b2ddff081165d3d97a59a88746f0b30f931.json
Remove useless variable
src/Illuminate/Routing/Router.php
@@ -478,7 +478,7 @@ protected function createRoute($methods, $uri, $action) } $route = $this->newRoute( - $methods, $uri = $this->prefix($uri), $action + $methods, $this->prefix($uri), $action ); // If we have groups that need to be merged, we will merge them now after this
false
Other
laravel
framework
0ae4b029f54f02fab724d21dea01fe426fb8f01a.json
Allow releasing jobs.
src/Illuminate/Queue/Jobs/SqsJob.php
@@ -86,7 +86,11 @@ public function release($delay = 0) { parent::release($delay); - // SQS job releases are handled by the server configuration... + $this->sqs->changeMessageVisibility([ + 'QueueUrl' => $this->queue, + 'ReceiptHandle' => $this->job['ReceiptHandle'], + 'VisibilityTimeout' => $delay, + ]); } /**
false
Other
laravel
framework
866a8cfc58430830069bd24feacf2d81e99385a2.json
Tweak some code.
src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
@@ -16,9 +16,9 @@ public function bootstrap(Application $app) { try { - Dotenv::makeMutable(); - Dotenv::load($app['path.base'], $app->environmentFile()); + + Dotenv::makeMutable(); } catch (InvalidArgumentException $e) {
false
Other
laravel
framework
d07f5ce82a361b457329b54e0eb6b688a226c376.json
Return response to routeMiddleware too Fix spacing Add prepareResponse back Revert indentation
src/Illuminate/Routing/Router.php
@@ -686,7 +686,10 @@ protected function runRouteWithinStack(Route $route, Request $request) ->through($middleware) ->then(function($request) use ($route) { - return $route->run($request); + return $this->prepareResponse( + $request, + $route->run($request) + ); }); }
false
Other
laravel
framework
f0d5efaa1c4464565e47aab3e3c24b523f1824cc.json
add conditions to 'credentials not match' message
src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
@@ -84,7 +84,7 @@ public function postLogin(Request $request) return redirect($this->loginPath()) ->withInput($request->only('email', 'remember')) ->withErrors([ - 'email' => 'These credentials do not match our records.', + 'email' => trans()->has('validation.credentials_not_match') ? trans('validation.credentials_not_match') : 'These credentials do not match our records.' ]); }
false
Other
laravel
framework
c7c85b1ad6ffab9f21f8931b7acf2d1b2b891679.json
Use phpdotenv methods instead of getenv/putenv
src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
@@ -16,6 +16,8 @@ public function bootstrap(Application $app) { try { + Dotenv::makeMutable(); + Dotenv::load($app['path.base'], $app->environmentFile()); } catch (InvalidArgumentException $e)
true
Other
laravel
framework
c7c85b1ad6ffab9f21f8931b7acf2d1b2b891679.json
Use phpdotenv methods instead of getenv/putenv
src/Illuminate/Foundation/Testing/ApplicationTrait.php
@@ -1,5 +1,6 @@ <?php namespace Illuminate\Foundation\Testing; +use Dotenv; use Illuminate\Http\Request; use Illuminate\Contracts\Auth\Authenticatable as UserContract; @@ -26,8 +27,8 @@ trait ApplicationTrait { */ protected function refreshApplication() { - putenv('APP_ENV=testing'); - + Dotenv::setEnvironmentVariable('APP_ENV', 'testing'); + $this->app = $this->createApplication(); }
true
Other
laravel
framework
c7c85b1ad6ffab9f21f8931b7acf2d1b2b891679.json
Use phpdotenv methods instead of getenv/putenv
src/Illuminate/Foundation/helpers.php
@@ -559,9 +559,9 @@ function view($view = null, $data = array(), $mergeData = array()) */ function env($key, $default = null) { - $value = getenv($key); + $value = Dotenv::findEnvironmentVariable($key); - if ($value === false) return value($default); + if ($value === null) return value($default); switch (strtolower($value)) {
true
Other
laravel
framework
a141f5120e5fa7e86c58de10f59513fd3fd80a38.json
Fix DocBlock declaration
src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
@@ -33,7 +33,7 @@ public function getRegister() /** * Handle a registration request for the application. * - * @param \Illuminate\Foundation\Http\FormRequest $request + * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function postRegister(Request $request)
false
Other
laravel
framework
3359de6d6cd322e8a1b251c2f8d9dd42a3e4e232.json
Increment 4.2 version.
src/Illuminate/Foundation/Application.php
@@ -28,7 +28,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn * * @var string */ - const VERSION = '4.2.16'; + const VERSION = '4.2.17'; /** * Indicates if the application has "booted".
false
Other
laravel
framework
7861640f4d5c55b066f0ac5f017006d972e20b14.json
Clear the facaded request on calls to Kernel.
src/Illuminate/Foundation/Http/Kernel.php
@@ -3,6 +3,7 @@ use Exception; use Illuminate\Routing\Router; use Illuminate\Pipeline\Pipeline; +use Illuminate\Support\Facades\Facade; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Routing\TerminableMiddleware; use Illuminate\Contracts\Http\Kernel as KernelContract; @@ -100,6 +101,8 @@ protected function sendRequestThroughRouter($request) { $this->app->instance('request', $request); + Facade::clearResolvedInstance('request'); + $this->bootstrap(); return (new Pipeline($this->app))
false
Other
laravel
framework
d297faf5e17b5ec8a705354eba5ac710454f792c.json
Update the Passwords Facade Constants
src/Illuminate/Support/Facades/Password.php
@@ -10,35 +10,35 @@ class Password extends Facade { * * @var int */ - const REMINDER_SENT = 'reminders.sent'; + const REMINDER_SENT = 'passwords.sent'; /** * Constant representing a successfully reset password. * * @var int */ - const PASSWORD_RESET = 'reminders.reset'; + const PASSWORD_RESET = 'passwords.reset'; /** * Constant representing the user not found response. * * @var int */ - const INVALID_USER = 'reminders.user'; + const INVALID_USER = 'passwords.user'; /** * Constant representing an invalid password. * * @var int */ - const INVALID_PASSWORD = 'reminders.password'; + const INVALID_PASSWORD = 'passwords.password'; /** * Constant representing an invalid token. * * @var int */ - const INVALID_TOKEN = 'reminders.token'; + const INVALID_TOKEN = 'passwords.token'; /** * Get the registered name of the component.
false
Other
laravel
framework
95155f772912f9b339e9da9fc1a61b9f19fdcc8b.json
Add tests for multi-row inserts
tests/Database/DatabaseEloquentIntegrationTest.php
@@ -242,6 +242,32 @@ public function testBasicMorphManyRelationship() $this->assertEquals('First Post', $photos[3]->imageable->name); } + + public function testMultiInsertsWithDifferentValues() + { + $date = '1970-01-01'; + $result = EloquentTestPost::insert([ + ['user_id' => 1, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], + ['user_id' => 2, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], + ]); + + $this->assertTrue($result); + $this->assertEquals(2, EloquentTestPost::count()); + } + + + public function testMultiInsertsWithSameValues() + { + $date = '1970-01-01'; + $result = EloquentTestPost::insert([ + ['user_id' => 1, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], + ['user_id' => 1, 'name' => 'Post', 'created_at' => $date, 'updated_at' => $date], + ]); + + $this->assertTrue($result); + $this->assertEquals(2, EloquentTestPost::count()); + } + /** * Helpers... */
false
Other
laravel
framework
1078952f8bc9f377f478af8ea62aa0f70128755d.json
Return nested collection from groupBy
src/Illuminate/Support/Collection.php
@@ -245,11 +245,18 @@ public function get($key, $default = null) */ public function groupBy($groupBy) { - $results = array(); + $results = []; foreach ($this->items as $key => $value) { - $results[$this->getGroupByKey($groupBy, $key, $value)][] = $value; + $groupKey = $this->getGroupByKey($groupBy, $key, $value); + + if ( ! array_key_exists($groupKey, $results)) + { + $results[$groupKey] = new static; + } + + $results[$groupKey]->push($value); } return new static($results);
false
Other
laravel
framework
a2ec930588969db06fb6ae45e8c6681c1b8b323f.json
Fix multi-row insert for sqlite
src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php
@@ -56,7 +56,7 @@ public function compileInsert(Builder $query, array $values) $columns = array_fill(0, count($values), implode(', ', $columns)); - return "insert into $table ($names) select ".implode(' union select ', $columns); + return "insert into $table ($names) select ".implode(' union all select ', $columns); } /**
true
Other
laravel
framework
a2ec930588969db06fb6ae45e8c6681c1b8b323f.json
Fix multi-row insert for sqlite
tests/Database/DatabaseQueryBuilderTest.php
@@ -837,7 +837,7 @@ public function testInsertMethod() public function testSQLiteMultipleInserts() { $builder = $this->getSQLiteBuilder(); - $builder->getConnection()->shouldReceive('insert')->once()->with('insert into "users" ("email", "name") select ? as "email", ? as "name" union select ? as "email", ? as "name"', array('foo', 'taylor', 'bar', 'dayle'))->andReturn(true); + $builder->getConnection()->shouldReceive('insert')->once()->with('insert into "users" ("email", "name") select ? as "email", ? as "name" union all select ? as "email", ? as "name"', array('foo', 'taylor', 'bar', 'dayle'))->andReturn(true); $result = $builder->from('users')->insert(array(array('email' => 'foo', 'name' => 'taylor'), array('email' => 'bar', 'name' => 'dayle'))); $this->assertTrue($result); }
true
Other
laravel
framework
23526ca9a4620a60e2f282df14ccb053d52b36a7.json
Fix docblock spelling
src/Illuminate/Hashing/BcryptHasher.php
@@ -63,7 +63,7 @@ public function needsRehash($hashedValue, array $options = array()) } /** - * Set the default passwork work factor. + * Set the default password work factor. * * @param int $rounds * @return $this
false
Other
laravel
framework
fb40aba786421581781ae59be98132e13724ed42.json
Add contract to let dispatcher use pipelines
src/Illuminate/Contracts/Bus/PipingDispatcher.php
@@ -0,0 +1,13 @@ +<?php namespace Illuminate\Contracts\Bus; + +interface PipingDispatcher extends Dispatcher { + + /** + * Set the pipes commands should be piped through before dispatching. + * + * @param array $pipes + * @return $this + */ + public function pipeThrough(array $pipes); + +}
false
Other
laravel
framework
8ff29231212e9b2d8c078b7037f382d68cccb51b.json
Implement the PipingDispatcher contract
src/Illuminate/Bus/Dispatcher.php
@@ -11,10 +11,11 @@ use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Bus\HandlerResolver; use Illuminate\Contracts\Queue\ShouldBeQueued; +use Illuminate\Contracts\Bus\PipingDispatcher; use Illuminate\Contracts\Bus\QueueingDispatcher; use Illuminate\Contracts\Bus\Dispatcher as DispatcherContract; -class Dispatcher implements DispatcherContract, QueueingDispatcher, HandlerResolver { +class Dispatcher implements DispatcherContract, QueueingDispatcher, HandlerResolver, PipingDispatcher { /** * The container implementation.
false
Other
laravel
framework
2719387da1caec95d9d537cbcfd9278597df25a0.json
Add whereNotNull to JoinClause
src/Illuminate/Database/Query/JoinClause.php
@@ -114,4 +114,16 @@ public function whereNull($column, $boolean = 'and') return $this->on($column, 'is', new Expression('null'), $boolean, false); } + /** + * Add an "on where is not null" clause to the join + * + * @param string $column + * @param string $boolean + * @return \Illuminate\Database\Query\JoinClause + */ + public function whereNotNull($column, $boolean = 'and') + { + return $this->on($column, 'is', new Expression('not null'), $boolean, false); + } + }
true
Other
laravel
framework
2719387da1caec95d9d537cbcfd9278597df25a0.json
Add whereNotNull to JoinClause
tests/Database/DatabaseQueryBuilderTest.php
@@ -652,6 +652,7 @@ public function testComplexJoin() $this->assertEquals(array('foo', 'bar'), $builder->getBindings()); } + public function testJoinWhereNull() { $builder = $this->getBuilder(); @@ -662,6 +663,18 @@ public function testJoinWhereNull() $this->assertEquals('select * from "users" inner join "contacts" on "users"."id" = "contacts"."id" and "contacts"."deleted_at" is null', $builder->toSql()); } + + public function testJoinWhereNotNull() + { + $builder = $this->getBuilder(); + $builder->select('*')->from('users')->join('contacts', function($j) + { + $j->on('users.id', '=', 'contacts.id')->whereNotNull('contacts.deleted_at'); + }); + $this->assertEquals('select * from "users" inner join "contacts" on "users"."id" = "contacts"."id" and "contacts"."deleted_at" is not null', $builder->toSql()); + } + + public function testRawExpressionsInSelect() { $builder = $this->getBuilder();
true
Other
laravel
framework
b890d6cdd0f45f642c6695b2ec10e34b360a6850.json
Replace slash to double back slash
src/Illuminate/Console/GeneratorCommand.php
@@ -90,6 +90,11 @@ protected function parseName($name) return $name; } + if (str_contains($name, '/')) + { + $name = str_replace('/', '\\', $name); + } + return $this->parseName($this->getDefaultNamespace(trim($rootNamespace, '\\')).'\\'.$name); }
false