Browse Source

Make View::$Blocks protected.

ADmad 7 years ago
parent
commit
1462dde3d0
1 changed files with 10 additions and 1 deletions
  1. 10 1
      src/View/View.php

+ 10 - 1
src/View/View.php

@@ -94,7 +94,7 @@ class View implements EventDispatcherInterface
      *
      * @var \Cake\View\ViewBlock
      */
-    public $Blocks;
+    protected $Blocks;
 
     /**
      * The name of the plugin.
@@ -1211,6 +1211,15 @@ class View implements EventDispatcherInterface
             return $this->{$method}();
         }
 
+        if ($name === 'Blocks') {
+            deprecationWarning(
+                'View::$Blocks is protected now. ' .
+                'Use one of the wrapper methods like View::fetch() etc. instead.'
+            );
+
+            return $this->Blocks;
+        }
+
         $registry = $this->helpers();
         if (isset($registry->{$name})) {
             $this->{$name} = $registry->{$name};