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
a8d35bf8fc44f2c73f4a58a6c32ab1edbdca85d6.json
Fix seed method in Foundation TestCase
src/Illuminate/Foundation/Testing/TestCase.php
@@ -355,7 +355,7 @@ public function be(UserInterface $user, $driver = null) */ public function seed($class = 'DatabaseSeeder') { - $this->app['artisan']->call('seed', array('--class' => $class)); + $this->app['artisan']->call('db:seed', array('--class' => $class)); } /**
false
Other
laravel
framework
3ef7bf2bf4fc7c7b240ea1f0f1bb2e364603f4ca.json
Fix bug in URL generator.
src/Illuminate/Routing/UrlGenerator.php
@@ -153,7 +153,7 @@ public function secureAsset($path) */ protected function getScheme($secure) { - if (is_null($secure)) + if ( ! $secure) { return $this->request->getScheme().'://'; }
true
Other
laravel
framework
3ef7bf2bf4fc7c7b240ea1f0f1bb2e364603f4ca.json
Fix bug in URL generator.
tests/Routing/RoutingUrlGeneratorTest.php
@@ -35,7 +35,7 @@ public function testBasicGeneration() $this->assertEquals('http://www.foo.com/foo/bar', $url->asset('foo/bar')); $this->assertEquals('https://www.foo.com/foo/bar', $url->asset('foo/bar', true)); - } + } public function testBasicRouteGeneration() @@ -76,9 +76,26 @@ public function testBasicRouteGeneration() } + public function testRoutesMaintainRequestScheme() + { + $url = new UrlGenerator( + $routes = new Illuminate\Routing\RouteCollection, + $request = Illuminate\Http\Request::create('https://www.foo.com/') + ); + + /** + * Named Routes + */ + $route = new Illuminate\Routing\Route(array('GET'), 'foo/bar', array('as' => 'foo')); + $routes->add($route); + + $this->assertEquals('https://www.foo.com/foo/bar', $url->route('foo')); + } + + public function testRoutesWithDomains() { - $url = new UrlGenerator( + $url = new UrlGenerator( $routes = new Illuminate\Routing\RouteCollection, $request = Illuminate\Http\Request::create('http://www.foo.com/') );
true
Other
laravel
framework
14716e50812860f27fb0d3d93d13f79fe70b8d63.json
Fix no error on console preboot.
src/Illuminate/Exception/Handler.php
@@ -160,7 +160,18 @@ public function handleException($exception) $response = $this->displayException($exception); } - return $this->responsePreparer->readyForResponses() + return $this->sendResponse($response); + } + + /** + * Send the repsonse back to the client. + * + * @param \Symfony\Component\HttpFoundation\Response $response + * @return mixed + */ + protected function sendResponse($response) + { + return $this->responsePreparer->readyForResponses() && ! $this->runningInConsole() ? $response : $response->send(); } @@ -356,6 +367,16 @@ protected function prepareResponse($response) return $this->responsePreparer->prepareResponse($response); } + /** + * Determine if we are running in the console. + * + * @return bool + */ + public function runningInConsole() + { + return php_sapi_name() == 'cli'; + } + /** * Set the debug level for the handler. *
false
Other
laravel
framework
1a67ab0a88b2b7cd7e5fbc6f60241b43b902813f.json
Fix status code.
src/Illuminate/Exception/PlainDisplayer.php
@@ -2,6 +2,7 @@ use Exception; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class PlainDisplayer implements ExceptionDisplayerInterface { @@ -12,7 +13,9 @@ class PlainDisplayer implements ExceptionDisplayerInterface { */ public function display(Exception $exception) { - return new Response(file_get_contents(__DIR__.'/resources/plain.html'), 500); + $status = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; + + return new Response(file_get_contents(__DIR__.'/resources/plain.html'), $status); } } \ No newline at end of file
true
Other
laravel
framework
1a67ab0a88b2b7cd7e5fbc6f60241b43b902813f.json
Fix status code.
src/Illuminate/Exception/WhoopsDisplayer.php
@@ -3,6 +3,7 @@ use Exception; use Whoops\Run; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; class WhoopsDisplayer implements ExceptionDisplayerInterface { @@ -40,7 +41,9 @@ public function __construct(Run $whoops, $runningInConsole) */ public function display(Exception $exception) { - return new Response($this->whoops->handleException($exception), 500); + $status = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; + + return new Response($this->whoops->handleException($exception), $status); } } \ No newline at end of file
true
Other
laravel
framework
f2e92773aba508201fd736b3e424b856f0f6fcfe.json
Return user from loginUsingID. Fixes #2871.
src/Illuminate/Auth/Guard.php
@@ -382,7 +382,9 @@ public function loginUsingId($id, $remember = false) { $this->session->put($this->getName(), $id); - return $this->login($this->provider->retrieveById($id), $remember); + $this->login($user = $this->provider->retrieveById($id), $remember); + + return $user; } /**
false
Other
laravel
framework
e8d523cbbc1fc5270925b1532cb166ea0855b537.json
Fix route match.
src/Illuminate/Routing/Route.php
@@ -456,7 +456,7 @@ protected static function compileParameters($value, array $wheres = array()) { $value = static::compileWhereParameters($value, $wheres); - return preg_replace('/\{(([\w\-]+)[^?])\}/', static::$wildcard, $value); + return preg_replace('/\{([\w\-]+)\}/', static::$wildcard, $value); } /**
false
Other
laravel
framework
11ed2b19166c20e15866492a7c61fb6951447707.json
Fix variable typo in Collection Signed-off-by: Gergely Tarjan <mail@malakai.hu>
src/Illuminate/Support/Collection.php
@@ -582,7 +582,7 @@ private function getArrayableItems($items) } elseif ($items instanceof ArrayableInterface) { - $tiems = $items->toArray(); + $items = $items->toArray(); } return $items;
false
Other
laravel
framework
73340aed77b9d06b065b629bf5834ec2ae92ad9f.json
Fix bug in place-holder replacement.
src/Illuminate/Routing/Route.php
@@ -456,7 +456,7 @@ protected static function compileParameters($value, array $wheres = array()) { $value = static::compileWhereParameters($value, $wheres); - return preg_replace('/\{((.*?)[^?])\}/', static::$wildcard, $value); + return preg_replace('/\{(([\w\-]+)[^?])\}/', static::$wildcard, $value); } /** @@ -499,9 +499,9 @@ protected static function compileOptional($value, $wheres = array()) */ protected static function compileStandardOptional($value, $custom = 0) { - $value = preg_replace('/\/\{(.*?)\?\}/', static::$optional, $value, -1, $count); + $value = preg_replace('/\/\{([\w\-]+)\?\}/', static::$optional, $value, -1, $count); - $value = preg_replace('/^(\{(.*?)\?\})/', static::$leadingOptional, $value, -1, $leading); + $value = preg_replace('/^(\{([\w\-]+)\?\})/', static::$leadingOptional, $value, -1, $leading); $total = $leading + $count + $custom;
false
Other
laravel
framework
1973197d53c9daaf65c54c4c872669e787a408d3.json
Fix command bug.
src/Illuminate/Database/Seeder.php
@@ -37,7 +37,10 @@ public function call($class) { $this->resolve($class)->run(); - $this->command->getOutput()->writeln("<info>Seeded:</info> $class"); + if ($this->command) + { + $this->command->getOutput()->writeln("<info>Seeded:</info> $class"); + } } /**
false
Other
laravel
framework
24e5c2f33e70b3f6576d1906adcf058bdc34a5da.json
Use ternary short-cut.
src/Illuminate/View/View.php
@@ -93,7 +93,7 @@ public function render(Closure $callback = null) if ($env->doneRendering()) $env->flushSections(); - return $response !== null ? $response : $contents; + return $response ?: $contents; } /**
false
Other
laravel
framework
ce5726d870f66e1082f5207b8456e8cc434d5c10.json
Bind Artisan to container.
src/Illuminate/Console/Application.php
@@ -42,10 +42,14 @@ public static function make($app) { $app->boot(); - return with($console = new static('Laravel Framework', $app::VERSION)) - ->setLaravel($app) - ->setExceptionHandler($app['exception']) - ->setAutoExit(false); + $console = with($console = new static('Laravel Framework', $app::VERSION)) + ->setLaravel($app) + ->setExceptionHandler($app['exception']) + ->setAutoExit(false); + + $app->instance('artisan', $console); + + return $console; } /**
false
Other
laravel
framework
f5e95c357c93f6cc60ce9f2aa3bfc7e218e6a6f3.json
Add start helper method.
src/Illuminate/Console/Application.php
@@ -21,6 +21,17 @@ class Application extends \Symfony\Component\Console\Application { */ protected $laravel; + /** + * Create and boot a new Console application. + * + * @param \Illuminate\Foundation\Application $app + * @return \Illuminate\Console\Application + */ + public static function start($app) + { + return static::make($app)->boot(); + } + /** * Create a new Console application. * @@ -40,7 +51,7 @@ public static function make($app) /** * Boot the Console application. * - * @return void + * @return \Illuminate\Console\Application */ public function boot() {
false
Other
laravel
framework
4df192314896f4afe5da51f68fb689186bbc8526.json
Remove unique index.
src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php
@@ -119,7 +119,7 @@ public function createRepository() // The migrations table is responsible for keeping track of which of the // migrations have actually run for the application. We'll create the // table to hold the migration file's path as well as the batch ID. - $table->string('migration')->unique(); + $table->string('migration'); $table->integer('batch'); });
false
Other
laravel
framework
2f4c14f5a4f58b1a6312074af53f07312653dee5.json
Add support for using IAM Roles for SQS queues. The AWS PHP SDK allows for specifying a location on EC2 instances that will allow the instance to assume an IAM role and connect to different services. You just need to add a `default_cache_config` option to the config array for queues using the SQS driver.
src/Illuminate/Queue/Connectors/SqsConnector.php
@@ -13,11 +13,9 @@ class SqsConnector implements ConnectorInterface { */ public function connect(array $config) { - $sqs = SqsClient::factory(array( + $sqsConfig = array_only($config, array('key', 'secret', 'region', 'default_cache_config')); - 'key' => $config['key'], 'secret' => $config['secret'], 'region' => $config['region'], - - )); + $sqs = SqsClient::factory($sqsConfig); return new SqsQueue($sqs, $config['queue']); }
false
Other
laravel
framework
bccc3fbaf48bf05800269251fecc6b6f27e3731c.json
Show better exception messages with Blade views.
src/Illuminate/View/Engines/CompilerEngine.php
@@ -11,6 +11,13 @@ class CompilerEngine extends PhpEngine { */ protected $compiler; + /** + * A stack of the last compiled templates. + * + * @var array + */ + protected $lastCompiled = array(); + /** * Create a new Blade view engine instance. * @@ -31,6 +38,8 @@ public function __construct(CompilerInterface $compiler) */ public function get($path, array $data = array()) { + $this->lastCompiled[] = $path; + // If this given view has expired, which means it has simply been edited since // it was last compiled, we will re-compile the views so we can evaluate a // fresh copy of the view. We'll pass the compiler the path of the view. @@ -41,7 +50,40 @@ public function get($path, array $data = array()) $compiled = $this->compiler->getCompiledPath($path); - return $this->evaluatePath($compiled, $data); + // Once we have the path to the compiled file, we will evaluate the paths with + // typical PHP just like any other templates. We also keep a stack of views + // which have been rendered for right exception messages to be generated. + $results = $this->evaluatePath($compiled, $data); + + array_pop($this->lastCompiled); + + return $results; + } + + /** + * Handle a view exception. + * + * @param Exception $e + * @return void + * + * @throws $e + */ + protected function handleViewException($e) + { + $e = new \ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); + + ob_get_clean(); throw $e; + } + + /** + * Get the exception message for an exception. + * + * @param \Exception $e + * @return string + */ + protected function getMessage($e) + { + return $e->getMessage().' (View: '.realpath(last($this->lastCompiled)).')'; } /**
false
Other
laravel
framework
7dfc1025ccf79046eaeb611f50d200edfae33b49.json
Display no failed jobs.
src/Illuminate/Queue/Console/ListFailedCommand.php
@@ -55,6 +55,11 @@ public function fire() $rows[] = array_values(array_except((array) $failed, array('payload'))); } + if (count($rows) == 0) + { + return $this->info('Awesome! No failed jobs!'); + } + $table = $this->getHelperSet()->get('table'); $table->setHeaders(array('ID', 'Connection', 'Queue', 'Failed At'))
false
Other
laravel
framework
e07e9383170efe7043e854bf54466ba021f01ed0.json
Pass the IronQueue instance to IronJob
src/Illuminate/Queue/IronQueue.php
@@ -183,7 +183,7 @@ protected function marshalPushedJob() */ protected function createPushedIronJob($job) { - return new IronJob($this->container, $this->iron, $job, true); + return new IronJob($this->container, $this, $job, true); } /**
false
Other
laravel
framework
ddfacfb64afbf8da8044bd96b702cb4e21dc7657.json
Remove colon from message.
src/Illuminate/Database/Eloquent/Model.php
@@ -519,7 +519,7 @@ public static function findOrFail($id, $columns = array('*')) { if ( ! is_null($model = static::find($id, $columns))) return $model; - throw new ModelNotFoundException(get_called_class().': model not found'); + throw new ModelNotFoundException(get_called_class().' model not found'); } /**
false
Other
laravel
framework
d64e3a7faaa38c52223133b6340a0f4a621afc70.json
Implement diff and intersect on Support\Collection
src/Illuminate/Support/Collection.php
@@ -355,6 +355,50 @@ public function merge($items) return new static($results); } + /** + * Diff items with the collection items. + * + * @param \Illuminate\Support\Collection|\Illuminate\Support\Contracts\ArrayableInterface|array $items + * @return \Illuminate\Support\Collection + */ + public function diff($items) + { + if ($items instanceof Collection) + { + $items = $items->all(); + } + elseif ($items instanceof ArrayableInterface) + { + $items = $items->toArray(); + } + + $results = array_diff($this->items, $items); + + return new static($results); + } + + /** + * Intersect items with the collection items. + * + * @param \Illuminate\Support\Collection|\Illuminate\Support\Contracts\ArrayableInterface|array $items + * @return \Illuminate\Support\Collection + */ + public function intersect($items) + { + if ($items instanceof Collection) + { + $items = $items->all(); + } + elseif ($items instanceof ArrayableInterface) + { + $tiems = $items->toArray(); + } + + $results = array_intersect($this->items, $items); + + return new static($results); + } + /** * Slice the underlying collection array. *
true
Other
laravel
framework
d64e3a7faaa38c52223133b6340a0f4a621afc70.json
Implement diff and intersect on Support\Collection
tests/Support/SupportCollectionTest.php
@@ -154,6 +154,20 @@ public function testMergeCollection() } + public function testDiffCollection() + { + $c = new Collection(array('id' => 1, 'first_word' => 'Hello')); + $this->assertEquals(array('id' => 1), $c->diff(new Collection(array('first_word' => 'Hello', 'last_word' => 'World')))->all()); + } + + + public function testIntersectCollection() + { + $c = new Collection(array('id' => 1, 'first_word' => 'Hello')); + $this->assertEquals(array('first_word' => 'Hello'), $c->intersect(new Collection(array('first_world' => 'Hello', 'last_word' => 'World')))->all()); + } + + public function testCollapse() { $data = new Collection(array(array($object1 = new StdClass), array($object2 = new StdClass)));
true
Other
laravel
framework
8ef840af4f7d90ebed04a9fca58dbdc29572da10.json
Fix missing variable.
src/Illuminate/Auth/Console/stubs/controller.stub
@@ -19,13 +19,13 @@ class RemindersController extends Controller { */ public function postRemind() { - switch (Password::remind(Input::only('email'))) + switch ($response = Password::remind(Input::only('email'))) { case Password::INVALID_USER: - return Redirect::back()->with('error', Lang::get($reason)); + return Redirect::back()->with('error', Lang::get($response)); case Password::REMINDER_SENT: - return Redirect::back()->with('status', Lang::get($reason)); + return Redirect::back()->with('status', Lang::get($response)); } }
false
Other
laravel
framework
4a7f96a02e44f464ca20198a81988e1c5a889544.json
Remove strtolower(), already done in snake_case()
src/Illuminate/Validation/Validator.php
@@ -1118,7 +1118,7 @@ protected function validateAfter($attribute, $value, $parameters) */ protected function getMessage($attribute, $rule) { - $lowerRule = strtolower(snake_case($rule)); + $lowerRule = snake_case($rule); $inlineMessage = $this->getInlineMessage($attribute, $lowerRule); @@ -1197,7 +1197,7 @@ protected function getInlineMessage($attribute, $lowerRule, $source = null) */ protected function getSizeMessage($attribute, $rule) { - $lowerRule = strtolower(snake_case($rule)); + $lowerRule = snake_case($rule); // There are three different types of size validations. The attribute may be // either a number, file, or string so we will check a few things to know
false
Other
laravel
framework
2f263dce2948559dafb9944eab146d0721e9d7a5.json
Use proper instance of Relation Bugfix from @anlutro's recent PR #2734
src/Illuminate/Database/Eloquent/Model.php
@@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Contracts\JsonableInterface; use Illuminate\Support\Contracts\ArrayableInterface; +use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\Relations\MorphOne; use Illuminate\Database\Eloquent\Relations\MorphMany; use Illuminate\Database\Eloquent\Relations\BelongsTo;
false
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Auth/Guard.php
@@ -465,6 +465,8 @@ protected function clearUserDataFromStorage() * Get the cookie creator instance used by the guard. * * @return \Illuminate\Cookie\CookieJar + * + * @throws \RuntimeException */ public function getCookieJar() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Auth/Reminders/PasswordBroker.php
@@ -252,6 +252,8 @@ protected function validatePasswordWithDefaults(array $credentials) * * @param array $credentials * @return \Illuminate\Auth\Reminders\RemindableInterface + * + * @throws \UnexpectedValueException */ public function getUser(array $credentials) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Cache/DatabaseStore.php
@@ -113,6 +113,8 @@ public function put($key, $value, $minutes) * @param string $key * @param mixed $value * @return void + * + * @throws \LogicException */ public function increment($key, $value = 1) { @@ -125,6 +127,8 @@ public function increment($key, $value = 1) * @param string $key * @param mixed $value * @return void + * + * @throws \LogicException */ public function decrement($key, $value = 1) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Cache/FileStore.php
@@ -110,6 +110,8 @@ protected function createCacheDirectory($path) * @param string $key * @param mixed $value * @return void + * + * @throws \LogicException */ public function increment($key, $value = 1) { @@ -122,6 +124,8 @@ public function increment($key, $value = 1) * @param string $key * @param mixed $value * @return void + * + * @throws \LogicException */ public function decrement($key, $value = 1) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Cache/MemcachedConnector.php
@@ -9,6 +9,8 @@ class MemcachedConnector { * * @param array $servers * @return \Memcached + * + * @throws \RuntimeException */ public function connect(array $servers) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Container/Container.php
@@ -229,6 +229,8 @@ public function bindShared($abstract, Closure $closure) * @param string $abstract * @param Closure $closure * @return void + * + * @throws \InvalidArgumentException */ public function extend($abstract, Closure $closure) { @@ -458,6 +460,8 @@ protected function getConcrete($abstract) * @param string $concrete * @param array $parameters * @return mixed + * + * @throws BindingResolutionException */ public function build($concrete, $parameters = array()) { @@ -536,6 +540,8 @@ protected function getDependencies($parameters) * * @param ReflectionParameter $parameter * @return mixed + * + * @throws BindingResolutionException */ protected function resolveNonClass(ReflectionParameter $parameter) { @@ -556,6 +562,8 @@ protected function resolveNonClass(ReflectionParameter $parameter) * * @param \ReflectionParameter $parameter * @return mixed + * + * @throws BindingResolutionException */ protected function resolveClass(ReflectionParameter $parameter) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Connection.php
@@ -404,6 +404,8 @@ public function prepareBindings(array $bindings) * * @param Closure $callback * @return mixed + * + * @throws \Exception */ public function transaction(Closure $callback) { @@ -507,6 +509,8 @@ public function pretend(Closure $callback) * @param array $bindings * @param Closure $callback * @return mixed + * + * @throws QueryException */ protected function run($query, $bindings, Closure $callback) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Connectors/ConnectionFactory.php
@@ -60,6 +60,8 @@ protected function parseConfig(array $config, $name) * * @param array $config * @return \Illuminate\Database\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException */ public function createConnector(array $config) { @@ -95,6 +97,8 @@ public function createConnector(array $config) * @param string $prefix * @param array $config * @return \Illuminate\Database\Connection + * + * @throws \InvalidArgumentException */ protected function createConnection($driver, PDO $connection, $database, $prefix = '', $config = null) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Connectors/SQLiteConnector.php
@@ -7,6 +7,8 @@ class SQLiteConnector extends Connector implements ConnectorInterface { * * @param array $config * @return PDO + * + * @throws \InvalidArgumentException */ public function connect(array $config) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/DatabaseManager.php
@@ -168,6 +168,8 @@ protected function prepare(Connection $connection) * * @param string $name * @return array + * + * @throws \InvalidArgumentException */ protected function getConfig($name) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Eloquent/Builder.php
@@ -88,6 +88,8 @@ public function findMany($id, $columns = array('*')) * @param mixed $id * @param array $columns * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws ModelNotFoundException */ public function findOrFail($id, $columns = array('*')) { @@ -112,6 +114,8 @@ public function first($columns = array('*')) * * @param array $columns * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws ModelNotFoundException */ public function firstOrFail($columns = array('*')) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Eloquent/Model.php
@@ -309,6 +309,8 @@ public static function observe($class) * * @param array $attributes * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws MassAssignmentException */ public function fill(array $attributes) { @@ -508,6 +510,8 @@ public static function find($id, $columns = array('*')) * @param mixed $id * @param array $columns * @return \Illuminate\Database\Eloquent\Model|Collection|static + * + * @throws ModelNotFoundException */ public static function findOrFail($id, $columns = array('*')) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Eloquent/Relations/BelongsTo.php
@@ -80,6 +80,8 @@ public function addConstraints() * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder + * + * @throws \LogicException */ public function getRelationCountQuery(Builder $query) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
@@ -91,6 +91,8 @@ public function first($columns = array('*')) * * @param array $columns * @return \Illuminate\Database\Eloquent\Model|static + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ public function firstOrFail($columns = array('*')) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/Query/Builder.php
@@ -311,6 +311,8 @@ public function leftJoinWhere($table, $one, $operator, $two) * @param mixed $value * @param string $boolean * @return \Illuminate\Database\Query\Builder|static + * + * @throws \InvalidArgumentException */ public function where($column, $operator = null, $value = null, $boolean = 'and') { @@ -1792,6 +1794,8 @@ public function getGrammar() * @param string $method * @param array $parameters * @return mixed + * + * @throws \BadMethodCallException */ public function __call($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Database/SqlServerConnection.php
@@ -13,6 +13,8 @@ class SqlServerConnection extends Connection { * * @param Closure $callback * @return mixed + * + * @throws \Exception */ public function transaction(Closure $callback) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Encryption/Encrypter.php
@@ -114,6 +114,8 @@ protected function mcryptDecrypt($value, $iv) * * @param string $payload * @return array + * + * @throws DecryptException */ protected function getJsonPayload($payload) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Exception/Handler.php
@@ -123,6 +123,8 @@ protected function registerShutdownHandler() * @param string $file * @param int $line * @param array $context + * + * @throws \ErrorException */ public function handleError($level, $message, $file, $line, $context) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Filesystem/Filesystem.php
@@ -23,6 +23,8 @@ public function exists($path) * * @param string $path * @return string + * + * @throws FileNotFoundException */ public function get($path) { @@ -47,6 +49,8 @@ public function getRemote($path) * * @param string $path * @return mixed + * + * @throws FileNotFoundException */ public function getRequire($path) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Foundation/Application.php
@@ -780,6 +780,9 @@ public function down(Closure $callback) * @param string $message * @param array $headers * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\HttpException + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function abort($code, $message = '', array $headers = array()) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Foundation/AssetPublisher.php
@@ -44,6 +44,8 @@ public function __construct(Filesystem $files, $publishPath) * @param string $name * @param string $source * @return bool + * + * @throws \RuntimeException */ public function publish($name, $source) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Foundation/ConfigPublisher.php
@@ -82,6 +82,8 @@ public function publishPackage($package, $packagePath = null) * @param string $name * @param string $packagePath * @return string + * + * @throws \InvalidArgumentException */ protected function getSource($package, $name, $packagePath) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Foundation/Console/ServeCommand.php
@@ -45,6 +45,8 @@ public function fire() * Check the current PHP version is >= 5.4. * * @return void + * + * @throws \Exception */ protected function checkPhpVersion() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Foundation/ViewPublisher.php
@@ -77,6 +77,8 @@ public function publishPackage($package, $packagePath = null) * @param string $name * @param string $packagePath * @return string + * + * @throws \InvalidArgumentException */ protected function getSource($package, $name, $packagePath) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Hashing/BcryptHasher.php
@@ -15,6 +15,8 @@ class BcryptHasher implements HasherInterface { * @param string $value * @param array $options * @return string + * + * @throws \RuntimeException */ public function make($value, array $options = array()) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Html/FormBuilder.php
@@ -979,6 +979,8 @@ public function setSessionStore(Session $session) * @param string $method * @param array $parameters * @return mixed + * + * @throws \BadMethodCallException */ public function __call($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Html/HtmlBuilder.php
@@ -395,6 +395,8 @@ public function obfuscate($value) * @param string $method * @param array $parameters * @return mixed + * + * @throws \BadMethodCallException */ public function __call($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Http/RedirectResponse.php
@@ -175,6 +175,8 @@ public function setSession(SessionStore $session) * @param string $method * @param array $parameters * @return void + * + * @throws \BadMethodCallException */ public function __call($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Http/Request.php
@@ -499,6 +499,8 @@ public static function createFromBase(SymfonyRequest $request) * Get the Illuminate session store implementation. * * @return \Illuminate\Session\Store + * + * @throws \RuntimeException */ public function getSessionStore() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Log/Writer.php
@@ -106,6 +106,8 @@ public function useDailyFiles($path, $days = 0, $level = 'debug') * * @param string $level * @return int + * + * @throws \InvalidArgumentException */ protected function parseLevel($level) { @@ -146,6 +148,8 @@ protected function parseLevel($level) * * @param Closure $callback * @return void + * + * @throws \RuntimeException */ public function listen(Closure $callback) { @@ -212,6 +216,8 @@ protected function fireLogEvent($level, $message, array $context = array()) * @param string $method * @param array $parameters * @return mixed + * + * @throws \BadMethodCallException */ public function __call($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Mail/MailServiceProvider.php
@@ -81,6 +81,8 @@ protected function registerSwiftMailer() * * @param array $config * @return void + * + * @throws \InvalidArgumentException */ protected function registerSwiftTransport($config) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Mail/Mailer.php
@@ -252,6 +252,8 @@ protected function addContent($message, $view, $plain, $data) * * @param string|array $view * @return array + * + * @throws \InvalidArgumentException */ protected function parseView($view) { @@ -315,6 +317,8 @@ protected function logMessage($message) * @param Closure|string $callback * @param \Illuminate\Mail\Message $message * @return mixed + * + * @throws \InvalidArgumentException */ protected function callMessageBuilder($callback, $message) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Queue/Console/SubscribeCommand.php
@@ -33,6 +33,8 @@ class SubscribeCommand extends Command { * Execute the console command. * * @return void + * + * @throws \RuntimeException */ public function fire() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Queue/Queue.php
@@ -18,6 +18,8 @@ abstract class Queue { * Marshal a push queue request and fire the job. * * @return Illuminate\Http\Response + * + * @throws \RuntimeException */ public function marshal() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Queue/QueueManager.php
@@ -81,6 +81,8 @@ protected function resolve($name) * * @param string $driver * @return \Illuminate\Queue\Connectors\ConnectorInterface + * + * @throws \InvalidArgumentException */ protected function getConnector($driver) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Queue/Worker.php
@@ -74,6 +74,8 @@ protected function getNextJob($connection, $queue) * @param \Illuminate\Queue\Jobs\Job $job * @param int $delay * @return void + * + * @throws \Exception */ public function process(Job $job, $delay) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Remote/RemoteManager.php
@@ -135,6 +135,8 @@ protected function setOutput(Connection $connection) * * @param array $config * @return array + * + * @throws \InvalidArgumentException */ protected function getAuth(array $config) { @@ -155,6 +157,8 @@ protected function getAuth(array $config) * * @param string $name * @return array + * + * @throws \InvalidArgumentException */ protected function getConfig($name) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Remote/SecLibGateway.php
@@ -146,6 +146,7 @@ public function nextLine() * Get the authentication object for login. * * @return \Crypt_RSA|string + * @throws \InvalidArgumentException */ protected function getAuthForLogin() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Routing/Controller.php
@@ -115,6 +115,8 @@ protected function registerInstanceFilter($filter) * * @param mixed $filter * @return boolean + * + * @throws \InvalidArgumentException */ protected function isInstanceFilter($filter) { @@ -206,6 +208,8 @@ public function callAction($method, $parameters) * @param string $method * @param array $parameters * @return mixed + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function missingMethod($method, $parameters = array()) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Routing/Route.php
@@ -259,6 +259,8 @@ public function setParameter($name, $value) * Get the key / value list of parameters for the route. * * @return array + * + * @throws \LogicException */ public function parameters() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Routing/RouteCollection.php
@@ -100,6 +100,8 @@ protected function addLookups($route) * * @param \Illuminate\Http\Request $request * @return \Illuminate\Routing\Route + * + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function match(Request $request) { @@ -150,6 +152,8 @@ protected function checkForAlternateVerbs($request) * * @param string $other * @return void + * + * @throws \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException */ protected function methodNotAllowed($other) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Routing/Router.php
@@ -1104,6 +1104,8 @@ public function when($pattern, $name, $methods = null) * @param string $class * @param \Closure $callback * @return void + * + * @throws NotFoundHttpException */ public function model($key, $class, Closure $callback = null) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Routing/UrlGenerator.php
@@ -170,6 +170,8 @@ protected function getScheme($secure) * @param mixed $parameters * @param \Illuminate\Routing\Route $route * @return string + * + * @throws \InvalidArgumentException */ public function route($name, $parameters = array(), $route = null) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Support/Facades/Facade.php
@@ -120,6 +120,8 @@ public static function getFacadeRoot() * Get the registered name of the component. * * @return string + * + * @throws \RuntimeException */ protected static function getFacadeAccessor() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Support/Facades/Response.php
@@ -114,6 +114,8 @@ public static function macro($name, $callback) * @param string $method * @param array $parameters * @return mixed + * + * @throws \BadMethodCallException */ public static function __callStatic($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Support/Manager.php
@@ -62,6 +62,8 @@ public function driver($driver = null) * * @param string $driver * @return mixed + * + * @throws \InvalidArgumentException */ protected function createDriver($driver) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Support/Str.php
@@ -185,6 +185,8 @@ public static function plural($value, $count = 2) * * @param int $length * @return string + * + * @throws \RuntimeException */ public static function random($length = 16) { @@ -338,6 +340,8 @@ public static function macro($name, $macro) * @param string $method * @param array $parameters * @return mixed + * + * @throws \BadMethodCallException */ public static function __callStatic($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Support/helpers.php
@@ -464,6 +464,8 @@ function class_basename($class) * Get the CSRF token value. * * @return string + * + * @throws RuntimeException */ function csrf_token() {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Validation/Validator.php
@@ -1786,6 +1786,8 @@ public function setFiles(array $files) * Get the Presence Verifier implementation. * * @return \Illuminate\Validation\PresenceVerifierInterface + * + * @throws \RuntimeException */ public function getPresenceVerifier() { @@ -1967,6 +1969,8 @@ protected function callClassBasedExtension($callback, $parameters) * @param string $method * @param array $parameters * @return mixed + * + * @throws \BadMethodCallException */ public function __call($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/View/Engines/PhpEngine.php
@@ -49,6 +49,8 @@ protected function evaluatePath($__path, $__data) * * @param Exception $e * @return void + * + * @throws $e */ protected function handleViewException($e) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/View/FileViewFinder.php
@@ -94,6 +94,8 @@ protected function findNamedPathView($name) * * @param string $name * @return array + * + * @throws \InvalidArgumentException */ protected function getNamespaceSegments($name) { @@ -118,6 +120,8 @@ protected function getNamespaceSegments($name) * @param string $name * @param array $paths * @return string + * + * @throws \InvalidArgumentException */ protected function findInPaths($name, $paths) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/View/View.php
@@ -332,6 +332,8 @@ public function __unset($key) * @param string $method * @param array $parameters * @return \Illuminate\View\View + * + * @throws \BadMethodCallException */ public function __call($method, $parameters) {
true
Other
laravel
framework
70548faf9ee28dcc5d73ae29bf75d98b3b6650f6.json
Add @throws fo dock block function signature
src/Illuminate/Workbench/PackageCreator.php
@@ -349,7 +349,9 @@ protected function formatPackageStub(Package $package, $stub) * * @param \Illuminate\Workbench\Package $package * @param string $path - * @return string + * @return + * + * @throws \InvalidArgumentException */ protected function createDirectory(Package $package, $path) {
true
Other
laravel
framework
3413503c0a616d4b9e1c1cf550b6b576174d1b9c.json
Fix bug with routing and dashes.
src/Illuminate/Routing/Route.php
@@ -756,6 +756,16 @@ public function domain() return array_get($this->action, 'domain'); } + /** + * Get the URI that the route responds to. + * + * @return string + */ + public function getUri() + { + return $this->uri; + } + /** * Get the name of the route instance. *
true
Other
laravel
framework
3413503c0a616d4b9e1c1cf550b6b576174d1b9c.json
Fix bug with routing and dashes.
src/Illuminate/Routing/Router.php
@@ -329,7 +329,7 @@ public function resource($name, $controller, array $options = array()) // We need to extract the base resource from the resource name. Nested resources // are supported in the framework, but we need to know what name to use for a // place-holder on the route wildcards, which should be the base resources. - $base = last(explode('.', $name)); + $base = $this->getResourceWildcard(last(explode('.', $name))); $defaults = $this->resourceDefaults; @@ -418,7 +418,7 @@ public function getResourceUri($resource) $uri = $this->getNestedResourceUri($segments); - return str_replace('/{'.last($segments).'}', '', $uri); + return str_replace('/{'.$this->getResourceWildcard(last($segments)).'}', '', $uri); } /** @@ -429,12 +429,14 @@ public function getResourceUri($resource) */ protected function getNestedResourceUri(array $segments) { + $me = $this; + // We will spin through the segments and create a place-holder for each of the // resource segments, as well as the resource itself. Then we should get an // entire string for the resource URI that contains all nested resources. - return implode('/', array_map(function($s) + return implode('/', array_map(function($s) use ($me) { - return $s.'/{'.$s.'}'; + return $s.'/{'.$me->getResourceWildcard($s).'}'; }, $segments)); } @@ -486,6 +488,17 @@ protected function getGroupResourceName($resource, $method) return trim("{$prefix}.{$resource}.{$method}", '.'); } + /** + * Format a resource wildcard for usage. + * + * @param string $value + * @return string + */ + public function getResourceWildcard($value) + { + return str_replace('-', '_', $value); + } + /** * Add the index method for a resourceful route. * @@ -1127,7 +1140,7 @@ public function model($key, $class, Closure $callback = null) */ public function bind($key, $binder) { - $this->binders[$key] = $binder; + $this->binders[str_replace('-', '_', $key)] = $binder; } /**
true
Other
laravel
framework
3413503c0a616d4b9e1c1cf550b6b576174d1b9c.json
Fix bug with routing and dashes.
tests/Routing/RoutingRouteTest.php
@@ -502,6 +502,20 @@ public function testResourceRouting() $routes = $router->getRoutes(); $this->assertEquals(6, count($routes)); + + $router = $this->getRouter(); + $router->resource('foo-bars', 'FooController', array('only' => array('show'))); + $routes = $router->getRoutes(); + $routes = $routes->getRoutes(); + + $this->assertEquals('foo-bars/{foo_bars}', $routes[0]->getUri()); + + $router = $this->getRouter(); + $router->resource('foo-bars.foo-bazs', 'FooController', array('only' => array('show'))); + $routes = $router->getRoutes(); + $routes = $routes->getRoutes(); + + $this->assertEquals('foo-bars/{foo_bars}/foo-bazs/{foo_bazs}', $routes[0]->getUri()); }
true
Other
laravel
framework
52ade3b85c5f6425f1a3b4911fc892f5caf1c05c.json
Fix missing argument on missingMethod
src/Illuminate/Routing/Controller.php
@@ -207,7 +207,7 @@ public function callAction($method, $parameters) * @param array $parameters * @return mixed */ - public function missingMethod($method, $parameters) + public function missingMethod($method, $parameters = array()) { throw new NotFoundHttpException("Controller method [{$method}] not found."); }
false
Other
laravel
framework
6e0e2cf09a910f37eb5f84bbafdbdf0063637934.json
Add table_shema to select query Adjust getColumnListing method on the MySqlBuilder class
src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
@@ -43,9 +43,9 @@ public function compileTableExists() * @param string $table * @return string */ - public function compileColumnExists($table) + public function compileColumnExists() { - return "select column_name from information_schema.columns where table_name = '$table'"; + return "select column_name from information_schema.columns where table_schema = ? and table_name = ?"; } /**
true
Other
laravel
framework
6e0e2cf09a910f37eb5f84bbafdbdf0063637934.json
Add table_shema to select query Adjust getColumnListing method on the MySqlBuilder class
src/Illuminate/Database/Schema/MySqlBuilder.php
@@ -19,4 +19,22 @@ public function hasTable($table) return count($this->connection->select($sql, array($database, $table))) > 0; } -} \ No newline at end of file + /** + * Get the column listing for a given table. + * + * @param string $table + * @return array + */ + protected function getColumnListing($table) + { + $sql = $this->grammar->compileColumnExists(); + + $database = $this->connection->getDatabaseName(); + + $table = $this->connection->getTablePrefix().$table; + + $results = $this->connection->select($sql, array($database, $table)); + + return $this->connection->getPostProcessor()->processColumnListing($results); + } +}
true
Other
laravel
framework
443a9c6dbae9d2b2412a53a253b56c6cbb17d095.json
Fix bug with filter method on class filters.
src/Illuminate/Routing/Router.php
@@ -1037,7 +1037,7 @@ public function after($callback) */ protected function addGlobalFilter($filter, $callback) { - $this->events->listen('router.'.$filter, $callback); + $this->events->listen('router.'.$filter, $this->parseFilter($callback)); } /** @@ -1049,7 +1049,25 @@ protected function addGlobalFilter($filter, $callback) */ public function filter($name, $callback) { - $this->events->listen('router.filter: '.$name, $callback); + $this->events->listen('router.filter: '.$name, $this->parseFilter($callback)); + } + + /** + * Parse the registered filter. + * + * @param \Closure|string $callback + * @return mixed + */ + protected function parseFilter($callback) + { + if (is_string($callback) and ! str_contains($callback, '@')) + { + return $callback.'@filter'; + } + else + { + return $callback; + } } /**
true
Other
laravel
framework
443a9c6dbae9d2b2412a53a253b56c6cbb17d095.json
Fix bug with filter method on class filters.
tests/Routing/RoutingRouteTest.php
@@ -124,6 +124,16 @@ public function testBasicBeforeFilters() $router->before(function() { return 'foo!'; }); $this->assertEquals('foo!', $router->dispatch(Request::create('foo/bar', 'GET'))->getContent()); + $router = $this->getRouter(); + $router->get('foo/bar', function() { return 'hello'; }); + $router->before('RouteTestFilterStub'); + $this->assertEquals('foo!', $router->dispatch(Request::create('foo/bar', 'GET'))->getContent()); + + $router = $this->getRouter(); + $router->get('foo/bar', function() { return 'hello'; }); + $router->before('RouteTestFilterStub@handle'); + $this->assertEquals('handling!', $router->dispatch(Request::create('foo/bar', 'GET'))->getContent()); + $router = $this->getRouter(); $router->get('foo/bar', array('before' => 'foo', function() { return 'hello'; })); $router->filter('foo', function() { return 'foo!'; }); @@ -570,3 +580,14 @@ public function find($value) { return strtoupper($value); } class RouteModelBindingNullStub { public function find($value) {} } + +class RouteTestFilterStub { + public function filter() + { + return 'foo!'; + } + public function handle() + { + return 'handling!'; + } +}
true
Other
laravel
framework
26124a71f63814d74877a615b95f02a81111fe17.json
Use requestClass class.
src/Illuminate/Foundation/Application.php
@@ -106,13 +106,23 @@ class Application extends Container implements HttpKernelInterface, TerminableIn */ public function __construct(Request $request = null) { - $this->registerBaseBindings($request ?: Request::createFromGlobals()); + $this->registerBaseBindings($request ?: $this->createNewRequest()); $this->registerBaseServiceProviders(); $this->registerBaseMiddlewares(); } + /** + * Create a new request instance from the request class. + * + * @return \Illuminate\Http\Request + */ + protected function createNewRequest() + { + return forward_static_call(array(static::$requestClass, 'createFromGlobals')); + } + /** * Register the basic bindings into the container. *
false
Other
laravel
framework
a879001ce96fae833695854b7f77a4f15b73a988.json
Fix HTML dump from Artisan console.
src/Illuminate/Exception/ExceptionServiceProvider.php
@@ -56,9 +56,19 @@ protected function registerPlainDisplayer() { $this->app['exception.plain'] = $this->app->share(function($app) { - $handler = new KernelHandler($app['config']['app.debug']); + // If the application is running in a console environment, we will just always + // use the debug handler as there is no point in the console ever returning + // out HTML. This debug handler always returns JSON from the console env. + if ($app->runningInConsole()) + { + return $app['exception.debug']; + } + else + { + $handler = new KernelHandler($app['config']['app.debug']); - return new SymfonyDisplayer($handler); + return new SymfonyDisplayer($handler); + } }); }
false
Other
laravel
framework
5049b298140846001963ab621e078b134b159d3a.json
Add a comment about the route.
src/Illuminate/Auth/Console/RemindersControllerCommand.php
@@ -53,6 +53,8 @@ public function fire() $this->files->copy(__DIR__.'/stubs/controller.stub', $destination); $this->info('Password reminders controller created successfully!'); + + $this->comment("Route: Route::controller('password', 'RemindersController')"); } else {
false
Other
laravel
framework
fac04bc9f7158bafc7432a27452ef2e5751cb23c.json
Allow all future minor releases of Monolog.
composer.json
@@ -16,7 +16,7 @@ "ircmaxell/password-compat": "1.0.*", "filp/whoops": "1.0.7", "jeremeamia/superclosure": "1.0.*", - "monolog/monolog": "1.6.*", + "monolog/monolog": "1.*", "nesbot/carbon": "1.*", "patchwork/utf8": "1.1.*", "predis/predis": "0.8.*",
false
Other
laravel
framework
811f52cbfe22f0da99ed6340486468518f2e1159.json
Add failing test for handling HEAD request. Signed-off-by: crynobone <crynobone@gmail.com>
tests/Routing/RoutingRouteTest.php
@@ -49,6 +49,14 @@ public function testBasicDispatchingOfRoutes() $this->assertEquals('fred25', $router->dispatch(Request::create('fred', 'GET'))->getContent()); $this->assertEquals('fred30', $router->dispatch(Request::create('fred/30', 'GET'))->getContent()); $this->assertTrue($router->currentRouteNamed('foo')); + + $router = $this->getRouter(); + $router->get('foo/bar', function() { return 'hello'; }); + $this->assertEquals('', $router->dispatch(Request::create('foo/bar', 'HEAD'))->getContent()); + + $router = $this->getRouter(); + $router->any('foo/bar', function() { return 'hello'; }); + $this->assertEquals('', $router->dispatch(Request::create('foo/bar', 'HEAD'))->getContent()); } @@ -561,4 +569,4 @@ public function find($value) { return strtoupper($value); } class RouteModelBindingNullStub { public function find($value) {} -} \ No newline at end of file +}
false
Other
laravel
framework
3a5f0f1910b2dd76853917277a4531f30d137ed4.json
Fix bug with setting save keys.
src/Illuminate/Database/Eloquent/Model.php
@@ -100,7 +100,7 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa /** * The accessors to append to the model's array form. - * + * * @var array */ protected $appends = array(); @@ -1314,11 +1314,28 @@ protected function fireModelEvent($event, $halt = true) */ protected function setKeysForSaveQuery(Builder $query) { - $query->where($this->getKeyName(), '=', $this->original[$this->getKeyName()]); + $query->where($this->getKeyName(), '=', $this->getKeyForSaveQuery()); return $query; } + /** + * Get the primary key value for a save query. + * + * @return mixed + */ + protected function getKeyForSaveQuery() + { + if (isset($this->original[$this->getKeyName()])) + { + return $this->original[$this->getKeyName()]; + } + else + { + return $this->getAttribute($this->getKeyName()); + } + } + /** * Update the model's update timestamp. * @@ -2014,7 +2031,7 @@ protected function getArrayableItems(array $values) return array_intersect_key($values, array_flip($this->visible)); } - return array_diff_key($values, array_flip($this->hidden)); + return array_diff_key($values, array_flip($this->hidden)); } /** @@ -2365,7 +2382,7 @@ public function getDirty() /** * Get all the loaded relations for the instance. - * + * * @return array */ public function getRelations()
false
Other
laravel
framework
134147f89dedf5e80e3c27aa127983e1d0a58216.json
use PHP_BINARY to serve development server
src/Illuminate/Foundation/Console/ServeCommand.php
@@ -38,7 +38,7 @@ public function fire() $this->info("Laravel development server started on http://{$host}:{$port}"); - passthru("php -S {$host}:{$port} -t \"{$public}\" server.php"); + passthru(PHP_BINARY." -S {$host}:{$port} -t \"{$public}\" server.php"); } /**
false
Other
laravel
framework
601e395a130df9f673de1d62d58a255e75fdfffa.json
Change visibility of some BelongsToMany methods
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
@@ -578,7 +578,7 @@ protected function attachNew(array $records, array $current, $touch = true) * @param bool $touch * @return void */ - protected function updateExistingPivot($id, array $attributes, $touch) + public function updateExistingPivot($id, array $attributes, $touch) { if (in_array($this->updatedAt(), $this->pivotColumns)) { @@ -808,7 +808,7 @@ public function newPivotStatement() * @param mixed $id * @return \Illuminate\Database\Query\Builder */ - protected function newPivotStatementForId($id) + public function newPivotStatementForId($id) { $pivot = $this->newPivotStatement(); @@ -927,4 +927,4 @@ public function getTable() return $this->table; } -} \ No newline at end of file +}
false
Other
laravel
framework
649996aaba2aa7719de5b9eac90d0c5c11ece0b8.json
Fix expectations for mock objects.
tests/Database/DatabaseEloquentModelTest.php
@@ -100,7 +100,7 @@ public function testUpdateProcess() $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps')); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1); - $query->shouldReceive('update')->once()->with(array('id' => 1, 'name' => 'taylor')); + $query->shouldReceive('update')->once()->with(array('name' => 'taylor')); $model->expects($this->once())->method('newQuery')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->setEventDispatcher($events = m::mock('Illuminate\Events\Dispatcher')); @@ -124,7 +124,7 @@ public function testUpdateProcessDoesntOverrideTimestamps() $model = $this->getMock('EloquentModelStub', array('newQuery')); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1); - $query->shouldReceive('update')->once()->with(array('id' => 1, 'created_at' => 'foo', 'updated_at' => 'bar')); + $query->shouldReceive('update')->once()->with(array('created_at' => 'foo', 'updated_at' => 'bar')); $model->expects($this->once())->method('newQuery')->will($this->returnValue($query)); $model->setEventDispatcher($events = m::mock('Illuminate\Events\Dispatcher')); $events->shouldReceive('until'); @@ -173,7 +173,7 @@ public function testUpdateProcessWithoutTimestamps() $model->timestamps = false; $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1); - $query->shouldReceive('update')->once()->with(array('id' => 1, 'name' => 'taylor')); + $query->shouldReceive('update')->once()->with(array('name' => 'taylor')); $model->expects($this->once())->method('newQuery')->will($this->returnValue($query)); $model->expects($this->never())->method('updateTimestamps'); $model->expects($this->any())->method('fireModelEvent')->will($this->returnValue(true));
false
Other
laravel
framework
07a12cbeb86d25d66e19f259424d8ae47c6f1bcb.json
Add additional unit test for #2414.
tests/Database/DatabaseEloquentModelTest.php
@@ -186,6 +186,30 @@ public function testUpdateProcessWithoutTimestamps() } + public function testUpdateUsesOldPrimaryKey() + { + $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps')); + $query = m::mock('Illuminate\Database\Eloquent\Builder'); + $query->shouldReceive('where')->once()->with('id', '=', 1); + $query->shouldReceive('update')->once()->with(array('id' => 2, 'foo' => 'bar')); + $model->expects($this->once())->method('newQuery')->will($this->returnValue($query)); + $model->expects($this->once())->method('updateTimestamps'); + $model->setEventDispatcher($events = m::mock('Illuminate\Events\Dispatcher')); + $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true); + $events->shouldReceive('until')->once()->with('eloquent.updating: '.get_class($model), $model)->andReturn(true); + $events->shouldReceive('fire')->once()->with('eloquent.updated: '.get_class($model), $model)->andReturn(true); + $events->shouldReceive('fire')->once()->with('eloquent.saved: '.get_class($model), $model)->andReturn(true); + + $model->id = 1; + $model->syncOriginal(); + $model->id = 2; + $model->foo = 'bar'; + $model->exists = true; + + $this->assertTrue($model->save()); + } + + public function testTimestampsAreReturnedAsObjects() { $model = $this->getMock('EloquentDateModelStub', array('getDateFormat'));
false
Other
laravel
framework
30663f23b38b03e49c52eb63b8d6913d4b7e325e.json
Fix failing tests.
tests/Database/DatabaseEloquentModelTest.php
@@ -109,10 +109,10 @@ public function testUpdateProcess() $events->shouldReceive('fire')->once()->with('eloquent.updated: '.get_class($model), $model)->andReturn(true); $events->shouldReceive('fire')->once()->with('eloquent.saved: '.get_class($model), $model)->andReturn(true); + $model->id = 1; $model->foo = 'bar'; // make sure foo isn't synced so we can test that dirty attributes only are updated $model->syncOriginal(); - $model->id = 1; $model->name = 'taylor'; $model->exists = true; $this->assertTrue($model->save()); @@ -130,8 +130,8 @@ public function testUpdateProcessDoesntOverrideTimestamps() $events->shouldReceive('until'); $events->shouldReceive('fire'); - $model->syncOriginal(); $model->id = 1; + $model->syncOriginal(); $model->created_at = 'foo'; $model->updated_at = 'bar'; $model->exists = true; @@ -179,6 +179,7 @@ public function testUpdateProcessWithoutTimestamps() $model->expects($this->any())->method('fireModelEvent')->will($this->returnValue(true)); $model->id = 1; + $model->syncOriginal(); $model->name = 'taylor'; $model->exists = true; $this->assertTrue($model->save());
false
Other
laravel
framework
8c4e988d5f36e693406dd331dc65156343413723.json
Use original key value when updating models. This is necessary in case the primary key was changed. Fixes #2414.
src/Illuminate/Database/Eloquent/Model.php
@@ -1314,7 +1314,7 @@ protected function fireModelEvent($event, $halt = true) */ protected function setKeysForSaveQuery(Builder $query) { - $query->where($this->getKeyName(), '=', $this->getKey()); + $query->where($this->getKeyName(), '=', $this->original[$this->getKeyName()]); return $query; }
false
Other
laravel
framework
66f5cd298caf3a6dfd186cff5d20b65b18482572.json
Remove superfluous tag() method
src/Illuminate/Cache/TaggableStore.php
@@ -13,17 +13,6 @@ public function section($name) return $this->tag($name); } - /** - * Begin executing a new tags operation. - * - * @param string $name - * @return \Illuminate\Cache\TaggedCache - */ - public function tag($name) - { - return $this->tags(array($name)); - } - /** * Begin executing a new tags operation. *
true
Other
laravel
framework
66f5cd298caf3a6dfd186cff5d20b65b18482572.json
Remove superfluous tag() method
tests/Cache/CacheTaggedCacheTest.php
@@ -38,7 +38,7 @@ public function testCacheSavedWithMultipleTagsCanBeFlushed() $store->tags($tags1)->put('foo', 'bar', 10); $tags2 = array('bam', 'pow'); $store->tags($tags2)->put('foo', 'bar', 10); - $store->tag('zap')->flush(); + $store->tags('zap')->flush(); $this->assertNull($store->tags($tags1)->get('foo')); $this->assertEquals('bar', $store->tags($tags2)->get('foo')); }
true