[Config] Add deprecation warning

If someone extends FileLoader and do not call the parent constructor a
deprecation warning should be triggered.
This commit is contained in:
Diego Saint Esteben 2015-06-11 12:10:04 -03:00
parent 17387fdc8e
commit dbfca37703
1 changed files with 6 additions and 1 deletions

View File

@ -86,7 +86,12 @@ abstract class FileLoader extends Loader
// we fallback to the current locator to keep BC
// as some some loaders do not call the parent __construct()
// @deprecated should be removed in 3.0
$locator = $loader->getLocator() ?: $this->locator;
$locator = $loader->getLocator();
if (null === $locator) {
@trigger_error('Not calling the parent constructor in '.get_class($loader).' which extends '.__CLASS__.' is deprecated since version 2.7 and will not be supported anymore in 3.0.', E_USER_DEPRECATED);
$locator = $this->locator;
}
$resource = $locator->locate($resource, $this->currentDir, false);
}