From ac745730492ef23a04ce614228d11e496feb625d Mon Sep 17 00:00:00 2001 From: Tetiana Blindaruk Date: Sat, 6 Oct 2018 21:48:42 +0300 Subject: [PATCH] [5.7] Apply `square bracket syntax for array destructuring assignment` (#25966) Apply `square bracket syntax for array destructuring assignment`, for more information please look into https://wiki.php.net/rfc/short_list_syntax This rfc was implemented in PHP v7.1. Laravel support php from the 7.1.3 --- .../Auth/Passwords/PasswordBroker.php | 4 +- src/Illuminate/Cache/MemcachedConnector.php | 2 +- src/Illuminate/Config/Repository.php | 2 +- src/Illuminate/Console/Command.php | 2 +- src/Illuminate/Console/Parser.php | 4 +- src/Illuminate/Cookie/CookieJar.php | 4 +- .../Database/Connectors/Connector.php | 2 +- src/Illuminate/Database/DatabaseManager.php | 2 +- src/Illuminate/Database/Eloquent/Builder.php | 6 +-- .../Eloquent/Concerns/HasAttributes.php | 2 +- .../Eloquent/Concerns/HasRelationships.php | 8 ++-- .../Concerns/QueriesRelationships.php | 2 +- .../Concerns/InteractsWithPivotTable.php | 4 +- src/Illuminate/Database/Query/Builder.php | 44 +++++++++---------- .../Database/Query/Grammars/MySqlGrammar.php | 4 +- .../Database/Query/Grammars/SQLiteGrammar.php | 2 +- .../Query/Grammars/SqlServerGrammar.php | 6 +-- .../Database/Schema/PostgresBuilder.php | 4 +- src/Illuminate/Events/Dispatcher.php | 8 ++-- .../Auth/Access/AuthorizesRequests.php | 4 +- .../Console/VendorPublishCommand.php | 4 +- src/Illuminate/Foundation/Http/Kernel.php | 4 +- src/Illuminate/Log/LogManager.php | 2 +- src/Illuminate/Mail/Mailer.php | 4 +- src/Illuminate/Pipeline/Pipeline.php | 4 +- src/Illuminate/Queue/Jobs/Job.php | 4 +- src/Illuminate/Queue/RedisQueue.php | 2 +- .../Middleware/ThrottleRequestsWithRedis.php | 2 +- .../Routing/MiddlewareNameResolver.php | 4 +- src/Illuminate/Routing/RedirectController.php | 2 +- src/Illuminate/Routing/ResourceRegistrar.php | 2 +- src/Illuminate/Routing/RouteBinding.php | 2 +- src/Illuminate/Routing/RouteCollection.php | 2 +- .../Routing/RouteSignatureParameters.php | 2 +- src/Illuminate/Routing/UrlGenerator.php | 2 +- src/Illuminate/Routing/ViewController.php | 2 +- src/Illuminate/Support/Arr.php | 2 +- .../Support/NamespacedItemResolver.php | 2 +- .../Translation/MessageSelector.php | 2 +- src/Illuminate/Translation/Translator.php | 4 +- .../Validation/Concerns/FormatsMessages.php | 2 +- .../Concerns/ValidatesAttributes.php | 14 +++--- .../Validation/ValidationRuleParser.php | 2 +- src/Illuminate/Validation/Validator.php | 6 +-- .../View/Compilers/BladeCompiler.php | 2 +- .../View/Concerns/ManagesEvents.php | 2 +- src/Illuminate/View/FileViewFinder.php | 2 +- src/Illuminate/View/ViewName.php | 2 +- tests/Auth/AuthGuardTest.php | 44 +++++++++---------- .../DatabaseEloquentMorphToManyTest.php | 2 +- tests/Support/SupportArrTest.php | 2 +- tests/Support/SupportCollectionTest.php | 14 +++--- tests/Support/SupportHelpersTest.php | 2 +- 53 files changed, 133 insertions(+), 133 deletions(-) diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index 07d046fb0f33..66918fca08c4 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -146,7 +146,7 @@ public function validator(Closure $callback) public function validateNewPassword(array $credentials) { if (isset($this->passwordValidator)) { - list($password, $confirm) = [ + [$password, $confirm] = [ $credentials['password'], $credentials['password_confirmation'], ]; @@ -167,7 +167,7 @@ public function validateNewPassword(array $credentials) */ protected function validatePasswordWithDefaults(array $credentials) { - list($password, $confirm) = [ + [$password, $confirm] = [ $credentials['password'], $credentials['password_confirmation'], ]; diff --git a/src/Illuminate/Cache/MemcachedConnector.php b/src/Illuminate/Cache/MemcachedConnector.php index a4593b34716a..224d94099bf3 100755 --- a/src/Illuminate/Cache/MemcachedConnector.php +++ b/src/Illuminate/Cache/MemcachedConnector.php @@ -78,7 +78,7 @@ protected function createMemcachedInstance($connectionId) */ protected function setCredentials($memcached, $credentials) { - list($username, $password) = $credentials; + [$username, $password] = $credentials; $memcached->setOption(Memcached::OPT_BINARY_PROTOCOL, true); diff --git a/src/Illuminate/Config/Repository.php b/src/Illuminate/Config/Repository.php index 56644eba6da0..cadcd64c9864 100644 --- a/src/Illuminate/Config/Repository.php +++ b/src/Illuminate/Config/Repository.php @@ -65,7 +65,7 @@ public function getMany($keys) foreach ($keys as $key => $default) { if (is_numeric($key)) { - list($key, $default) = [$default, null]; + [$key, $default] = [$default, null]; } $config[$key] = Arr::get($this->items, $key, $default); diff --git a/src/Illuminate/Console/Command.php b/src/Illuminate/Console/Command.php index 9b56130a0cba..92288a30a67d 100755 --- a/src/Illuminate/Console/Command.php +++ b/src/Illuminate/Console/Command.php @@ -123,7 +123,7 @@ public function __construct() */ protected function configureUsingFluentDefinition() { - list($name, $arguments, $options) = Parser::parse($this->signature); + [$name, $arguments, $options] = Parser::parse($this->signature); parent::__construct($this->name = $name); diff --git a/src/Illuminate/Console/Parser.php b/src/Illuminate/Console/Parser.php index 75cea481a331..776431014834 100644 --- a/src/Illuminate/Console/Parser.php +++ b/src/Illuminate/Console/Parser.php @@ -82,7 +82,7 @@ protected static function parameters(array $tokens) */ protected static function parseArgument($token) { - list($token, $description) = static::extractDescription($token); + [$token, $description] = static::extractDescription($token); switch (true) { case Str::endsWith($token, '?*'): @@ -108,7 +108,7 @@ protected static function parseArgument($token) */ protected static function parseOption($token) { - list($token, $description) = static::extractDescription($token); + [$token, $description] = static::extractDescription($token); $matches = preg_split('/\s*\|\s*/', $token, 2); diff --git a/src/Illuminate/Cookie/CookieJar.php b/src/Illuminate/Cookie/CookieJar.php index f792a6c7638e..abf23fd87933 100755 --- a/src/Illuminate/Cookie/CookieJar.php +++ b/src/Illuminate/Cookie/CookieJar.php @@ -62,7 +62,7 @@ class CookieJar implements JarContract */ public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null) { - list($path, $domain, $secure, $sameSite) = $this->getPathAndDomain($path, $domain, $secure, $sameSite); + [$path, $domain, $secure, $sameSite] = $this->getPathAndDomain($path, $domain, $secure, $sameSite); $time = ($minutes == 0) ? 0 : $this->availableAt($minutes * 60); @@ -176,7 +176,7 @@ protected function getPathAndDomain($path, $domain, $secure = null, $sameSite = */ public function setDefaultPathAndDomain($path, $domain, $secure = false, $sameSite = null) { - list($this->path, $this->domain, $this->secure, $this->sameSite) = [$path, $domain, $secure, $sameSite]; + [$this->path, $this->domain, $this->secure, $this->sameSite] = [$path, $domain, $secure, $sameSite]; return $this; } diff --git a/src/Illuminate/Database/Connectors/Connector.php b/src/Illuminate/Database/Connectors/Connector.php index aa4788034c29..ab0903d9ca48 100755 --- a/src/Illuminate/Database/Connectors/Connector.php +++ b/src/Illuminate/Database/Connectors/Connector.php @@ -37,7 +37,7 @@ class Connector */ public function createConnection($dsn, array $config, array $options) { - list($username, $password) = [ + [$username, $password] = [ $config['username'] ?? null, $config['password'] ?? null, ]; diff --git a/src/Illuminate/Database/DatabaseManager.php b/src/Illuminate/Database/DatabaseManager.php index 413afaf7016c..9f775e6d46ed 100755 --- a/src/Illuminate/Database/DatabaseManager.php +++ b/src/Illuminate/Database/DatabaseManager.php @@ -62,7 +62,7 @@ public function __construct($app, ConnectionFactory $factory) */ public function connection($name = null) { - list($database, $type) = $this->parseConnectionName($name); + [$database, $type] = $this->parseConnectionName($name); $name = $name ?: $database; diff --git a/src/Illuminate/Database/Eloquent/Builder.php b/src/Illuminate/Database/Eloquent/Builder.php index 75539e728f0e..271e62cc1ecc 100755 --- a/src/Illuminate/Database/Eloquent/Builder.php +++ b/src/Illuminate/Database/Eloquent/Builder.php @@ -240,7 +240,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' */ public function orWhere($column, $operator = null, $value = null) { - list($value, $operator) = $this->query->prepareValueAndOperator( + [$value, $operator] = $this->query->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -915,7 +915,7 @@ public function scopes(array $scopes) // the parameter list is empty, so we will format the scope name and these // parameters here. Then, we'll be ready to call the scope on the model. if (is_int($scope)) { - list($scope, $parameters) = [$parameters, []]; + [$scope, $parameters] = [$parameters, []]; } // Next we'll pass the scope callback to the callScope method which will take @@ -1120,7 +1120,7 @@ protected function parseWithRelations(array $relations) if (is_numeric($name)) { $name = $constraints; - list($name, $constraints) = Str::contains($name, ':') + [$name, $constraints] = Str::contains($name, ':') ? $this->createSelectWithConstraint($name) : [$name, function () { // diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index b61321af509e..c446957c858d 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -613,7 +613,7 @@ protected function isDateAttribute($key) */ public function fillJsonAttribute($key, $value) { - list($key, $path) = explode('->', $key, 2); + [$key, $path] = explode('->', $key, 2); $this->attributes[$key] = $this->asJson($this->getArrayAttributeWithValue( $path, $key, $value diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php b/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php index 244d95fd45fa..019fc19c2597 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php @@ -91,7 +91,7 @@ public function morphOne($related, $name, $type = null, $id = null, $localKey = { $instance = $this->newRelatedInstance($related); - list($type, $id) = $this->getMorphs($name, $type, $id); + [$type, $id] = $this->getMorphs($name, $type, $id); $table = $instance->getTable(); @@ -183,7 +183,7 @@ public function morphTo($name = null, $type = null, $id = null, $ownerKey = null // use that to get both the class and foreign key that will be utilized. $name = $name ?: $this->guessBelongsToRelation(); - list($type, $id) = $this->getMorphs( + [$type, $id] = $this->getMorphs( Str::snake($name), $type, $id ); @@ -266,7 +266,7 @@ public static function getActualClassNameForMorph($class) */ protected function guessBelongsToRelation() { - list($one, $two, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); + [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); return $caller['function']; } @@ -366,7 +366,7 @@ public function morphMany($related, $name, $type = null, $id = null, $localKey = // Here we will gather up the morph type and ID for the relationship so that we // can properly query the intermediate table of a relation. Finally, we will // get the table and create the relationship instances for the developers. - list($type, $id) = $this->getMorphs($name, $type, $id); + [$type, $id] = $this->getMorphs($name, $type, $id); $table = $instance->getTable(); diff --git a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php index 08e5323ecaf7..57fdad8dd357 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php +++ b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php @@ -202,7 +202,7 @@ public function withCount($relations) unset($alias); if (count($segments) == 3 && Str::lower($segments[1]) == 'as') { - list($name, $alias) = [$segments[0], $segments[2]]; + [$name, $alias] = [$segments[0], $segments[2]]; } $relation = $this->getRelationWithoutConstraints($name); diff --git a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php b/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php index 12f9df0aa3df..61392452f7a2 100644 --- a/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php +++ b/src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php @@ -133,7 +133,7 @@ protected function formatRecordsList(array $records) { return collect($records)->mapWithKeys(function ($attributes, $id) { if (! is_array($attributes)) { - list($id, $attributes) = [$attributes, []]; + [$id, $attributes] = [$attributes, []]; } return [$id => $attributes]; @@ -258,7 +258,7 @@ protected function formatAttachRecords($ids, array $attributes) */ protected function formatAttachRecord($key, $value, $attributes, $hasTimestamps) { - list($id, $attributes) = $this->extractAttachIdAndAttributes($key, $value, $attributes); + [$id, $attributes] = $this->extractAttachIdAndAttributes($key, $value, $attributes); return array_merge( $this->baseAttachRecord($id, $hasTimestamps), $this->castAttributes($attributes) diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 8781d23bdef7..465366365c07 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -235,7 +235,7 @@ public function select($columns = ['*']) */ public function selectSub($query, $as) { - list($query, $bindings) = $this->createSub($query); + [$query, $bindings] = $this->createSub($query); return $this->selectRaw( '('.$query.') as '.$this->grammar->wrap($as), $bindings @@ -271,7 +271,7 @@ public function selectRaw($expression, array $bindings = []) */ public function fromSub($query, $as) { - list($query, $bindings) = $this->createSub($query); + [$query, $bindings] = $this->createSub($query); return $this->fromRaw('('.$query.') as '.$this->grammar->wrap($as), $bindings); } @@ -440,7 +440,7 @@ public function joinWhere($table, $first, $operator, $second, $type = 'inner') */ public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false) { - list($query, $bindings) = $this->createSub($query); + [$query, $bindings] = $this->createSub($query); $expression = '('.$query.') as '.$this->grammar->wrap($as); @@ -592,7 +592,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' // Here we will make some assumptions about the operator. If only 2 values are // passed to the method, we will assume that the operator is an equals sign // and keep going. Otherwise, we'll require the operator to be passed in. - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -607,7 +607,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' // assume that the developer is just short-cutting the '=' operators and // we will set the operators to '=' and set the values appropriately. if ($this->invalidOperator($operator)) { - list($value, $operator) = [$operator, '=']; + [$value, $operator] = [$operator, '=']; } // If the value is a Closure, it means the developer is performing an entire @@ -726,7 +726,7 @@ protected function invalidOperator($operator) */ public function orWhere($column, $operator = null, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -755,7 +755,7 @@ public function whereColumn($first, $operator = null, $second = null, $boolean = // assume that the developer is just short-cutting the '=' operators and // we will set the operators to '=' and set the values appropriately. if ($this->invalidOperator($operator)) { - list($second, $operator) = [$operator, '=']; + [$second, $operator] = [$operator, '=']; } // Finally, we will add this where clause into this array of clauses that we @@ -1067,7 +1067,7 @@ public function orWhereNotNull($column) */ public function whereDate($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1088,7 +1088,7 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and') */ public function orWhereDate($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1106,7 +1106,7 @@ public function orWhereDate($column, $operator, $value = null) */ public function whereTime($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1127,7 +1127,7 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and') */ public function orWhereTime($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1145,7 +1145,7 @@ public function orWhereTime($column, $operator, $value = null) */ public function whereDay($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1166,7 +1166,7 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and') */ public function orWhereDay($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1184,7 +1184,7 @@ public function orWhereDay($column, $operator, $value = null) */ public function whereMonth($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1205,7 +1205,7 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and') */ public function orWhereMonth($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1223,7 +1223,7 @@ public function orWhereMonth($column, $operator, $value = null) */ public function whereYear($column, $operator, $value = null, $boolean = 'and') { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1244,7 +1244,7 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and') */ public function orWhereYear($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1526,7 +1526,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a { $type = 'JsonLength'; - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1549,7 +1549,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a */ public function orWhereJsonLength($column, $operator, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1652,7 +1652,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and // Here we will make some assumptions about the operator. If only 2 values are // passed to the method, we will assume that the operator is an equals sign // and keep going. Otherwise, we'll require the operator to be passed in. - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); @@ -1660,7 +1660,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and // assume that the developer is just short-cutting the '=' operators and // we will set the operators to '=' and set the values appropriately. if ($this->invalidOperator($operator)) { - list($value, $operator) = [$operator, '=']; + [$value, $operator] = [$operator, '=']; } $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); @@ -1682,7 +1682,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and */ public function orHaving($column, $operator = null, $value = null) { - list($value, $operator) = $this->prepareValueAndOperator( + [$value, $operator] = $this->prepareValueAndOperator( $value, $operator, func_num_args() === 2 ); diff --git a/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php index 292c71c874c8..9bc33286a4b6 100755 --- a/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php @@ -74,7 +74,7 @@ protected function compileJsonContains($column, $value) */ protected function compileJsonLength($column, $operator, $value) { - list($field, $path) = $this->wrapJsonFieldAndPath($column); + [$field, $path] = $this->wrapJsonFieldAndPath($column); return 'json_length('.$field.$path.') '.$operator.' '.$value; } @@ -194,7 +194,7 @@ protected function compileUpdateColumns($values) */ protected function compileJsonUpdateColumn($key, JsonExpression $value) { - list($field, $path) = $this->wrapJsonFieldAndPath($key); + [$field, $path] = $this->wrapJsonFieldAndPath($key); return "{$field} = json_set({$field}{$path}, {$value->getValue()})"; } diff --git a/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php index 1220009e1fc9..a5f38ffafcb7 100755 --- a/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php @@ -153,7 +153,7 @@ protected function dateBasedWhere($type, Builder $query, $where) */ protected function compileJsonLength($column, $operator, $value) { - list($field, $path) = $this->wrapJsonFieldAndPath($column); + [$field, $path] = $this->wrapJsonFieldAndPath($column); return 'json_array_length('.$field.$path.') '.$operator.' '.$value; } diff --git a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php b/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php index 381aa1edec32..b2aff7b10fd2 100755 --- a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php @@ -126,7 +126,7 @@ protected function whereTime(Builder $query, $where) */ protected function compileJsonContains($column, $value) { - list($field, $path) = $this->wrapJsonFieldAndPath($column); + [$field, $path] = $this->wrapJsonFieldAndPath($column); return $value.' in (select [value] from openjson('.$field.$path.'))'; } @@ -152,7 +152,7 @@ public function prepareBindingForJsonContains($binding) */ protected function compileJsonLength($column, $operator, $value) { - list($field, $path) = $this->wrapJsonFieldAndPath($column); + [$field, $path] = $this->wrapJsonFieldAndPath($column); return '(select count(*) from openjson('.$field.$path.')) '.$operator.' '.$value; } @@ -349,7 +349,7 @@ public function compileTruncate(Builder $query) */ public function compileUpdate(Builder $query, $values) { - list($table, $alias) = $this->parseUpdateTable($query->from); + [$table, $alias] = $this->parseUpdateTable($query->from); // Each one of the columns in the update statements needs to be wrapped in the // keyword identifiers, also a place-holder needs to be created for each of diff --git a/src/Illuminate/Database/Schema/PostgresBuilder.php b/src/Illuminate/Database/Schema/PostgresBuilder.php index aa2255ed6b94..bdeb972a6747 100755 --- a/src/Illuminate/Database/Schema/PostgresBuilder.php +++ b/src/Illuminate/Database/Schema/PostgresBuilder.php @@ -12,7 +12,7 @@ class PostgresBuilder extends Builder */ public function hasTable($table) { - list($schema, $table) = $this->parseSchemaAndTable($table); + [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; @@ -107,7 +107,7 @@ protected function getAllViews() */ public function getColumnListing($table) { - list($schema, $table) = $this->parseSchemaAndTable($table); + [$schema, $table] = $this->parseSchemaAndTable($table); $table = $this->connection->getTablePrefix().$table; diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index be3561b5c0e4..8fb73bac39a8 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -195,7 +195,7 @@ public function dispatch($event, $payload = [], $halt = false) // When the given "event" is actually an object we will assume it is an event // object and use the class as the event name and this event itself as the // payload to the handler, which makes object based events quite simple. - list($event, $payload) = $this->parseEventAndPayload( + [$event, $payload] = $this->parseEventAndPayload( $event, $payload ); @@ -238,7 +238,7 @@ public function dispatch($event, $payload = [], $halt = false) protected function parseEventAndPayload($event, $payload) { if (is_object($event)) { - list($payload, $event) = [[$event], get_class($event)]; + [$payload, $event] = [[$event], get_class($event)]; } return [$event, Arr::wrap($payload)]; @@ -389,7 +389,7 @@ public function createClassListener($listener, $wildcard = false) */ protected function createClassCallable($listener) { - list($class, $method) = $this->parseClassCallable($listener); + [$class, $method] = $this->parseClassCallable($listener); if ($this->handlerShouldBeQueued($class)) { return $this->createQueuedHandlerCallable($class, $method); @@ -472,7 +472,7 @@ protected function handlerWantsToBeQueued($class, $arguments) */ protected function queueHandler($class, $method, $arguments) { - list($listener, $job) = $this->createListenerAndJob($class, $method, $arguments); + [$listener, $job] = $this->createListenerAndJob($class, $method, $arguments); $connection = $this->resolveQueue()->connection( $listener->connection ?? null diff --git a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php b/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php index ece53587edf8..9930d9052d8b 100644 --- a/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php +++ b/src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php @@ -18,7 +18,7 @@ trait AuthorizesRequests */ public function authorize($ability, $arguments = []) { - list($ability, $arguments) = $this->parseAbilityAndArguments($ability, $arguments); + [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->authorize($ability, $arguments); } @@ -35,7 +35,7 @@ public function authorize($ability, $arguments = []) */ public function authorizeForUser($user, $ability, $arguments = []) { - list($ability, $arguments) = $this->parseAbilityAndArguments($ability, $arguments); + [$ability, $arguments] = $this->parseAbilityAndArguments($ability, $arguments); return app(Gate::class)->forUser($user)->authorize($ability, $arguments); } diff --git a/src/Illuminate/Foundation/Console/VendorPublishCommand.php b/src/Illuminate/Foundation/Console/VendorPublishCommand.php index 03a80bfeea2a..08d9b9c95f93 100644 --- a/src/Illuminate/Foundation/Console/VendorPublishCommand.php +++ b/src/Illuminate/Foundation/Console/VendorPublishCommand.php @@ -90,7 +90,7 @@ protected function determineWhatShouldBePublished() return; } - list($this->provider, $this->tags) = [ + [$this->provider, $this->tags] = [ $this->option('provider'), (array) $this->option('tag'), ]; @@ -140,7 +140,7 @@ protected function publishableChoices() */ protected function parseChoice($choice) { - list($type, $value) = explode(': ', strip_tags($choice)); + [$type, $value] = explode(': ', strip_tags($choice)); if ($type == 'Provider') { $this->provider = $value; diff --git a/src/Illuminate/Foundation/Http/Kernel.php b/src/Illuminate/Foundation/Http/Kernel.php index 04f0e4a07155..f8460a550252 100644 --- a/src/Illuminate/Foundation/Http/Kernel.php +++ b/src/Illuminate/Foundation/Http/Kernel.php @@ -210,7 +210,7 @@ protected function terminateMiddleware($request, $response) continue; } - list($name) = $this->parseMiddleware($middleware); + [$name] = $this->parseMiddleware($middleware); $instance = $this->app->make($name); @@ -243,7 +243,7 @@ protected function gatherRouteMiddleware($request) */ protected function parseMiddleware($middleware) { - list($name, $parameters) = array_pad(explode(':', $middleware, 2), 2, []); + [$name, $parameters] = array_pad(explode(':', $middleware, 2), 2, []); if (is_string($parameters)) { $parameters = explode(',', $parameters); diff --git a/src/Illuminate/Log/LogManager.php b/src/Illuminate/Log/LogManager.php index d49c4bac9aaf..ac5942b22bb4 100644 --- a/src/Illuminate/Log/LogManager.php +++ b/src/Illuminate/Log/LogManager.php @@ -120,7 +120,7 @@ protected function get($name) protected function tap($name, Logger $logger) { foreach ($this->configurationFor($name)['tap'] ?? [] as $tap) { - list($class, $arguments) = $this->parseTap($tap); + [$class, $arguments] = $this->parseTap($tap); $this->app->make($class)->__invoke($logger, ...explode(',', $arguments)); } diff --git a/src/Illuminate/Mail/Mailer.php b/src/Illuminate/Mail/Mailer.php index 237bddf29b22..bc2f2980aa34 100755 --- a/src/Illuminate/Mail/Mailer.php +++ b/src/Illuminate/Mail/Mailer.php @@ -208,7 +208,7 @@ public function render($view, array $data = []) // First we need to parse the view, which could either be a string or an array // containing both an HTML and plain text versions of the view which should // be used when sending an e-mail. We will extract both of them out here. - list($view, $plain, $raw) = $this->parseView($view); + [$view, $plain, $raw] = $this->parseView($view); $data['message'] = $this->createMessage(); @@ -232,7 +232,7 @@ public function send($view, array $data = [], $callback = null) // First we need to parse the view, which could either be a string or an array // containing both an HTML and plain text versions of the view which should // be used when sending an e-mail. We will extract both of them out here. - list($view, $plain, $raw) = $this->parseView($view); + [$view, $plain, $raw] = $this->parseView($view); $data['message'] = $message = $this->createMessage(); diff --git a/src/Illuminate/Pipeline/Pipeline.php b/src/Illuminate/Pipeline/Pipeline.php index b45f1093b6d3..2949c26e1c2a 100644 --- a/src/Illuminate/Pipeline/Pipeline.php +++ b/src/Illuminate/Pipeline/Pipeline.php @@ -132,7 +132,7 @@ protected function carry() // the appropriate method and arguments, returning the results back out. return $pipe($passable, $stack); } elseif (! is_object($pipe)) { - list($name, $parameters) = $this->parsePipeString($pipe); + [$name, $parameters] = $this->parsePipeString($pipe); // If the pipe is a string we will parse the string and resolve the class out // of the dependency injection container. We can then build a callable and @@ -166,7 +166,7 @@ protected function carry() */ protected function parsePipeString($pipe) { - list($name, $parameters) = array_pad(explode(':', $pipe, 2), 2, []); + [$name, $parameters] = array_pad(explode(':', $pipe, 2), 2, []); if (is_string($parameters)) { $parameters = explode(',', $parameters); diff --git a/src/Illuminate/Queue/Jobs/Job.php b/src/Illuminate/Queue/Jobs/Job.php index 93a020f53193..2f043c574b4b 100755 --- a/src/Illuminate/Queue/Jobs/Job.php +++ b/src/Illuminate/Queue/Jobs/Job.php @@ -78,7 +78,7 @@ public function fire() { $payload = $this->payload(); - list($class, $method) = JobName::parse($payload['job']); + [$class, $method] = JobName::parse($payload['job']); ($this->instance = $this->resolve($class))->{$method}($this, $payload['data']); } @@ -166,7 +166,7 @@ public function failed($e) $payload = $this->payload(); - list($class, $method) = JobName::parse($payload['job']); + [$class, $method] = JobName::parse($payload['job']); if (method_exists($this->instance = $this->resolve($class), 'failed')) { $this->instance->failed($payload['data'], $e); diff --git a/src/Illuminate/Queue/RedisQueue.php b/src/Illuminate/Queue/RedisQueue.php index 670b61cbd0b7..31eac51642ea 100644 --- a/src/Illuminate/Queue/RedisQueue.php +++ b/src/Illuminate/Queue/RedisQueue.php @@ -167,7 +167,7 @@ public function pop($queue = null) return; } - list($job, $reserved) = $nextJob; + [$job, $reserved] = $nextJob; if ($reserved) { return new RedisJob( diff --git a/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php b/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php index 35e57281531e..fe2567f57b43 100644 --- a/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php +++ b/src/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.php @@ -84,7 +84,7 @@ protected function tooManyAttempts($key, $maxAttempts, $decayMinutes) ); return tap(! $limiter->acquire(), function () use ($limiter) { - list($this->decaysAt, $this->remaining) = [ + [$this->decaysAt, $this->remaining] = [ $limiter->decaysAt, $limiter->remaining, ]; }); diff --git a/src/Illuminate/Routing/MiddlewareNameResolver.php b/src/Illuminate/Routing/MiddlewareNameResolver.php index ad67b46c6d3c..605d61a768c9 100644 --- a/src/Illuminate/Routing/MiddlewareNameResolver.php +++ b/src/Illuminate/Routing/MiddlewareNameResolver.php @@ -37,7 +37,7 @@ public static function resolve($name, $map, $middlewareGroups) // Finally, when the middleware is simply a string mapped to a class name the // middleware name will get parsed into the full class name and parameters // which may be run using the Pipeline which accepts this string format. - list($name, $parameters) = array_pad(explode(':', $name, 2), 2, null); + [$name, $parameters] = array_pad(explode(':', $name, 2), 2, null); return ($map[$name] ?? $name).(! is_null($parameters) ? ':'.$parameters : ''); } @@ -66,7 +66,7 @@ protected static function parseMiddlewareGroup($name, $map, $middlewareGroups) continue; } - list($middleware, $parameters) = array_pad( + [$middleware, $parameters] = array_pad( explode(':', $middleware, 2), 2, null ); diff --git a/src/Illuminate/Routing/RedirectController.php b/src/Illuminate/Routing/RedirectController.php index 82dbf337b520..e825ddfa5a81 100644 --- a/src/Illuminate/Routing/RedirectController.php +++ b/src/Illuminate/Routing/RedirectController.php @@ -14,7 +14,7 @@ class RedirectController extends Controller */ public function __invoke(...$args) { - list($destination, $status) = array_slice($args, -2); + [$destination, $status] = array_slice($args, -2); return new RedirectResponse($destination, $status); } diff --git a/src/Illuminate/Routing/ResourceRegistrar.php b/src/Illuminate/Routing/ResourceRegistrar.php index 37ccb2e59f77..7528173e517d 100644 --- a/src/Illuminate/Routing/ResourceRegistrar.php +++ b/src/Illuminate/Routing/ResourceRegistrar.php @@ -113,7 +113,7 @@ public function register($name, $controller, array $options = []) */ protected function prefixedResource($name, $controller, array $options) { - list($name, $prefix) = $this->getResourcePrefix($name); + [$name, $prefix] = $this->getResourcePrefix($name); // 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 diff --git a/src/Illuminate/Routing/RouteBinding.php b/src/Illuminate/Routing/RouteBinding.php index 510531991ec3..e2f284c33ab8 100644 --- a/src/Illuminate/Routing/RouteBinding.php +++ b/src/Illuminate/Routing/RouteBinding.php @@ -37,7 +37,7 @@ protected static function createClassBinding($container, $binding) // If the binding has an @ sign, we will assume it's being used to delimit // the class name from the bind method name. This allows for bindings // to run multiple bind methods in a single class for convenience. - list($class, $method) = Str::parseCallback($binding, 'bind'); + [$class, $method] = Str::parseCallback($binding, 'bind'); $callable = [$container->make($class), $method]; diff --git a/src/Illuminate/Routing/RouteCollection.php b/src/Illuminate/Routing/RouteCollection.php index a9b93fdb4968..32c1bf40af6a 100644 --- a/src/Illuminate/Routing/RouteCollection.php +++ b/src/Illuminate/Routing/RouteCollection.php @@ -189,7 +189,7 @@ public function match(Request $request) */ protected function matchAgainstRoutes(array $routes, $request, $includingMethod = true) { - list($fallbacks, $routes) = collect($routes)->partition(function ($route) { + [$fallbacks, $routes] = collect($routes)->partition(function ($route) { return $route->isFallback; }); diff --git a/src/Illuminate/Routing/RouteSignatureParameters.php b/src/Illuminate/Routing/RouteSignatureParameters.php index c09baeb986fd..59d660f7739c 100644 --- a/src/Illuminate/Routing/RouteSignatureParameters.php +++ b/src/Illuminate/Routing/RouteSignatureParameters.php @@ -34,7 +34,7 @@ public static function fromAction(array $action, $subClass = null) */ protected static function fromClassMethodString($uses) { - list($class, $method) = Str::parseCallback($uses); + [$class, $method] = Str::parseCallback($uses); if (! method_exists($class, $method) && is_callable($class, $method)) { return []; diff --git a/src/Illuminate/Routing/UrlGenerator.php b/src/Illuminate/Routing/UrlGenerator.php index 68c564ab7ac4..6c29daadc0ea 100755 --- a/src/Illuminate/Routing/UrlGenerator.php +++ b/src/Illuminate/Routing/UrlGenerator.php @@ -194,7 +194,7 @@ public function to($path, $extra = [], $secure = null) // for passing the array of parameters to this URL as a list of segments. $root = $this->formatRoot($this->formatScheme($secure)); - list($path, $query) = $this->extractQueryString($path); + [$path, $query] = $this->extractQueryString($path); return $this->format( $root, '/'.trim($path.'/'.$tail, '/') diff --git a/src/Illuminate/Routing/ViewController.php b/src/Illuminate/Routing/ViewController.php index c1f9d09dc443..232013f82609 100644 --- a/src/Illuminate/Routing/ViewController.php +++ b/src/Illuminate/Routing/ViewController.php @@ -32,7 +32,7 @@ public function __construct(ViewFactory $view) */ public function __invoke(...$args) { - list($view, $data) = array_slice($args, -2); + [$view, $data] = array_slice($args, -2); return $this->view->make($view, $data); } diff --git a/src/Illuminate/Support/Arr.php b/src/Illuminate/Support/Arr.php index 85d04b67fb01..a50829bf06a9 100755 --- a/src/Illuminate/Support/Arr.php +++ b/src/Illuminate/Support/Arr.php @@ -385,7 +385,7 @@ public static function pluck($array, $value, $key = null) { $results = []; - list($value, $key) = static::explodePluckParameters($value, $key); + [$value, $key] = static::explodePluckParameters($value, $key); foreach ($array as $item) { $itemValue = data_get($item, $value); diff --git a/src/Illuminate/Support/NamespacedItemResolver.php b/src/Illuminate/Support/NamespacedItemResolver.php index fea32753058f..cc389578c19c 100755 --- a/src/Illuminate/Support/NamespacedItemResolver.php +++ b/src/Illuminate/Support/NamespacedItemResolver.php @@ -74,7 +74,7 @@ protected function parseBasicSegments(array $segments) */ protected function parseNamespacedSegments($key) { - list($namespace, $item) = explode('::', $key); + [$namespace, $item] = explode('::', $key); // First we'll just explode the first segment to get the namespace and group // since the item should be in the remaining segments. Once we have these diff --git a/src/Illuminate/Translation/MessageSelector.php b/src/Illuminate/Translation/MessageSelector.php index ecb03f2d0b39..fdea3c2d4aeb 100755 --- a/src/Illuminate/Translation/MessageSelector.php +++ b/src/Illuminate/Translation/MessageSelector.php @@ -69,7 +69,7 @@ private function extractFromString($part, $number) $value = $matches[2]; if (Str::contains($condition, ',')) { - list($from, $to) = explode(',', $condition, 2); + [$from, $to] = explode(',', $condition, 2); if ($to == '*' && $number >= $from) { return $value; diff --git a/src/Illuminate/Translation/Translator.php b/src/Illuminate/Translation/Translator.php index 1c0970bbbdd7..7514ba2ce8a8 100755 --- a/src/Illuminate/Translation/Translator.php +++ b/src/Illuminate/Translation/Translator.php @@ -113,7 +113,7 @@ public function trans($key, array $replace = [], $locale = null) */ public function get($key, array $replace = [], $locale = null, $fallback = true) { - list($namespace, $group, $item) = $this->parseKey($key); + [$namespace, $group, $item] = $this->parseKey($key); // Here we will get the locale that should be used for the language line. If one // was not passed, we will use the default locales which was given to us when @@ -301,7 +301,7 @@ protected function sortReplacements(array $replace) public function addLines(array $lines, $locale, $namespace = '*') { foreach ($lines as $key => $value) { - list($group, $item) = explode('.', $key, 2); + [$group, $item] = explode('.', $key, 2); Arr::set($this->loaded, "$namespace.$group.$locale.$item", $value); } diff --git a/src/Illuminate/Validation/Concerns/FormatsMessages.php b/src/Illuminate/Validation/Concerns/FormatsMessages.php index 5744830d217d..c3dc5765b86b 100644 --- a/src/Illuminate/Validation/Concerns/FormatsMessages.php +++ b/src/Illuminate/Validation/Concerns/FormatsMessages.php @@ -377,7 +377,7 @@ protected function callReplacer($message, $attribute, $rule, $parameters, $valid */ protected function callClassBasedReplacer($callback, $message, $attribute, $rule, $parameters, $validator) { - list($class, $method) = Str::parseCallback($callback, 'replace'); + [$class, $method] = Str::parseCallback($callback, 'replace'); return call_user_func_array([$this->container->make($class), $method], array_slice(func_get_args(), 1)); } diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index b79e211ad1a2..541e69b143c2 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -498,7 +498,7 @@ public function validateDimensions($attribute, $value, $parameters) $this->requireParameterCount(1, $parameters, 'dimensions'); - list($width, $height) = $sizeDetails; + [$width, $height] = $sizeDetails; $parameters = $this->parseNamedParameters($parameters); @@ -542,7 +542,7 @@ protected function failsRatioCheck($parameters, $width, $height) return false; } - list($numerator, $denominator) = array_replace( + [$numerator, $denominator] = array_replace( [1, 1], array_filter(sscanf($parameters['ratio'], '%f/%d')) ); @@ -604,7 +604,7 @@ public function validateExists($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'exists'); - list($connection, $table) = $this->parseTable($parameters[0]); + [$connection, $table] = $this->parseTable($parameters[0]); // The second parameter position holds the name of the column that should be // verified as existing. If this parameter is not specified we will guess @@ -659,17 +659,17 @@ public function validateUnique($attribute, $value, $parameters) { $this->requireParameterCount(1, $parameters, 'unique'); - list($connection, $table) = $this->parseTable($parameters[0]); + [$connection, $table] = $this->parseTable($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 // assume that this column to be verified shares the attribute's name. $column = $this->getQueryColumn($parameters, $attribute); - list($idColumn, $id) = [null, null]; + [$idColumn, $id] = [null, null]; if (isset($parameters[2])) { - list($idColumn, $id) = $this->getUniqueIds($parameters); + [$idColumn, $id] = $this->getUniqueIds($parameters); } // The presence verifier is responsible for counting rows within this store @@ -1621,7 +1621,7 @@ protected function compare($first, $second, $operator) protected function parseNamedParameters($parameters) { return array_reduce($parameters, function ($result, $item) { - list($key, $value) = array_pad(explode('=', $item, 2), 2, null); + [$key, $value] = array_pad(explode('=', $item, 2), 2, null); $result[$key] = $value; diff --git a/src/Illuminate/Validation/ValidationRuleParser.php b/src/Illuminate/Validation/ValidationRuleParser.php index 0c593e61e8b7..b8e42559dbec 100644 --- a/src/Illuminate/Validation/ValidationRuleParser.php +++ b/src/Illuminate/Validation/ValidationRuleParser.php @@ -231,7 +231,7 @@ protected static function parseStringRule($rules) // easy {rule}:{parameters} formatting convention. For instance the // rule "Max:3" states that the value may only be three letters. if (strpos($rules, ':') !== false) { - list($rules, $parameter) = explode(':', $rules, 2); + [$rules, $parameter] = explode(':', $rules, 2); $parameters = static::parseParameters($rules, $parameter); } diff --git a/src/Illuminate/Validation/Validator.php b/src/Illuminate/Validation/Validator.php index 415118a0bc3b..911c0be2b819 100755 --- a/src/Illuminate/Validation/Validator.php +++ b/src/Illuminate/Validation/Validator.php @@ -332,7 +332,7 @@ protected function validateAttribute($attribute, $rule) { $this->currentRule = $rule; - list($rule, $parameters) = ValidationRuleParser::parse($rule); + [$rule, $parameters] = ValidationRuleParser::parse($rule); if ($rule == '') { return; @@ -715,7 +715,7 @@ protected function getRule($attribute, $rules) $rules = (array) $rules; foreach ($this->rules[$attribute] as $rule) { - list($rule, $parameters) = ValidationRuleParser::parse($rule); + [$rule, $parameters] = ValidationRuleParser::parse($rule); if (in_array($rule, $rules)) { return [$rule, $parameters]; @@ -1133,7 +1133,7 @@ protected function callExtension($rule, $parameters) */ protected function callClassBasedExtension($callback, $parameters) { - list($class, $method) = Str::parseCallback($callback, 'validate'); + [$class, $method] = Str::parseCallback($callback, 'validate'); return call_user_func_array([$this->container->make($class), $method], $parameters); } diff --git a/src/Illuminate/View/Compilers/BladeCompiler.php b/src/Illuminate/View/Compilers/BladeCompiler.php index 4a97052beaed..119a20abbf12 100644 --- a/src/Illuminate/View/Compilers/BladeCompiler.php +++ b/src/Illuminate/View/Compilers/BladeCompiler.php @@ -272,7 +272,7 @@ protected function addFooters($result) */ protected function parseToken($token) { - list($id, $content) = $token; + [$id, $content] = $token; if ($id == T_INLINE_HTML) { foreach ($this->compilers as $type) { diff --git a/src/Illuminate/View/Concerns/ManagesEvents.php b/src/Illuminate/View/Concerns/ManagesEvents.php index f3d7717c3ca2..7e844b295a3a 100644 --- a/src/Illuminate/View/Concerns/ManagesEvents.php +++ b/src/Illuminate/View/Concerns/ManagesEvents.php @@ -115,7 +115,7 @@ protected function addClassEvent($view, $class, $prefix) */ protected function buildClassEventCallback($class, $prefix) { - list($class, $method) = $this->parseClassEvent($class, $prefix); + [$class, $method] = $this->parseClassEvent($class, $prefix); // Once we have the class and method name, we can build the Closure to resolve // the instance out of the IoC container and call the method on it with the diff --git a/src/Illuminate/View/FileViewFinder.php b/src/Illuminate/View/FileViewFinder.php index 26271b918fc7..4a380f9ce3f0 100755 --- a/src/Illuminate/View/FileViewFinder.php +++ b/src/Illuminate/View/FileViewFinder.php @@ -87,7 +87,7 @@ public function find($name) */ protected function findNamespacedView($name) { - list($namespace, $view) = $this->parseNamespaceSegments($name); + [$namespace, $view] = $this->parseNamespaceSegments($name); return $this->findInPaths($view, $this->hints[$namespace]); } diff --git a/src/Illuminate/View/ViewName.php b/src/Illuminate/View/ViewName.php index ab5d9ce2c294..03efcc5a22ed 100644 --- a/src/Illuminate/View/ViewName.php +++ b/src/Illuminate/View/ViewName.php @@ -18,7 +18,7 @@ public static function normalize($name) return str_replace('/', '.', $name); } - list($namespace, $name) = explode($delimiter, $name); + [$namespace, $name] = explode($delimiter, $name); return $namespace.$delimiter.str_replace('/', '.', $name); } diff --git a/tests/Auth/AuthGuardTest.php b/tests/Auth/AuthGuardTest.php index cc87e7f1ef91..24fb8489099a 100755 --- a/tests/Auth/AuthGuardTest.php +++ b/tests/Auth/AuthGuardTest.php @@ -28,7 +28,7 @@ public function tearDown() public function testBasicReturnsNullOnValidAttempt() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class.'[check,attempt]', ['default', $provider, $session]); $guard->shouldReceive('check')->once()->andReturn(false); $guard->shouldReceive('attempt')->once()->with(['email' => 'foo@bar.com', 'password' => 'secret'])->andReturn(true); @@ -40,7 +40,7 @@ public function testBasicReturnsNullOnValidAttempt() public function testBasicReturnsNullWhenAlreadyLoggedIn() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class.'[check]', ['default', $provider, $session]); $guard->shouldReceive('check')->once()->andReturn(true); $guard->shouldReceive('attempt')->never(); @@ -55,7 +55,7 @@ public function testBasicReturnsNullWhenAlreadyLoggedIn() */ public function testBasicReturnsResponseOnFailure() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class.'[check,attempt]', ['default', $provider, $session]); $guard->shouldReceive('check')->once()->andReturn(false); $guard->shouldReceive('attempt')->once()->with(['email' => 'foo@bar.com', 'password' => 'secret'])->andReturn(false); @@ -66,7 +66,7 @@ public function testBasicReturnsResponseOnFailure() public function testBasicWithExtraConditions() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class.'[check,attempt]', ['default', $provider, $session]); $guard->shouldReceive('check')->once()->andReturn(false); $guard->shouldReceive('attempt')->once()->with(['email' => 'foo@bar.com', 'password' => 'secret', 'active' => 1])->andReturn(true); @@ -78,7 +78,7 @@ public function testBasicWithExtraConditions() public function testBasicWithExtraArrayConditions() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class.'[check,attempt]', ['default', $provider, $session]); $guard->shouldReceive('check')->once()->andReturn(false); $guard->shouldReceive('attempt')->once()->with(['email' => 'foo@bar.com', 'password' => 'secret', 'active' => 1, 'type' => [1, 2, 3]])->andReturn(true); @@ -100,7 +100,7 @@ public function testAttemptCallsRetrieveByCredentials() public function testAttemptReturnsUserInterface() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = $this->getMockBuilder(SessionGuard::class)->setMethods(['login'])->setConstructorArgs(['default', $provider, $session, $request])->getMock(); $guard->setDispatcher($events = m::mock(Dispatcher::class)); $events->shouldReceive('dispatch')->once()->with(m::type(Attempting::class)); @@ -123,7 +123,7 @@ public function testAttemptReturnsFalseIfUserNotGiven() public function testLoginStoresIdentifierInSession() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $mock = $this->getMockBuilder(SessionGuard::class)->setMethods(['getName'])->setConstructorArgs(['default', $provider, $session, $request])->getMock(); $user = m::mock(Authenticatable::class); $mock->expects($this->once())->method('getName')->will($this->returnValue('foo')); @@ -148,7 +148,7 @@ public function testSessionGuardIsMacroable() public function testLoginFiresLoginAndAuthenticatedEvents() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $mock = $this->getMockBuilder(SessionGuard::class)->setMethods(['getName'])->setConstructorArgs(['default', $provider, $session, $request])->getMock(); $mock->setDispatcher($events = m::mock(Dispatcher::class)); $user = m::mock(Authenticatable::class); @@ -227,7 +227,7 @@ public function testIsAuthedReturnsTrueWhenUserIsNotNull() public function testIsAuthedReturnsFalseWhenUserIsNull() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $mock = $this->getMockBuilder(SessionGuard::class)->setMethods(['user'])->setConstructorArgs(['default', $provider, $session, $request])->getMock(); $mock->expects($this->exactly(2))->method('user')->will($this->returnValue(null)); $this->assertFalse($mock->check()); @@ -261,7 +261,7 @@ public function testUserIsSetToRetrievedUser() public function testLogoutRemovesSessionTokenAndRememberMeCookie() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $mock = $this->getMockBuilder(SessionGuard::class)->setMethods(['getName', 'getRecallerName', 'recaller'])->setConstructorArgs(['default', $provider, $session, $request])->getMock(); $mock->setCookieJar($cookies = m::mock(CookieJar::class)); $user = m::mock(Authenticatable::class); @@ -282,7 +282,7 @@ public function testLogoutRemovesSessionTokenAndRememberMeCookie() public function testLogoutDoesNotEnqueueRememberMeCookieForDeletionIfCookieDoesntExist() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $mock = $this->getMockBuilder(SessionGuard::class)->setMethods(['getName', 'recaller'])->setConstructorArgs(['default', $provider, $session, $request])->getMock(); $mock->setCookieJar($cookies = m::mock(CookieJar::class)); $user = m::mock(Authenticatable::class); @@ -299,7 +299,7 @@ public function testLogoutDoesNotEnqueueRememberMeCookieForDeletionIfCookieDoesn public function testLogoutFiresLogoutEvent() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $mock = $this->getMockBuilder(SessionGuard::class)->setMethods(['clearUserDataFromStorage'])->setConstructorArgs(['default', $provider, $session, $request])->getMock(); $mock->expects($this->once())->method('clearUserDataFromStorage'); $mock->setDispatcher($events = m::mock(Dispatcher::class)); @@ -314,7 +314,7 @@ public function testLogoutFiresLogoutEvent() public function testLoginMethodQueuesCookieWhenRemembering() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = new SessionGuard('default', $provider, $session, $request); $guard->setCookieJar($cookie); $foreverCookie = new Cookie($guard->getRecallerName(), 'foo'); @@ -333,7 +333,7 @@ public function testLoginMethodQueuesCookieWhenRemembering() public function testLoginMethodCreatesRememberTokenIfOneDoesntExist() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = new SessionGuard('default', $provider, $session, $request); $guard->setCookieJar($cookie); $foreverCookie = new Cookie($guard->getRecallerName(), 'foo'); @@ -352,7 +352,7 @@ public function testLoginMethodCreatesRememberTokenIfOneDoesntExist() public function testLoginUsingIdLogsInWithUser() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class, ['default', $provider, $session])->makePartial(); @@ -365,7 +365,7 @@ public function testLoginUsingIdLogsInWithUser() public function testLoginUsingIdFailure() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class, ['default', $provider, $session])->makePartial(); $guard->getProvider()->shouldReceive('retrieveById')->once()->with(11)->andReturn(null); @@ -376,7 +376,7 @@ public function testLoginUsingIdFailure() public function testOnceUsingIdSetsUser() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class, ['default', $provider, $session])->makePartial(); $user = m::mock(Authenticatable::class); @@ -388,7 +388,7 @@ public function testOnceUsingIdSetsUser() public function testOnceUsingIdFailure() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class, ['default', $provider, $session])->makePartial(); $guard->getProvider()->shouldReceive('retrieveById')->once()->with(11)->andReturn(null); @@ -400,7 +400,7 @@ public function testOnceUsingIdFailure() public function testUserUsesRememberCookieIfItExists() { $guard = $this->getGuard(); - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $request = Request::create('/', 'GET', [], [$guard->getRecallerName() => 'id|recaller|baz']); $guard = new SessionGuard('default', $provider, $session, $request); $guard->getSession()->shouldReceive('get')->once()->with($guard->getName())->andReturn(null); @@ -415,7 +415,7 @@ public function testUserUsesRememberCookieIfItExists() public function testLoginOnceSetsUser() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class, ['default', $provider, $session])->makePartial(); $user = m::mock(Authenticatable::class); $guard->getProvider()->shouldReceive('retrieveByCredentials')->once()->with(['foo'])->andReturn($user); @@ -426,7 +426,7 @@ public function testLoginOnceSetsUser() public function testLoginOnceFailure() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); $guard = m::mock(SessionGuard::class, ['default', $provider, $session])->makePartial(); $user = m::mock(Authenticatable::class); $guard->getProvider()->shouldReceive('retrieveByCredentials')->once()->with(['foo'])->andReturn($user); @@ -436,7 +436,7 @@ public function testLoginOnceFailure() protected function getGuard() { - list($session, $provider, $request, $cookie) = $this->getMocks(); + [$session, $provider, $request, $cookie] = $this->getMocks(); return new SessionGuard('default', $provider, $session, $request); } diff --git a/tests/Database/DatabaseEloquentMorphToManyTest.php b/tests/Database/DatabaseEloquentMorphToManyTest.php index 45bf73b73370..761429aac6b4 100644 --- a/tests/Database/DatabaseEloquentMorphToManyTest.php +++ b/tests/Database/DatabaseEloquentMorphToManyTest.php @@ -74,7 +74,7 @@ public function testDetachMethodClearsAllPivotRecordsWhenNoIDsAreGiven() public function getRelation() { - list($builder, $parent) = $this->getRelationArguments(); + [$builder, $parent] = $this->getRelationArguments(); return new MorphToMany($builder, $parent, 'taggable', 'taggables', 'taggable_id', 'tag_id', 'id', 'id'); } diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index 6ce5e3bcf647..8a855124235a 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -84,7 +84,7 @@ public function testCrossJoin() public function testDivide() { - list($keys, $values) = Arr::divide(['name' => 'Desk']); + [$keys, $values] = Arr::divide(['name' => 'Desk']); $this->assertEquals(['name'], $keys); $this->assertEquals(['Desk'], $values); } diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 0357ab3e55e2..0a376834595c 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -2544,7 +2544,7 @@ public function testPartition() { $collection = new Collection(range(1, 10)); - list($firstPartition, $secondPartition) = $collection->partition(function ($i) { + [$firstPartition, $secondPartition] = $collection->partition(function ($i) { return $i <= 5; }); @@ -2556,7 +2556,7 @@ public function testPartitionCallbackWithKey() { $collection = new Collection(['zero', 'one', 'two', 'three']); - list($even, $odd) = $collection->partition(function ($item, $index) { + [$even, $odd] = $collection->partition(function ($item, $index) { return $index % 2 === 0; }); @@ -2571,7 +2571,7 @@ public function testPartitionByKey() ['free' => true, 'title' => 'Basic'], ['free' => false, 'title' => 'Premium'], ]); - list($free, $premium) = $courses->partition('free'); + [$free, $premium] = $courses->partition('free'); $this->assertSame([['free' => true, 'title' => 'Basic']], $free->values()->toArray()); @@ -2587,7 +2587,7 @@ public function testPartitionWithOperators() ['name' => 'Tim', 'age' => 41], ]); - list($tims, $others) = $collection->partition('name', 'Tim'); + [$tims, $others] = $collection->partition('name', 'Tim'); $this->assertEquals($tims->values()->all(), [ ['name' => 'Tim', 'age' => 17], @@ -2599,7 +2599,7 @@ public function testPartitionWithOperators() ['name' => 'Kristina', 'age' => 33], ]); - list($adults, $minors) = $collection->partition('age', '>=', 18); + [$adults, $minors] = $collection->partition('age', '>=', 18); $this->assertEquals($adults->values()->all(), [ ['name' => 'Agatha', 'age' => 62], @@ -2618,7 +2618,7 @@ public function testPartitionPreservesKeys() 'a' => ['free' => true], 'b' => ['free' => false], 'c' => ['free' => true], ]); - list($free, $premium) = $courses->partition('free'); + [$free, $premium] = $courses->partition('free'); $this->assertSame(['a' => ['free' => true], 'c' => ['free' => true]], $free->toArray()); @@ -2640,7 +2640,7 @@ public function testHigherOrderPartition() 'a' => ['free' => true], 'b' => ['free' => false], 'c' => ['free' => true], ]); - list($free, $premium) = $courses->partition->free; + [$free, $premium] = $courses->partition->free; $this->assertSame(['a' => ['free' => true], 'c' => ['free' => true]], $free->toArray()); diff --git a/tests/Support/SupportHelpersTest.php b/tests/Support/SupportHelpersTest.php index 91afe82edcb9..b9d311b92679 100755 --- a/tests/Support/SupportHelpersTest.php +++ b/tests/Support/SupportHelpersTest.php @@ -137,7 +137,7 @@ public function testArrayCollapse() public function testArrayDivide() { $array = ['name' => 'taylor']; - list($keys, $values) = Arr::divide($array); + [$keys, $values] = Arr::divide($array); $this->assertEquals(['name'], $keys); $this->assertEquals(['taylor'], $values); }