disabling cache issue

Hello,

I just did a fresh install of last version of drupal 8. I want to create a new theme and so I want to disable the cache during developments. I followed this tutorial: https://www.drupal.org/node/2598914

But when enabling the settings.local.php file (uncommenting the if() in settings.php) I get this error:

Warning: Invalid argument supplied for foreach() in DrupalCoreExtensionThemeHandler->addTheme() (line 202 of core/lib/Drupal/Core/Extension/ThemeHandler.php).

I tried clearing the cache again, but the error remains.

Just to mention that the if() is not at the last line of the settings.php on my configuration:

 if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
  include $app_root . '/' . $site_path . '/settings.local.php';
 }
$databases['default']['default'] = array (
  'database' => '****',
  'username' => '****',
  'password' => '****',
  'prefix' => '',
  'host' => '****',
  'port' => '3306',
  'namespace' => 'DrupalCoreDatabaseDrivermysql',
  'driver' => 'mysql',
);
$settings['install_profile'] = 'standard';
$config_directories['sync'] = '*****';

thanks in advance for your help 🙂

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/22/feed