Skip to content

Commit

Permalink
Mitigate erronous complaint of phpstan
Browse files Browse the repository at this point in the history
phpstan complains that `assertIsArray($config)` will always fail because
it doesn't know about the side effects of `require`ing the default
config.
  • Loading branch information
pabzm committed Oct 30, 2024
1 parent ef5aae3 commit b1ea913
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/Framework/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ public function test_parse_env()
// Test if values in defaults.inc.php and values in rcube_config::DEFAULTS match
public function test_defaults_values(): void
{
// Initialize the variable to make the static analysis happy.
// Initialize the variable to avoid warnings.
$config = null;
// Load the values from defaults.inc.php manually (we don't want to
// test the whole loading mechanics of `rcube_config` here).
ob_start();
require realpath(RCUBE_INSTALL_PATH . 'config/defaults.inc.php');
ob_end_clean();

$this->assertIsArray($config);
$this->assertIsArray($config); // @phpstan-ignore-line

foreach (\rcube_config::DEFAULTS as $name => $hardcoded_value) {
$this->assertSame($hardcoded_value, $config[$name], "The value for '{$name}' in defaults.inc.php does not match the hardcoded default in rcube_config!");
Expand Down

0 comments on commit b1ea913

Please sign in to comment.