Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loosen APCu check for SourceCache #661

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Use sourceCache if isSupported check passes, otherwise proceed withou…

…t cache and do not throw an exception

- so that php-di does not break if there is any problem with apcu - instead of having to wrap ContainerBuilder::build() with try...catch block
  • Loading branch information...
falkenhawk committed Apr 25, 2019
commit f20fd0bb4c48fc3b6cf242dfd55d91b5c42ac1a6
@@ -150,10 +150,8 @@ public function build()
// Mutable definition source
$source->setMutableDefinitionSource(new DefinitionArray([], $autowiring));
if ($this->sourceCache) {
if (!SourceCache::isSupported()) {
throw new \Exception('APCu is not enabled, PHP-DI cannot use it as a cache');
}
// use cache if isSupported check passes, otherwise proceed without cache and do not throw an exception
if ($this->sourceCache && SourceCache::isSupported()) {
// Wrap the source with the cache decorator
$source = new SourceCache($source);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.