Skip to content

Conversation

@seriquynh
Copy link
Contributor

The application configurationIsCached method is currently controlled by 2 factors:

  • The "config_loaded_from_cache" abstract is bound to the container or not.
  • A config cache file (usually bootstrap/cache/config.php) exists or not.

Therefore, I added some small tests here to prevent unexpected breaking changes later if any.

a config cache file does not exist

  • If "config_loaded_from_cache" is not bound to the container, configurationIsCached returns false and "config_loaded_from_cache" is implicitly set as false
  • If "config_loaded_from_cache" is bound to the container as true, configurationIsCached returns true.
  • If "config_loaded_from_cache" is bound to the container as false, configurationIsCached returns false.

a config cache file exist

  • If "config_loaded_from_cache" is not bound to the container, configurationIsCached returns true and "config_loaded_from_cache" is implicitly set as true
  • If "config_loaded_from_cache" is bound to the container as false, configurationIsCached returns false.

Plus

inside the RegisterProviders class, instead of accessing config_loaded_from_cache directly, using configurationIsCached is more consistent because:

  • config_loaded_from_cache should be called with a "setter" in order to change the config cache state.
$app->instance('config_loaded_from_cache', true);
  • configurationIsCached should be called with a "getter" in order to check the config cache state.
$app->configurationIsCached();

@taylorotwell
Copy link
Member

If nothing is broken here I don't want to change the logic in the bootstrapper on a patch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants