diff --git a/src/Illuminate/Console/ConfirmableTrait.php b/src/Illuminate/Console/ConfirmableTrait.php index 7172215303ab..1a5308ede778 100644 --- a/src/Illuminate/Console/ConfirmableTrait.php +++ b/src/Illuminate/Console/ConfirmableTrait.php @@ -48,7 +48,7 @@ public function confirmToProceed($warning = 'Application In Production!', $callb protected function getDefaultConfirmCallback() { return function () { - return $this->getLaravel()->environment() == 'production'; + return $this->getLaravel()->environment() === 'production'; }; } } diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index afa62e69537d..d21defd2dae9 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -163,7 +163,7 @@ public function __construct(EventMutex $mutex, $command) */ public function getDefaultOutput() { - return (DIRECTORY_SEPARATOR == '\\') ? 'NUL' : '/dev/null'; + return (DIRECTORY_SEPARATOR === '\\') ? 'NUL' : '/dev/null'; } /** diff --git a/src/Illuminate/Database/Connectors/SQLiteConnector.php b/src/Illuminate/Database/Connectors/SQLiteConnector.php index ae8e4e7668ef..90dc16be24cc 100755 --- a/src/Illuminate/Database/Connectors/SQLiteConnector.php +++ b/src/Illuminate/Database/Connectors/SQLiteConnector.php @@ -21,7 +21,7 @@ public function connect(array $config) // SQLite supports "in-memory" databases that only last as long as the owning // connection does. These are useful for tests or for short lifetime store // querying. In-memory databases may only have a single open connection. - if ($config['database'] == ':memory:') { + if ($config['database'] === ':memory:') { return $this->createConnection('sqlite::memory:', $config, $options); } diff --git a/src/Illuminate/Database/DatabaseManager.php b/src/Illuminate/Database/DatabaseManager.php index 9f775e6d46ed..cb0f3bc9c1c5 100755 --- a/src/Illuminate/Database/DatabaseManager.php +++ b/src/Illuminate/Database/DatabaseManager.php @@ -180,9 +180,9 @@ protected function configure(Connection $connection, $type) */ protected function setPdoForType(Connection $connection, $type = null) { - if ($type == 'read') { + if ($type === 'read') { $connection->setPdo($connection->getReadPdo()); - } elseif ($type == 'write') { + } elseif ($type === 'write') { $connection->setReadPdo($connection->getPdo()); } diff --git a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php index 67164a180aa3..266c070cb569 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php +++ b/src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php @@ -201,7 +201,7 @@ public function withCount($relations) unset($alias); - if (count($segments) == 3 && Str::lower($segments[1]) == 'as') { + if (count($segments) == 3 && Str::lower($segments[1]) === 'as') { [$name, $alias] = [$segments[0], $segments[2]]; } diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index 9a83b0d316dd..eac7e1a01878 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -568,7 +568,7 @@ protected function incrementOrDecrement($column, $amount, $extra, $method) */ protected function incrementOrDecrementAttributeValue($column, $amount, $extra, $method) { - $this->{$column} = $this->{$column} + ($method == 'increment' ? $amount : $amount * -1); + $this->{$column} = $this->{$column} + ($method === 'increment' ? $amount : $amount * -1); $this->forceFill($extra); diff --git a/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php b/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php index 20b2b4f7b76f..64e16c2d31fe 100755 --- a/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php +++ b/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php @@ -151,7 +151,7 @@ protected function getRelationValue(array $dictionary, $key, $type) { $value = $dictionary[$key]; - return $type == 'one' ? reset($value) : $this->related->newCollection($value); + return $type === 'one' ? reset($value) : $this->related->newCollection($value); } /** diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 465366365c07..bd66993decbb 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -1731,7 +1731,7 @@ public function orderBy($column, $direction = 'asc') { $this->{$this->unions ? 'unionOrders' : 'orders'}[] = [ 'column' => $column, - 'direction' => strtolower($direction) == 'asc' ? 'asc' : 'desc', + 'direction' => strtolower($direction) === 'asc' ? 'asc' : 'desc', ]; return $this; diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php index 97eaaf07f671..de2bb13b84b8 100755 --- a/src/Illuminate/Database/Schema/Blueprint.php +++ b/src/Illuminate/Database/Schema/Blueprint.php @@ -249,7 +249,7 @@ public function addFluentCommands(Grammar $grammar) protected function creating() { return collect($this->commands)->contains(function ($command) { - return $command->name == 'create'; + return $command->name === 'create'; }); } diff --git a/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php b/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php index 45a217f29bc9..3941cd318262 100644 --- a/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php +++ b/src/Illuminate/Database/Schema/Grammars/ChangeColumn.php @@ -118,7 +118,7 @@ protected static function getDoctrineColumnChangeOptions(Fluent $fluent) $options['length'] = static::calculateDoctrineTextLength($fluent['type']); } - if ($fluent['type'] == 'json') { + if ($fluent['type'] === 'json') { $options['customSchemaOptions'] = [ 'collation' => '', ]; @@ -206,6 +206,6 @@ protected static function mapFluentOptionToDoctrine($attribute) */ protected static function mapFluentValueToDoctrine($option, $value) { - return $option == 'notnull' ? ! $value : $value; + return $option === 'notnull' ? ! $value : $value; } } diff --git a/src/Illuminate/Database/SqlServerConnection.php b/src/Illuminate/Database/SqlServerConnection.php index 95395637d6b8..db5a0bed8c78 100755 --- a/src/Illuminate/Database/SqlServerConnection.php +++ b/src/Illuminate/Database/SqlServerConnection.php @@ -25,7 +25,7 @@ class SqlServerConnection extends Connection public function transaction(Closure $callback, $attempts = 1) { for ($a = 1; $a <= $attempts; $a++) { - if ($this->getDriverName() == 'sqlsrv') { + if ($this->getDriverName() === 'sqlsrv') { return parent::transaction($callback); } diff --git a/src/Illuminate/Encryption/Encrypter.php b/src/Illuminate/Encryption/Encrypter.php index 5f80599a48bd..d4a18225b780 100755 --- a/src/Illuminate/Encryption/Encrypter.php +++ b/src/Illuminate/Encryption/Encrypter.php @@ -67,7 +67,7 @@ public static function supported($key, $cipher) */ public static function generateKey($cipher) { - return random_bytes($cipher == 'AES-128-CBC' ? 16 : 32); + return random_bytes($cipher === 'AES-128-CBC' ? 16 : 32); } /** diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 1338e8b9c63a..da3f17b070b9 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -494,7 +494,7 @@ public function environment() */ public function isLocal() { - return $this['env'] == 'local'; + return $this['env'] === 'local'; } /** diff --git a/src/Illuminate/Foundation/Console/VendorPublishCommand.php b/src/Illuminate/Foundation/Console/VendorPublishCommand.php index 08d9b9c95f93..5c878cdc7339 100644 --- a/src/Illuminate/Foundation/Console/VendorPublishCommand.php +++ b/src/Illuminate/Foundation/Console/VendorPublishCommand.php @@ -142,9 +142,9 @@ protected function parseChoice($choice) { [$type, $value] = explode(': ', strip_tags($choice)); - if ($type == 'Provider') { + if ($type === 'Provider') { $this->provider = $value; - } elseif ($type == 'Tag') { + } elseif ($type === 'Tag') { $this->tags = [$value]; } } diff --git a/src/Illuminate/Foundation/Testing/PendingCommand.php b/src/Illuminate/Foundation/Testing/PendingCommand.php index efdd5e97e54c..2a40aed1c789 100644 --- a/src/Illuminate/Foundation/Testing/PendingCommand.php +++ b/src/Illuminate/Foundation/Testing/PendingCommand.php @@ -135,7 +135,7 @@ public function run() try { $exitCode = $this->app[Kernel::class]->call($this->command, $this->parameters); } catch (NoMatchingExpectationException $e) { - if ($e->getMethodName() == 'askQuestion') { + if ($e->getMethodName() === 'askQuestion') { $this->test->fail('Unexpected question "'.$e->getActualArguments()[0]->getQuestion().'" was asked.'); } } diff --git a/src/Illuminate/Foundation/Testing/RefreshDatabase.php b/src/Illuminate/Foundation/Testing/RefreshDatabase.php index 292653997661..50fb39168244 100644 --- a/src/Illuminate/Foundation/Testing/RefreshDatabase.php +++ b/src/Illuminate/Foundation/Testing/RefreshDatabase.php @@ -27,7 +27,7 @@ protected function usingInMemoryDatabase() { return config('database.connections')[ config('database.default') - ]['database'] == ':memory:'; + ]['database'] === ':memory:'; } /** diff --git a/src/Illuminate/Http/Request.php b/src/Illuminate/Http/Request.php index eb8c457ec8d4..f38a184c38ee 100644 --- a/src/Illuminate/Http/Request.php +++ b/src/Illuminate/Http/Request.php @@ -108,7 +108,7 @@ public function fullUrl() { $query = $this->getQueryString(); - $question = $this->getBaseUrl().$this->getPathInfo() == '/' ? '/?' : '?'; + $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; return $query ? $this->url().$question.$query : $this->url(); } @@ -121,7 +121,7 @@ public function fullUrl() */ public function fullUrlWithQuery(array $query) { - $question = $this->getBaseUrl().$this->getPathInfo() == '/' ? '/?' : '?'; + $question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?'; return count($this->query()) > 0 ? $this->url().$question.Arr::query(array_merge($this->query(), $query)) diff --git a/src/Illuminate/Notifications/resources/views/email.blade.php b/src/Illuminate/Notifications/resources/views/email.blade.php index 1dfbd02bb7b4..5e8073dbd7c4 100644 --- a/src/Illuminate/Notifications/resources/views/email.blade.php +++ b/src/Illuminate/Notifications/resources/views/email.blade.php @@ -3,7 +3,7 @@ @if (! empty($greeting)) # {{ $greeting }} @else -@if ($level == 'error') +@if ($level === 'error') # @lang('Whoops!') @else # @lang('Hello!') diff --git a/src/Illuminate/Routing/Matching/UriValidator.php b/src/Illuminate/Routing/Matching/UriValidator.php index 6a54d129630d..3aeb73b2d176 100644 --- a/src/Illuminate/Routing/Matching/UriValidator.php +++ b/src/Illuminate/Routing/Matching/UriValidator.php @@ -16,7 +16,7 @@ class UriValidator implements ValidatorInterface */ public function matches(Route $route, Request $request) { - $path = $request->path() == '/' ? '/' : '/'.$request->path(); + $path = $request->path() === '/' ? '/' : '/'.$request->path(); return preg_match($route->getCompiled()->getRegex(), rawurldecode($path)); } diff --git a/src/Illuminate/Routing/Redirector.php b/src/Illuminate/Routing/Redirector.php index 87716e06ede8..3054d49d614f 100755 --- a/src/Illuminate/Routing/Redirector.php +++ b/src/Illuminate/Routing/Redirector.php @@ -84,7 +84,7 @@ public function guest($path, $status = 302, $headers = [], $secure = null) { $request = $this->generator->getRequest(); - $intended = $request->method() == 'GET' && $request->route() && ! $request->expectsJson() + $intended = $request->method() === 'GET' && $request->route() && ! $request->expectsJson() ? $this->generator->full() : $this->generator->previous(); diff --git a/src/Illuminate/Routing/RouteCollection.php b/src/Illuminate/Routing/RouteCollection.php index 32c1bf40af6a..265d2823e9eb 100644 --- a/src/Illuminate/Routing/RouteCollection.php +++ b/src/Illuminate/Routing/RouteCollection.php @@ -233,7 +233,7 @@ protected function checkForAlternateVerbs($request) */ protected function getRouteForMethods($request, array $methods) { - if ($request->method() == 'OPTIONS') { + if ($request->method() === 'OPTIONS') { return (new Route('OPTIONS', $request->path(), function () use ($methods) { return new Response('', 200, ['Allow' => implode(',', $methods)]); }))->bind($request); diff --git a/src/Illuminate/Routing/RouteRegistrar.php b/src/Illuminate/Routing/RouteRegistrar.php index b911f1b5b31a..81e2385ff223 100644 --- a/src/Illuminate/Routing/RouteRegistrar.php +++ b/src/Illuminate/Routing/RouteRegistrar.php @@ -186,7 +186,7 @@ public function __call($method, $parameters) } if (in_array($method, $this->allowedAttributes)) { - if ($method == 'middleware') { + if ($method === 'middleware') { return $this->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); } diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index 14c4ba8f4f1a..2ab7bb5dfc55 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -1251,7 +1251,7 @@ public function __call($method, $parameters) return $this->macroCall($method, $parameters); } - if ($method == 'middleware') { + if ($method === 'middleware') { return (new RouteRegistrar($this))->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters); } diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 1953cab5137b..9c3cda57b995 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -420,7 +420,7 @@ public static function slug($title, $separator = '-', $language = 'en') $title = static::ascii($title, $language); // Convert all dashes/underscores into separator - $flip = $separator == '-' ? '_' : '-'; + $flip = $separator === '-' ? '_' : '-'; $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); diff --git a/src/Illuminate/Translation/FileLoader.php b/src/Illuminate/Translation/FileLoader.php index 66fb8a0f8952..d2d21d2692f7 100755 --- a/src/Illuminate/Translation/FileLoader.php +++ b/src/Illuminate/Translation/FileLoader.php @@ -59,11 +59,11 @@ public function __construct(Filesystem $files, $path) */ public function load($locale, $group, $namespace = null) { - if ($group == '*' && $namespace == '*') { + if ($group === '*' && $namespace === '*') { return $this->loadJsonPaths($locale); } - if (is_null($namespace) || $namespace == '*') { + if (is_null($namespace) || $namespace === '*') { return $this->loadPath($this->path, $locale, $group); } diff --git a/src/Illuminate/Translation/MessageSelector.php b/src/Illuminate/Translation/MessageSelector.php index fdea3c2d4aeb..30b4c9bb78d2 100755 --- a/src/Illuminate/Translation/MessageSelector.php +++ b/src/Illuminate/Translation/MessageSelector.php @@ -71,9 +71,9 @@ private function extractFromString($part, $number) if (Str::contains($condition, ',')) { [$from, $to] = explode(',', $condition, 2); - if ($to == '*' && $number >= $from) { + if ($to === '*' && $number >= $from) { return $value; - } elseif ($from == '*' && $number <= $to) { + } elseif ($from === '*' && $number <= $to) { return $value; } elseif ($number >= $from && $number <= $to) { return $value; diff --git a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php index 541e69b143c2..26b1e352d95c 100644 --- a/src/Illuminate/Validation/Concerns/ValidatesAttributes.php +++ b/src/Illuminate/Validation/Concerns/ValidatesAttributes.php @@ -488,7 +488,7 @@ public function validateDigitsBetween($attribute, $value, $parameters) */ public function validateDimensions($attribute, $value, $parameters) { - if ($this->isValidFileInstance($value) && $value->getClientMimeType() == 'image/svg+xml') { + if ($this->isValidFileInstance($value) && $value->getClientMimeType() === 'image/svg+xml') { return true; } @@ -713,7 +713,7 @@ protected function prepareUniqueId($id) $id = $this->getValue($matches[1]); } - if (strtolower($id) == 'null') { + if (strtolower($id) === 'null') { $id = null; }