laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Method test has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function test(User $user, Post $post, Comment $comment, ChildUser $child): void
{
    assertType('Illuminate\Database\Eloquent\Relations\HasOne<Illuminate\Types\Relations\Address, Illuminate\Types\Relations\User>', $user->address());
    assertType('Illuminate\Types\Relations\Address|null', $user->address()->getResults());
    assertType('Illuminate\Database\Eloquent\Collection<int, Illuminate\Types\Relations\Address>', $user->address()->get());
Severity: Major
Found in types/Database/Eloquent/Relations.php - About 3 hrs to fix

    MailManager has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MailManager implements FactoryContract
    {
        /**
         * The application instance.
         *
    Severity: Minor
    Found in src/Illuminate/Mail/MailManager.php - About 3 hrs to fix

      ResourceRegistrar has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ResourceRegistrar
      {
          /**
           * The router instance.
           *
      Severity: Minor
      Found in src/Illuminate/Routing/ResourceRegistrar.php - About 3 hrs to fix

        Kernel has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Kernel implements KernelContract
        {
            use InteractsWithTime;
        
            /**
        Severity: Minor
        Found in src/Illuminate/Foundation/Console/Kernel.php - About 3 hrs to fix

          Sleep has 31 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Sleep
          {
              use Macroable;
          
              /**
          Severity: Minor
          Found in src/Illuminate/Support/Sleep.php - About 3 hrs to fix

            File DynamoBatchRepository.php has 324 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace Illuminate\Bus;
            
            use Aws\DynamoDb\DynamoDbClient;
            Severity: Minor
            Found in src/Illuminate/Bus/DynamoBatchRepository.php - About 3 hrs to fix

              File Kernel.php has 323 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              namespace Illuminate\Foundation\Http;
              
              use Carbon\CarbonInterval;
              Severity: Minor
              Found in src/Illuminate/Foundation/Http/Kernel.php - About 3 hrs to fix

                Repository has 30 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Repository
                {
                    use Conditionable, Macroable, SerializesModels;
                
                    /**
                Severity: Minor
                Found in src/Illuminate/Log/Context/Repository.php - About 3 hrs to fix

                  MessageBag has 30 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class MessageBag implements Jsonable, JsonSerializable, MessageBagContract, MessageProvider, Stringable
                  {
                      /**
                       * All of the registered messages.
                       *
                  Severity: Minor
                  Found in src/Illuminate/Support/MessageBag.php - About 3 hrs to fix

                    File DynamoDbStore.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace Illuminate\Cache;
                    
                    use Aws\DynamoDb\DynamoDbClient;
                    Severity: Minor
                    Found in src/Illuminate/Cache/DynamoDbStore.php - About 3 hrs to fix

                      File BuildsQueries.php has 317 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace Illuminate\Database\Concerns;
                      
                      use Illuminate\Container\Container;
                      Severity: Minor
                      Found in src/Illuminate/Database/Concerns/BuildsQueries.php - About 3 hrs to fix

                        MySqlGrammar has 29 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class MySqlGrammar extends Grammar
                        {
                            /**
                             * The grammar specific operators.
                             *
                        Severity: Minor
                        Found in src/Illuminate/Database/Query/Grammars/MySqlGrammar.php - About 3 hrs to fix

                          SQLiteGrammar has 29 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class SQLiteGrammar extends Grammar
                          {
                              /**
                               * All of the available clause operators.
                               *
                          Severity: Minor
                          Found in src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php - About 3 hrs to fix

                            File MakesHttpRequests.php has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            
                            namespace Illuminate\Foundation\Testing\Concerns;
                            
                            use Illuminate\Contracts\Http\Kernel as HttpKernel;
                            Severity: Minor
                            Found in src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php - About 3 hrs to fix

                              Function repeatEvents has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function repeatEvents($events)
                                  {
                                      $hasEnteredMaintenanceMode = false;
                              
                                      while (Date::now()->lte($this->startedAt->endOfMinute())) {
                              Severity: Minor
                              Found in src/Illuminate/Console/Scheduling/ScheduleRunCommand.php - About 3 hrs 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 getFromLocalArray has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function getFromLocalArray($attribute, $lowerRule, $source = null)
                                  {
                                      $source = $source ?: $this->customMessages;
                              
                                      $keys = ["{$attribute}.{$lowerRule}", $lowerRule, $attribute];
                              Severity: Minor
                              Found in src/Illuminate/Validation/Concerns/FormatsMessages.php - About 3 hrs 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

                              File GeneratorCommand.php has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              
                              namespace Illuminate\Console;
                              
                              use Illuminate\Console\Concerns\CreatesMatchingTest;
                              Severity: Minor
                              Found in src/Illuminate/Console/GeneratorCommand.php - About 3 hrs to fix

                                File AbstractPaginator.php has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                
                                namespace Illuminate\Pagination;
                                
                                use Closure;
                                Severity: Minor
                                Found in src/Illuminate/Pagination/AbstractPaginator.php - About 3 hrs to fix

                                  Translator has 28 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  class Translator extends NamespacedItemResolver implements TranslatorContract
                                  {
                                      use Macroable, ReflectsClosures;
                                  
                                      /**
                                  Severity: Minor
                                  Found in src/Illuminate/Translation/Translator.php - About 3 hrs to fix

                                    DocsCommand has 28 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    #[AsCommand(name: 'docs')]
                                    class DocsCommand extends Command
                                    {
                                        /**
                                         * The name and signature of the console command.
                                    Severity: Minor
                                    Found in src/Illuminate/Foundation/Console/DocsCommand.php - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language