Skip to content

Commit a1f5da4

Browse files
committed
[Config] Add deprecation warning
If someone extends FileLoader and do not call the parent constructor a deprecation warning should be triggered.
1 parent d2d2b28 commit a1f5da4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Loader/FileLoader.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
8686
// we fallback to the current locator to keep BC
8787
// as some some loaders do not call the parent __construct()
8888
// @deprecated should be removed in 3.0
89-
$locator = $loader->getLocator() ?: $this->locator;
89+
$locator = $loader->getLocator();
90+
if (null === $locator) {
91+
@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);
92+
$locator = $this->locator;
93+
}
94+
9095
$resource = $locator->locate($resource, $this->currentDir, false);
9196
}
9297

0 commit comments

Comments
 (0)