@@ -59,7 +59,7 @@ abstract class Block implements BlockInterface
59
59
* @param BlockFactory $blockFactory
60
60
* @param array $config
61
61
*/
62
- public function __construct (Element $ element , BlockFactory $ blockFactory , array $ config )
62
+ public function __construct (Element $ element , BlockFactory $ blockFactory , array $ config = [] )
63
63
{
64
64
$ this ->_rootElement = $ element ;
65
65
$ this ->blockFactory = $ blockFactory ;
@@ -140,20 +140,23 @@ function () use ($browser, $selector, $strategy) {
140
140
* @param string $type
141
141
* @param string $method
142
142
* @param array $arguments
143
- * @return void
143
+ * @return bool
144
144
*/
145
145
protected function callRender ($ type , $ method , array $ arguments = [])
146
146
{
147
147
$ block = $ this ->getRenderInstance ($ type );
148
- call_user_func_array ([$ block , $ method ], $ arguments );
148
+ if ($ block !== null ) {
149
+ call_user_func_array ([$ block , $ method ], $ arguments );
150
+ return true ;
151
+ }
152
+ return false ;
149
153
}
150
154
151
155
/**
152
156
* Get render instance by name
153
157
*
154
158
* @param string $renderName
155
159
* @return BlockInterface
156
- * @throws \InvalidArgumentException
157
160
*/
158
161
protected function getRenderInstance ($ renderName )
159
162
{
@@ -173,9 +176,7 @@ protected function getRenderInstance($renderName)
173
176
]
174
177
);
175
178
} else {
176
- throw new \InvalidArgumentException (
177
- sprintf ('There is no such render "%s" declared for the block "%s" ' , $ renderName , $ class )
178
- );
179
+ return null ;
179
180
}
180
181
181
182
$ this ->renderInstances [$ renderName ] = $ block ;
0 commit comments