laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($count = null,
                                ?Collection $states = null,
                                ?Collection $has = null,
                                ?Collection $for = null,
                                ?Collection $afterMaking = null,
Severity: Major
Found in src/Illuminate/Database/Eloquent/Factories/Factory.php - About 1 hr to fix

    Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct(Builder $query, Model $parent, $table, $foreignPivotKey,
                                    $relatedPivotKey, $parentKey, $relatedKey, $relationName = null)
    Severity: Major
    Found in src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php - About 1 hr to fix

      Method newBelongsToMany has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function newBelongsToMany(Builder $query, Model $parent, $table, $foreignPivotKey, $relatedPivotKey,
                                              $parentKey, $relatedKey, $relationName = null)
      Severity: Major
      Found in src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php - About 1 hr to fix

        Method morphedByMany has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function morphedByMany($related, $name, $table = null, $foreignPivotKey = null,
                                          $relatedPivotKey = null, $parentKey = null, $relatedKey = null, $relation = null)
        Severity: Major
        Found in src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if ($attribute === $original) {
                      return true;
                  } elseif (is_null($attribute)) {
                      return false;
                  } elseif ($this->isDateAttribute($key) || $this->isDateCastableWithCustomFormat($key)) {
          Severity: Major
          Found in src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php - About 1 hr to fix

            Method forever has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null);
            Severity: Major
            Found in src/Illuminate/Contracts/Cookie/Factory.php - About 1 hr to fix

              Method forever has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null)
              Severity: Major
              Found in src/Illuminate/Cookie/CookieJar.php - About 1 hr to fix

                Function assertDownload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function assertDownload($filename = null)
                    {
                        $contentDisposition = explode(';', $this->headers->get('content-disposition', ''));
                
                        if (trim($contentDisposition[0]) !== 'attachment') {
                Severity: Minor
                Found in src/Illuminate/Testing/TestResponse.php - About 55 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 getPluralIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getPluralIndex($locale, $number)
                    {
                        switch ($locale) {
                            case 'az':
                            case 'az_AZ':
                Severity: Minor
                Found in src/Illuminate/Translation/MessageSelector.php - About 55 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 queue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function queue($event)
                    {
                        if ($event instanceof ShouldBroadcastNow ||
                            (is_object($event) &&
                             method_exists($event, 'shouldBroadcastNow') &&
                Severity: Minor
                Found in src/Illuminate/Broadcasting/BroadcastManager.php - About 55 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 transaction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function transaction(Closure $callback, $attempts = 1)
                    {
                        for ($currentAttempt = 1; $currentAttempt <= $attempts; $currentAttempt++) {
                            $this->beginTransaction();
                
                
                Severity: Minor
                Found in src/Illuminate/Database/Concerns/ManagesTransactions.php - About 55 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 guessAnonymousComponentUsingPaths has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function guessAnonymousComponentUsingPaths(Factory $viewFactory, string $component)
                    {
                        $delimiter = ViewFinderInterface::HINT_PATH_DELIMITER;
                
                        foreach ($this->blade->getAnonymousComponentPaths() as $path) {
                Severity: Minor
                Found in src/Illuminate/View/Compilers/ComponentTagCompiler.php - About 55 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 detach has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function detach($ids = null, $touch = true)
                    {
                        if ($this->using &&
                            ! empty($ids) &&
                            empty($this->pivotWheres) &&

                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 transformModelValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function transformModelValue($key, $value)
                    {
                        // If the attribute has a get mutator, we will call that then return what
                        // it returns as the value, which is useful for transforming values on
                        // retrieval from the model to a form that is more useful for usage.
                Severity: Minor
                Found in src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php - About 55 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 register has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function register($name, $controller, array $options = [])
                    {
                        if (isset($options['parameters']) && ! isset($this->parameters)) {
                            $this->parameters = $options['parameters'];
                        }
                Severity: Minor
                Found in src/Illuminate/Routing/ResourceRegistrar.php - About 55 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 getPolicyFor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getPolicyFor($class)
                    {
                        if (is_object($class)) {
                            $class = get_class($class);
                        }
                Severity: Minor
                Found in src/Illuminate/Auth/Access/Gate.php - About 55 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 doSend has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function doSend(SentMessage $message): void
                    {
                        $options = $this->options;
                
                        if ($message->getOriginalMessage() instanceof Message) {
                Severity: Minor
                Found in src/Illuminate/Mail/Transport/SesV2Transport.php - About 55 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 toResponse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function toResponse($request, $response)
                    {
                        if ($response instanceof Responsable) {
                            $response = $response->toResponse($request);
                        }
                Severity: Minor
                Found in src/Illuminate/Routing/Router.php - About 55 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 doSend has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function doSend(SentMessage $message): void
                    {
                        $options = $this->options;
                
                        if ($message->getOriginalMessage() instanceof Message) {
                Severity: Minor
                Found in src/Illuminate/Mail/Transport/SesTransport.php - About 55 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 resolveBackedEnumsForRoute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected static function resolveBackedEnumsForRoute($route, $parameters)
                    {
                        foreach ($route->signatureParameters(['backedEnum' => true]) as $parameter) {
                            if (! $parameterName = static::getParameterName($parameter->getName(), $parameters)) {
                                continue;
                Severity: Minor
                Found in src/Illuminate/Routing/ImplicitRouteBinding.php - About 55 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