File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/Symfony/Component/HttpKernel/Bundle Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,24 @@ public function getContainerExtension()
66
66
{
67
67
if (null === $ this ->extension ) {
68
68
$ class = $ this ->getNamespace ().'\\DependencyInjection \\' .str_replace ('Bundle ' , 'Extension ' , $ this ->getName ());
69
- $ this ->extension = class_exists ($ class ) ? new $ class () : false ;
69
+ if (class_exists ($ class )) {
70
+ $ extension = new $ class ();
71
+
72
+ // check naming convention
73
+ $ expectedAlias = Container::underscore (str_replace ('Bundle ' , '' , $ this ->getName ()));
74
+ if ($ expectedAlias != $ extension ->getAlias ()) {
75
+ throw new \LogicException (sprintf (
76
+ 'The extension alias for the default extension of a ' .
77
+ 'bundle must be the underscored version of the ' .
78
+ 'bundle name ("%s" vs "%s") ' ,
79
+ $ expectedAlias , $ extension ->getAlias ()
80
+ ));
81
+ }
82
+
83
+ $ this ->extension = $ extension ;
84
+ } else {
85
+ $ this ->extension = false ;
86
+ }
70
87
}
71
88
72
89
if ($ this ->extension ) {
You can’t perform that action at this time.
0 commit comments