1616use Doctrine \ORM \Proxy \Autoloader ;
1717use Doctrine \ORM \Proxy \DefaultProxyClassNameResolver ;
1818use Symfony \Bridge \Doctrine \DependencyInjection \CompilerPass \DoctrineValidationPass ;
19+ use Symfony \Bridge \Doctrine \DependencyInjection \CompilerPass \RegisterDatePointTypePass ;
1920use Symfony \Bridge \Doctrine \DependencyInjection \CompilerPass \RegisterEventListenersAndSubscribersPass ;
2021use Symfony \Bridge \Doctrine \DependencyInjection \CompilerPass \RegisterUidTypePass ;
2122use Symfony \Bridge \Doctrine \DependencyInjection \Security \UserProvider \EntityFactory ;
2728use Symfony \Component \HttpKernel \Bundle \Bundle ;
2829
2930use function assert ;
31+ use function class_exists ;
3032use function clearstatcache ;
3133use function dirname ;
3234use function spl_autoload_unregister ;
@@ -36,8 +38,7 @@ class DoctrineBundle extends Bundle
3638{
3739 private Closure |null $ autoloader = null ;
3840
39- /** @return void */
40- public function build (ContainerBuilder $ container )
41+ public function build (ContainerBuilder $ container ): void
4142 {
4243 parent ::build ($ container );
4344
@@ -73,10 +74,15 @@ public function process(ContainerBuilder $container): void
7374 $ container ->addCompilerPass (new RemoveLoggingMiddlewarePass ());
7475 $ container ->addCompilerPass (new MiddlewaresPass ());
7576 $ container ->addCompilerPass (new RegisterUidTypePass ());
77+
78+ if (! class_exists (RegisterDatePointTypePass::class)) {
79+ return ;
80+ }
81+
82+ $ container ->addCompilerPass (new RegisterDatePointTypePass ());
7683 }
7784
78- /** @return void */
79- public function boot ()
85+ public function boot (): void
8086 {
8187 // Register an autoloader for proxies to avoid issues when unserializing them
8288 // when the ORM is used.
@@ -124,8 +130,7 @@ public function boot()
124130 $ this ->autoloader = Autoloader::register ($ dir , $ namespace , $ proxyGenerator );
125131 }
126132
127- /** @return void */
128- public function shutdown ()
133+ public function shutdown (): void
129134 {
130135 if ($ this ->autoloader !== null ) {
131136 spl_autoload_unregister ($ this ->autoloader );
@@ -157,8 +162,7 @@ public function shutdown()
157162 }
158163 }
159164
160- /** @return void */
161- public function registerCommands (Application $ application )
165+ public function registerCommands (Application $ application ): void
162166 {
163167 }
164168
0 commit comments