title: "ReflectionException Function () does not exist" when trying to setup authentication in Laravel
body: <p>I'm having some trouble getting authentication working 100% in Laravel (all views seem to work so far except for &quot;home&quot;) and was hoping to get some assistance from the Laravel experts out there.</p>
  <br/>
  <h3>A bit of background info:</h3>
  <ul>
  <li>PHP Version: <strong>7.3.11</strong></li>
  <li>Laravel Version: <strong>8.13.0</strong></li>
  <li>Used <strong>Composer</strong> to build the ui scaffolding (<code>composer require laravel/ui</code>)</li>
  <li>Used the <strong>Bootstrap</strong> ui option (<code>php artisan ui bootstrap --auth</code>)</li>
  </ul>
  <br/>
  <h3>The issue</h3>
  <p>As mentioned above, I seem to be able to access all of the generated authentication views so far  (login, register &amp; the password reset views), however after registering with a dummy account I get the following error when trying to access the &quot;home&quot; view:</p>
  <blockquote>
  <p>ReflectionException</p>
  </blockquote>
  <blockquote>
  <p>Function () does not exist</p>
  </blockquote>
  <p>The Stack trace is pointing to the following file:
  &quot;vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php:23&quot;:</p>
  <pre><code>&lt;?php
  
  namespace Illuminate\Routing;
  
  use Illuminate\Support\Reflector;
  use Illuminate\Support\Str;
  use ReflectionFunction;
  use ReflectionMethod;
  
  class RouteSignatureParameters
  {
      /**
       * Extract the route action's signature parameters.
       *
       * @param  array  $action
       * @param  string|null  $subClass
       * @return array
       */
      public static function fromAction(array $action, $subClass = null)
      {
          $parameters = is_string($action['uses'])
                          ? static::fromClassMethodString($action['uses'])
                          : (new ReflectionFunction($action['uses']))-&gt;getParameters();
  
          return is_null($subClass) ? $parameters : array_filter($parameters, function ($p) use ($subClass) {
              return Reflector::isParameterSubclassOf($p, $subClass);
          });
      }
  
      /**
       * Get the parameters for the given class / method by string.
       *
       * @param  string  $uses
       * @return array
       */
      protected static function fromClassMethodString($uses)
      {
          [$class, $method] = Str::parseCallback($uses);
  
          if (! method_exists($class, $method) &amp;&amp; Reflector::isCallable($class, $method)) {
              return [];
          }
  
          return (new ReflectionMethod($class, $method))-&gt;getParameters();
      }
  }
  </code></pre>
  <p>With the following line (line 23) being highlighted as the error:</p>
  <p><code>: (new ReflectionFunction($action['uses']))-&gt;getParameters(); </code></p>
  <br/>
  <p>And here are the routes used in the &quot;web.php&quot; file:</p>
  <pre><code>&lt;?php
  
  use Illuminate\Support\Facades\Route;
  
  /*
  |--------------------------------------------------------------------------
  | Web Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register web routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | contains the &quot;web&quot; middleware group. Now create something great!
  |
  */
  
  Route::get('/', function () {
      return view('welcome', ['pageTitle' =&gt; 'Home']);
  });
  
  Route::get('/services', function () {
      return view('services', ['pageTitle' =&gt; 'Services']);
  });
  
  Route::get('/contact', function () {
      return view('contact', ['pageTitle' =&gt; 'Contact']);
  });
  
  Auth::routes();
  
  Route::get('/home', ['pageTitle' =&gt; 'Client Dashboard'], [App\Http\Controllers\HomeController::class, 'index'])-&gt;name('home');
  </code></pre>
  <p>After a bit of googling I've learnt that the method I'm trying to use to setup authentication has been deprecated and it is now advised to use <strong>Jetstream</strong> or <strong>Fortify</strong>, however I also found a few examples of people still managing to use this old method in their projects:</p>
  <p><a href="https://www.youtube.com/watch?v=NuGBzmHlINQ" rel="noreferrer">https://www.youtube.com/watch?v=NuGBzmHlINQ</a></p>
  <br/>
  <p>As this is my first ever Laravel project I was really trying to just stick with the basics and not over complicate things for myself which is why I chose not to use <strong>Jetstream</strong> or <strong>Fortify</strong> and tried to stick to this older approach of setting up authentication. However I've been stuck on this for a couple of hours now and have not been able to figure out what's going wrong which is why I'm now seeking some help with it.</p>
  <p>Happy to provide extra details/project code if needed - any help I can get with this would be really appreciated.</p>
  <br/>
  <p>Btw, this also happens to be my first ever post on StackOverflow so any feedback on my question or advice on how I can improve it would also be greatly appreciated.</p>
  <p><br/><br/></p>
  <p>Cheers,</p>
  <p>adb</p>