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
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Pagination/BootstrapThreeNextPreviousButtonRendererTrait.php
@@ -37,7 +37,7 @@ public function getNextButton($text = '»') // If the current page is greater than or equal to the last page, it means we // can't go any further into the pages, as we're already on this last page // that is available, so we will make it the "next" link style disabled. - if (!$this->paginator->hasMorePages()) { + if (! $this->paginator->hasMorePages()) { return $this->getDisabledTextWrapper($text); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Pagination/UrlWindow.php
@@ -75,7 +75,7 @@ protected function getUrlSlider($onEachSide) { $window = $onEachSide * 2; - if (!$this->hasPages()) { + if (! $this->hasPages()) { return [ 'first' => null, 'slider' => null,
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/CallQueuedHandler.php
@@ -42,7 +42,7 @@ public function call(Job $job, array $data) $this->setJobInstanceIfNecessary($job, $handler); }); - if (!$job->isDeletedOrReleased()) { + if (! $job->isDeletedOrReleased()) { $job->delete(); } }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/Console/RetryCommand.php
@@ -30,7 +30,7 @@ public function fire() { $failed = $this->laravel['queue.failer']->find($this->argument('id')); - if (!is_null($failed)) { + if (! is_null($failed)) { $failed = (object) $failed; $failed->payload = $this->resetAttempts($failed->payload);
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/Console/WorkCommand.php
@@ -51,7 +51,7 @@ public function __construct(Worker $worker) */ public function fire() { - if ($this->downForMaintenance() && !$this->option('daemon')) { + if ($this->downForMaintenance() && ! $this->option('daemon')) { return $this->worker->sleep($this->option('sleep')); } @@ -73,7 +73,7 @@ public function fire() // If a job was fired by the worker, we'll write the output out to the console // so that the developer can watch live while the queue runs in the console // window, which will also of get logged if stdout is logged out to disk. - if (!is_null($response['job'])) { + if (! is_null($response['job'])) { $this->writeOutput($response['job'], $response['failed']); } }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/DatabaseQueue.php
@@ -160,7 +160,7 @@ public function pop($queue = null) { $queue = $this->getQueue($queue); - if (!is_null($this->expire)) { + if (! is_null($this->expire)) { $this->releaseJobsThatHaveBeenReservedTooLong($queue); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/IronQueue.php
@@ -123,7 +123,7 @@ public function pop($queue = null) // If we were able to pop a message off of the queue, we will need to decrypt // the message body, as all Iron.io messages are encrypted, since the push // queues will be a security hazard to unsuspecting developers using it. - if (!is_null($job)) { + if (! is_null($job)) { $job->body = $this->parseJobBody($job->body); return new IronJob($this->container, $this, $job);
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/Jobs/IronJob.php
@@ -96,7 +96,7 @@ public function release($delay = 0) { parent::release($delay); - if (!$this->pushed) { + if (! $this->pushed) { $this->delete(); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/QueueManager.php
@@ -98,7 +98,7 @@ public function connection($name = null) // If the connection has not been resolved yet we will resolve it now as all // of the connections are resolved when they are actually needed so we do // not make any unnecessary connection to the various queue end-points. - if (!isset($this->connections[$name])) { + if (! isset($this->connections[$name])) { $this->connections[$name] = $this->resolve($name); $this->connections[$name]->setContainer($this->app);
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/RedisQueue.php
@@ -129,13 +129,13 @@ public function pop($queue = null) $queue = $this->getQueue($queue); - if (!is_null($this->expire)) { + if (! is_null($this->expire)) { $this->migrateAllExpiredJobs($queue); } $job = $this->getConnection()->lpop($queue); - if (!is_null($job)) { + if (! is_null($job)) { $this->getConnection()->zadd($queue.':reserved', $this->getTime() + $this->expire, $job); return new RedisJob($this->container, $this, $job, $original);
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Queue/Worker.php
@@ -153,7 +153,7 @@ public function pop($connectionName, $queue = null, $delay = 0, $sleep = 3, $max // If we're able to pull a job off of the stack, we will process it and // then immediately return back out. If there is no job on the queue // we will "sleep" the worker for the specified number of seconds. - if (!is_null($job)) { + if (! is_null($job)) { return $this->process( $this->manager->getName($connectionName), $job, $maxTries, $delay ); @@ -178,7 +178,7 @@ protected function getNextJob($connection, $queue) } foreach (explode(',', $queue) as $queue) { - if (!is_null($job = $connection->pop($queue))) { + if (! is_null($job = $connection->pop($queue))) { return $job; } } @@ -212,13 +212,13 @@ public function process($connection, Job $job, $maxTries = 0, $delay = 0) // If we catch an exception, we will attempt to release the job back onto // the queue so it is not lost. This will let is be retried at a later // time by another listener (or the same one). We will do that here. - if (!$job->isDeleted()) { + if (! $job->isDeleted()) { $job->release($delay); } throw $e; } catch (Throwable $e) { - if (!$job->isDeleted()) { + if (! $job->isDeleted()) { $job->release($delay); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/ControllerDispatcher.php
@@ -109,7 +109,7 @@ protected function getMiddleware($instance, $method) $results = []; foreach ($instance->getMiddleware() as $name => $options) { - if (!$this->methodExcludedByOptions($method, $options)) { + if (! $this->methodExcludedByOptions($method, $options)) { $results[] = $this->router->resolveMiddlewareClassName($name); } } @@ -126,8 +126,8 @@ protected function getMiddleware($instance, $method) */ public function methodExcludedByOptions($method, array $options) { - return (!empty($options['only']) && !in_array($method, (array) $options['only'])) || - (!empty($options['except']) && in_array($method, (array) $options['except'])); + return (! empty($options['only']) && ! in_array($method, (array) $options['only'])) || + (! empty($options['except']) && in_array($method, (array) $options['except'])); } /**
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/Matching/SchemeValidator.php
@@ -17,7 +17,7 @@ class SchemeValidator implements ValidatorInterface public function matches(Route $route, Request $request) { if ($route->httpOnly()) { - return !$request->secure(); + return ! $request->secure(); } elseif ($route->secure()) { return $request->secure(); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/ResourceRegistrar.php
@@ -128,7 +128,7 @@ protected function getResourceMethods($defaults, $options) */ public function getResourceUri($resource) { - if (!Str::contains($resource, '.')) { + if (! Str::contains($resource, '.')) { return $resource; } @@ -194,7 +194,7 @@ protected function getResourceName($resource, $method, $options) // the resource action. Otherwise we'll just use an empty string for here. $prefix = isset($options['as']) ? $options['as'].'.' : ''; - if (!$this->router->hasGroupStack()) { + if (! $this->router->hasGroupStack()) { return $prefix.$resource.'.'.$method; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/ResponseFactory.php
@@ -82,7 +82,7 @@ public function view($view, $data = [], $status = 200, array $headers = []) */ public function json($data = [], $status = 200, array $headers = [], $options = 0) { - if ($data instanceof Arrayable && !$data instanceof JsonSerializable) { + if ($data instanceof Arrayable && ! $data instanceof JsonSerializable) { $data = $data->toArray(); } @@ -130,7 +130,7 @@ public function download($file, $name = null, array $headers = [], $disposition { $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); - if (!is_null($name)) { + if (! is_null($name)) { return $response->setContentDisposition($disposition, $name, str_replace('%', '', Str::ascii($name))); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/Route.php
@@ -106,7 +106,7 @@ public function __construct($methods, $uri, $action) $this->methods = (array) $methods; $this->action = $this->parseAction($action); - if (in_array('GET', $this->methods) && !in_array('HEAD', $this->methods)) { + if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods)) { $this->methods[] = 'HEAD'; } @@ -126,7 +126,7 @@ public function run(Request $request) $this->container = $this->container ?: new Container; try { - if (!is_string($this->action['uses'])) { + if (! is_string($this->action['uses'])) { return $this->runCallable($request); } @@ -169,7 +169,7 @@ protected function runController(Request $request) $this->parametersWithoutNulls(), $class, $method ); - if (!method_exists($instance = $this->container->make($class), $method)) { + if (! method_exists($instance = $this->container->make($class), $method)) { throw new NotFoundHttpException; } @@ -213,11 +213,11 @@ public function matches(Request $request, $includingMethod = true) $this->compileRoute(); foreach ($this->getValidators() as $validator) { - if (!$includingMethod && $validator instanceof MethodValidator) { + if (! $includingMethod && $validator instanceof MethodValidator) { continue; } - if (!$validator->matches($this, $request)) { + if (! $validator->matches($this, $request)) { return false; } } @@ -353,7 +353,7 @@ public function parameters() */ public function parametersWithoutNulls() { - return array_filter($this->parameters(), function ($p) { return !is_null($p); }); + return array_filter($this->parameters(), function ($p) { return ! is_null($p); }); } /** @@ -417,7 +417,7 @@ public function bindParameters(Request $request) // If the route has a regular expression for the host part of the URI, we will // compile that and get the parameter matches for this domain. We will then // merge them into this parameters array so that this array is completed. - if (!is_null($this->compiled->getHostRegex())) { + if (! is_null($this->compiled->getHostRegex())) { $params = $this->bindHostParameters( $request, $params ); @@ -507,7 +507,7 @@ protected function parseAction($action) // If no "uses" property has been set, we will dig through the array to find a // Closure instance within this list. We will set the first Closure we come // across into the "uses" property that will get fired off by this route. - elseif (!isset($action['uses'])) { + elseif (! isset($action['uses'])) { $action['uses'] = $this->findCallable($action); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/RouteCollection.php
@@ -127,7 +127,7 @@ public function match(Request $request) // by the consumer. Otherwise we will check for routes with another verb. $route = $this->check($routes, $request); - if (!is_null($route)) { + if (! is_null($route)) { return $route->bind($request); } @@ -159,7 +159,7 @@ protected function checkForAlternateVerbs($request) $others = []; foreach ($methods as $method) { - if (!is_null($this->check($this->get($method), $request, false))) { + if (! is_null($this->check($this->get($method), $request, false))) { $others[] = $method; } } @@ -239,7 +239,7 @@ protected function get($method = null) */ public function hasNamedRoute($name) { - return !is_null($this->getByName($name)); + return ! is_null($this->getByName($name)); } /**
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/RouteDependencyResolverTrait.php
@@ -32,7 +32,7 @@ protected function callWithDependencies($instance, $method) */ protected function resolveClassMethodDependencies(array $parameters, $instance, $method) { - if (!method_exists($instance, $method)) { + if (! method_exists($instance, $method)) { return $parameters; } @@ -56,7 +56,7 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA // binding and we do not want to mess with those; otherwise, we resolve it here. $class = $parameter->getClass(); - if ($class && !$this->alreadyInParameters($class->name, $parameters)) { + if ($class && ! $this->alreadyInParameters($class->name, $parameters)) { array_splice( $parameters, $key, 0, [$this->container->make($class->name)] ); @@ -75,7 +75,7 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA */ protected function alreadyInParameters($class, array $parameters) { - return !is_null(Arr::first($parameters, function ($key, $value) use ($class) { + return ! is_null(Arr::first($parameters, function ($key, $value) use ($class) { return $value instanceof $class; })); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/Router.php
@@ -233,7 +233,7 @@ public function controller($uri, $controller, $names = []) // First, we will check to see if a controller prefix has been registered in // the route group. If it has, we will need to prefix it before trying to // reflect into the class instance and pull out the method for routing. - if (!empty($this->groupStack)) { + if (! empty($this->groupStack)) { $prepended = $this->prependGroupUses($controller); } @@ -346,7 +346,7 @@ public function group(array $attributes, Closure $callback) */ protected function updateGroupStack(array $attributes) { - if (!empty($this->groupStack)) { + if (! empty($this->groupStack)) { $attributes = $this->mergeGroup($attributes, end($this->groupStack)); } @@ -436,7 +436,7 @@ protected static function formatGroupPrefix($new, $old) */ public function getLastGroupPrefix() { - if (!empty($this->groupStack)) { + if (! empty($this->groupStack)) { $last = end($this->groupStack); return isset($last['prefix']) ? $last['prefix'] : ''; @@ -573,7 +573,7 @@ protected function convertToControllerAction($action) // Here we'll merge any group "uses" statement if necessary so that the action // has the proper clause for this property. Then we can simply set the name // of the controller on the action and return the action array for usage. - if (!empty($this->groupStack)) { + if (! empty($this->groupStack)) { $action['uses'] = $this->prependGroupUses($action['uses']); } @@ -882,7 +882,7 @@ public function prepareResponse($request, $response) { if ($response instanceof PsrResponseInterface) { $response = (new HttpFoundationFactory)->createResponse($response); - } elseif (!$response instanceof SymfonyResponse) { + } elseif (! $response instanceof SymfonyResponse) { $response = new Response($response); } @@ -896,7 +896,7 @@ public function prepareResponse($request, $response) */ public function hasGroupStack() { - return !empty($this->groupStack); + return ! empty($this->groupStack); } /** @@ -997,7 +997,7 @@ public function currentRouteNamed($name) */ public function currentRouteAction() { - if (!$this->current()) { + if (! $this->current()) { return; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Routing/UrlGenerator.php
@@ -271,7 +271,7 @@ public function forceSchema($schema) */ public function route($name, $parameters = [], $absolute = true) { - if (!is_null($route = $this->routes->getByName($name))) { + if (! is_null($route = $this->routes->getByName($name))) { return $this->toRoute($route, $parameters, $absolute); } @@ -358,7 +358,7 @@ protected function addQueryString($uri, array $parameters) // If the URI has a fragment, we will move it to the end of the URI since it will // need to come after any query string that may be added to the URL else it is // not going to be available. We will remove it then append it back on here. - if (!is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { + if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) { $uri = preg_replace('/#.*/', '', $uri); } @@ -497,7 +497,7 @@ protected function addPortToDomain($domain) $port = (int) $this->request->getPort(); - if (($secure && $port === 443) || (!$secure && $port === 80)) { + if (($secure && $port === 443) || (! $secure && $port === 80)) { return $domain; } @@ -545,13 +545,13 @@ protected function getRouteScheme($route) */ public function action($action, $parameters = [], $absolute = true) { - if ($this->rootNamespace && !(strpos($action, '\\') === 0)) { + if ($this->rootNamespace && ! (strpos($action, '\\') === 0)) { $action = $this->rootNamespace.'\\'.$action; } else { $action = trim($action, '\\'); } - if (!is_null($route = $this->routes->getByAction($action))) { + if (! is_null($route = $this->routes->getByAction($action))) { return $this->toRoute($route, $parameters, $absolute); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Session/CacheBasedSessionHandler.php
@@ -35,47 +35,47 @@ public function __construct(CacheContract $cache, $minutes) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function open($savePath, $sessionName) { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function close() { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function read($sessionId) { return $this->cache->get($sessionId, ''); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function write($sessionId, $data) { return $this->cache->put($sessionId, $data, $this->minutes); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function destroy($sessionId) { return $this->cache->forget($sessionId); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function gc($lifetime) {
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Session/CookieSessionHandler.php
@@ -36,47 +36,47 @@ public function __construct(CookieJar $cookie, $minutes) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function open($savePath, $sessionName) { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function close() { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function read($sessionId) { return $this->request->cookies->get($sessionId) ?: ''; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function write($sessionId, $data) { $this->cookie->queue($sessionId, $data, $this->minutes); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function destroy($sessionId) { $this->cookie->queue($this->cookie->forget($sessionId)); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function gc($lifetime) {
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Session/DatabaseSessionHandler.php
@@ -42,23 +42,23 @@ public function __construct(ConnectionInterface $connection, $table) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function open($savePath, $sessionName) { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function close() { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function read($sessionId) { @@ -72,7 +72,7 @@ public function read($sessionId) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function write($sessionId, $data) { @@ -90,15 +90,15 @@ public function write($sessionId, $data) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function destroy($sessionId) { $this->getQuery()->where('id', $sessionId)->delete(); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function gc($lifetime) {
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Session/FileSessionHandler.php
@@ -36,23 +36,23 @@ public function __construct(Filesystem $files, $path) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function open($savePath, $sessionName) { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function close() { return true; } /** - * {@inheritDoc} + * {@inheritdoc} */ public function read($sessionId) { @@ -64,23 +64,23 @@ public function read($sessionId) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function write($sessionId, $data) { $this->files->put($this->path.'/'.$sessionId, $data, true); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function destroy($sessionId) { $this->files->delete($this->path.'/'.$sessionId); } /** - * {@inheritDoc} + * {@inheritdoc} */ public function gc($lifetime) {
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Session/Middleware/StartSession.php
@@ -84,7 +84,7 @@ public function handle($request, Closure $next) */ public function terminate($request, $response) { - if ($this->sessionHandled && $this->sessionConfigured() && !$this->usingCookieSessions()) { + if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) { $this->manager->driver()->save(); } } @@ -128,7 +128,7 @@ public function getSession(Request $request) */ protected function storeCurrentUrl(Request $request, $session) { - if ($request->method() === 'GET' && $request->route() && !$request->ajax()) { + if ($request->method() === 'GET' && $request->route() && ! $request->ajax()) { $session->setPreviousUrl($request->fullUrl()); } } @@ -212,7 +212,7 @@ protected function getCookieExpirationDate() */ protected function sessionConfigured() { - return !is_null(Arr::get($this->manager->getSessionConfig(), 'driver')); + return ! is_null(Arr::get($this->manager->getSessionConfig(), 'driver')); } /** @@ -225,7 +225,7 @@ protected function sessionIsPersistent(array $config = null) { $config = $config ?: $this->manager->getSessionConfig(); - return !in_array($config['driver'], [null, 'array']); + return ! in_array($config['driver'], [null, 'array']); } /** @@ -235,7 +235,7 @@ protected function sessionIsPersistent(array $config = null) */ protected function usingCookieSessions() { - if (!$this->sessionConfigured()) { + if (! $this->sessionConfigured()) { return false; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Session/Store.php
@@ -91,7 +91,7 @@ public function start() { $this->loadSession(); - if (!$this->has('_token')) { + if (! $this->has('_token')) { $this->regenerateToken(); } @@ -169,7 +169,7 @@ public function getId() */ public function setId($id) { - if (!$this->isValidId($id)) { + if (! $this->isValidId($id)) { $id = $this->generateSessionId(); } @@ -308,7 +308,7 @@ public function ageFlashData() */ public function has($name) { - return !is_null($this->get($name)); + return ! is_null($this->get($name)); } /** @@ -341,7 +341,7 @@ public function hasOldInput($key = null) { $old = $this->getOldInput($key); - return is_null($key) ? count($old) > 0 : !is_null($old); + return is_null($key) ? count($old) > 0 : ! is_null($old); } /** @@ -378,7 +378,7 @@ public function set($name, $value) */ public function put($key, $value = null) { - if (!is_array($key)) { + if (! is_array($key)) { $key = [$key => $value]; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/Arr.php
@@ -208,7 +208,7 @@ public static function get($array, $key, $default = null) } foreach (explode('.', $key) as $segment) { - if (!is_array($array) || !array_key_exists($segment, $array)) { + if (! is_array($array) || ! array_key_exists($segment, $array)) { return value($default); } @@ -236,7 +236,7 @@ public static function has($array, $key) } foreach (explode('.', $key) as $segment) { - if (!is_array($array) || !array_key_exists($segment, $array)) { + if (! is_array($array) || ! array_key_exists($segment, $array)) { return false; } @@ -362,7 +362,7 @@ public static function set(&$array, $key, $value) // If the key doesn't exist at this depth, we will just create an empty array // to hold the next value, allowing us to create the arrays to hold final // values at the correct depth. Then we'll keep digging into the array. - if (!isset($array[$key]) || !is_array($array[$key])) { + if (! isset($array[$key]) || ! is_array($array[$key])) { $array[$key] = []; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/ClassLoader.php
@@ -61,7 +61,7 @@ public static function normalizeClass($class) */ public static function register() { - if (!static::$registered) { + if (! static::$registered) { static::$registered = spl_autoload_register(['\Illuminate\Support\ClassLoader', 'load']); } }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/Collection.php
@@ -79,7 +79,7 @@ public function contains($key, $value = null) } if ($this->useAsCallable($key)) { - return !is_null($this->first($key)); + return ! is_null($this->first($key)); } return in_array($key, $this->items); @@ -237,7 +237,7 @@ public function groupBy($groupBy, $preserveKeys = false) foreach ($this->items as $key => $value) { $groupKey = $groupBy($value, $key); - if (!array_key_exists($groupKey, $results)) { + if (! array_key_exists($groupKey, $results)) { $results[$groupKey] = new static; } @@ -324,7 +324,7 @@ public function isEmpty() */ protected function useAsCallable($value) { - return !is_string($value) && is_callable($value); + return ! is_string($value) && is_callable($value); } /** @@ -552,7 +552,7 @@ public function reject($callback) { if ($this->useAsCallable($callback)) { return $this->filter(function ($item) use ($callback) { - return !$callback($item); + return ! $callback($item); }); } @@ -580,7 +580,7 @@ public function reverse() */ public function search($value, $strict = false) { - if (!$this->useAsCallable($value)) { + if (! $this->useAsCallable($value)) { return array_search($value, $this->items, $strict); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/Facades/Cookie.php
@@ -15,7 +15,7 @@ class Cookie extends Facade */ public static function has($key) { - return !is_null(static::$app['request']->cookie($key, null)); + return ! is_null(static::$app['request']->cookie($key, null)); } /**
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/HtmlString.php
@@ -7,7 +7,7 @@ class HtmlString implements Htmlable { /** - * The HTML string + * The HTML string. * * @var string */ @@ -25,7 +25,7 @@ public function __construct($html) } /** - * Get the the HTML string + * Get the the HTML string. * * @return string */ @@ -35,7 +35,7 @@ public function toHtml() } /** - * Get the the HTML string + * Get the the HTML string. * * @return string */
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/Manager.php
@@ -59,7 +59,7 @@ public function driver($driver = null) // If the given driver has not been created before, we will create the instances // here and cache it so we can return it next time very quickly. If there is // already a driver created by this name, we'll just return that instance. - if (!isset($this->drivers[$driver])) { + if (! isset($this->drivers[$driver])) { $this->drivers[$driver] = $this->createDriver($driver); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/MessageBag.php
@@ -92,7 +92,7 @@ protected function isUnique($key, $message) { $messages = (array) $this->messages; - return !isset($messages[$key]) || !in_array($message, $messages[$key]); + return ! isset($messages[$key]) || ! in_array($message, $messages[$key]); } /** @@ -243,7 +243,7 @@ public function setFormat($format = ':message') */ public function isEmpty() { - return !$this->any(); + return ! $this->any(); } /**
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/ServiceProvider.php
@@ -105,14 +105,14 @@ protected function publishes(array $paths, $group = null) { $class = get_class($this); - if (!array_key_exists($class, static::$publishes)) { + if (! array_key_exists($class, static::$publishes)) { static::$publishes[$class] = []; } static::$publishes[$class] = array_merge(static::$publishes[$class], $paths); if ($group) { - if (!array_key_exists($group, static::$publishGroups)) { + if (! array_key_exists($group, static::$publishGroups)) { static::$publishGroups[$group] = []; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/Str.php
@@ -181,7 +181,7 @@ public static function words($value, $words = 100, $end = '...') { preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches); - if (!isset($matches[0]) || strlen($value) === strlen($matches[0])) { + if (! isset($matches[0]) || strlen($value) === strlen($matches[0])) { return $value; } @@ -288,11 +288,11 @@ public static function quickRandom($length = 16) */ public static function equals($knownString, $userInput) { - if (!is_string($knownString)) { + if (! is_string($knownString)) { $knownString = (string) $knownString; } - if (!is_string($userInput)) { + if (! is_string($userInput)) { $userInput = (string) $userInput; } @@ -388,7 +388,7 @@ public static function snake($value, $delimiter = '_') return static::$snakeCache[$key]; } - if (!ctype_lower($value)) { + if (! ctype_lower($value)) { $value = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.$delimiter, $value)); $value = preg_replace('/\s+/', '', $value);
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/Traits/CapsuleManagerTrait.php
@@ -31,7 +31,7 @@ protected function setupContainer(Container $container) { $this->container = $container; - if (!$this->container->bound('config')) { + if (! $this->container->bound('config')) { $this->container->instance('config', new Fluent); } }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Support/helpers.php
@@ -6,7 +6,7 @@ use Illuminate\Support\Debug\Dumper; use Illuminate\Contracts\Support\Htmlable; -if (!function_exists('append_config')) { +if (! function_exists('append_config')) { /** * Assign high numeric IDs to a config item to force appending. * @@ -29,7 +29,7 @@ function append_config(array $array) } } -if (!function_exists('array_add')) { +if (! function_exists('array_add')) { /** * Add an element to an array using "dot" notation if it doesn't exist. * @@ -44,7 +44,7 @@ function array_add($array, $key, $value) } } -if (!function_exists('array_build')) { +if (! function_exists('array_build')) { /** * Build a new array using a callback. * @@ -58,7 +58,7 @@ function array_build($array, callable $callback) } } -if (!function_exists('array_collapse')) { +if (! function_exists('array_collapse')) { /** * Collapse an array of arrays into a single array. * @@ -71,7 +71,7 @@ function array_collapse($array) } } -if (!function_exists('array_divide')) { +if (! function_exists('array_divide')) { /** * Divide an array into two arrays. One with keys and the other with values. * @@ -84,7 +84,7 @@ function array_divide($array) } } -if (!function_exists('array_dot')) { +if (! function_exists('array_dot')) { /** * Flatten a multi-dimensional associative array with dots. * @@ -98,7 +98,7 @@ function array_dot($array, $prepend = '') } } -if (!function_exists('array_except')) { +if (! function_exists('array_except')) { /** * Get all of the given array except for a specified array of items. * @@ -112,7 +112,23 @@ function array_except($array, $keys) } } -if (!function_exists('array_first')) { +if (! function_exists('array_fetch')) { + /** + * Fetch a flattened array of a nested array element. + * + * @param array $array + * @param string $key + * @return array + * + * @deprecated since version 5.1. Use array_pluck instead. + */ + function array_fetch($array, $key) + { + return Arr::fetch($array, $key); + } +} + +if (! function_exists('array_first')) { /** * Return the first element in an array passing a given truth test. * @@ -127,7 +143,7 @@ function array_first($array, callable $callback, $default = null) } } -if (!function_exists('array_last')) { +if (! function_exists('array_last')) { /** * Return the last element in an array passing a given truth test. * @@ -142,7 +158,7 @@ function array_last($array, $callback, $default = null) } } -if (!function_exists('array_flatten')) { +if (! function_exists('array_flatten')) { /** * Flatten a multi-dimensional array into a single level. * @@ -155,7 +171,7 @@ function array_flatten($array) } } -if (!function_exists('array_forget')) { +if (! function_exists('array_forget')) { /** * Remove one or many array items from a given array using "dot" notation. * @@ -169,7 +185,7 @@ function array_forget(&$array, $keys) } } -if (!function_exists('array_get')) { +if (! function_exists('array_get')) { /** * Get an item from an array using "dot" notation. * @@ -184,7 +200,7 @@ function array_get($array, $key, $default = null) } } -if (!function_exists('array_has')) { +if (! function_exists('array_has')) { /** * Check if an item exists in an array using "dot" notation. * @@ -198,7 +214,7 @@ function array_has($array, $key) } } -if (!function_exists('array_only')) { +if (! function_exists('array_only')) { /** * Get a subset of the items from the given array. * @@ -212,7 +228,7 @@ function array_only($array, $keys) } } -if (!function_exists('array_pluck')) { +if (! function_exists('array_pluck')) { /** * Pluck an array of values from an array. * @@ -227,7 +243,7 @@ function array_pluck($array, $value, $key = null) } } -if (!function_exists('array_pull')) { +if (! function_exists('array_pull')) { /** * Get a value from the array, and remove it. * @@ -242,7 +258,7 @@ function array_pull(&$array, $key, $default = null) } } -if (!function_exists('array_set')) { +if (! function_exists('array_set')) { /** * Set an array item to a given value using "dot" notation. * @@ -259,7 +275,7 @@ function array_set(&$array, $key, $value) } } -if (!function_exists('array_sort')) { +if (! function_exists('array_sort')) { /** * Sort the array using the given callback. * @@ -273,7 +289,7 @@ function array_sort($array, callable $callback) } } -if (!function_exists('array_sort_recursive')) { +if (! function_exists('array_sort_recursive')) { /** * Recursively sort an array by keys and values. * @@ -286,7 +302,7 @@ function array_sort_recursive($array) } } -if (!function_exists('array_where')) { +if (! function_exists('array_where')) { /** * Filter the array using the given callback. * @@ -300,7 +316,7 @@ function array_where($array, callable $callback) } } -if (!function_exists('camel_case')) { +if (! function_exists('camel_case')) { /** * Convert a value to camel case. * @@ -313,7 +329,7 @@ function camel_case($value) } } -if (!function_exists('class_basename')) { +if (! function_exists('class_basename')) { /** * Get the class "basename" of the given object / class. * @@ -328,7 +344,7 @@ function class_basename($class) } } -if (!function_exists('class_uses_recursive')) { +if (! function_exists('class_uses_recursive')) { /** * Returns all traits used by a class, its subclasses and trait of their traits. * @@ -347,7 +363,7 @@ function class_uses_recursive($class) } } -if (!function_exists('collect')) { +if (! function_exists('collect')) { /** * Create a collection from the given value. * @@ -360,7 +376,7 @@ function collect($value = null) } } -if (!function_exists('data_get')) { +if (! function_exists('data_get')) { /** * Get an item from an array or object using "dot" notation. * @@ -379,19 +395,19 @@ function data_get($target, $key, $default = null) foreach ($key as $segment) { if (is_array($target)) { - if (!array_key_exists($segment, $target)) { + if (! array_key_exists($segment, $target)) { return value($default); } $target = $target[$segment]; } elseif ($target instanceof ArrayAccess) { - if (!isset($target[$segment])) { + if (! isset($target[$segment])) { return value($default); } $target = $target[$segment]; } elseif (is_object($target)) { - if (!isset($target->{$segment})) { + if (! isset($target->{$segment})) { return value($default); } @@ -405,7 +421,7 @@ function data_get($target, $key, $default = null) } } -if (!function_exists('dd')) { +if (! function_exists('dd')) { /** * Dump the passed variables and end the script. * @@ -422,7 +438,7 @@ function dd() } } -if (!function_exists('e')) { +if (! function_exists('e')) { /** * Escape HTML entities in a string. * @@ -439,7 +455,7 @@ function e($value) } } -if (!function_exists('ends_with')) { +if (! function_exists('ends_with')) { /** * Determine if a given string ends with a given substring. * @@ -453,7 +469,7 @@ function ends_with($haystack, $needles) } } -if (!function_exists('head')) { +if (! function_exists('head')) { /** * Get the first element of an array. Useful for method chaining. * @@ -466,7 +482,7 @@ function head($array) } } -if (!function_exists('last')) { +if (! function_exists('last')) { /** * Get the last element from an array. * @@ -479,7 +495,7 @@ function last($array) } } -if (!function_exists('object_get')) { +if (! function_exists('object_get')) { /** * Get an item from an object using "dot" notation. * @@ -495,7 +511,7 @@ function object_get($object, $key, $default = null) } foreach (explode('.', $key) as $segment) { - if (!is_object($object) || !isset($object->{$segment})) { + if (! is_object($object) || ! isset($object->{$segment})) { return value($default); } @@ -506,7 +522,7 @@ function object_get($object, $key, $default = null) } } -if (!function_exists('preg_replace_sub')) { +if (! function_exists('preg_replace_sub')) { /** * Replace a given pattern with each value in the array in sequentially. * @@ -526,7 +542,7 @@ function preg_replace_sub($pattern, &$replacements, $subject) } } -if (!function_exists('snake_case')) { +if (! function_exists('snake_case')) { /** * Convert a string to snake case. * @@ -540,7 +556,7 @@ function snake_case($value, $delimiter = '_') } } -if (!function_exists('starts_with')) { +if (! function_exists('starts_with')) { /** * Determine if a given string starts with a given substring. * @@ -554,7 +570,7 @@ function starts_with($haystack, $needles) } } -if (!function_exists('str_contains')) { +if (! function_exists('str_contains')) { /** * Determine if a given string contains a given substring. * @@ -568,7 +584,7 @@ function str_contains($haystack, $needles) } } -if (!function_exists('str_finish')) { +if (! function_exists('str_finish')) { /** * Cap a string with a single instance of a given value. * @@ -582,7 +598,7 @@ function str_finish($value, $cap) } } -if (!function_exists('str_is')) { +if (! function_exists('str_is')) { /** * Determine if a given string matches a given pattern. * @@ -596,7 +612,7 @@ function str_is($pattern, $value) } } -if (!function_exists('str_limit')) { +if (! function_exists('str_limit')) { /** * Limit the number of characters in a string. * @@ -611,7 +627,7 @@ function str_limit($value, $limit = 100, $end = '...') } } -if (!function_exists('str_plural')) { +if (! function_exists('str_plural')) { /** * Get the plural form of an English word. * @@ -625,7 +641,7 @@ function str_plural($value, $count = 2) } } -if (!function_exists('str_random')) { +if (! function_exists('str_random')) { /** * Generate a more truly "random" alpha-numeric string. * @@ -640,7 +656,7 @@ function str_random($length = 16) } } -if (!function_exists('str_replace_array')) { +if (! function_exists('str_replace_array')) { /** * Replace a given value in the string sequentially with an array. * @@ -659,7 +675,7 @@ function str_replace_array($search, array $replace, $subject) } } -if (!function_exists('str_singular')) { +if (! function_exists('str_singular')) { /** * Get the singular form of an English word. * @@ -672,7 +688,7 @@ function str_singular($value) } } -if (!function_exists('str_slug')) { +if (! function_exists('str_slug')) { /** * Generate a URL friendly "slug" from a given string. * @@ -686,7 +702,7 @@ function str_slug($title, $separator = '-') } } -if (!function_exists('studly_case')) { +if (! function_exists('studly_case')) { /** * Convert a value to studly caps case. * @@ -699,7 +715,7 @@ function studly_case($value) } } -if (!function_exists('title_case')) { +if (! function_exists('title_case')) { /** * Convert a value to title case. * @@ -712,7 +728,7 @@ function title_case($value) } } -if (!function_exists('trait_uses_recursive')) { +if (! function_exists('trait_uses_recursive')) { /** * Returns all traits used by a trait and its traits. * @@ -731,7 +747,7 @@ function trait_uses_recursive($trait) } } -if (!function_exists('value')) { +if (! function_exists('value')) { /** * Return the default value of the given value. * @@ -744,7 +760,7 @@ function value($value) } } -if (!function_exists('with')) { +if (! function_exists('with')) { /** * Return the given object. Useful for chaining. *
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Translation/Translator.php
@@ -85,15 +85,15 @@ public function get($key, array $replace = [], $locale = null) $namespace, $group, $locale, $item, $replace ); - if (!is_null($line)) { + if (! is_null($line)) { break; } } // If the line doesn't exist, we will return back the key which was requested as // that will be quick to spot in the UI if language keys are wrong or missing // from the application's language files. Otherwise we can return the line. - if (!isset($line)) { + if (! isset($line)) { return $key; } @@ -271,7 +271,7 @@ public function parseKey($key) */ protected function parseLocale($locale) { - if (!is_null($locale)) { + if (! is_null($locale)) { return array_filter([$locale, $this->fallback]); } @@ -285,7 +285,7 @@ protected function parseLocale($locale) */ public function getSelector() { - if (!isset($this->selector)) { + if (! isset($this->selector)) { $this->selector = new MessageSelector; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Validation/DatabasePresenceVerifier.php
@@ -46,7 +46,7 @@ public function getCount($collection, $column, $value, $excludeId = null, $idCol { $query = $this->table($collection)->where($column, '=', $value); - if (!is_null($excludeId) && $excludeId != 'NULL') { + if (! is_null($excludeId) && $excludeId != 'NULL') { $query->where($idColumn ?: 'id', '<>', $excludeId); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Validation/Factory.php
@@ -95,14 +95,14 @@ public function make(array $data, array $rules, array $messages = [], array $cus // it may be written besides database. We'll inject it into the validator. $validator = $this->resolve($data, $rules, $messages, $customAttributes); - if (!is_null($this->verifier)) { + if (! is_null($this->verifier)) { $validator->setPresenceVerifier($this->verifier); } // Next we'll set the IoC container instance of the validator, which is used to // resolve out class based validator extensions. If it is not set then these // types of extensions will not be possible on these validation instances. - if (!is_null($this->container)) { + if (! is_null($this->container)) { $validator->setContainer($this->container); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Validation/ValidatesWhenResolvedTrait.php
@@ -19,9 +19,9 @@ public function validate() { $instance = $this->getValidatorInstance(); - if (!$this->passesAuthorization()) { + if (! $this->passesAuthorization()) { $this->failedAuthorization(); - } elseif (!$instance->passes()) { + } elseif (! $instance->passes()) { $this->failedValidation($instance); } }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/Validation/Validator.php
@@ -262,7 +262,7 @@ public function each($attribute, $rules) { $data = Arr::get($this->data, $attribute); - if (!is_array($data)) { + if (! is_array($data)) { if ($this->hasRule($attribute, 'Array')) { return; } @@ -272,7 +272,7 @@ public function each($attribute, $rules) foreach ($data as $dataKey => $dataValue) { foreach ((array) $rules as $ruleKey => $ruleValue) { - if (!is_string($ruleKey)) { + if (! is_string($ruleKey)) { $this->mergeRules("$attribute.$dataKey", $ruleValue); } else { $this->mergeRules("$attribute.$dataKey.$ruleKey", $ruleValue); @@ -332,7 +332,7 @@ public function passes() */ public function fails() { - return !$this->passes(); + return ! $this->passes(); } /** @@ -359,7 +359,7 @@ protected function validate($attribute, $rule) $method = "validate{$rule}"; - if ($validatable && !$this->$method($attribute, $value, $parameters, $this)) { + if ($validatable && ! $this->$method($attribute, $value, $parameters, $this)) { $this->addFailure($attribute, $rule, $parameters); } } @@ -371,7 +371,7 @@ protected function validate($attribute, $rule) */ public function valid() { - if (!$this->messages) { + if (! $this->messages) { $this->passes(); } @@ -385,7 +385,7 @@ public function valid() */ public function invalid() { - if (!$this->messages) { + if (! $this->messages) { $this->passes(); } @@ -400,9 +400,9 @@ public function invalid() */ protected function getValue($attribute) { - if (!is_null($value = Arr::get($this->data, $attribute))) { + if (! is_null($value = Arr::get($this->data, $attribute))) { return $value; - } elseif (!is_null($value = Arr::get($this->files, $attribute))) { + } elseif (! is_null($value = Arr::get($this->files, $attribute))) { return $value; } } @@ -475,7 +475,7 @@ protected function isImplicit($rule) protected function hasNotFailedPreviousRuleIfPresenceRule($rule, $attribute) { return in_array($rule, ['Unique', 'Exists']) - ? !$this->messages->has($attribute) : true; + ? ! $this->messages->has($attribute) : true; } /** @@ -569,7 +569,7 @@ protected function validateFilled($attribute, $value) protected function anyFailingRequired(array $attributes) { foreach ($attributes as $key) { - if (!$this->validateRequired($key, $this->getValue($key))) { + if (! $this->validateRequired($key, $this->getValue($key))) { return true; } } @@ -604,7 +604,7 @@ protected function allFailingRequired(array $attributes) */ protected function validateRequiredWith($attribute, $value, $parameters) { - if (!$this->allFailingRequired($parameters)) { + if (! $this->allFailingRequired($parameters)) { return $this->validateRequired($attribute, $value); } @@ -621,7 +621,7 @@ protected function validateRequiredWith($attribute, $value, $parameters) */ protected function validateRequiredWithAll($attribute, $value, $parameters) { - if (!$this->anyFailingRequired($parameters)) { + if (! $this->anyFailingRequired($parameters)) { return $this->validateRequired($attribute, $value); } @@ -921,7 +921,7 @@ protected function validateMax($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'max'); - if ($value instanceof UploadedFile && !$value->isValid()) { + if ($value instanceof UploadedFile && ! $value->isValid()) { return false; } @@ -981,7 +981,7 @@ protected function validateIn($attribute, $value, $parameters) */ protected function validateNotIn($attribute, $value, $parameters) { - return !$this->validateIn($attribute, $value, $parameters); + return ! $this->validateIn($attribute, $value, $parameters); } /** @@ -1020,7 +1020,7 @@ protected function validateUnique($attribute, $value, $parameters) // data store like Redis, etc. We will use it to determine uniqueness. $verifier = $this->getPresenceVerifier(); - if (!is_null($connection)) { + if (! is_null($connection)) { $verifier->setConnection($connection); } @@ -1220,7 +1220,7 @@ protected function validateImage($attribute, $value) */ protected function validateMimes($attribute, $value, $parameters) { - if (!$this->isAValidFileInstance($value)) { + if (! $this->isAValidFileInstance($value)) { return false; } @@ -1237,7 +1237,7 @@ protected function validateMimes($attribute, $value, $parameters) */ protected function validateMimetypes($attribute, $value, $parameters) { - if (!$this->isAValidFileInstance($value)) { + if (! $this->isAValidFileInstance($value)) { return false; } @@ -1252,7 +1252,7 @@ protected function validateMimetypes($attribute, $value, $parameters) */ protected function isAValidFileInstance($value) { - if ($value instanceof UploadedFile && !$value->isValid()) { + if ($value instanceof UploadedFile && ! $value->isValid()) { return false; } @@ -1381,7 +1381,7 @@ protected function validateBefore($attribute, $value, $parameters) return $this->validateBeforeWithFormat($format, $value, $parameters); } - if (!($date = strtotime($parameters[0]))) { + if (! ($date = strtotime($parameters[0]))) { return strtotime($value) < strtotime($this->getValue($parameters[0])); } @@ -1419,7 +1419,7 @@ protected function validateAfter($attribute, $value, $parameters) return $this->validateAfterWithFormat($format, $value, $parameters); } - if (!($date = strtotime($parameters[0]))) { + if (! ($date = strtotime($parameters[0]))) { return strtotime($value) > strtotime($this->getValue($parameters[0])); } @@ -1527,7 +1527,7 @@ protected function getMessage($attribute, $rule) // First we will retrieve the custom message for the validation rule if one // exists. If a custom validation message is being used we'll return the // custom message, otherwise we'll keep searching for a valid message. - if (!is_null($inlineMessage)) { + if (! is_null($inlineMessage)) { return $inlineMessage; } @@ -1983,7 +1983,7 @@ protected function replaceDateFormat($message, $attribute, $rule, $parameters) */ protected function replaceBefore($message, $attribute, $rule, $parameters) { - if (!(strtotime($parameters[0]))) { + if (! (strtotime($parameters[0]))) { return str_replace(':date', $this->getAttribute($parameters[0]), $message); } @@ -2013,7 +2013,7 @@ protected function replaceAfter($message, $attribute, $rule, $parameters) */ protected function hasRule($attribute, $rules) { - return !is_null($this->getRule($attribute, $rules)); + return ! is_null($this->getRule($attribute, $rules)); } /** @@ -2025,7 +2025,7 @@ protected function hasRule($attribute, $rules) */ protected function getRule($attribute, $rules) { - if (!array_key_exists($attribute, $this->rules)) { + if (! array_key_exists($attribute, $this->rules)) { return; } @@ -2313,7 +2313,7 @@ public function setFiles(array $files) */ public function getPresenceVerifier() { - if (!isset($this->presenceVerifier)) { + if (! isset($this->presenceVerifier)) { throw new RuntimeException('Presence verifier has not been set.'); } @@ -2457,7 +2457,7 @@ public function failed() */ public function messages() { - if (!$this->messages) { + if (! $this->messages) { $this->passes(); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/View/Compilers/BladeCompiler.php
@@ -98,7 +98,7 @@ public function compile($path = null) $contents = $this->compileString($this->files->get($this->getPath())); - if (!is_null($this->cachePath)) { + if (! is_null($this->cachePath)) { $this->files->put($this->getCompiledPath($this->getPath()), $contents); } } @@ -391,7 +391,7 @@ protected function compileYield($expression) */ protected function compileShow($expression) { - return "<?php echo \$__env->yieldSection(); ?>"; + return '<?php echo $__env->yieldSection(); ?>'; } /** @@ -413,7 +413,7 @@ protected function compileSection($expression) */ protected function compileAppend($expression) { - return "<?php \$__env->appendSection(); ?>"; + return '<?php $__env->appendSection(); ?>'; } /** @@ -424,7 +424,7 @@ protected function compileAppend($expression) */ protected function compileEndsection($expression) { - return "<?php \$__env->stopSection(); ?>"; + return '<?php $__env->stopSection(); ?>'; } /** @@ -435,7 +435,7 @@ protected function compileEndsection($expression) */ protected function compileStop($expression) { - return "<?php \$__env->stopSection(); ?>"; + return '<?php $__env->stopSection(); ?>'; } /** @@ -446,7 +446,7 @@ protected function compileStop($expression) */ protected function compileOverwrite($expression) { - return "<?php \$__env->stopSection(true); ?>"; + return '<?php $__env->stopSection(true); ?>'; } /** @@ -704,14 +704,14 @@ protected function compilePush($expression) */ protected function compileEndpush($expression) { - return "<?php \$__env->appendSection(); ?>"; + return '<?php $__env->appendSection(); ?>'; } /** - * Get the extensions used by the compiler. - * - * @return array - */ + * Get the extensions used by the compiler. + * + * @return array + */ public function getExtensions() { return $this->extensions; @@ -751,10 +751,10 @@ public function getCustomDirectives() } /** - * Gets the raw tags used by the compiler. - * - * @return array - */ + * Gets the raw tags used by the compiler. + * + * @return array + */ public function getRawTags() { return $this->rawTags;
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/View/Compilers/Compiler.php
@@ -57,7 +57,7 @@ public function isExpired($path) // If the compiled file doesn't exist we will indicate that the view is expired // so that it can be re-compiled. Else, we will verify the last modification // of the views is less than the modification times of the compiled views. - if (!$this->cachePath || !$this->files->exists($compiled)) { + if (! $this->cachePath || ! $this->files->exists($compiled)) { return true; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/View/Expression.php
@@ -7,7 +7,7 @@ class Expression implements Htmlable { /** - * The HTML string + * The HTML string. * * @var string */ @@ -25,7 +25,7 @@ public function __construct($html) } /** - * Get the the HTML string + * Get the the HTML string. * * @return string */ @@ -35,7 +35,7 @@ public function toHtml() } /** - * Get the the HTML string + * Get the the HTML string. * * @return string */
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/View/Factory.php
@@ -288,7 +288,7 @@ public function renderEach($view, $data, $iterator, $empty = 'raw|') */ public function getEngineFromPath($path) { - if (!$extension = $this->getExtension($path)) { + if (! $extension = $this->getExtension($path)) { throw new InvalidArgumentException("Unrecognized extension in file: $path"); } @@ -321,7 +321,7 @@ protected function getExtension($path) */ public function share($key, $value = null) { - if (!is_array($key)) { + if (! is_array($key)) { return $this->shared[$key] = $value; }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
src/Illuminate/View/FileViewFinder.php
@@ -108,7 +108,7 @@ protected function getNamespaceSegments($name) throw new InvalidArgumentException("View [$name] has an invalid name."); } - if (!isset($this->hints[$segments[0]])) { + if (! isset($this->hints[$segments[0]])) { throw new InvalidArgumentException("No hint path defined for [{$segments[0]}]."); }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Cache/CacheRateLimiterTest.php
@@ -6,54 +6,50 @@ class CacheRateLimiterTest extends PHPUnit_Framework_TestCase { - public function tearDown() - { - m::close(); - } - - - public function testTooManyAttemptsReturnTrueIfAlreadyLockedOut() - { - $cache = m::mock(Cache::class); - $cache->shouldReceive('get')->once()->with('key', 0)->andReturn(0); - $cache->shouldReceive('has')->once()->with('key:lockout')->andReturn(true); - $cache->shouldReceive('add')->never(); - $rateLimiter = new RateLimiter($cache); - - $this->assertTrue($rateLimiter->tooManyAttempts('key', 1, 1)); - } - - - public function testTooManyAttemptsReturnsTrueIfMaxAttemptsExceeded() - { - $cache = m::mock(Cache::class); - $cache->shouldReceive('get')->once()->with('key', 0)->andReturn(10); - $cache->shouldReceive('has')->once()->with('key:lockout')->andReturn(false); - $cache->shouldReceive('add')->once()->with('key:lockout', m::type('int'), 1); - $rateLimiter = new RateLimiter($cache); - - $this->assertTrue($rateLimiter->tooManyAttempts('key', 1, 1)); - } - - - public function testHitProperlyIncrementsAttemptCount() - { - $cache = m::mock(Cache::class); - $cache->shouldReceive('add')->once()->with('key', 1, 1); - $cache->shouldReceive('increment')->once()->with('key'); - $rateLimiter = new RateLimiter($cache); - - $rateLimiter->hit('key', 1); - } - - - public function testClearClearsTheCacheKeys() - { - $cache = m::mock(Cache::class); - $cache->shouldReceive('forget')->once()->with('key'); - $cache->shouldReceive('forget')->once()->with('key:lockout'); - $rateLimiter = new RateLimiter($cache); - - $rateLimiter->clear('key'); - } + public function tearDown() + { + m::close(); + } + + public function testTooManyAttemptsReturnTrueIfAlreadyLockedOut() + { + $cache = m::mock(Cache::class); + $cache->shouldReceive('get')->once()->with('key', 0)->andReturn(0); + $cache->shouldReceive('has')->once()->with('key:lockout')->andReturn(true); + $cache->shouldReceive('add')->never(); + $rateLimiter = new RateLimiter($cache); + + $this->assertTrue($rateLimiter->tooManyAttempts('key', 1, 1)); + } + + public function testTooManyAttemptsReturnsTrueIfMaxAttemptsExceeded() + { + $cache = m::mock(Cache::class); + $cache->shouldReceive('get')->once()->with('key', 0)->andReturn(10); + $cache->shouldReceive('has')->once()->with('key:lockout')->andReturn(false); + $cache->shouldReceive('add')->once()->with('key:lockout', m::type('int'), 1); + $rateLimiter = new RateLimiter($cache); + + $this->assertTrue($rateLimiter->tooManyAttempts('key', 1, 1)); + } + + public function testHitProperlyIncrementsAttemptCount() + { + $cache = m::mock(Cache::class); + $cache->shouldReceive('add')->once()->with('key', 1, 1); + $cache->shouldReceive('increment')->once()->with('key'); + $rateLimiter = new RateLimiter($cache); + + $rateLimiter->hit('key', 1); + } + + public function testClearClearsTheCacheKeys() + { + $cache = m::mock(Cache::class); + $cache->shouldReceive('forget')->once()->with('key'); + $cache->shouldReceive('forget')->once()->with('key:lockout'); + $rateLimiter = new RateLimiter($cache); + + $rateLimiter->clear('key'); + } }
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Cookie/Middleware/EncryptCookiesTest.php
@@ -39,7 +39,7 @@ public function testSetCookieEncryption() { $this->router->get($this->setCookiePath, [ 'middleware' => 'EncryptCookiesTestMiddleware', - 'uses' => 'EncryptCookiesTestController@setCookies' + 'uses' => 'EncryptCookiesTestController@setCookies', ]); $response = $this->router->dispatch(Request::create($this->setCookiePath, 'GET')); @@ -56,7 +56,7 @@ public function testQueuedCookieEncryption() { $this->router->get($this->queueCookiePath, [ 'middleware' => ['EncryptCookiesTestMiddleware', 'AddQueuedCookiesToResponseTestMiddleware'], - 'uses' => 'EncryptCookiesTestController@queueCookies' + 'uses' => 'EncryptCookiesTestController@queueCookies', ]); $response = $this->router->dispatch(Request::create($this->queueCookiePath, 'GET'));
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Database/DatabaseConnectorTest.php
@@ -77,7 +77,7 @@ public function testPostgresSearchPathArraySupported() { $dsn = 'pgsql:host=foo;dbname=bar'; $config = ['host' => 'foo', 'database' => 'bar', 'schema' => ['public', 'user'], 'charset' => 'utf8']; - $connector = $this->getMock('Illuminate\Database\Connectors\PostgresConnector', ['createConnection', 'getOptions'] ); + $connector = $this->getMock('Illuminate\Database\Connectors\PostgresConnector', ['createConnection', 'getOptions']); $connection = m::mock('stdClass'); $connector->expects($this->once())->method('getOptions')->with($this->equalTo($config))->will($this->returnValue(['options'])); $connector->expects($this->once())->method('createConnection')->with($this->equalTo($dsn), $this->equalTo($config), $this->equalTo(['options']))->will($this->returnValue($connection));
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php
@@ -124,7 +124,6 @@ public function testOnlyTrashedOnlyReturnsTrashedRecords() $this->assertEquals(1, $users->first()->id); } - /** * Helpers... */ @@ -169,7 +168,6 @@ class SoftDeletesTestUser extends Eloquent protected $guarded = []; } - /** * Connection Resolver. */
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Database/DatabaseMigrationMakeCommandTest.php
@@ -58,7 +58,7 @@ public function testBasicCreateGivesCreatorProperArgumentsWhenTableIsSet() public function testCanSpecifyPathToCreateMigrationsIn() { - $command = new MigrateMakeCommand( + $command = new MigrateMakeCommand( $creator = m::mock('Illuminate\Database\Migrations\MigrationCreator'), m::mock('Illuminate\Foundation\Composer')->shouldIgnoreMissing(), __DIR__.'/vendor'
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Database/DatabaseMySqlSchemaGrammarTest.php
@@ -581,7 +581,7 @@ public function testAddingTimeStampTz() public function testAddingTimeStampTzWithDefault() { $blueprint = new Blueprint('users'); - $blueprint->timestampTz('foo')->default('2015-07-22 11:43:17');; + $blueprint->timestampTz('foo')->default('2015-07-22 11:43:17'); $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements));
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Database/DatabaseQueryBuilderTest.php
@@ -538,7 +538,7 @@ public function testLimitsAndOffsets() public function testGetCountForPaginationWithBindings() { $builder = $this->getBuilder(); - $builder->from('users')->selectSub(function($q) { $q->select('body')->from('posts')->where('id', 4); }, 'post'); + $builder->from('users')->selectSub(function ($q) { $q->select('body')->from('posts')->where('id', 4); }, 'post'); $builder->getConnection()->shouldReceive('select')->once()->with('select count(*) as aggregate from "users"', [], true)->andReturn([['aggregate' => 1]]); $builder->getProcessor()->shouldReceive('processSelect')->once()->andReturnUsing(function ($builder, $results) { return $results; }); @@ -854,7 +854,7 @@ public function testAggregateWithSubSelect() $builder = $this->getBuilder(); $builder->getConnection()->shouldReceive('select')->once()->with('select count(*) as aggregate from "users"', [], true)->andReturn([['aggregate' => 1]]); $builder->getProcessor()->shouldReceive('processSelect')->once()->andReturnUsing(function ($builder, $results) { return $results; }); - $builder->from('users')->selectSub(function($query) { $query->from('posts')->select('foo')->where('title', 'foo'); }, 'post'); + $builder->from('users')->selectSub(function ($query) { $query->from('posts')->select('foo')->where('title', 'foo'); }, 'post'); $count = $builder->count(); $this->assertEquals(1, $count); $this->assertEquals(['foo'], $builder->getBindings());
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Http/HttpRequestTest.php
@@ -343,7 +343,7 @@ public function testPrefers() $this->assertEquals('text/html', Request::create('/', 'GET', [], [], [], ['HTTP_ACCEPT' => 'application/json;q=0.4, text/html;q=0.6'])->prefers(['text/html', 'application/json'])); $this->assertEquals('text/html', Request::create('/', 'GET', [], [], [], ['HTTP_ACCEPT' => 'application/json;q=0.4, text/html;q=0.6'])->prefers(['application/json', 'text/html'])); - $this->assertEquals('json', Request::create('/', 'GET', [], [], [], ['HTTP_ACCEPT' => '*/*; charset=utf-8'])->prefers('json')); + $this->assertEquals('json', Request::create('/', 'GET', [], [], [], ['HTTP_ACCEPT' => '*/*; charset=utf-8'])->prefers('json')); $this->assertEquals('application/json', Request::create('/', 'GET', [], [], [], ['HTTP_ACCEPT' => 'application/*'])->prefers('application/json')); $this->assertEquals('application/xml', Request::create('/', 'GET', [], [], [], ['HTTP_ACCEPT' => 'application/*'])->prefers('application/xml')); $this->assertNull(Request::create('/', 'GET', [], [], [], ['HTTP_ACCEPT' => 'application/*'])->prefers('text/html'));
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Queue/QueueDatabaseQueueTest.php
@@ -20,7 +20,7 @@ public function testPushProperlyPushesJobOntoDatabase() $this->assertEquals(0, $array['attempts']); $this->assertEquals(0, $array['reserved']); $this->assertNull($array['reserved_at']); - $this->assertTrue(is_integer($array['available_at'])); + $this->assertTrue(is_int($array['available_at'])); }); $queue->push('foo', ['data']); @@ -41,7 +41,7 @@ public function testDelayedPushProperlyPushesJobOntoDatabase() $this->assertEquals(0, $array['attempts']); $this->assertEquals(0, $array['reserved']); $this->assertNull($array['reserved_at']); - $this->assertTrue(is_integer($array['available_at'])); + $this->assertTrue(is_int($array['available_at'])); }); $queue->later(10, 'foo', ['data']);
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Routing/RoutingRouteTest.php
@@ -477,31 +477,31 @@ public function testNestedRouteGroupingWithAs() public function testRoutePrefixing() { - /** + /* * Prefix route */ $router = $this->getRouter(); - $router->get('foo/bar', function() { return 'hello'; }); + $router->get('foo/bar', function () { return 'hello'; }); $routes = $router->getRoutes(); $routes = $routes->getRoutes(); $routes[0]->prefix('prefix'); $this->assertEquals('prefix/foo/bar', $routes[0]->uri()); - /** + /* * Use empty prefix */ $router = $this->getRouter(); - $router->get('foo/bar', function() { return 'hello'; }); + $router->get('foo/bar', function () { return 'hello'; }); $routes = $router->getRoutes(); $routes = $routes->getRoutes(); $routes[0]->prefix('/'); $this->assertEquals('foo/bar', $routes[0]->uri()); - /** + /* * Prefix homepage */ $router = $this->getRouter(); - $router->get('/', function() { return 'hello'; }); + $router->get('/', function () { return 'hello'; }); $routes = $router->getRoutes(); $routes = $routes->getRoutes(); $routes[0]->prefix('prefix');
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Support/SupportArrTest.php
@@ -13,7 +13,6 @@ public function testIsAssoc() $this->assertFalse(Arr::isAssoc(['a', 'b'])); } - public function testSortRecursive() { $array = [
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Support/SupportCollectionTest.php
@@ -694,7 +694,7 @@ public function testSearchReturnsIndexOfFirstFoundItem() $this->assertEquals(1, $c->search(2)); $this->assertEquals('foo', $c->search('bar')); $this->assertEquals(4, $c->search(function ($value) { return $value > 4; })); - $this->assertEquals('foo', $c->search(function ($value) { return !is_numeric($value); })); + $this->assertEquals('foo', $c->search(function ($value) { return ! is_numeric($value); })); } public function testSearchReturnsFalseWhenItemIsNotFound() @@ -804,7 +804,7 @@ public function __isset($attribute) $accessor = 'get'.lcfirst($attribute).'Attribute'; if (method_exists($this, $accessor)) { - return !is_null($this->$accessor()); + return ! is_null($this->$accessor()); } return isset($this->$attribute);
true
Other
laravel
framework
2c64b62f61ba0bf51fc1578c9286abead664e231.json
fix merge conflicts.
tests/Support/SupportHelpersTest.php
@@ -351,7 +351,7 @@ public function testArraySortRecursive() 'bar', 'baz', 'foo', - ] + ], ]; $this->assertEquals($assumedArray, array_sort_recursive($array));
true
Other
laravel
framework
3a00e3c9dd99156e7495f1e2005e5f7134c0e7cc.json
Fix additional subqueries
src/Illuminate/Database/Query/Builder.php
@@ -640,7 +640,7 @@ public function addNestedWhereQuery($query, $boolean = 'and') $this->wheres[] = compact('type', 'query', 'boolean'); - $this->mergeBindings($query); + $this->addBinding($query->getBindings(), 'where'); } return $this; @@ -668,7 +668,7 @@ protected function whereSub($column, $operator, Closure $callback, $boolean) $this->wheres[] = compact('type', 'column', 'operator', 'query', 'boolean'); - $this->mergeBindings($query); + $this->addBinding($query->getBindings(), 'where'); return $this; } @@ -694,7 +694,7 @@ public function whereExists(Closure $callback, $boolean = 'and', $not = false) $this->wheres[] = compact('type', 'operator', 'query', 'boolean'); - $this->mergeBindings($query); + $this->addBinding($query, 'where'); return $this; } @@ -822,7 +822,7 @@ protected function whereInSub($column, Closure $callback, $boolean, $not) $this->wheres[] = compact('type', 'column', 'query', 'boolean'); - $this->mergeBindings($query); + $this->addBinding($query->getBindings(), 'where'); return $this; } @@ -1234,7 +1234,9 @@ public function union($query, $all = false) $this->unions[] = compact('query', 'all'); - return $this->addBinding($query->bindings, 'union'); + $this->addBinding($query->bindings, 'union'); + + return $this; } /**
true
Other
laravel
framework
3a00e3c9dd99156e7495f1e2005e5f7134c0e7cc.json
Fix additional subqueries
tests/Database/DatabaseQueryBuilderTest.php
@@ -312,10 +312,11 @@ public function testUnions() $this->assertEquals([0 => 1, 1 => 2], $builder->getBindings()); $builder = $this->getMysqlBuilder(); - $second = $this->getMysqlBuilder()->select('*')->from('users')->orderByRaw('id = ?', 2); - $third = $this->getMysqlBuilder()->select('*')->from('users')->where('id', 3)->groupBy('id')->having('id', '!=', 4); - $builder->groupBy('a')->having('a', '=', 1)->union($second)->union($third); - $this->assertEquals([0 => 1, 1 => 2, 2 => 3, 3 => 4], $builder->getBindings()); + $expectedSql = '(select `a` from `t1` where `a` = ? and `b` = ?) union (select `a` from `t2` where `a` = ? and `b` = ?) order by `a` asc limit 10'; + $union = $this->getMysqlBuilder()->select('a')->from('t2')->where('a', 11)->where('b', 2); + $builder->select('a')->from('t1')->where('a', 10)->where('b', 1)->union($union)->orderBy('a')->limit(10); + $this->assertEquals($expectedSql, $builder->toSql()); + $this->assertEquals([0 => 10, 1 => 1, 2 => 11, 3 => 2], $builder->getBindings()); } public function testUnionAlls() @@ -846,6 +847,23 @@ public function testAggregateWithSubSelect() $this->assertEquals(['foo'], $builder->getBindings()); } + public function testSubqueriesBindings() + { + $builder = $this->getBuilder(); + $second = $this->getBuilder()->select('*')->from('users')->orderByRaw('id = ?', 2); + $third = $this->getBuilder()->select('*')->from('users')->where('id', 3)->groupBy('id')->having('id', '!=', 4); + $builder->groupBy('a')->having('a', '=', 1)->union($second)->union($third); + $this->assertEquals([0 => 1, 1 => 2, 2 => 3, 3 => 4], $builder->getBindings()); + + $builder = $this->getBuilder()->select('*')->from('users')->where('email', '=', function ($q) { + $q->select(new Raw('max(id)')) + ->from('users')->where('email', '=', 'bar') + ->orderByRaw('email like ?', '%.com') + ->groupBy('id')->having('id', '=', 4); + })->orWhere('id', '=', 'foo')->groupBy('id')->having('id', '=', 5); + $this->assertEquals([0 => 'bar', 1 => 4, 2 => '%.com', 3 => 'foo', 4 => 5], $builder->getBindings()); + } + public function testInsertMethod() { $builder = $this->getBuilder();
true
Other
laravel
framework
89c5f0b6b9de31895709153af2ed98ab3f38c923.json
Fix bindings on unions by added a new binding type
src/Illuminate/Database/Query/Builder.php
@@ -49,6 +49,7 @@ class Builder 'where' => [], 'having' => [], 'order' => [], + 'union' => [], ]; /** @@ -1233,7 +1234,7 @@ public function union($query, $all = false) $this->unions[] = compact('query', 'all'); - return $this->mergeBindings($query); + return $this->addBinding($query->bindings, 'union'); } /**
true
Other
laravel
framework
89c5f0b6b9de31895709153af2ed98ab3f38c923.json
Fix bindings on unions by added a new binding type
tests/Database/DatabaseQueryBuilderTest.php
@@ -310,6 +310,12 @@ public function testUnions() $builder->union($this->getMySqlBuilder()->select('*')->from('users')->where('id', '=', 2)); $this->assertEquals('(select * from `users` where `id` = ?) union (select * from `users` where `id` = ?)', $builder->toSql()); $this->assertEquals([0 => 1, 1 => 2], $builder->getBindings()); + + $builder = $this->getMysqlBuilder(); + $second = $this->getMysqlBuilder()->select('*')->from('users')->orderByRaw('id = ?', 2); + $third = $this->getMysqlBuilder()->select('*')->from('users')->where('id', 3)->groupBy('id')->having('id', '!=', 4); + $builder->groupBy('a')->having('a', '=', 1)->union($second)->union($third); + $this->assertEquals([0 => 1, 1 => 2, 2 => 3, 3 => 4], $builder->getBindings()); } public function testUnionAlls()
true
Other
laravel
framework
5ce38d712d381cff62849b935c1bc3a701331d9e.json
Allow multi-dimentional arrays
src/Illuminate/Pagination/AbstractPaginator.php
@@ -128,7 +128,7 @@ public function url($page) } return $this->path.'?' - .http_build_query($parameters, null, '&') + .url_decode(http_build_query($parameters, null, '&')) .$this->buildFragment(); }
false
Other
laravel
framework
ce2b1a271352bb19a1785a337c6551bc63d7fe23.json
Fix typo in with() docblock.
src/Illuminate/Database/Eloquent/Model.php
@@ -703,7 +703,7 @@ public function load($relations) } /** - * Being querying a model with eager loading. + * Begin querying a model with eager loading. * * @param array|string $relations * @return \Illuminate\Database\Eloquent\Builder|static
false
Other
laravel
framework
65fec46142e4e9d284aee2a4d8b07c87be8934bf.json
remove repeated code
src/Illuminate/Database/Migrations/Migrator.php
@@ -157,22 +157,20 @@ public function rollback($pretend = false) // of them "down" to reverse the last migration "operation" which ran. $migrations = $this->repository->getLast(); - $migrationsCount = count($migrations); + $count = count($migrations); - if ($migrationsCount === 0) { + if ($count === 0) { $this->note('<info>Nothing to rollback.</info>'); - - return $migrationsCount; - } - - // We need to reverse these migrations so that they are "downed" in reverse - // to what they run on "up". It lets us backtrack through the migrations - // and properly reverse the entire database schema operation that ran. - foreach ($migrations as $migration) { - $this->runDown((object) $migration, $pretend); + } else { + // We need to reverse these migrations so that they are "downed" in reverse + // to what they run on "up". It lets us backtrack through the migrations + // and properly reverse the entire database schema operation that ran. + foreach ($migrations as $migration) { + $this->runDown((object) $migration, $pretend); + } } - return $migrationsCount; + return $count; } /** @@ -187,19 +185,17 @@ public function reset($pretend = false) $migrations = array_reverse($this->repository->getRan()); - $migrationsCount = count($migrations); + $count = count($migrations); - if ($migrationsCount === 0) { + if ($count === 0) { $this->note('<info>Nothing to rollback.</info>'); - - return $migrationsCount; - } - - foreach ($migrations as $migration) { - $this->runDown((object) ['migration' => $migration], $pretend); + } else { + foreach ($migrations as $migration) { + $this->runDown((object) ['migration' => $migration], $pretend); + } } - return $migrationsCount; + return $count; } /**
false
Other
laravel
framework
3d8146a58232d6a69818e9d2c2d2b18660b0fc33.json
add a blank line between methods.
src/Illuminate/Foundation/Testing/CrawlerTrait.php
@@ -673,13 +673,14 @@ protected function filterByNameOrId($name, $element = '*') public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) { $kernel = $this->app->make('Illuminate\Contracts\Http\Kernel'); + $this->currentUri = $this->prepareUrlForRequest($uri); $request = Request::create( $this->currentUri, $method, $parameters, $cookies, $files, $server, $content ); - + $response = $kernel->handle($request); $kernel->terminate($request, $response);
false
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Database/Connection.php
@@ -6,6 +6,7 @@ use Closure; use DateTime; use Exception; +use Throwable; use LogicException; use RuntimeException; use Illuminate\Support\Arr; @@ -450,7 +451,7 @@ public function prepareBindings(array $bindings) /** * Execute a Closure within a transaction. * - * @param \Closure $callback + * @param \Throwable $callback * @return mixed * * @throws \Exception @@ -474,6 +475,10 @@ public function transaction(Closure $callback) catch (Exception $e) { $this->rollBack(); + throw $e; + } catch (Throwable $e) { + $this->rollBack(); + throw $e; }
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Database/ConnectionInterface.php
@@ -107,7 +107,7 @@ public function prepareBindings(array $bindings); * @param \Closure $callback * @return mixed * - * @throws \Exception + * @throws \Throwable */ public function transaction(Closure $callback);
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Database/SqlServerConnection.php
@@ -4,6 +4,7 @@ use Closure; use Exception; +use Throwable; use Doctrine\DBAL\Driver\PDOSqlsrv\Driver as DoctrineDriver; use Illuminate\Database\Query\Processors\SqlServerProcessor; use Illuminate\Database\Query\Grammars\SqlServerGrammar as QueryGrammar; @@ -17,7 +18,7 @@ class SqlServerConnection extends Connection * @param \Closure $callback * @return mixed * - * @throws \Exception + * @throws \Throwable */ public function transaction(Closure $callback) { @@ -42,6 +43,10 @@ public function transaction(Closure $callback) catch (Exception $e) { $this->pdo->exec('ROLLBACK TRAN'); + throw $e; + } catch (Throwable $e) { + $this->pdo->exec('ROLLBACK TRAN'); + throw $e; }
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
@@ -2,10 +2,12 @@ namespace Illuminate\Foundation\Bootstrap; +use Exception; use ErrorException; use Illuminate\Contracts\Foundation\Application; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Debug\Exception\FatalErrorException; +use Symfony\Component\Debug\Exception\FatalThrowableError; class HandleExceptions { @@ -65,11 +67,15 @@ public function handleError($level, $message, $file = '', $line = 0, $context = * the HTTP and Console kernels. But, fatal error exceptions must * be handled differently since they are not normal exceptions. * - * @param \Exception $e + * @param \Throwable $e * @return void */ public function handleException($e) { + if (!$e instanceof Exception) { + $e = new FatalThrowableError($e); + } + $this->getExceptionHandler()->report($e); if ($this->app->runningInConsole()) {
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Foundation/Console/Kernel.php
@@ -3,11 +3,13 @@ namespace Illuminate\Foundation\Console; use Exception; +use Throwable; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Application as Artisan; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Console\Kernel as KernelContract; +use Symfony\Component\Debug\Exception\FatalThrowableError; class Kernel implements KernelContract { @@ -101,6 +103,14 @@ public function handle($input, $output = null) $this->renderException($output, $e); + return 1; + } catch (Throwable $e) { + $e = new FatalThrowableError($e); + + $this->reportException($e); + + $this->renderException($output, $e); + return 1; } }
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Foundation/Http/Kernel.php
@@ -3,12 +3,14 @@ namespace Illuminate\Foundation\Http; use Exception; +use Throwable; use RuntimeException; use Illuminate\Routing\Router; use Illuminate\Pipeline\Pipeline; use Illuminate\Support\Facades\Facade; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Http\Kernel as KernelContract; +use Symfony\Component\Debug\Exception\FatalThrowableError; class Kernel implements KernelContract { @@ -87,6 +89,12 @@ public function handle($request) } catch (Exception $e) { $this->reportException($e); + $response = $this->renderException($request, $e); + } catch (Throwable $e) { + $e = new FatalThrowableError($e); + + $this->reportException($e); + $response = $this->renderException($request, $e); }
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Queue/SyncQueue.php
@@ -3,6 +3,7 @@ namespace Illuminate\Queue; use Exception; +use Throwable; use Illuminate\Queue\Jobs\SyncJob; use Illuminate\Contracts\Queue\Job; use Illuminate\Contracts\Queue\Queue as QueueContract; @@ -16,7 +17,7 @@ class SyncQueue extends Queue implements QueueContract * @param mixed $data * @param string $queue * @return mixed - * @throws \Exception + * @throws \Throwable */ public function push($job, $data = '', $queue = null) { @@ -27,6 +28,10 @@ public function push($job, $data = '', $queue = null) } catch (Exception $e) { $this->handleFailedJob($queueJob); + throw $e; + } catch (Throwable $e) { + $this->handleFailedJob($queueJob); + throw $e; }
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/Queue/Worker.php
@@ -3,11 +3,13 @@ namespace Illuminate\Queue; use Exception; +use Throwable; use Illuminate\Contracts\Queue\Job; use Illuminate\Contracts\Events\Dispatcher; +use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Queue\Failed\FailedJobProviderInterface; +use Symfony\Component\Debug\Exception\FatalThrowableError; use Illuminate\Contracts\Cache\Repository as CacheContract; -use Illuminate\Contracts\Debug\ExceptionHandler; class Worker { @@ -111,6 +113,10 @@ protected function runNextJobForDaemon($connectionName, $queue, $delay, $sleep, if ($this->exceptions) { $this->exceptions->report($e); } + } catch (Throwable $e) { + if ($this->exceptions) { + $this->exceptions->report(new FatalThrowableError($e)); + } } } @@ -187,7 +193,7 @@ protected function getNextJob($connection, $queue) * @param int $delay * @return void * - * @throws \Exception + * @throws \Throwable */ public function process($connection, Job $job, $maxTries = 0, $delay = 0) { @@ -210,6 +216,12 @@ public function process($connection, Job $job, $maxTries = 0, $delay = 0) $job->release($delay); } + throw $e; + } catch (Throwable $e) { + if (!$job->isDeleted()) { + $job->release($delay); + } + throw $e; } }
true
Other
laravel
framework
03221c9a0ac66d6b3f6f1b239d125ded467bf360.json
Support php 7 throwables
src/Illuminate/View/Engines/PhpEngine.php
@@ -3,6 +3,8 @@ namespace Illuminate\View\Engines; use Exception; +use Throwable; +use Symfony\Component\Debug\Exception\FatalThrowableError; class PhpEngine implements EngineInterface { @@ -40,6 +42,8 @@ protected function evaluatePath($__path, $__data) include $__path; } catch (Exception $e) { $this->handleViewException($e, $obLevel); + } catch (Throwable $e) { + $this->handleViewException(new FatalThrowableError($e), $obLevel); } return ltrim(ob_get_clean());
true
Other
laravel
framework
191a8499eb9c7226e4564633143a82bdfd9510bd.json
Improve artisan make:listener feedback
src/Illuminate/Foundation/Console/ListenerMakeCommand.php
@@ -29,6 +29,20 @@ class ListenerMakeCommand extends GeneratorCommand */ protected $type = 'Listener'; + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + if (!$this->option('event')) { + return $this->error("Missing required --event option"); + } + + parent::fire(); + } + /** * Build the class with the given name. *
false
Other
laravel
framework
7937238d6313a9e87ec57adfff5383d1204d8e7b.json
Add all() to the Config contract
src/Illuminate/Contracts/Config/Repository.php
@@ -47,4 +47,11 @@ public function prepend($key, $value); * @return void */ public function push($key, $value); + + /** + * Get all of the configuration items for the application. + * + * @return array + */ + public function all(); }
false
Other
laravel
framework
4ffb4a33c881e8e6443a3b09a66ccdc57e6ac028.json
Modify dd() to conform to PSR2
src/Illuminate/Support/helpers.php
@@ -430,7 +430,9 @@ function data_get($target, $key, $default = null) */ function dd() { - array_map(function ($x) { (new Dumper)->dump($x); }, func_get_args()); + array_map(function ($x) { + (new Dumper)->dump($x); + }, func_get_args()); die(1); }
false
Other
laravel
framework
ac5c52b2e108d2b2eb4bc84d2d7b08c2237c09b7.json
Remove old code that was never documented or used.
src/Illuminate/Foundation/Testing/TestCase.php
@@ -9,13 +9,6 @@ abstract class TestCase extends PHPUnit_Framework_TestCase { use ApplicationTrait, AssertionsTrait, CrawlerTrait; - /** - * The Eloquent factory instance. - * - * @var \Illuminate\Database\Eloquent\Factory - */ - protected $factory; - /** * The callbacks that should be run before the application is destroyed. * @@ -42,10 +35,6 @@ public function setUp() if (!$this->app) { $this->refreshApplication(); } - - if (!$this->factory) { - $this->factory = $this->app->make('Illuminate\Database\Eloquent\Factory'); - } } /**
false
Other
laravel
framework
5721d82315de50adc81eb0fe8167c4c8b18138c6.json
remove unneeded tests.
tests/View/ViewBladeCompilerTest.php
@@ -159,29 +159,6 @@ public function testEscapedWithAtEchosAreCompiled() ')); } - public function testReversedEchosAreCompiled() - { - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $compiler->setEscapedContentTags('{{', '}}'); - $compiler->setContentTags('{{{', '}}}'); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{$name}}')); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{$name}}}')); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{ $name }}}')); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{ - $name - }}}')); - } - - public function testShortRawEchosAreCompiled() - { - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $compiler->setRawTags('{{', '}}'); - $this->assertEquals('<?php echo $name; ?>', $compiler->compileString('{{$name}}')); - $this->assertEquals('<?php echo $name; ?>', $compiler->compileString('{{ $name }}')); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{$name}}}')); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('{{{ $name }}}')); - } - public function testExtendsAreCompiled() { $compiler = new BladeCompiler($this->getFiles(), __DIR__); @@ -535,19 +512,6 @@ public function testCustomShortStatements() $this->assertEquals($expected, $compiler->compileString($string)); } - public function testConfiguringContentTags() - { - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $compiler->setContentTags('[[', ']]'); - $compiler->setEscapedContentTags('[[[', ']]]'); - - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('[[[ $name ]]]')); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('[[ $name ]]')); - $this->assertEquals('<?php echo e($name); ?>', $compiler->compileString('[[ - $name - ]]')); - } - public function testRawTagsCanBeSetToLegacyValues() { $compiler = new BladeCompiler($this->getFiles(), __DIR__); @@ -605,26 +569,6 @@ public function testSequentialCompileStringCalls() $this->assertEquals($expected, $compiler->compileString($string)); } - /** - * @dataProvider testGetTagsProvider() - */ - public function testSetAndRetrieveContentTags($openingTag, $closingTag) - { - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $compiler->setContentTags($openingTag, $closingTag); - $this->assertSame([$openingTag, $closingTag], $compiler->getContentTags()); - } - - /** - * @dataProvider testGetTagsProvider() - */ - public function testSetAndRetrieveEscapedContentTags($openingTag, $closingTag) - { - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $compiler->setEscapedContentTags($openingTag, $closingTag); - $this->assertSame([$openingTag, $closingTag], $compiler->getEscapedContentTags()); - } - public function testGetTagsProvider() { return [
false
Other
laravel
framework
73ab0d56526488bfb1692e014deda17ea0b78599.json
fix several problems
src/Illuminate/Queue/Console/ListFailedCommand.php
@@ -69,7 +69,7 @@ protected function parseFailedJob(array $failed) { $row = array_values(array_except($failed, ['payload'])); - array_splice($row, 3, 0, $this->setPayload($failed['payload'])); + array_splice($row, 3, 0, $this->extractJobName($failed['payload'])); return $row; } @@ -79,20 +79,23 @@ protected function parseFailedJob(array $failed) * * @return string */ - private function setPayload($payload) + private function extractJobName($payload) { - $response = ''; + $payload = json_decode($payload, true); - $jsonDecode = json_decode($payload, true); + if ($payload && (! isset($payload['data']['command']))) { + return array_get($payload, 'job'); + } - if ($jsonDecode && array_key_exists('data', $jsonDecode)) { - $data = unserialize($jsonDecode['data']['command']); - $name = (is_object($data) ? get_class($data) : substr(var_export($data, true), 0, 40)); + if ($payload && isset($payload['data']['command'])) { + preg_match('/"([^"]+)"/', $payload['data']['command'], $matches); - $response .= $name; + if (isset($matches[1])) { + return $matches[1]; + } else { + return array_get($payload['job']); + } } - - return $response; } /**
false
Other
laravel
framework
ae0e42fb7ff008e48abd4baa7427bba3232ab9fe.json
Cleanup the caster
src/Illuminate/Foundation/Console/IlluminateCaster.php
@@ -6,7 +6,6 @@ use Illuminate\Support\Collection; use Illuminate\Foundation\Application; use Illuminate\Database\Eloquent\Model; -use Symfony\Component\VarDumper\Cloner\Stub; use Symfony\Component\VarDumper\Caster\Caster; class IlluminateCaster @@ -37,41 +36,33 @@ class IlluminateCaster * Get an array representing the properties of an application. * * @param \Illuminate\Foundation\Application $app - * @param array $a - * @param Stub $stub - * @param bool $isNested - * @param int $filter * @return array */ - public static function castApplication(Application $app, array $a, Stub $stub, $isNested, $filter = 0) + public static function castApplication(Application $app) { - $a = []; + $result = []; foreach (self::$appProperties as $property) { try { $val = $app->$property(); if (!is_null($val)) { - $a[Caster::PREFIX_VIRTUAL . $property] = $val; + $result[Caster::PREFIX_VIRTUAL . $property] = $val; } } catch (Exception $e) { // } } - return $a; + return $result; } /** * Get an array representing the properties of a collection. * * @param \Illuminate\Support\Collection $value - * @param array $a - * @param Stub $stub - * @param bool $isNested - * @param int $filter * @return array */ - public static function castCollection(Collection $coll, array $a, Stub $stub, $isNested, $filter = 0) + public static function castCollection(Collection $collection) { return [ Caster::PREFIX_VIRTUAL.'all' => $coll->all(), @@ -82,23 +73,20 @@ public static function castCollection(Collection $coll, array $a, Stub $stub, $i * Get an array representing the properties of a model. * * @param \Illuminate\Database\Eloquent\Model $model - * @param array $a - * @param Stub $stub - * @param bool $isNested - * @param int $filter * @return array */ - public static function castModel(Model $model, array $a, Stub $stub, $isNested, $filter = 0) + public static function castModel(Model $model) { $attributes = array_merge($model->getAttributes(), $model->getRelations()); $visible = array_flip($model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden())); $attributes = array_intersect_key($attributes, $visible); - $a = []; + $result = []; + foreach ($attributes as $key => $value) { - $a[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value; + $result[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value; } - return $a; + return $result; } }
false
Other
laravel
framework
f7eba2089b91733b70ae25dd36556111ed3b4313.json
Fix psysh upgrade
composer.json
@@ -26,7 +26,7 @@ "monolog/monolog": "~1.11", "mtdowling/cron-expression": "~1.0", "nesbot/carbon": "~1.19", - "psy/psysh": "0.5.*", + "psy/psysh": "~0.5.1", "swiftmailer/swiftmailer": "~5.1", "symfony/console": "2.7.*", "symfony/css-selector": "2.7.*",
true
Other
laravel
framework
f7eba2089b91733b70ae25dd36556111ed3b4313.json
Fix psysh upgrade
src/Illuminate/Foundation/Console/Tinker/IlluminateCaster.php
@@ -3,16 +3,16 @@ namespace Illuminate\Foundation\Console\Tinker\Casters; use Exception; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Application; use Illuminate\Support\Collection; -use Symfony\Component\VarDumper\Caster\Caster; +use Illuminate\Foundation\Application; +use Illuminate\Database\Eloquent\Model; use Symfony\Component\VarDumper\Cloner\Stub; +use Symfony\Component\VarDumper\Caster\Caster; class FoundationCaster { /** - * Illuminate Application methods to include in the presenter. + * Illuminate application methods to include in the presenter. * * @var array */ @@ -34,9 +34,9 @@ class FoundationCaster ]; /** - * Get an array representing the properties of an Application object. + * Get an array representing the properties of an application. * - * @param Application $value + * @param \Illuminate\Foundation\Application $app * @param array $a * @param Stub $stub * @param bool $isNested @@ -49,21 +49,22 @@ public static function castApplication(Application $app, array $a, Stub $stub, $ foreach (self::$appProperties as $property) { try { - $val = $value->$property(); - if ( ! is_null($val)) { + $val = $app->$property(); + if (!is_null($val)) { $a[Caster::PREFIX_VIRTUAL . $property] = $val; } } catch (Exception $e) { + // } } return $a; } /** - * Get an array representing the properties of a Collection. + * Get an array representing the properties of a collection. * - * @param Collection $value + * @param \Illuminate\Support\Collection $value * @param array $a * @param Stub $stub * @param bool $isNested @@ -78,9 +79,9 @@ public static function castCollection(Collection $coll, array $a, Stub $stub, $i } /** - * Get an array representing the properties of a Model object. + * Get an array representing the properties of a model. * - * @param Application $value + * @param \Illuminate\Database\Eloquent\Model $model * @param array $a * @param Stub $stub * @param bool $isNested
true
Other
laravel
framework
f7eba2089b91733b70ae25dd36556111ed3b4313.json
Fix psysh upgrade
src/Illuminate/Foundation/Console/TinkerCommand.php
@@ -73,15 +73,15 @@ protected function getCommands() } /** - * Get an array of Laravel tailored Casters. + * Get an array of Laravel tailored casters. * * @return array */ protected function getCasters() { return [ - 'Illuminate\Foundation\Application' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castApplication', - 'Illuminate\Support\Collection' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castCollection', + 'Illuminate\Foundation\Application' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castApplication', + 'Illuminate\Support\Collection' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castCollection', 'Illuminate\Database\Eloquent\Model' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castModel', ]; }
true
Other
laravel
framework
9cd2ea83b04a696a8ebba040f95ae69ae173f6a8.json
Replace Presenters by Casters for PsySH 0.5 Signed-off-by: Graham Campbell <graham@alt-three.com>
composer.json
@@ -26,7 +26,7 @@ "monolog/monolog": "~1.11", "mtdowling/cron-expression": "~1.0", "nesbot/carbon": "~1.19", - "psy/psysh": "0.4.*", + "psy/psysh": "0.5.*", "swiftmailer/swiftmailer": "~5.1", "symfony/console": "2.7.*", "symfony/css-selector": "2.7.*",
true
Other
laravel
framework
9cd2ea83b04a696a8ebba040f95ae69ae173f6a8.json
Replace Presenters by Casters for PsySH 0.5 Signed-off-by: Graham Campbell <graham@alt-three.com>
src/Illuminate/Foundation/Console/Tinker/IlluminateCaster.php
@@ -0,0 +1,103 @@ +<?php + +namespace Illuminate\Foundation\Console\Tinker\Casters; + +use Exception; +use Illuminate\Database\Eloquent\Model; +use Illuminate\Foundation\Application; +use Illuminate\Support\Collection; +use Symfony\Component\VarDumper\Caster\Caster; +use Symfony\Component\VarDumper\Cloner\Stub; + +class FoundationCaster +{ + /** + * Illuminate Application methods to include in the presenter. + * + * @var array + */ + private static $appProperties = [ + 'configurationIsCached', + 'environment', + 'environmentFile', + 'isLocal', + 'routesAreCached', + 'runningUnitTests', + 'version', + 'path', + 'basePath', + 'configPath', + 'databasePath', + 'langPath', + 'publicPath', + 'storagePath', + ]; + + /** + * Get an array representing the properties of an Application object. + * + * @param Application $value + * @param array $a + * @param Stub $stub + * @param bool $isNested + * @param int $filter + * @return array + */ + public static function castApplication(Application $app, array $a, Stub $stub, $isNested, $filter = 0) + { + $a = []; + + foreach (self::$appProperties as $property) { + try { + $val = $value->$property(); + if ( ! is_null($val)) { + $a[Caster::PREFIX_VIRTUAL . $property] = $val; + } + } catch (Exception $e) { + } + } + + return $a; + } + + /** + * Get an array representing the properties of a Collection. + * + * @param Collection $value + * @param array $a + * @param Stub $stub + * @param bool $isNested + * @param int $filter + * @return array + */ + public static function castCollection(Collection $coll, array $a, Stub $stub, $isNested, $filter = 0) + { + return [ + Caster::PREFIX_VIRTUAL.'all' => $coll->all(), + ]; + } + + /** + * Get an array representing the properties of a Model object. + * + * @param Application $value + * @param array $a + * @param Stub $stub + * @param bool $isNested + * @param int $filter + * @return array + */ + public static function castModel(Model $model, array $a, Stub $stub, $isNested, $filter = 0) + { + $attributes = array_merge($model->getAttributes(), $model->getRelations()); + $visible = array_flip($model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden())); + $attributes = array_intersect_key($attributes, $visible); + + $a = []; + foreach ($attributes as $key => $value) { + $a[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value; + } + + return $a; + } +}
true
Other
laravel
framework
9cd2ea83b04a696a8ebba040f95ae69ae173f6a8.json
Replace Presenters by Casters for PsySH 0.5 Signed-off-by: Graham Campbell <graham@alt-three.com>
src/Illuminate/Foundation/Console/Tinker/Presenters/EloquentModelPresenter.php
@@ -1,68 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Tinker\Presenters; - -use ReflectionClass; -use ReflectionProperty; -use Psy\Presenter\ObjectPresenter; -use Illuminate\Database\Eloquent\Model; - -class EloquentModelPresenter extends ObjectPresenter -{ - /** - * Determine if the presenter can present the given value. - * - * @param mixed $value - * @return bool - */ - public function canPresent($value) - { - return $value instanceof Model; - } - - /** - * Get an array of Model object properties. - * - * @param object $value - * @param \ReflectionClass $class - * @param int $propertyFilter - * @return array - */ - public function getProperties($value, ReflectionClass $class, $propertyFilter) - { - $attributes = array_merge($value->getAttributes(), $value->getRelations()); - - $visible = $value->getVisible(); - - if (count($visible) === 0) { - $visible = array_diff(array_keys($attributes), $value->getHidden()); - } - - if (!$this->showHidden($propertyFilter)) { - return array_intersect_key($attributes, array_flip($visible)); - } - - $properties = []; - - foreach ($attributes as $key => $value) { - if (!in_array($key, $visible)) { - $key = sprintf('<protected>%s</protected>', $key); - } - - $properties[$key] = $value; - } - - return $properties; - } - - /** - * Decide whether to show hidden properties, based on a ReflectionProperty filter. - * - * @param int $propertyFilter - * @return bool - */ - protected function showHidden($propertyFilter) - { - return $propertyFilter & (ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE); - } -}
true
Other
laravel
framework
9cd2ea83b04a696a8ebba040f95ae69ae173f6a8.json
Replace Presenters by Casters for PsySH 0.5 Signed-off-by: Graham Campbell <graham@alt-three.com>
src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateApplicationPresenter.php
@@ -1,71 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Tinker\Presenters; - -use Exception; -use ReflectionClass; -use Psy\Presenter\ObjectPresenter; -use Illuminate\Foundation\Application; - -class IlluminateApplicationPresenter extends ObjectPresenter -{ - /** - * Illuminate Application methods to include in the presenter. - * - * @var array - */ - protected static $appProperties = [ - 'configurationIsCached', - 'environment', - 'environmentFile', - 'isLocal', - 'routesAreCached', - 'runningUnitTests', - 'version', - 'path', - 'basePath', - 'configPath', - 'databasePath', - 'langPath', - 'publicPath', - 'storagePath', - ]; - - /** - * Determine if the presenter can present the given value. - * - * @param mixed $value - * @return bool - */ - public function canPresent($value) - { - return $value instanceof Application; - } - - /** - * Get an array of Application object properties. - * - * @param object $value - * @param \ReflectionClass $class - * @param int $propertyFilter - * @return array - */ - public function getProperties($value, ReflectionClass $class, $propertyFilter) - { - $properties = []; - - foreach (self::$appProperties as $property) { - try { - $val = $value->$property(); - - if (!is_null($val)) { - $properties[$property] = $val; - } - } catch (Exception $e) { - // - } - } - - return $properties; - } -}
true
Other
laravel
framework
9cd2ea83b04a696a8ebba040f95ae69ae173f6a8.json
Replace Presenters by Casters for PsySH 0.5 Signed-off-by: Graham Campbell <graham@alt-three.com>
src/Illuminate/Foundation/Console/Tinker/Presenters/IlluminateCollectionPresenter.php
@@ -1,42 +0,0 @@ -<?php - -namespace Illuminate\Foundation\Console\Tinker\Presenters; - -use Psy\Presenter\ArrayPresenter; -use Illuminate\Support\Collection; - -class IlluminateCollectionPresenter extends ArrayPresenter -{ - /** - * Determine if the presenter can present the given value. - * - * @param mixed $value - * @return bool - */ - public function canPresent($value) - { - return $value instanceof Collection; - } - - /** - * Determine if the given value is a collection. - * - * @param object $value - * @return bool - */ - protected function isArrayObject($value) - { - return $value instanceof Collection; - } - - /** - * Get an array of collection values. - * - * @param object $value - * @return array - */ - protected function getArrayObjectValue($value) - { - return $value->all(); - } -}
true
Other
laravel
framework
9cd2ea83b04a696a8ebba040f95ae69ae173f6a8.json
Replace Presenters by Casters for PsySH 0.5 Signed-off-by: Graham Campbell <graham@alt-three.com>
src/Illuminate/Foundation/Console/TinkerCommand.php
@@ -6,9 +6,6 @@ use Psy\Configuration; use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputArgument; -use Illuminate\Foundation\Console\Tinker\Presenters\EloquentModelPresenter; -use Illuminate\Foundation\Console\Tinker\Presenters\IlluminateCollectionPresenter; -use Illuminate\Foundation\Console\Tinker\Presenters\IlluminateApplicationPresenter; class TinkerCommand extends Command { @@ -46,8 +43,8 @@ public function fire() $config = new Configuration; - $config->getPresenterManager()->addPresenters( - $this->getPresenters() + $config->getPresenter()->addCasters( + $this->getCasters() ); $shell = new Shell($config); @@ -76,16 +73,16 @@ protected function getCommands() } /** - * Get an array of Laravel tailored Presenters. + * Get an array of Laravel tailored Casters. * * @return array */ - protected function getPresenters() + protected function getCasters() { return [ - new EloquentModelPresenter, - new IlluminateCollectionPresenter, - new IlluminateApplicationPresenter, + 'Illuminate\Foundation\Application' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castApplication', + 'Illuminate\Support\Collection' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castCollection', + 'Illuminate\Database\Eloquent\Model' => 'Illuminate\Foundation\Console\Tinker\IlluminateCaster::castModel', ]; }
true
Other
laravel
framework
e3c381570a239c2d8d96607eeef5173a760af50d.json
Add test for incrementing forever cache item
tests/Cache/CacheFileStoreTest.php
@@ -68,6 +68,17 @@ public function testForeversAreStoredWithHighTimestamp() $store->forever('foo', 'Hello World', 10); } + public function testForeversAreNotRemovedOnIncrement() + { + $files = $this->mockFilesystem(); + $contents = '9999999999'.serialize('Hello World'); + $store = new FileStore($files, __DIR__); + $store->forever('foo', 'Hello World'); + $store->increment('foo'); + $files->expects($this->once())->method('get')->will($this->returnValue($contents)); + $this->assertEquals('Hello World', $store->get('foo')); + } + public function testRemoveDeletesFileDoesntExist() { $files = $this->mockFilesystem();
false
Other
laravel
framework
18dfea3a1c47116407bb7cefd6897318b9f2087a.json
Add root url to elixir
src/Illuminate/Foundation/helpers.php
@@ -688,7 +688,7 @@ function elixir($file) } if (isset($manifest[$file])) { - return '/build/'.$manifest[$file]; + return asset('build/'.$manifest[$file]); } throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
false
Other
laravel
framework
dd6433fad46a5076ac8080ca42cd1a1ed1930613.json
Fix wrong @return docblock in updateExistingPivot
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
@@ -832,7 +832,7 @@ protected function attachNew(array $records, array $current, $touch = true) * @param mixed $id * @param array $attributes * @param bool $touch - * @return void + * @return int */ public function updateExistingPivot($id, array $attributes, $touch = true) {
false
Other
laravel
framework
7612009667db1b7796a3525ce8614ccec38def53.json
add comment. fix formatting
src/Illuminate/Database/Query/Builder.php
@@ -1643,7 +1643,12 @@ public function aggregate($function, $columns = ['*']) $this->aggregate = compact('function', 'columns'); $previousColumns = $this->columns; + + // We will also back up the select bindings since the select clause will be + // removed when performing the aggregate function. Once the query is run + // we will add the bindings back onto this query so they can get used. $previousSelectBindings = $this->bindings['select']; + $this->bindings['select'] = []; $results = $this->get($columns); @@ -1654,6 +1659,7 @@ public function aggregate($function, $columns = ['*']) $this->aggregate = null; $this->columns = $previousColumns; + $this->bindings['select'] = $previousSelectBindings; if (isset($results[0])) {
false
Other
laravel
framework
407ee032a90e9e2a26774f4a346228f54a132eb7.json
Fix bug in lockout.
src/Illuminate/Foundation/Auth/ThrottlesLogins.php
@@ -18,8 +18,12 @@ protected function hasTooManyLoginAttempts(Request $request) { $attempts = $this->getLoginAttempts($request); - if ($attempts > 5) { - Cache::add($this->getLoginLockExpirationKey($request), time() + 60, 1); + $lockedOut = Cache::has($this->getLoginLockExpirationKey($request)); + + if ($attempts > 5 || $lockedOut) { + if (! $lockedOut) { + Cache::put($this->getLoginLockExpirationKey($request), time() + 60, 1); + } return true; }
false
Other
laravel
framework
e14199a3386f86af84efbad2d83ef62f851ebb5b.json
Add support for localization in AuthenticatesUsers Just suggestion, add lang support for failed login message
src/Illuminate/Foundation/Auth/AuthenticatesUsers.php
@@ -81,7 +81,7 @@ protected function getCredentials(Request $request) */ protected function getFailedLoginMessage() { - return 'These credentials do not match our records.'; + return trans()->has('passwords.failed') ? trans('passwords.failed') : 'These credentials do not match our records.'; } /**
false
Other
laravel
framework
e963fcbe25e0b716f2a8d958a84dabb25a97670e.json
Add support for localization in ThrottlesLogins Just suggestion, and it assumes we use the existing passwords.php file in resources/lang/en Thank you.
src/Illuminate/Foundation/Auth/ThrottlesLogins.php
@@ -59,11 +59,11 @@ protected function incrementLoginAttempts(Request $request) protected function sendLockoutResponse(Request $request) { $seconds = (int) Cache::get($this->getLoginLockExpirationKey($request)) - time(); - + $key = 'passwords.throttle'; return redirect($this->loginPath()) ->withInput($request->only($this->loginUsername(), 'remember')) ->withErrors([ - $this->loginUsername() => 'Too many login attempts. Please try again in '.$seconds.' seconds.', + $this->loginUsername() => trans()->has($key) ? trans($key, ['seconds' => $seconds]) : 'Too many login attempts. Please try again in '.$seconds.' seconds.', ]); }
false