laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Avoid too many return statements within this method.
Open

            return (new ReflectionMethod($class, '__call'))->isPublic();
Severity: Major
Found in src/Illuminate/Support/Reflector.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in src/Illuminate/Support/Reflector.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $this->getSize($attribute, $value) > $this->getSize($attribute, $comparedToValue);
      Severity: Major
      Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return true;
        Severity: Major
        Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return (new ReflectionMethod($class, $method))->isPublic();
          Severity: Major
          Found in src/Illuminate/Support/Reflector.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return (string) $value;
            Severity: Major
            Found in src/Illuminate/Validation/Concerns/FormatsMessages.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return true;
              Severity: Major
              Found in src/Illuminate/Support/Testing/Fakes/BusFake.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                        return false;
                Severity: Major
                Found in src/Illuminate/Support/Testing/Fakes/BusFake.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return 'empty';
                  Severity: Major
                  Found in src/Illuminate/Validation/Concerns/FormatsMessages.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return $this->getSize($attribute, $value) >= $this->getSize($attribute, $comparedToValue);
                    Severity: Major
                    Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return $this->getSize($attribute, $value) < $this->getSize($attribute, $comparedToValue);
                      Severity: Major
                      Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return trim((string) $value) === '';
                        Severity: Major
                        Found in src/Illuminate/Support/helpers.php - About 30 mins to fix

                          Function assertViewHas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function assertViewHas($key, $value = null)
                              {
                                  if (is_array($key)) {
                                      return $this->assertViewHasAll($key);
                                  }
                          Severity: Minor
                          Found in src/Illuminate/Testing/TestView.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function guess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function guess($migration)
                              {
                                  foreach (self::CREATE_PATTERNS as $pattern) {
                                      if (preg_match($pattern, $migration, $matches)) {
                                          return [$matches[1], $create = true];
                          Severity: Minor
                          Found in src/Illuminate/Database/Console/Migrations/TableGuesser.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function displayForCli has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function displayForCli(array $data)
                              {
                                  $platform = $data['platform'];
                                  $tables = $data['tables'];
                                  $views = $data['views'] ?? null;
                          Severity: Minor
                          Found in src/Illuminate/Database/Console/ShowCommand.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function displayForCli has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function displayForCli(array $data)
                              {
                                  [$table, $columns, $indexes, $foreignKeys] = [
                                      $data['table'], $data['columns'], $data['indexes'], $data['foreign_keys'],
                                  ];
                          Severity: Minor
                          Found in src/Illuminate/Database/Console/TableCommand.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function assertViewHas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function assertViewHas($key, $value = null)
                              {
                                  if (is_array($key)) {
                                      return $this->assertViewHasAll($key);
                                  }
                          Severity: Minor
                          Found in src/Illuminate/Testing/TestResponse.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function handle()
                              {
                                  if ($this->isProhibited() ||
                                      ! $this->confirmToProceed()) {
                                      return 1;
                          Severity: Minor
                          Found in src/Illuminate/Database/Console/Migrations/RefreshCommand.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function lazy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function lazy($chunkSize = 1000)
                              {
                                  if ($chunkSize < 1) {
                                      throw new InvalidArgumentException('The chunk size should be at least 1');
                                  }
                          Severity: Minor
                          Found in src/Illuminate/Database/Concerns/BuildsQueries.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Function get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function get($key, array $replace = [], $locale = null, $fallback = true)
                              {
                                  $locale = $locale ?: $this->locale;
                          
                                  // For JSON translations, there is only one file per locale, so we will simply load
                          Severity: Minor
                          Found in src/Illuminate/Translation/Translator.php - About 25 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Severity
                          Category
                          Status
                          Source
                          Language