@@ -55,17 +55,9 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
55
55
protected $ bundles = [];
56
56
57
57
protected $ container ;
58
- /**
59
- * @deprecated since Symfony 4.2
60
- */
61
- protected $ rootDir ;
62
58
protected $ environment ;
63
59
protected $ debug ;
64
60
protected $ booted = false ;
65
- /**
66
- * @deprecated since Symfony 4.2
67
- */
68
- protected $ name ;
69
61
protected $ startTime ;
70
62
71
63
private $ projectDir ;
@@ -87,8 +79,6 @@ public function __construct(string $environment, bool $debug)
87
79
{
88
80
$ this ->environment = $ environment ;
89
81
$ this ->debug = $ debug ;
90
- $ this ->rootDir = $ this ->getRootDir (false );
91
- $ this ->name = $ this ->getName (false );
92
82
}
93
83
94
84
public function __clone ()
@@ -278,27 +268,6 @@ public function locateResource($name, $dir = null, $first = true)
278
268
throw new \InvalidArgumentException (sprintf ('Unable to find file "%s". ' , $ name ));
279
269
}
280
270
281
- /**
282
- * {@inheritdoc}
283
- *
284
- * @deprecated since Symfony 4.2
285
- */
286
- public function getName (/* $triggerDeprecation = true */ )
287
- {
288
- if (0 === \func_num_args () || func_get_arg (0 )) {
289
- @trigger_error (sprintf ('The "%s()" method is deprecated since Symfony 4.2. ' , __METHOD__ ), E_USER_DEPRECATED );
290
- }
291
-
292
- if (null === $ this ->name ) {
293
- $ this ->name = preg_replace ('/[^a-zA-Z0-9_]+/ ' , '' , basename ($ this ->rootDir ));
294
- if (ctype_digit ($ this ->name [0 ])) {
295
- $ this ->name = '_ ' .$ this ->name ;
296
- }
297
- }
298
-
299
- return $ this ->name ;
300
- }
301
-
302
271
/**
303
272
* {@inheritdoc}
304
273
*/
@@ -315,25 +284,6 @@ public function isDebug()
315
284
return $ this ->debug ;
316
285
}
317
286
318
- /**
319
- * {@inheritdoc}
320
- *
321
- * @deprecated since Symfony 4.2, use getProjectDir() instead
322
- */
323
- public function getRootDir (/* $triggerDeprecation = true */ )
324
- {
325
- if (0 === \func_num_args () || func_get_arg (0 )) {
326
- @trigger_error (sprintf ('The "%s()" method is deprecated since Symfony 4.2, use getProjectDir() instead. ' , __METHOD__ ), E_USER_DEPRECATED );
327
- }
328
-
329
- if (null === $ this ->rootDir ) {
330
- $ r = new \ReflectionObject ($ this );
331
- $ this ->rootDir = \dirname ($ r ->getFileName ());
332
- }
333
-
334
- return $ this ->rootDir ;
335
- }
336
-
337
287
/**
338
288
* Gets the application root dir (path of the project's composer file).
339
289
*
@@ -450,8 +400,7 @@ protected function getContainerClass()
450
400
{
451
401
$ class = \get_class ($ this );
452
402
$ class = 'c ' === $ class [0 ] && 0 === strpos ($ class , "class@anonymous \0" ) ? get_parent_class ($ class ).str_replace ('. ' , '_ ' , ContainerBuilder::hash ($ class )) : $ class ;
453
- $ class = $ this ->name .str_replace ('\\' , '_ ' , $ class ).ucfirst ($ this ->environment ).($ this ->debug ? 'Debug ' : '' ).'Container ' ;
454
-
403
+ $ class = str_replace ('\\' , '_ ' , $ class ).ucfirst ($ this ->environment ).($ this ->debug ? 'Debug ' : '' ).'Container ' ;
455
404
if (!preg_match ('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/ ' , $ class )) {
456
405
throw new \InvalidArgumentException (sprintf ('The environment "%s" contains invalid characters, it can only contain characters allowed in PHP class names. ' , $ this ->environment ));
457
406
}
@@ -611,18 +560,17 @@ protected function getKernelParameters()
611
560
];
612
561
}
613
562
563
+ $ rootDir = new \ReflectionObject ($ this );
564
+ $ rootDir = \dirname ($ rootDir ->getFileName ());
565
+
614
566
return [
615
567
/*
616
568
* @deprecated since Symfony 4.2, use kernel.project_dir instead
617
569
*/
618
- 'kernel.root_dir ' => realpath ($ this -> rootDir ) ?: $ this -> rootDir ,
570
+ 'kernel.root_dir ' => realpath ($ rootDir ) ?: $ rootDir ,
619
571
'kernel.project_dir ' => realpath ($ this ->getProjectDir ()) ?: $ this ->getProjectDir (),
620
572
'kernel.environment ' => $ this ->environment ,
621
573
'kernel.debug ' => $ this ->debug ,
622
- /*
623
- * @deprecated since Symfony 4.2
624
- */
625
- 'kernel.name ' => $ this ->name ,
626
574
'kernel.cache_dir ' => realpath ($ cacheDir = $ this ->warmupDir ?: $ this ->getCacheDir ()) ?: $ cacheDir ,
627
575
'kernel.logs_dir ' => realpath ($ this ->getLogDir ()) ?: $ this ->getLogDir (),
628
576
'kernel.bundles ' => $ bundles ,
@@ -837,48 +785,13 @@ public static function stripComments($source)
837
785
return $ output ;
838
786
}
839
787
840
- /**
841
- * @deprecated since Symfony 4.3
842
- */
843
- public function serialize ()
844
- {
845
- @trigger_error (sprintf ('The "%s" method is deprecated since Symfony 4.3. ' , __METHOD__ ), E_USER_DEPRECATED );
846
-
847
- return serialize ([$ this ->environment , $ this ->debug ]);
848
- }
849
-
850
- /**
851
- * @deprecated since Symfony 4.3
852
- */
853
- public function unserialize ($ data )
854
- {
855
- @trigger_error (sprintf ('The "%s" method is deprecated since Symfony 4.3. ' , __METHOD__ ), E_USER_DEPRECATED );
856
- list ($ environment , $ debug ) = unserialize ($ data , ['allowed_classes ' => false ]);
857
-
858
- $ this ->__construct ($ environment , $ debug );
859
- }
860
-
861
788
public function __sleep ()
862
789
{
863
- if (__CLASS__ !== $ c = (new \ReflectionMethod ($ this , 'serialize ' ))->getDeclaringClass ()->name ) {
864
- @trigger_error (sprintf ('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3. ' , $ c ), E_USER_DEPRECATED );
865
- $ this ->serialized = $ this ->serialize ();
866
-
867
- return ['serialized ' ];
868
- }
869
-
870
790
return ['environment ' , 'debug ' ];
871
791
}
872
792
873
793
public function __wakeup ()
874
794
{
875
- if (__CLASS__ !== $ c = (new \ReflectionMethod ($ this , 'serialize ' ))->getDeclaringClass ()->name ) {
876
- @trigger_error (sprintf ('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3. ' , $ c ), E_USER_DEPRECATED );
877
- $ this ->unserialize ($ this ->serialized );
878
- unset($ this ->serialized );
879
-
880
- return ;
881
- }
882
795
$ this ->__construct ($ this ->environment , $ this ->debug );
883
796
}
884
797
}
0 commit comments