Here is my main Slim app instantiation code:
$slimSettings = [
'settings' => [
'displayErrorDetails' => false,
'routerCacheFile' => false # Settings::ABSPATH . '/tmp/route.cache'
],
];
# Initialize
$app = new \Slim\App( $slimSettings );
# Create container
$container = $app->getContainer();
# Register component on container
$container[ 'view' ] = function( $container ) {
$renderer = new \Slim\Views\PhpRenderer();
$renderer->setAttributes( [ 'absPath' => Settings::ABSPATH ] ); # Variable accessible from all templates
return $renderer;
};
# Remove error handling from slim, so custom error handling is used.
unset( $app->getContainer()[ 'errorHandler' ] );
You can see that the last line is supposed to unset the errorHandler. Yet, in a controller for example I declare a function with:
public function index( $request, Response $response )
I forgot to set the 'Response' use statement, so it created an error (easily fixed but that's not the point). But this error was handled by slim. Why is that ? Isn't it supposed not to handle errors from the unset statement ?
UPDATE: error:
Details
Slim Application Error
The application could not run because of the following error:
Type: TypeError
Message: Argument 2 passed to Rib\Src\Controllers\HomeController::index() must be an instance of Rib\Src\Controllers\Response, instance of Slim\Http\Response given
File: /Users/ME/Documents/Apps_And_Sites/PHP_Apps/ribklein/src/Controllers/HomeController.php
Line: 19