File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33namespace PHPStan \DependencyInjection ;
44
55use Nette \DI \Config \Loader ;
6+ use Nette \DI \Container as OriginalNetteContainer ;
67use Nette \DI \ContainerLoader ;
78use PHPStan \File \FileReader ;
89use function array_keys ;
10+ use function error_reporting ;
11+ use function restore_error_handler ;
12+ use function set_error_handler ;
913use function sha1 ;
14+ use const E_USER_DEPRECATED ;
1015use const PHP_RELEASE_VERSION ;
1116use const PHP_VERSION_ID ;
1217
@@ -60,6 +65,26 @@ public function loadContainer(): string
6065 );
6166 }
6267
68+ public function createContainer (bool $ initialize = true ): OriginalNetteContainer
69+ {
70+ set_error_handler (static function (int $ errno ): bool {
71+ if ((error_reporting () & $ errno ) === 0 ) {
72+ // silence @ operator
73+ return true ;
74+ }
75+
76+ return $ errno === E_USER_DEPRECATED ;
77+ });
78+
79+ try {
80+ $ container = parent ::createContainer ($ initialize );
81+ } finally {
82+ restore_error_handler ();
83+ }
84+
85+ return $ container ;
86+ }
87+
6388 /**
6489 * @return string[]
6590 */
You can’t perform that action at this time.
0 commit comments