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
5796036e3f0114fd3dfdecd26b0dfd1e896faf38.json
Remove middleware contract from core middleware.
src/Illuminate/Cookie/Middleware/EncryptCookies.php
@@ -4,13 +4,12 @@ use Closure; use Symfony\Component\HttpFoundation\Cookie; -use Illuminate\Contracts\Routing\Middleware; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract; -class EncryptCookies implements Middleware +class EncryptCookies { /** * The encrypter instance.
true
Other
laravel
framework
5796036e3f0114fd3dfdecd26b0dfd1e896faf38.json
Remove middleware contract from core middleware.
src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php
@@ -3,11 +3,10 @@ namespace Illuminate\Foundation\Http\Middleware; use Closure; -use Illuminate\Contracts\Routing\Middleware; use Illuminate\Contracts\Foundation\Application; use Symfony\Component\HttpKernel\Exception\HttpException; -class CheckForMaintenanceMode implements Middleware +class CheckForMaintenanceMode { /** * The application implementation.
true
Other
laravel
framework
5796036e3f0114fd3dfdecd26b0dfd1e896faf38.json
Remove middleware contract from core middleware.
src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php
@@ -4,12 +4,11 @@ use Closure; use Illuminate\Support\Str; -use Illuminate\Contracts\Routing\Middleware; use Symfony\Component\HttpFoundation\Cookie; use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Session\TokenMismatchException; -class VerifyCsrfToken implements Middleware +class VerifyCsrfToken { /** * The encrypter implementation.
true
Other
laravel
framework
5796036e3f0114fd3dfdecd26b0dfd1e896faf38.json
Remove middleware contract from core middleware.
src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php
@@ -3,10 +3,9 @@ namespace Illuminate\Foundation\Http\Middleware; use Closure; -use Illuminate\Contracts\Routing\Middleware; use Illuminate\Http\Exception\PostTooLargeException; -class VerifyPostSize implements Middleware +class VerifyPostSize { /** * Handle an incoming request.
true
Other
laravel
framework
5796036e3f0114fd3dfdecd26b0dfd1e896faf38.json
Remove middleware contract from core middleware.
src/Illuminate/Http/Middleware/FrameGuard.php
@@ -3,9 +3,8 @@ namespace Illuminate\Http\Middleware; use Closure; -use Illuminate\Contracts\Routing\Middleware; -class FrameGuard implements Middleware +class FrameGuard { /** * Handle the given request and get the response.
true
Other
laravel
framework
5796036e3f0114fd3dfdecd26b0dfd1e896faf38.json
Remove middleware contract from core middleware.
src/Illuminate/View/Middleware/ShareErrorsFromSession.php
@@ -4,10 +4,9 @@ use Closure; use Illuminate\Support\ViewErrorBag; -use Illuminate\Contracts\Routing\Middleware; use Illuminate\Contracts\View\Factory as ViewFactory; -class ShareErrorsFromSession implements Middleware +class ShareErrorsFromSession { /** * The view factory implementation.
true
Other
laravel
framework
67f5e96738dbcf48a262f943a0e4b3e32f51d5a6.json
Allow all integer fields as SQLite serials
src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
@@ -20,7 +20,7 @@ class SQLiteGrammar extends Grammar * * @var array */ - protected $serials = ['bigInteger', 'integer']; + protected $serials = ['bigInteger', 'integer', 'mediumInteger', 'smallInteger', 'tinyInteger']; /** * Compile the query to determine if a table exists.
false
Other
laravel
framework
8c21f3ca3faf66a7f75d0ec40d4a34d9bca0e9c0.json
improve console parser. add tests
src/Illuminate/Console/Parser.php
@@ -20,12 +20,20 @@ public static function parse($expression) throw new InvalidArgumentException('Console command definition is empty.'); } - $tokens = array_values(array_filter( - array_map('trim', explode(' ', $expression)) - )); + preg_match('/.*?\s/', $expression, $matches); + + if (isset($matches[0])) { + $name = trim($matches[0]); + } else { + throw new InvalidArgumentException('Unable to determine command name from signature.'); + } + + preg_match_all('/\{.*?\}/', $expression, $matches); + + $tokens = isset($matches[0]) ? $matches[0] : []; return [ - array_shift($tokens), static::arguments($tokens), static::options($tokens), + $name, static::arguments($tokens), static::options($tokens), ]; } @@ -37,11 +45,11 @@ public static function parse($expression) */ protected static function arguments(array $tokens) { - return array_filter(array_map(function ($token) { + return array_values(array_filter(array_map(function ($token) { if (starts_with($token, '{') && !starts_with($token, '{--')) { return static::parseArgument(trim($token, '{}')); } - }, $tokens)); + }, $tokens))); } /** @@ -52,11 +60,11 @@ protected static function arguments(array $tokens) */ protected static function options(array $tokens) { - return array_filter(array_map(function ($token) { + return array_values(array_filter(array_map(function ($token) { if (starts_with($token, '{--')) { return static::parseOption(ltrim(trim($token, '{}'), '-')); } - }, $tokens)); + }, $tokens))); } /** @@ -67,21 +75,31 @@ protected static function options(array $tokens) */ protected static function parseArgument($token) { + $description = null; + + if (str_contains($token, ' : ')) { + list($token, $description) = explode(' : ', $token); + + $token = trim($token); + + $description = trim($description); + } + switch (true) { case ends_with($token, '?*'): - return new InputArgument(trim($token, '?*'), InputArgument::IS_ARRAY); + return new InputArgument(trim($token, '?*'), InputArgument::IS_ARRAY, $description); case ends_with($token, '*'): - return new InputArgument(trim($token, '*'), InputArgument::IS_ARRAY | InputArgument::REQUIRED); + return new InputArgument(trim($token, '*'), InputArgument::IS_ARRAY | InputArgument::REQUIRED, $description); case ends_with($token, '?'): - return new InputArgument(trim($token, '?'), InputArgument::OPTIONAL); + return new InputArgument(trim($token, '?'), InputArgument::OPTIONAL, $description); case (preg_match('/(.+)\=(.+)/', $token, $matches)): - return new InputArgument($matches[1], InputArgument::OPTIONAL, '', $matches[2]); + return new InputArgument($matches[1], InputArgument::OPTIONAL, $description, $matches[2]); default: - return new InputArgument($token, InputArgument::REQUIRED); + return new InputArgument($token, InputArgument::REQUIRED, $description); } } @@ -93,18 +111,28 @@ protected static function parseArgument($token) */ protected static function parseOption($token) { + $description = null; + + if (str_contains($token, ' : ')) { + list($token, $description) = explode(' : ', $token); + + $token = trim($token); + + $description = trim($description); + } + switch (true) { case ends_with($token, '='): - return new InputOption(trim($token, '='), null, InputOption::VALUE_OPTIONAL); + return new InputOption(trim($token, '='), null, InputOption::VALUE_OPTIONAL, $description); case ends_with($token, '=*'): - return new InputOption(trim($token, '=*'), null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY); + return new InputOption(trim($token, '=*'), null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $description); case (preg_match('/(.+)\=(.+)/', $token, $matches)): - return new InputOption($matches[1], null, InputOption::VALUE_OPTIONAL, '', $matches[2]); + return new InputOption($matches[1], null, InputOption::VALUE_OPTIONAL, $description, $matches[2]); default: - return new InputOption($token, null, InputOption::VALUE_NONE); + return new InputOption($token, null, InputOption::VALUE_NONE, $description); } } }
true
Other
laravel
framework
8c21f3ca3faf66a7f75d0ec40d4a34d9bca0e9c0.json
improve console parser. add tests
tests/Console/ConsoleParserTest.php
@@ -0,0 +1,49 @@ +<?php + +use Illuminate\Console\Parser; + +class ConsoleParserTest extends PHPUnit_Framework_TestCase +{ + public function testBasicParameterParsing() + { + $results = Parser::parse('command:name {argument} {--option}'); + + $this->assertEquals('command:name', $results[0]); + $this->assertEquals('argument', $results[1][0]->getName()); + $this->assertEquals('option', $results[2][0]->getName()); + $this->assertFalse($results[2][0]->acceptValue()); + + $results = Parser::parse('command:name {argument*} {--option=}'); + + $this->assertEquals('command:name', $results[0]); + $this->assertEquals('argument', $results[1][0]->getName()); + $this->assertTrue($results[1][0]->isArray()); + $this->assertTrue($results[1][0]->isRequired()); + $this->assertEquals('option', $results[2][0]->getName()); + $this->assertTrue($results[2][0]->acceptValue()); + + $results = Parser::parse('command:name {argument?*} {--option=*}'); + + $this->assertEquals('command:name', $results[0]); + $this->assertEquals('argument', $results[1][0]->getName()); + $this->assertTrue($results[1][0]->isArray()); + $this->assertFalse($results[1][0]->isRequired()); + $this->assertEquals('option', $results[2][0]->getName()); + $this->assertTrue($results[2][0]->acceptValue()); + $this->assertTrue($results[2][0]->isArray()); + + $results = Parser::parse('command:name + {argument?* : The argument description.} + {--option=* : The option description.}'); + + $this->assertEquals('command:name', $results[0]); + $this->assertEquals('argument', $results[1][0]->getName()); + $this->assertEquals('The argument description.', $results[1][0]->getDescription()); + $this->assertTrue($results[1][0]->isArray()); + $this->assertFalse($results[1][0]->isRequired()); + $this->assertEquals('option', $results[2][0]->getName()); + $this->assertEquals('The option description.', $results[2][0]->getDescription()); + $this->assertTrue($results[2][0]->acceptValue()); + $this->assertTrue($results[2][0]->isArray()); + } +}
true
Other
laravel
framework
051c68d94f812986f54d71294d66a3a7bfad5adf.json
Simplify encrypter logic.
src/Illuminate/Encryption/Encrypter.php
@@ -17,13 +17,6 @@ class Encrypter extends BaseEncrypter implements EncrypterContract */ protected $cipher; - /** - * The block size of the cipher. - * - * @var int - */ - protected $block = 16; - /** * Create a new encrypter instance. * @@ -108,6 +101,6 @@ public function decrypt($payload) */ protected function getIvSize() { - return $this->block; + return 16; } }
false
Other
laravel
framework
6cacd3e3cb43f1e672c992eaf8b4fadef36d9ac6.json
Use 256 CBC.
tests/Encryption/EncrypterTest.php
@@ -84,7 +84,7 @@ public function testOpenSslEncrypterCanDecryptMcryptedData() $key = str_random(32); $encrypter = new Illuminate\Encryption\McryptEncrypter($key); $encrypted = $encrypter->encrypt('foo'); - $openSslEncrypter = new Illuminate\Encryption\Encrypter($key); + $openSslEncrypter = new Illuminate\Encryption\Encrypter($key, 'AES-256-CBC'); $this->assertEquals('foo', $openSslEncrypter->decrypt($encrypted)); }
false
Other
laravel
framework
7c68711ce7c05ba769b87a0caebbfed86c429cf7.json
Fix listener stubs.
src/Illuminate/Foundation/Console/stubs/listener-queued.stub
@@ -2,6 +2,7 @@ namespace DummyNamespace; +use DummyFullEvent; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue;
true
Other
laravel
framework
7c68711ce7c05ba769b87a0caebbfed86c429cf7.json
Fix listener stubs.
src/Illuminate/Foundation/Console/stubs/listener.stub
@@ -2,6 +2,10 @@ namespace DummyNamespace; +use DummyFullEvent; +use Illuminate\Queue\InteractsWithQueue; +use Illuminate\Contracts\Queue\ShouldQueue; + class DummyClass { /**
true
Other
laravel
framework
97a1ae2f68f692b7f6c3d0dc3bd285d4bef119e0.json
Generate keys of the correct length
src/Illuminate/Foundation/Console/KeyGenerateCommand.php
@@ -2,7 +2,6 @@ namespace Illuminate\Foundation\Console; -use Illuminate\Support\Str; use Illuminate\Console\Command; use Symfony\Component\Console\Input\InputOption; @@ -29,7 +28,7 @@ class KeyGenerateCommand extends Command */ public function fire() { - $key = $this->getRandomKey(); + $key = $this->getRandomKey($this->laravel['config']['app.cipher']); if ($this->option('show')) { return $this->line('<comment>'.$key.'</comment>'); @@ -51,11 +50,16 @@ public function fire() /** * Generate a random key for the application. * + * @param string $cipher * @return string */ - protected function getRandomKey() + protected function getRandomKey($cipher) { - return Str::random(32); + if ($cipher === 'AES-128-CBC') { + return str_random(16); + } + + return str_random(32); } /**
false
Other
laravel
framework
46a7edb57fd35533d8465b6f865f60cf8d958ca7.json
remove extra cast
src/Illuminate/Encryption/Encrypter.php
@@ -59,7 +59,7 @@ public function __construct($key, $cipher = 'AES-128-CBC') */ protected function hasValidCipherAndKeyCombination($key, $cipher) { - $length = mb_strlen($key = (string) $key, '8bit'); + $length = mb_strlen($key, '8bit'); return ($cipher === 'AES-128-CBC' && ($length === 16 || $length === 32)) || ($cipher === 'AES-256-CBC' && $length === 32);
false
Other
laravel
framework
b38bb6bc6d0dd831a334f8bbde6bd757bee694cb.json
Make callback in Collection::filter optional
src/Illuminate/Support/Collection.php
@@ -129,12 +129,16 @@ public function fetch($key) /** * Run a filter over each of the items. * - * @param callable $callback + * @param callable|null $callback * @return static */ - public function filter(callable $callback) + public function filter(callable $callback = null) { - return new static(array_filter($this->items, $callback)); + if ($callback) { + return new static(array_filter($this->items, $callback)); + } + + return new static(array_filter($this->items)); } /**
true
Other
laravel
framework
b38bb6bc6d0dd831a334f8bbde6bd757bee694cb.json
Make callback in Collection::filter optional
tests/Support/SupportCollectionTest.php
@@ -167,6 +167,9 @@ public function testFilter() $this->assertEquals([1 => ['id' => 2, 'name' => 'World']], $c->filter(function ($item) { return $item['id'] == 2; })->all()); + + $c = new Collection(['', 'Hello', '', 'World']); + $this->assertEquals(['Hello', 'World'], $c->filter()->values()->toArray()); } public function testWhere()
true
Other
laravel
framework
f3bae8e37fb9ba9c00a7fe71156f1bef37e2435b.json
Allow config['schema'] to be array for PostgreSQL
src/Illuminate/Database/Connectors/PostgresConnector.php
@@ -52,9 +52,9 @@ public function connect(array $config) // may have been specified on the connections. If that is the case we will // set the default schema search paths to the specified database schema. if (isset($config['schema'])) { - $schema = $config['schema']; + $schema = '"'.(is_array($config['schema']) ? implode('", "', $config['schema']) : $config['schema']).'"'; - $connection->prepare("set search_path to \"{$schema}\"")->execute(); + $connection->prepare("set search_path to {$schema}")->execute(); } return $connection;
true
Other
laravel
framework
f3bae8e37fb9ba9c00a7fe71156f1bef37e2435b.json
Allow config['schema'] to be array for PostgreSQL
tests/Database/DatabaseConnectorTest.php
@@ -73,6 +73,24 @@ public function testPostgresSearchPathIsSet() $this->assertSame($result, $connection); } + + 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'] ); + $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)); + $connection->shouldReceive('prepare')->once()->with('set names \'utf8\'')->andReturn($connection); + $connection->shouldReceive('prepare')->once()->with('set search_path to "public", "user"')->andReturn($connection); + $connection->shouldReceive('execute')->twice(); + $result = $connector->connect($config); + + $this->assertSame($result, $connection); + } + + public function testSQLiteMemoryDatabasesMayBeConnectedTo() { $dsn = 'sqlite::memory:';
true
Other
laravel
framework
df8df9eb3a3da7c9f93669cc261b9658742da207.json
Move BindingResolutionException exception To be deleted in 5.2. For now, old catch blocks will still work.
src/Illuminate/Container/BindingResolutionException.php
@@ -4,6 +4,9 @@ use Exception; +/** + * @deprecated since version 5.1. Use Illuminate\Contracts\Container\BindingResolutionException. + */ class BindingResolutionException extends Exception { }
true
Other
laravel
framework
df8df9eb3a3da7c9f93669cc261b9658742da207.json
Move BindingResolutionException exception To be deleted in 5.2. For now, old catch blocks will still work.
src/Illuminate/Container/Container.php
@@ -10,6 +10,7 @@ use ReflectionParameter; use InvalidArgumentException; use Illuminate\Contracts\Container\Container as ContainerContract; +use Illuminate\Contracts\Container\BindingResolutionException as BindingResolutionContractException; class Container implements ArrayAccess, ContainerContract { @@ -721,7 +722,7 @@ protected function getExtenders($abstract) * @param array $parameters * @return mixed * - * @throws BindingResolutionException + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function build($concrete, array $parameters = []) { @@ -740,7 +741,7 @@ public function build($concrete, array $parameters = []) if (!$reflector->isInstantiable()) { $message = "Target [$concrete] is not instantiable."; - throw new BindingResolutionException($message); + throw new BindingResolutionContractException($message); } $this->buildStack[] = $concrete; @@ -809,7 +810,7 @@ protected function getDependencies(array $parameters, array $primitives = []) * @param \ReflectionParameter $parameter * @return mixed * - * @throws BindingResolutionException + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function resolveNonClass(ReflectionParameter $parameter) { @@ -819,7 +820,7 @@ protected function resolveNonClass(ReflectionParameter $parameter) $message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; - throw new BindingResolutionException($message); + throw new BindingResolutionContractException($message); } /** @@ -828,7 +829,7 @@ protected function resolveNonClass(ReflectionParameter $parameter) * @param \ReflectionParameter $parameter * @return mixed * - * @throws BindingResolutionException + * @throws \Illuminate\Contracts\Container\BindingResolutionException */ protected function resolveClass(ReflectionParameter $parameter) { @@ -839,7 +840,7 @@ protected function resolveClass(ReflectionParameter $parameter) // If we can not resolve the class instance, we will check to see if the value // is optional, and if it is we will return the optional parameter value as // the value of the dependency, similarly to how we do this with scalars. - catch (BindingResolutionException $e) { + catch (BindingResolutionContractException $e) { if ($parameter->isOptional()) { return $parameter->getDefaultValue(); }
true
Other
laravel
framework
df8df9eb3a3da7c9f93669cc261b9658742da207.json
Move BindingResolutionException exception To be deleted in 5.2. For now, old catch blocks will still work.
src/Illuminate/Contracts/Container/BindingResolutionException.php
@@ -0,0 +1,9 @@ +<?php + +namespace Illuminate\Contracts\Container; + +use Illuminate\Container\BindingResolutionException as BaseException; + +class BindingResolutionException extends BaseException +{ +}
true
Other
laravel
framework
df8df9eb3a3da7c9f93669cc261b9658742da207.json
Move BindingResolutionException exception To be deleted in 5.2. For now, old catch blocks will still work.
tests/Container/ContainerTest.php
@@ -321,7 +321,7 @@ public function testCreatingBoundConcreteClassPassesParameters() public function testInternalClassWithDefaultParameters() { - $this->setExpectedException('Illuminate\Container\BindingResolutionException', 'Unresolvable dependency resolving [Parameter #0 [ <required> $first ]] in class ContainerMixedPrimitiveStub'); + $this->setExpectedException('Illuminate\Contracts\Container\BindingResolutionException', 'Unresolvable dependency resolving [Parameter #0 [ <required> $first ]] in class ContainerMixedPrimitiveStub'); $container = new Container; $parameters = []; $container->make('ContainerMixedPrimitiveStub', $parameters);
true
Other
laravel
framework
c7e125c8fae95d2a4eb09b33a4f7e68919595ede.json
Throw EncryptException if encryption failed
src/Illuminate/Contracts/Encryption/EncryptException.php
@@ -0,0 +1,9 @@ +<?php + +namespace Illuminate\Contracts\Encryption; + +use RuntimeException; + +class EncryptException extends RuntimeException +{ +}
true
Other
laravel
framework
c7e125c8fae95d2a4eb09b33a4f7e68919595ede.json
Throw EncryptException if encryption failed
src/Illuminate/Encryption/Encrypter.php
@@ -4,6 +4,7 @@ use RuntimeException; use Illuminate\Support\Str; +use Illuminate\Contracts\Encryption\EncryptException; use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract; @@ -66,6 +67,10 @@ public function encrypt($value) $value = openssl_encrypt(serialize($value), $this->cipher, $this->key, 0, $iv); + if ($value === false) { + throw new EncryptException('Could not encrypt the data.'); + } + // Once we have the encrypted value we will go ahead base64_encode the input // vector and create the MAC for the encrypted value so we can verify its // authenticity. Then, we'll JSON encode the data in a "payload" array. @@ -88,7 +93,7 @@ public function decrypt($payload) $decrypted = openssl_decrypt($payload['value'], $this->cipher, $this->key, 0, $iv); if ($decrypted === false) { - throw new DecryptException('Could not decrypt data.'); + throw new DecryptException('Could not decrypt the data.'); } return unserialize($decrypted);
true
Other
laravel
framework
9bb8eeaba2864f5d034a8c2649c28c921af861e4.json
Limit the supported ciphers and check key length
src/Illuminate/Encryption/Encrypter.php
@@ -2,6 +2,7 @@ namespace Illuminate\Encryption; +use RuntimeException; use Illuminate\Support\Str; use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract; @@ -20,7 +21,7 @@ class Encrypter implements EncrypterContract * * @var string */ - protected $cipher = 'AES-128-CBC'; + protected $cipher; /** * The block size of the cipher. @@ -33,16 +34,23 @@ class Encrypter implements EncrypterContract * Create a new encrypter instance. * * @param string $key - * @param string|null $cipher + * @param string $cipher * @return void */ - public function __construct($key, $cipher = null) + public function __construct($key, $cipher = 'AES-128-CBC') { - $this->key = (string) $key; + $len = mb_strlen($key = (string) $key); - if ($cipher) { + if ($len === 16 || $len === 32) { + $this->key = $key; + } else { + throw new RuntimeException('The only supported key lengths are 16 bytes and 32 bytes.'); + } + + if ($cipher === 'AES-128-CBC' || $cipher === 'AES-256-CBC') { $this->cipher = $cipher; - $this->block = openssl_cipher_iv_length($this->cipher); + } else { + throw new RuntimeException('The only supported ciphers are AES-128-CBC and AES-256-CBC.'); } }
false
Other
laravel
framework
b6c821f23b006042f2f966a0701013b88c874187.json
Allow orderByRaw on union
src/Illuminate/Database/Query/Builder.php
@@ -1139,9 +1139,11 @@ public function oldest($column = 'created_at') */ public function orderByRaw($sql, $bindings = []) { + $property = $this->unions ? 'unionOrders' : 'orders'; + $type = 'raw'; - $this->orders[] = compact('type', 'sql'); + $this->{$property}[] = compact('type', 'sql'); $this->addBinding($bindings, 'order');
false
Other
laravel
framework
a1cf594df8f7d93b89242058cc20f9c1a6f33b38.json
Configure the cipher in the SP
src/Illuminate/Encryption/EncryptionServiceProvider.php
@@ -14,7 +14,7 @@ class EncryptionServiceProvider extends ServiceProvider public function register() { $this->app->singleton('encrypter', function ($app) { - return new Encrypter($app['config']['app.key']); + return new Encrypter($app['config']['app.key'], $app['config']['app.cipher']); }); } }
false
Other
laravel
framework
a389ec1c98ed4e5f0961921e2e2ea9298e953363.json
Expose randomBytes in the string class
src/Illuminate/Support/Str.php
@@ -221,25 +221,40 @@ public static function plural($value, $count = 2) * @throws \RuntimeException */ public static function random($length = 16) + { + $bytes = static::randomBytes($length * 2); + + $string = substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $length); + + while (($len = strlen($string)) < $length) { + $string .= static::random($length - $len); + } + + return $string; + } + + /** + * Generate a more truly "random" bytes. + * + * @param int $length + * @return string + * + * @throws \RuntimeException + */ + public static function randomBytes($length = 16) { if (function_exists('random_bytes')) { - $bytes = random_bytes($length * 2); + $bytes = random_bytes($length); } elseif (function_exists('openssl_random_pseudo_bytes')) { - $bytes = openssl_random_pseudo_bytes($length * 2, $strong); + $bytes = openssl_random_pseudo_bytes($length, $strong); if ($bytes === false || $strong === false) { throw new RuntimeException('Unable to generate random string.'); } } else { throw new RuntimeException('OpenSSL extension is required for PHP 5 users.'); } - $string = substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $length); - - while (($len = strlen($string)) < $length) { - $string .= static::random($length - $len); - } - - return $string; + return $bytes; } /**
false
Other
laravel
framework
cb7d3603a7b95fb8340a5776f90509fa4fe74ea6.json
Update encrypter test
src/Illuminate/Encryption/Encrypter.php
@@ -113,7 +113,7 @@ protected function opensslDecrypt($value, $iv) if ($decrypted === false) { throw new DecryptException('Could not decrypt data.'); } - + return $decrypted; }
true
Other
laravel
framework
cb7d3603a7b95fb8340a5776f90509fa4fe74ea6.json
Update encrypter test
tests/Encryption/EncrypterTest.php
@@ -14,8 +14,7 @@ public function testEncryption() public function testEncryptionWithCustomCipher() { - $e = $this->getEncrypter(); - $e->setCipher('AES-256-CBC'); + $e = new Encrypter(str_repeat('a', 32), 'AES-256-CBC'); $this->assertNotEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')); $encrypted = $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); $this->assertEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->decrypt($encrypted));
true
Other
laravel
framework
2318d8799b55d6fcf448fa6ca113ff8b22cf7cb2.json
Remove mcrypt dependency
composer.json
@@ -17,7 +17,6 @@ "require": { "php": ">=5.5.9", "ext-openssl": "*", - "ext-mcrypt": "*", "ext-mbstring": "*", "classpreloader/classpreloader": "~1.2", "danielstjules/stringy": "~1.8",
true
Other
laravel
framework
2318d8799b55d6fcf448fa6ca113ff8b22cf7cb2.json
Remove mcrypt dependency
src/Illuminate/Encryption/Encrypter.php
@@ -22,14 +22,14 @@ class Encrypter implements EncrypterContract * * @var string */ - protected $cipher = MCRYPT_RIJNDAEL_128; + protected $cipher = 'AES-128-CBC'; /** * The mode used for encryption. * * @var string */ - protected $mode = MCRYPT_MODE_CBC; + protected $mode; /** * The block size of the cipher. @@ -57,9 +57,9 @@ public function __construct($key) */ public function encrypt($value) { - $iv = mcrypt_create_iv($this->getIvSize(), $this->getRandomizer()); + $iv = openssl_random_pseudo_bytes($this->getIvSize()); - $value = base64_encode($this->padAndMcrypt($value, $iv)); + $value = base64_encode($this->padAndEncrypt($value, $iv)); // Once we have the encrypted value we will go ahead base64_encode the input // vector and create the MAC for the encrypted value so we can verify its @@ -70,17 +70,17 @@ public function encrypt($value) } /** - * Pad and use mcrypt on the given value and input vector. + * Pad and encrypt on the given value and input vector. * * @param string $value * @param string $iv * @return string */ - protected function padAndMcrypt($value, $iv) + protected function padAndEncrypt($value, $iv) { $value = $this->addPadding(serialize($value)); - return mcrypt_encrypt($this->cipher, $this->key, $value, $this->mode, $iv); + return openssl_encrypt($value, $this->cipher, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); } /** @@ -100,22 +100,22 @@ public function decrypt($payload) $iv = base64_decode($payload['iv']); - return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv))); + return unserialize($this->stripPadding($this->opensslDecrypt($value, $iv))); } /** - * Run the mcrypt decryption routine for the value. + * Run the openssl decryption routine for the value. * * @param string $value * @param string $iv * @return string * * @throws \Exception */ - protected function mcryptDecrypt($value, $iv) + protected function opensslDecrypt($value, $iv) { try { - return mcrypt_decrypt($this->cipher, $this->key, $value, $this->mode, $iv); + return openssl_decrypt($value, $this->cipher, $this->key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv); } catch (Exception $e) { throw new DecryptException($e->getMessage()); } @@ -234,27 +234,7 @@ protected function invalidPayload($data) */ protected function getIvSize() { - return mcrypt_get_iv_size($this->cipher, $this->mode); - } - - /** - * Get the random data source available for the OS. - * - * @return int - */ - protected function getRandomizer() - { - if (defined('MCRYPT_DEV_URANDOM')) { - return MCRYPT_DEV_URANDOM; - } - - if (defined('MCRYPT_DEV_RANDOM')) { - return MCRYPT_DEV_RANDOM; - } - - mt_srand(); - - return MCRYPT_RAND; + return openssl_cipher_iv_length($this->cipher); } /** @@ -289,7 +269,7 @@ public function setCipher($cipher) */ public function setMode($mode) { - $this->mode = $mode; + $this->cipher = $mode; $this->updateBlockSize(); } @@ -301,6 +281,6 @@ public function setMode($mode) */ protected function updateBlockSize() { - $this->block = mcrypt_get_iv_size($this->cipher, $this->mode); + $this->block = openssl_cipher_iv_length($this->cipher); } }
true
Other
laravel
framework
2318d8799b55d6fcf448fa6ca113ff8b22cf7cb2.json
Remove mcrypt dependency
tests/Encryption/EncrypterTest.php
@@ -15,7 +15,7 @@ public function testEncryption() public function testEncryptionWithCustomCipher() { $e = $this->getEncrypter(); - $e->setCipher(MCRYPT_RIJNDAEL_256); + $e->setCipher('AES-256-CBC'); $this->assertNotEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')); $encrypted = $e->encrypt('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); $this->assertEquals('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', $e->decrypt($encrypted));
true
Other
laravel
framework
eeb0f30b07ff0614384129b5498daad9f9e3e689.json
Add optional priority to Eloquent observer
src/Illuminate/Database/Eloquent/Model.php
@@ -362,9 +362,10 @@ public function getGlobalScopes() * Register an observer with the Model. * * @param object|string $class + * @param int $priority * @return void */ - public static function observe($class) + public static function observe($class, $priority = 0) { $instance = new static; @@ -375,7 +376,7 @@ public static function observe($class) // it into the model's event system, making it convenient to watch these. foreach ($instance->getObservableEvents() as $event) { if (method_exists($class, $event)) { - static::registerModelEvent($event, $className.'@'.$event); + static::registerModelEvent($event, $className.'@'.$event, $priority); } } }
false
Other
laravel
framework
08fc7fa9350032582ad4e775416e9642d8cde2a2.json
Implement random fix from 5.0 in 5.1
src/Illuminate/Support/Str.php
@@ -225,15 +225,14 @@ public static function random($length = 16) if (function_exists('random_bytes')) { $bytes = random_bytes($length * 2); } elseif (function_exists('openssl_random_pseudo_bytes')) { - $bytes = openssl_random_pseudo_bytes($length * 2); + $bytes = openssl_random_pseudo_bytes($length * 2, $strong); + if ($bytes === false || $strong === false) { + throw new RuntimeException('Unable to generate random string.'); + } } else { throw new RuntimeException('OpenSSL extension is required for PHP 5 users.'); } - if ($bytes === false) { - throw new RuntimeException('Unable to generate random string.'); - } - return substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $length); }
false
Other
laravel
framework
92b3ac07c1b206f5ff0ddafcc20fa152dc3e8a5c.json
fix function call.
src/Illuminate/Foundation/Console/AppNameCommand.php
@@ -236,7 +236,7 @@ protected function setPhpSpecNamespace() protected function setDatabaseFactoryNamespaces() { $this->replaceIn( - $this->laravel['database_path'].'/factories', $this->currentRoot, $this->argument('name') + $this->laravel->databasePath().'/factories', $this->currentRoot, $this->argument('name') ); }
false
Other
laravel
framework
4cc5ebc340045a287a29e82f43ccd37480b4f202.json
Remove obsolete attribute
src/Illuminate/Http/Request.php
@@ -18,13 +18,6 @@ class Request extends SymfonyRequest implements ArrayAccess */ protected $json; - /** - * The Illuminate session store implementation. - * - * @var \Illuminate\Session\Store - */ - protected $sessionStore; - /** * The user resolver callback. *
false
Other
laravel
framework
093a29e3ab85957998f60a4e73291bab23d3af3f.json
Remove deprecated pluck methods
src/Illuminate/Database/Eloquent/Builder.php
@@ -190,21 +190,6 @@ public function value($column) } } - /** - * Get a single column's value from the first result of a query. - * - * This is an alias for the "value" method. - * - * @param string $column - * @return mixed - * - * @deprecated since version 5.1 - */ - public function pluck($column) - { - return $this->value($column); - } - /** * Chunk the results of the query. *
true
Other
laravel
framework
093a29e3ab85957998f60a4e73291bab23d3af3f.json
Remove deprecated pluck methods
src/Illuminate/Database/Query/Builder.php
@@ -1306,21 +1306,6 @@ public function value($column) return count($result) > 0 ? reset($result) : null; } - /** - * Get a single column's value from the first result of a query. - * - * This is an alias for the "value" method. - * - * @param string $column - * @return mixed - * - * @deprecated since version 5.1 - */ - public function pluck($column) - { - return $this->value($column); - } - /** * Execute the query and get the first result. *
true
Other
laravel
framework
094879204c1ed887337bf67294062d68b5e20ef8.json
Remove additional line. Signed-off-by: crynobone <crynobone@gmail.com>
src/Illuminate/Routing/ResourceRegistrar.php
@@ -48,7 +48,6 @@ public function register($name, $controller, array $options = []) return; } - // We need to extract the base resource from the resource name. Nested resources // are supported in the framework, but we need to know what name to use for a // place-holder on the route wildcards, which should be the base resources.
false
Other
laravel
framework
80c524c81e801a7b01744d6559637094f5e859c4.json
Port 5.0 fix for queue sleeping.
src/Illuminate/Queue/Console/WorkCommand.php
@@ -52,7 +52,7 @@ public function __construct(Worker $worker) public function fire() { if ($this->downForMaintenance() && !$this->option('daemon')) { - return; + return $this->worker->sleep($this->option('sleep')); } $queue = $this->option('queue');
false
Other
laravel
framework
2596225ffe49e004881a31feb166fcf942d63053.json
Add missing param
src/Illuminate/Queue/CallQueuedHandler.php
@@ -67,6 +67,7 @@ protected function setJobInstanceIfNecessary(Job $job, $instance) /** * Call the failed method on the job instance. * + * @param array $data * @return void */ public function failed(array $data)
false
Other
laravel
framework
2ab952145d92adc3b605234f7a6436f930465b81.json
Remove unused import
src/Illuminate/Cache/DatabaseStore.php
@@ -2,7 +2,6 @@ use Closure; use Exception; -use LogicException; use Illuminate\Contracts\Cache\Store; use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract;
false
Other
laravel
framework
90280a3951fd713ebfec0d150743d7ccaa8a057b.json
Use the latest Carbon.
composer.json
@@ -27,7 +27,7 @@ "league/flysystem": "~1.0", "monolog/monolog": "~1.11", "mtdowling/cron-expression": "~1.0", - "nesbot/carbon": "~1.0", + "nesbot/carbon": "~1.19", "psy/psysh": "0.4.*", "swiftmailer/swiftmailer": "~5.1", "symfony/console": "2.7.*",
true
Other
laravel
framework
90280a3951fd713ebfec0d150743d7ccaa8a057b.json
Use the latest Carbon.
src/Illuminate/Auth/composer.json
@@ -19,7 +19,7 @@ "illuminate/http": "5.1.*", "illuminate/session": "5.1.*", "illuminate/support": "5.1.*", - "nesbot/carbon": "~1.0" + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": {
true
Other
laravel
framework
90280a3951fd713ebfec0d150743d7ccaa8a057b.json
Use the latest Carbon.
src/Illuminate/Cache/composer.json
@@ -17,7 +17,7 @@ "php": ">=5.4.0", "illuminate/contracts": "5.1.*", "illuminate/support": "5.1.*", - "nesbot/carbon": "~1.0" + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": {
true
Other
laravel
framework
90280a3951fd713ebfec0d150743d7ccaa8a057b.json
Use the latest Carbon.
src/Illuminate/Console/composer.json
@@ -17,7 +17,7 @@ "php": ">=5.4.0", "illuminate/contracts": "5.1.*", "symfony/console": "2.7.*", - "nesbot/carbon": "~1.0" + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": { @@ -33,7 +33,7 @@ "guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~5.3|~6.0).", "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", "symfony/process": "Required to use scheduling component (2.7.*).", - "nesbot/carbon": "Required to use scheduling component (~1.0)." + "nesbot/carbon": "Required to use scheduling component (~1.19)." }, "minimum-stability": "dev" }
true
Other
laravel
framework
90280a3951fd713ebfec0d150743d7ccaa8a057b.json
Use the latest Carbon.
src/Illuminate/Database/composer.json
@@ -19,7 +19,7 @@ "illuminate/container": "5.1.*", "illuminate/contracts": "5.1.*", "illuminate/support": "5.1.*", - "nesbot/carbon": "~1.0" + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": {
true
Other
laravel
framework
90280a3951fd713ebfec0d150743d7ccaa8a057b.json
Use the latest Carbon.
src/Illuminate/Queue/composer.json
@@ -21,7 +21,7 @@ "illuminate/http": "5.1.*", "illuminate/support": "5.1.*", "symfony/process": "2.7.*", - "nesbot/carbon": "~1.0" + "nesbot/carbon": "~1.19" }, "autoload": { "psr-4": {
true
Other
laravel
framework
90280a3951fd713ebfec0d150743d7ccaa8a057b.json
Use the latest Carbon.
src/Illuminate/Session/composer.json
@@ -17,7 +17,7 @@ "php": ">=5.4.0", "illuminate/contracts": "5.1.*", "illuminate/support": "5.1.*", - "nesbot/carbon": "~1.0", + "nesbot/carbon": "~1.19", "symfony/finder": "2.7.*", "symfony/http-foundation": "2.7.*" },
true
Other
laravel
framework
3a69303e37daa5aa3df90360b583e47bfab34bff.json
fix some formatting
src/Illuminate/Console/GeneratorCommand.php
@@ -53,6 +53,7 @@ public function fire() if ($this->files->exists($path = $this->getPath($name))) { $this->error($this->type.' already exists!'); + return false; }
true
Other
laravel
framework
3a69303e37daa5aa3df90360b583e47bfab34bff.json
fix some formatting
src/Illuminate/Foundation/Console/ModelMakeCommand.php
@@ -33,7 +33,7 @@ class ModelMakeCommand extends GeneratorCommand { */ public function fire() { - if(parent::fire() == null) + if (parent::fire() !== false) { if ( ! $this->option('no-migration')) {
true
Other
laravel
framework
539750de5499f58cce061b431ab61f79257614f9.json
fix merge conflicts.
src/Illuminate/Database/Eloquent/Relations/Pivot.php
@@ -49,7 +49,9 @@ public function __construct(Model $parent, $attributes, $table, $exists = false) // The pivot model is a "dynamic" model since we will set the tables dynamically // for the instance. This allows it work for any intermediate tables for the // many to many relationship that are defined by this developer's classes. - $this->setRawAttributes($attributes, true); + $this->forceFill($attributes); + + $this->syncOriginal(); $this->setTable($table);
true
Other
laravel
framework
539750de5499f58cce061b431ab61f79257614f9.json
fix merge conflicts.
src/Illuminate/Foundation/helpers.php
@@ -29,11 +29,12 @@ function abort($code, $message = '', array $headers = array()) * * @param string $name * @param array $parameters + * @param bool $absolute * @return string */ - function action($name, $parameters = array()) + function action($name, $parameters = array(), $absolute = true) { - return app('url')->action($name, $parameters); + return app('url')->action($name, $parameters, $absolute); } }
true
Other
laravel
framework
539750de5499f58cce061b431ab61f79257614f9.json
fix merge conflicts.
src/Illuminate/Queue/Console/FailedTableCommand.php
@@ -55,7 +55,13 @@ public function fire() { $fullPath = $this->createBaseMigration(); - $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/failed_jobs.stub')); + $table = $this->laravel['config']['queue.failed.table']; + + $stub = str_replace( + '{{table}}', $table, $this->files->get(__DIR__.'/stubs/failed_jobs.stub') + ); + + $this->files->put($fullPath, $stub); $this->info('Migration created successfully!');
true
Other
laravel
framework
539750de5499f58cce061b431ab61f79257614f9.json
fix merge conflicts.
src/Illuminate/Queue/Console/TableCommand.php
@@ -55,7 +55,13 @@ public function fire() { $fullPath = $this->createBaseMigration(); - $this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/jobs.stub')); + $table = $this->laravel['config']['queue.connections.database.table']; + + $stub = str_replace( + '{{table}}', $table, $this->files->get(__DIR__.'/stubs/jobs.stub') + ); + + $this->files->put($fullPath, $stub); $this->info('Migration created successfully!');
true
Other
laravel
framework
539750de5499f58cce061b431ab61f79257614f9.json
fix merge conflicts.
tests/Database/DatabaseEloquentPivotTest.php
@@ -23,6 +23,15 @@ public function testPropertiesAreSetCorrectly() $this->assertTrue($pivot->exists); } + public function testMutatorsAreCalledFromConstructor() { + $parent = m::mock('Illuminate\Database\Eloquent\Model[getConnectionName]'); + $parent->shouldReceive('getConnectionName')->once()->andReturn('connection'); + + $pivot = new DatabaseEloquentPivotTestMutatorStub($parent, array('foo' => 'bar'), 'table', true); + + $this->assertTrue($pivot->getMutatorCalled()); + } + public function testPropertiesUnchangedAreNotDirty() { @@ -97,3 +106,16 @@ public function getDates() return array(); } } + +class DatabaseEloquentPivotTestMutatorStub extends Illuminate\Database\Eloquent\Relations\Pivot { + private $mutatorCalled = false; + + public function setFooAttribute($value) { + $this->mutatorCalled = true; + return $value; + } + + public function getMutatorCalled() { + return $this->mutatorCalled; + } +}
true
Other
laravel
framework
539750de5499f58cce061b431ab61f79257614f9.json
fix merge conflicts.
tests/Queue/QueueFailedTableCommandTest.php
@@ -1,51 +0,0 @@ -<?php - -use Illuminate\Queue\Console\FailedTableCommand as QueueFailedTableCommand; -use Illuminate\Foundation\Application; -use Mockery as m; - -class QueueFailedTableCommandTest extends PHPUnit_Framework_TestCase { - - public function tearDown() - { - m::close(); - } - - - public function testCreateMakesMigration() - { - $command = new QueueFailedTableCommandTestStub( - $files = m::mock('Illuminate\Filesystem\Filesystem'), - $composer = m::mock('Illuminate\Foundation\Composer') - ); - $creator = m::mock('Illuminate\Database\Migrations\MigrationCreator')->shouldIgnoreMissing(); - - $app = new Application(); - $app->useDatabasePath(__DIR__); - $app['migration.creator'] = $creator; - $command->setLaravel($app); - $path = __DIR__ . '/migrations'; - $creator->shouldReceive('create')->once()->with('create_failed_jobs_table', $path)->andReturn($path); - $files->shouldReceive('get')->once()->andReturn('foo'); - $files->shouldReceive('put')->once()->with($path, 'foo'); - $composer->shouldReceive('dumpAutoloads')->once(); - - $this->runCommand($command); - } - - - protected function runCommand($command, $input = array()) - { - return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), new Symfony\Component\Console\Output\NullOutput); - } - -} - -class QueueFailedTableCommandTestStub extends QueueFailedTableCommand { - - public function call($command, array $arguments = array()) - { - // - } - -}
true
Other
laravel
framework
539750de5499f58cce061b431ab61f79257614f9.json
fix merge conflicts.
tests/Queue/QueueTableCommandTest.php
@@ -1,51 +0,0 @@ -<?php - -use Illuminate\Queue\Console\TableCommand as QueueTableCommand; -use Illuminate\Foundation\Application; -use Mockery as m; - -class QueueTableCommandTest extends PHPUnit_Framework_TestCase { - - public function tearDown() - { - m::close(); - } - - - public function testCreateMakesMigration() - { - $command = new QueueTableCommandTestStub( - $files = m::mock('Illuminate\Filesystem\Filesystem'), - $composer = m::mock('Illuminate\Foundation\Composer') - ); - $creator = m::mock('Illuminate\Database\Migrations\MigrationCreator')->shouldIgnoreMissing(); - - $app = new Application(); - $app->useDatabasePath(__DIR__); - $app['migration.creator'] = $creator; - $command->setLaravel($app); - $path = __DIR__ . '/migrations'; - $creator->shouldReceive('create')->once()->with('create_jobs_table', $path)->andReturn($path); - $files->shouldReceive('get')->once()->andReturn('foo'); - $files->shouldReceive('put')->once()->with($path, 'foo'); - $composer->shouldReceive('dumpAutoloads')->once(); - - $this->runCommand($command); - } - - - protected function runCommand($command, $input = array()) - { - return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), new Symfony\Component\Console\Output\NullOutput); - } - -} - -class QueueTableCommandTestStub extends QueueTableCommand { - - public function call($command, array $arguments = array()) - { - // - } - -}
true
Other
laravel
framework
166381480526e8d06a73a44032eb2a440f4bce4a.json
Add everyMinute helper to event scheduler
src/Illuminate/Console/Scheduling/Event.php
@@ -460,6 +460,16 @@ public function yearly() return $this->cron('0 0 1 1 * *'); } + /** + * Schedule the event to run every minute. + * + * @return $this + */ + public function everyMinute() + { + return $this->cron('* * * * * *'); + } + /** * Schedule the event to run every five minutes. *
false
Other
laravel
framework
2f00d46fdb502272644f9c55851df22e99935c9b.json
add connection support to validator.
src/Illuminate/Validation/Validator.php
@@ -1027,7 +1027,7 @@ protected function validateUnique($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'unique'); - $table = $parameters[0]; + list($connection, $table) = $this->parseUniqueTable($parameters[0]); // The second parameter position holds the name of the column that needs to // be verified as unique. If this parameter isn't specified we will just @@ -1048,6 +1048,10 @@ 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)) { + $verifier->setConnection($connection); + } + $extra = $this->getUniqueExtra($parameters); return $verifier->getCount( @@ -1057,6 +1061,17 @@ protected function validateUnique($attribute, $value, $parameters) ) == 0; } + /** + * Parse the connection / table for the unique rule. + * + * @param string $table + * @return array + */ + protected function parseUniqueTable($table) + { + return str_contains($table, '.') ? explode('.', $table, 2) : [null, $table]; + } + /** * Get the excluded ID column and value for the unique rule. *
true
Other
laravel
framework
2f00d46fdb502272644f9c55851df22e99935c9b.json
add connection support to validator.
tests/Validation/ValidationValidatorTest.php
@@ -872,6 +872,14 @@ public function testValidateUnique() $v->setPresenceVerifier($mock); $this->assertTrue($v->passes()); + $trans = $this->getRealTranslator(); + $v = new Validator($trans, array('email' => 'foo'), array('email' => 'Unique:connection.users')); + $mock = m::mock('Illuminate\Validation\PresenceVerifierInterface'); + $mock->shouldReceive('setConnection')->once()->with('connection'); + $mock->shouldReceive('getCount')->once()->with('users', 'email', 'foo', null, null, array())->andReturn(0); + $v->setPresenceVerifier($mock); + $this->assertTrue($v->passes()); + $v = new Validator($trans, array('email' => 'foo'), array('email' => 'Unique:users,email_addr,1')); $mock2 = m::mock('Illuminate\Validation\PresenceVerifierInterface'); $mock2->shouldReceive('getCount')->once()->with('users', 'email_addr', 'foo', '1', 'id', array())->andReturn(1);
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Auth/Guard.php
@@ -660,7 +660,7 @@ public function getDispatcher() /** * Set the event dispatcher instance. * - * @param \Illuminate\Contracts\Events\Dispatcher + * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function setDispatcher(Dispatcher $events) @@ -735,7 +735,7 @@ public function getRequest() /** * Set the current request instance. * - * @param \Symfony\Component\HttpFoundation\Request + * @param \Symfony\Component\HttpFoundation\Request $request * @return $this */ public function setRequest(Request $request)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Cache/Repository.php
@@ -49,7 +49,7 @@ public function __construct(Store $store) /** * Set the event dispatcher instance. * - * @param \Illuminate\Contracts\Events\Dispatcher + * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function setEventDispatcher(Dispatcher $events)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Connection.php
@@ -929,7 +929,7 @@ public function getQueryGrammar() /** * Set the query grammar used by the connection. * - * @param \Illuminate\Database\Query\Grammars\Grammar + * @param \Illuminate\Database\Query\Grammars\Grammar $grammar * @return void */ public function setQueryGrammar(Query\Grammars\Grammar $grammar) @@ -950,7 +950,7 @@ public function getSchemaGrammar() /** * Set the schema grammar used by the connection. * - * @param \Illuminate\Database\Schema\Grammars\Grammar + * @param \Illuminate\Database\Schema\Grammars\Grammar $grammar * @return void */ public function setSchemaGrammar(Schema\Grammars\Grammar $grammar) @@ -971,7 +971,7 @@ public function getPostProcessor() /** * Set the query post processor used by the connection. * - * @param \Illuminate\Database\Query\Processors\Processor + * @param \Illuminate\Database\Query\Processors\Processor $processor * @return void */ public function setPostProcessor(Processor $processor) @@ -992,7 +992,7 @@ public function getEventDispatcher() /** * Set the event dispatcher instance on the connection. * - * @param \Illuminate\Contracts\Events\Dispatcher + * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function setEventDispatcher(Dispatcher $events)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Eloquent/Model.php
@@ -2871,7 +2871,7 @@ protected function asDateTime($value) /** * Prepare a date for array / JSON serialization. * - * @param \DateTime + * @param \DateTime $date * @return string */ protected function serializeDate(DateTime $date)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php
@@ -396,7 +396,7 @@ protected function hasPivotColumn($column) /** * Set the join clause for the relation query. * - * @param \Illuminate\Database\Eloquent\Builder|null + * @param \Illuminate\Database\Eloquent\Builder|null $query * @return $this */ protected function setJoin($query = null)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Eloquent/Relations/Pivot.php
@@ -68,7 +68,7 @@ public function __construct(Model $parent, $attributes, $table, $exists = false) /** * Set the keys for a save update query. * - * @param \Illuminate\Database\Eloquent\Builder + * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ protected function setKeysForSaveQuery(Builder $query)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Query/Grammars/Grammar.php
@@ -28,7 +28,7 @@ class Grammar extends BaseGrammar { /** * Compile a select query into SQL. * - * @param \Illuminate\Database\Query\Builder + * @param \Illuminate\Database\Query\Builder $query * @return string */ public function compileSelect(Builder $query) @@ -41,7 +41,7 @@ public function compileSelect(Builder $query) /** * Compile the components necessary for a select clause. * - * @param \Illuminate\Database\Query\Builder + * @param \Illuminate\Database\Query\Builder $query * @return array */ protected function compileComponents(Builder $query)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
@@ -26,7 +26,7 @@ class MySqlGrammar extends Grammar { /** * Compile a select query into SQL. * - * @param \Illuminate\Database\Query\Builder + * @param \Illuminate\Database\Query\Builder $query * @return string */ public function compileSelect(Builder $query)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
@@ -18,7 +18,7 @@ class SqlServerGrammar extends Grammar { /** * Compile a select query into SQL. * - * @param \Illuminate\Database\Query\Builder + * @param \Illuminate\Database\Query\Builder $query * @return string */ public function compileSelect(Builder $query)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Database/Schema/Builder.php
@@ -218,7 +218,7 @@ public function getConnection() /** * Set the database connection instance. * - * @param \Illuminate\Database\Connection + * @param \Illuminate\Database\Connection $connection * @return $this */ public function setConnection(Connection $connection)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Foundation/Application.php
@@ -551,7 +551,7 @@ public function resolveProviderClass($provider) /** * Mark the given provider as registered. * - * @param \Illuminate\Support\ServiceProvider + * @param \Illuminate\Support\ServiceProvider $provider * @return void */ protected function markAsRegistered($provider)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Foundation/Console/QueuedJob.php
@@ -25,7 +25,7 @@ public function __construct(KernelContract $kernel) /** * Fire the job. * - * @param \Illuminate\Queue\Jobs\Job + * @param \Illuminate\Queue\Jobs\Job $job * @param array $data * @return void */
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Foundation/Console/VendorPublishCommand.php
@@ -34,7 +34,7 @@ class VendorPublishCommand extends Command { /** * Create a new command instance. * - * @param \Illuminate\Filesystem\Filesystem + * @param \Illuminate\Filesystem\Filesystem $files * @return void */ public function __construct(Filesystem $files)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Foundation/Testing/CrawlerTrait.php
@@ -149,7 +149,7 @@ protected function makeRequest($method, $uri, $parameters = [], $cookies = [], $ /** * Make a request to the application using the given form. * - * @param \Symfony\Component\DomCrawler\Form + * @param \Symfony\Component\DomCrawler\Form $form * @return $this */ protected function makeRequestUsingForm(Form $form)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Queue/CallQueuedHandler.php
@@ -15,7 +15,7 @@ class CallQueuedHandler { /** * Create a new handler instance. * - * @param \Illuminate\Contracts\Bus\Dispatcher + * @param \Illuminate\Contracts\Bus\Dispatcher $dispatcher * @return void */ public function __construct(Dispatcher $dispatcher)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/Queue/InteractsWithQueue.php
@@ -51,7 +51,7 @@ public function attempts() /** * Set the base queue job instance. * - * @param \Illuminate\Contracts\Queue\Job + * @param \Illuminate\Contracts\Queue\Job $job * @return $this */ public function setJob(JobContract $job)
true
Other
laravel
framework
d69f639488c1a0389fd1999fda564a4591364d15.json
Add missing arguments names to params Signed-off-by: Graham Campbell <graham@cachethq.io>
src/Illuminate/View/Factory.php
@@ -814,7 +814,7 @@ public function getDispatcher() /** * Set the event dispatcher instance. * - * @param \Illuminate\Contracts\Events\Dispatcher + * @param \Illuminate\Contracts\Events\Dispatcher $events * @return void */ public function setDispatcher(Dispatcher $events)
true
Other
laravel
framework
5fc99089db0ebe5b3f2983e8f24a52e6b01140c9.json
Use is_dir instead of file_exists
src/Illuminate/Database/Eloquent/Factory.php
@@ -25,7 +25,7 @@ public static function construct($pathToFactories = null) $factory = new static; - if (file_exists($pathToFactories)) { + if (is_dir($pathToFactories)) { foreach (Finder::create()->files()->in($pathToFactories) as $file) { require $file->getRealPath(); }
false
Other
laravel
framework
e841cd842bc1efaaa6ea55f1656fae08fdfb5443.json
Remove docblocks space
src/Illuminate/Support/Collection.php
@@ -167,8 +167,8 @@ public function whereLoose($key, $value) /** * Get the first item from the collection. * - * @param callable|null $callback - * @param mixed $default + * @param callable|null $callback + * @param mixed $default * @return mixed */ public function first(callable $callback = null, $default = null)
false
Other
laravel
framework
45495066373ff6daa314f6550cab2b3de16f26f7.json
Fix some docblocks
src/Illuminate/Container/Container.php
@@ -916,7 +916,7 @@ protected function keyParametersByArgument(array $dependencies, array $parameter * Register a new resolving callback. * * @param string $abstract - * @param \Closure $callback + * @param \Closure|null $callback * @return void */ public function resolving($abstract, Closure $callback = null) @@ -935,7 +935,7 @@ public function resolving($abstract, Closure $callback = null) * Register a new after resolving callback for all types. * * @param string $abstract - * @param \Closure $callback + * @param \Closure|null $callback * @return void */ public function afterResolving($abstract, Closure $callback = null)
true
Other
laravel
framework
45495066373ff6daa314f6550cab2b3de16f26f7.json
Fix some docblocks
src/Illuminate/Contracts/Container/Container.php
@@ -126,7 +126,7 @@ public function resolved($abstract); * Register a new resolving callback. * * @param string $abstract - * @param \Closure $callback + * @param \Closure|null $callback * @return void */ public function resolving($abstract, Closure $callback = null); @@ -135,7 +135,7 @@ public function resolving($abstract, Closure $callback = null); * Register a new after resolving callback. * * @param string $abstract - * @param \Closure $callback + * @param \Closure|null $callback * @return void */ public function afterResolving($abstract, Closure $callback = null);
true
Other
laravel
framework
45495066373ff6daa314f6550cab2b3de16f26f7.json
Fix some docblocks
src/Illuminate/Database/Eloquent/Builder.php
@@ -592,7 +592,7 @@ public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', C * @param string $operator * @param int $count * @param string $boolean - * @param \Closure $callback + * @param \Closure|null $callback * @return \Illuminate\Database\Eloquent\Builder|static */ protected function hasNested($relations, $operator = '>=', $count = 1, $boolean = 'and', $callback = null)
true
Other
laravel
framework
45495066373ff6daa314f6550cab2b3de16f26f7.json
Fix some docblocks
src/Illuminate/Routing/Router.php
@@ -1044,7 +1044,7 @@ public function callRouteBefore($route, $request) * * @param \Illuminate\Routing\Route $route * @param \Illuminate\Http\Request $request - * @return mixed|null + * @return mixed */ protected function callPatternFilters($route, $request) {
true
Other
laravel
framework
45495066373ff6daa314f6550cab2b3de16f26f7.json
Fix some docblocks
src/Illuminate/Support/Collection.php
@@ -167,9 +167,9 @@ public function whereLoose($key, $value) /** * Get the first item from the collection. * - * @param callable $callback + * @param callable|null $callback * @param mixed $default - * @return mixed|null + * @return mixed */ public function first(callable $callback = null, $default = null) { @@ -354,7 +354,7 @@ public function keys() /** * Get the last item from the collection. * - * @return mixed|null + * @return mixed */ public function last() { @@ -426,7 +426,7 @@ public function forPage($page, $perPage) /** * Get and remove the last item from the collection. * - * @return mixed|null + * @return mixed */ public function pop() { @@ -576,7 +576,7 @@ public function search($value, $strict = false) /** * Get and remove the first item from the collection. * - * @return mixed|null + * @return mixed */ public function shift() {
true
Other
laravel
framework
f7b91c635dbac81b53090ee0b84ff8ae73b43b02.json
Add missing space
src/Illuminate/Queue/SyncQueue.php
@@ -24,7 +24,7 @@ public function push($job, $data = '', $queue = null) { $queueJob->fire(); } - catch(Exception $e) + catch (Exception $e) { $this->handleFailedJob($queueJob);
false
Other
laravel
framework
ae87a80db71a0ab9635a4eb8be4969116337c77f.json
Remove unneeded import.
tests/Queue/QueueSyncQueueTest.php
@@ -1,6 +1,5 @@ <?php -use Exception; use Mockery as m; class QueueSyncQueueTest extends PHPUnit_Framework_TestCase { @@ -109,4 +108,4 @@ public function fire($job, $data) { public function failed(){ $_SERVER['__sync.failed'] = true; } -} \ No newline at end of file +}
false
Other
laravel
framework
8b7c5a42895f41028899f9dfeb0059bcdb250183.json
Add failed job handling for SyncQueue
src/Illuminate/Queue/SyncQueue.php
@@ -1,6 +1,8 @@ <?php namespace Illuminate\Queue; +use Exception; use Illuminate\Queue\Jobs\SyncJob; +use Illuminate\Contracts\Queue\Job; use Illuminate\Contracts\Queue\Queue as QueueContract; class SyncQueue extends Queue implements QueueContract { @@ -12,10 +14,22 @@ class SyncQueue extends Queue implements QueueContract { * @param mixed $data * @param string $queue * @return mixed + * @throws \Exception */ public function push($job, $data = '', $queue = null) { - $this->resolveJob($this->createPayload($job, $data, $queue))->fire(); + $queueJob = $this->resolveJob($this->createPayload($job, $data, $queue)); + + try + { + $queueJob->fire(); + } + catch(Exception $e) + { + $this->handleFailedJob($queueJob); + + throw $e; + } return 0; } @@ -69,4 +83,33 @@ protected function resolveJob($payload) return new SyncJob($this->container, $payload); } + /** + * Handle the failed job + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return array + */ + protected function handleFailedJob(Job $job) + { + $job->failed(); + + $this->raiseFailedJobEvent($job); + } + + /** + * Raise the failed queue job event. + * + * @param \Illuminate\Contracts\Queue\Job $job + * @return void + */ + protected function raiseFailedJobEvent(Job $job) + { + $data = json_decode($job->getRawBody(), true); + + if($this->container->bound('events')) + { + $this->container['events']->fire('illuminate.queue.failed', array('sync', $job, $data)); + } + } + }
true
Other
laravel
framework
8b7c5a42895f41028899f9dfeb0059bcdb250183.json
Add failed job handling for SyncQueue
tests/Queue/QueueSyncQueueTest.php
@@ -1,5 +1,6 @@ <?php +use Exception; use Mockery as m; class QueueSyncQueueTest extends PHPUnit_Framework_TestCase { @@ -63,6 +64,30 @@ public function testQueueableEntitiesAreSerializedAndResolvedWhenPassedAsSingleE $this->assertInstanceOf('SyncQueueTestEntity', $_SERVER['__sync.test'][1]); } + + public function testFailedJobGetsHandledWhenAnExceptionIsThrown() + { + unset($_SERVER['__sync.failed']); + + $sync = new Illuminate\Queue\SyncQueue; + $container = new Illuminate\Container\Container; + $encrypter = new Illuminate\Encryption\Encrypter(str_random(32)); + $container->instance('Illuminate\Contracts\Encryption\Encrypter', $encrypter); + $events = m::mock('Illuminate\Contracts\Events\Dispatcher'); + $events->shouldReceive('fire')->once(); + $container->instance('events', $events); + $sync->setContainer($container); + $sync->setEncrypter($encrypter); + + try { + $sync->push('FailingSyncQueueTestHandler', ['foo' => 'bar']); + } + catch(Exception $e) + { + $this->assertTrue($_SERVER['__sync.failed']); + } + } + } class SyncQueueTestEntity implements Illuminate\Contracts\Queue\QueueableEntity { @@ -76,3 +101,12 @@ public function fire($job, $data) { $_SERVER['__sync.test'] = func_get_args(); } } + +class FailingSyncQueueTestHandler { + public function fire($job, $data) { + throw new Exception(); + } + public function failed(){ + $_SERVER['__sync.failed'] = true; + } +} \ No newline at end of file
true
Other
laravel
framework
b2ec9f1a0fd13f49ea53c1bea92fcb579d5e05df.json
Use list in after command parsing
src/Illuminate/Console/Command.php
@@ -85,15 +85,15 @@ public function __construct() */ protected function configureUsingFluentDefinition() { - $definition = Parser::parse($this->signature); + list($name, $arguments, $options) = Parser::parse($this->signature); - parent::__construct($definition[0]); + parent::__construct($name); - foreach ($definition[1] as $argument) { + foreach ($arguments as $argument) { $this->getDefinition()->addArgument($argument); } - foreach ($definition[2] as $option) { + foreach ($options as $option) { $this->getDefinition()->addOption($option); } }
false
Other
laravel
framework
e05deec2d36aa980880e1c7d893ee9e41c038388.json
Remove useless imports
src/Illuminate/Database/Console/Seeds/SeederMakeCommand.php
@@ -3,7 +3,6 @@ use Illuminate\Foundation\Composer; use Illuminate\Filesystem\Filesystem; use Illuminate\Console\GeneratorCommand; -use Symfony\Component\Console\Input\InputArgument; class SeederMakeCommand extends GeneratorCommand {
true
Other
laravel
framework
e05deec2d36aa980880e1c7d893ee9e41c038388.json
Remove useless imports
src/Illuminate/Foundation/Bus/DispatchesCommands.php
@@ -1,7 +1,5 @@ <?php namespace Illuminate\Foundation\Bus; -use ArrayAccess; - /** * @deprecated since version 5.1. Use the DispatchesJobs trait directly. */
true
Other
laravel
framework
e0ae2f6825f5f87440ed8132479f488533334f15.json
Add view:clear command
src/Illuminate/Foundation/Console/ViewClearCommand.php
@@ -0,0 +1,60 @@ +<?php namespace Illuminate\Foundation\Console; + +use Illuminate\Console\Command; +use Illuminate\Filesystem\Filesystem; + +class ViewClearCommand extends Command { + + /** + * The console command name. + * + * @var string + */ + protected $name = 'view:clear'; + + /** + * The console command description. + * + * @var string + */ + protected $description = 'Clear all compiled view files'; + + /** + * The filesystem instance. + * + * @var \Illuminate\Filesystem\Filesystem + */ + protected $files; + + /** + * Create a new config clear command instance. + * + * @param \Illuminate\Filesystem\Filesystem $files + * @return void + */ + public function __construct(Filesystem $files) + { + parent::__construct(); + + $this->files = $files; + } + + /** + * Execute the console command. + * + * @return void + */ + public function fire() + { + // Because glob ignores hidden files, .gitignore will be preserved. + $views = $this->files->glob($this->laravel['config']['view.compiled'].'/*'); + + foreach ($views as $view) + { + $this->files->delete($view); + } + + $this->info('Compiled views cleared!'); + } + +}
true
Other
laravel
framework
e0ae2f6825f5f87440ed8132479f488533334f15.json
Add view:clear command
src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
@@ -11,6 +11,7 @@ use Illuminate\Foundation\Console\RouteListCommand; use Illuminate\Foundation\Console\EventMakeCommand; use Illuminate\Foundation\Console\ModelMakeCommand; +use Illuminate\Foundation\Console\ViewClearCommand; use Illuminate\Foundation\Console\RouteCacheCommand; use Illuminate\Foundation\Console\RouteClearCommand; use Illuminate\Foundation\Console\CommandMakeCommand; @@ -69,6 +70,7 @@ class ArtisanServiceProvider extends ServiceProvider { 'Tinker' => 'command.tinker', 'Up' => 'command.up', 'VendorPublish' => 'command.vendor.publish', + 'ViewClear' => 'command.view.clear', ]; /** @@ -426,6 +428,19 @@ protected function registerVendorPublishCommand() }); } + /** + * Register the command. + * + * @return void + */ + protected function registerViewClearCommand() + { + $this->app->singleton('command.view.clear', function($app) + { + return new ViewClearCommand($app['files']); + }); + } + /** * Get the services provided by the provider. *
true
Other
laravel
framework
9b0b8e87ce000336b1dad57bba61d2a946de916a.json
Use DispatchesJobs in DispatchesCommands
src/Illuminate/Foundation/Bus/DispatchesCommands.php
@@ -3,44 +3,10 @@ use ArrayAccess; /** - * @deprecated since version 5.1. Use the DispatchesJobs trait instead. + * @deprecated since version 5.1. Use the DispatchesJobs trait directly. */ trait DispatchesCommands { - /** - * Dispatch a command to its appropriate handler. - * - * @param mixed $command - * @return mixed - */ - protected function dispatch($command) - { - return app('Illuminate\Contracts\Bus\Dispatcher')->dispatch($command); - } - - /** - * Marshal a command and dispatch it to its appropriate handler. - * - * @param mixed $command - * @param array $array - * @return mixed - */ - protected function dispatchFromArray($command, array $array) - { - return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFromArray($command, $array); - } - - /** - * Marshal a command and dispatch it to its appropriate handler. - * - * @param mixed $command - * @param \ArrayAccess $source - * @param array $extras - * @return mixed - */ - protected function dispatchFrom($command, ArrayAccess $source, $extras = []) - { - return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFrom($command, $source, $extras); - } + use DispatchesJobs; }
false
Other
laravel
framework
00869525009a0a07d282a7fe9cce9edeb29c21d7.json
Use proper docblock for deprecation
src/Illuminate/Foundation/Bus/DispatchesCommands.php
@@ -3,7 +3,7 @@ use ArrayAccess; /** - * This trait is deprecated. Use the DispatchesJobs trait. + * @deprecated since version 5.1. Use the DispatchesJobs trait instead. */ trait DispatchesCommands {
false
Other
laravel
framework
5543406e19b7585964071a01c8f856b56200181b.json
Use jsonSerialize in toJson
src/Illuminate/Database/Eloquent/Model.php
@@ -2354,7 +2354,7 @@ public function setIncrementing($value) */ public function toJson($options = 0) { - return json_encode($this->toArray(), $options); + return json_encode($this->jsonSerialize(), $options); } /**
false
Other
laravel
framework
df01d9e85140e898f20f6ba8566ba052f80d5c5c.json
Add keys to transfrom
src/Illuminate/Support/Collection.php
@@ -738,7 +738,9 @@ public function take($limit) */ public function transform(callable $callback) { - $this->items = array_map($callback, $this->items); + $keys = array_keys($this->items); + + $this->items = array_combine($keys, array_map($callback, $this->items, $keys)); return $this; }
true