Hi.
This is a question about Yii2 common config file and PSR1
I have the following in common/config/main.php:
<?php
$cache = require(__DIR__ . '/cache.php');
$db = require(__DIR__.'/database-local.php');
return [
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'timeZone' => 'America/Bogota',
'components' => [
'cache' => $cache,
'db' => $db,
...
],
'name' => call_user_func(function() use($db) {
try {
array_shift($db);
$connection = new \yii\db\Connection($db);
$connection->open();
$library_name = $connection->createCommand("Select library_name from {{%settings}}")->cache(7200)->queryOne()['library_name'];
} catch (Exception $ex) {
$library_name = "OpenBiblio2";
}
return $library_name;
}), 'modules' => [
...
]
];
My question goes if the file is or is not accomplishing the PSR1 at 2.3 paragraph about Side Effects, specifically on requires and the call_user_func code.
Regards,