Skip to content

Commit 7cb6b5c

Browse files
committed
Add void return types to event callback signatures
Add `: void` to 29 event callback method signatures across Table, Controller, Component, Helper, and Command documentation.
1 parent 2698e68 commit 7cb6b5c

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

docs/en/console-commands/commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ The `beforeExecute()` and `afterExecute()` hook methods were added.
619619

620620
### beforeExecute()
621621

622-
`method` Cake\\Console\\Command::**beforeExecute**(EventInterface $event, Arguments $args, ConsoleIo $io)
622+
`method` Cake\\Console\\Command::**beforeExecute**(EventInterface $event, Arguments $args, ConsoleIo $io): void
623623

624624
Called before the `execute()` method runs. Useful for initialization and
625625
validation:
@@ -644,7 +644,7 @@ class MyCommand extends Command
644644

645645
### afterExecute()
646646

647-
`method` Cake\\Console\\Command::**afterExecute**(EventInterface $event, Arguments $args, ConsoleIo $io)
647+
`method` Cake\\Console\\Command::**afterExecute**(EventInterface $event, Arguments $args, ConsoleIo $io): void
648648

649649
Called after the `execute()` method completes. Useful for cleanup and
650650
logging:

docs/en/controllers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,15 @@ methods are implemented by your controllers
561561

562562
#### beforeFilter()
563563

564-
`method` Cake\\Controller\\Controller::**beforeFilter**(EventInterface $event)
564+
`method` Cake\\Controller\\Controller::**beforeFilter**(EventInterface $event): void
565565

566566
#### beforeRender()
567567

568-
`method` Cake\\Controller\\Controller::**beforeRender**(EventInterface $event)
568+
`method` Cake\\Controller\\Controller::**beforeRender**(EventInterface $event): void
569569

570570
#### afterFilter()
571571

572-
`method` Cake\\Controller\\Controller::**afterFilter**(EventInterface $event)
572+
`method` Cake\\Controller\\Controller::**afterFilter**(EventInterface $event): void
573573

574574
In addition to controller life-cycle callbacks, [Components](controllers/components)
575575
also provide a similar set of callbacks.

docs/en/controllers/components.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,15 @@ $controller = $this->getController();
306306
Components also offer a few request life-cycle callbacks that allow them to
307307
augment the request cycle.
308308

309-
`method` Class::**beforeFilter**(EventInterface $event)
309+
`method` Class::**beforeFilter**(EventInterface $event): void
310310

311-
`method` Class::**startup**(EventInterface $event)
311+
`method` Class::**startup**(EventInterface $event): void
312312

313-
`method` Class::**beforeRender**(EventInterface $event)
313+
`method` Class::**beforeRender**(EventInterface $event): void
314314

315-
`method` Class::**afterFilter**(EventInterface $event)
315+
`method` Class::**afterFilter**(EventInterface $event): void
316316

317-
`method` Class::**beforeRedirect**(EventInterface $event, $url, Response $response)
317+
`method` Class::**beforeRedirect**(EventInterface $event, $url, Response $response): void
318318

319319
<a id="redirect-component-events"></a>
320320

docs/en/orm/table-objects.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function afterSaveCommit(Event $event, EntityInterface $entity, ArrayObje
174174

175175
### initialize
176176

177-
`method` Cake\\ORM\\Table::**initialize**(EventInterface $event, ArrayObject $data, ArrayObject $options)
177+
`method` Cake\\ORM\\Table::**initialize**(EventInterface $event, ArrayObject $data, ArrayObject $options): void
178178

179179
The `Model.initialize` event is fired after the constructor and initialize
180180
methods are called. The `Table` classes do not listen to this event by
@@ -214,22 +214,22 @@ This will call the `initializeEvent` when any `Table` class is constructed.
214214

215215
### beforeMarshal
216216

217-
`method` Cake\\ORM\\Table::**beforeMarshal**(EventInterface $event, ArrayObject $data, ArrayObject $options)
217+
`method` Cake\\ORM\\Table::**beforeMarshal**(EventInterface $event, ArrayObject $data, ArrayObject $options): void
218218

219219
The `Model.beforeMarshal` event is fired before request data is converted
220220
into entities. See the [Before Marshal](../orm/saving-data#before-marshal) documentation for more information.
221221

222222
### afterMarshal
223223

224-
`method` Cake\\ORM\\Table::**afterMarshal**(EventInterface $event, EntityInterface $entity, ArrayObject $data, ArrayObject $options)
224+
`method` Cake\\ORM\\Table::**afterMarshal**(EventInterface $event, EntityInterface $entity, ArrayObject $data, ArrayObject $options): void
225225

226226
The `Model.afterMarshal` event is fired after request data is converted
227227
into entities. Event handlers will get the converted entities, original request
228228
data and the options provided to the `patchEntity()` or `newEntity()` call.
229229

230230
### beforeFind
231231

232-
`method` Cake\\ORM\\Table::**beforeFind**(EventInterface $event, SelectQuery $query, ArrayObject $options, boolean $primary)
232+
`method` Cake\\ORM\\Table::**beforeFind**(EventInterface $event, SelectQuery $query, ArrayObject $options, boolean $primary): void
233233

234234
The `Model.beforeFind` event is fired before each find operation. By stopping
235235
the event, and feeding the query with a custom result set, you can bypass the find
@@ -266,7 +266,7 @@ been replaced with the [Map Reduce](../orm/retrieving-data-and-resultsets#map-re
266266

267267
### buildValidator
268268

269-
`method` Cake\\ORM\\Table::**buildValidator**(EventInterface $event, Validator $validator, $name)
269+
`method` Cake\\ORM\\Table::**buildValidator**(EventInterface $event, Validator $validator, $name): void
270270

271271
The `Model.buildValidator` event is fired when `$name` validator is created.
272272
Behaviors, can use this hook to add in validation methods.
@@ -280,37 +280,37 @@ created and after the `Table::buildRules()` method has been called.
280280

281281
### beforeRules
282282

283-
`method` Cake\\ORM\\Table::**beforeRules**(EventInterface $event, EntityInterface $entity, ArrayObject $options, $operation)
283+
`method` Cake\\ORM\\Table::**beforeRules**(EventInterface $event, EntityInterface $entity, ArrayObject $options, $operation): void
284284

285285
The `Model.beforeRules` event is fired before an entity has had rules applied. By
286286
stopping this event, you can halt the rules checking and set the result
287287
of applying rules.
288288

289289
### afterRules
290290

291-
`method` Cake\\ORM\\Table::**afterRules**(EventInterface $event, EntityInterface $entity, ArrayObject $options, $result, $operation)
291+
`method` Cake\\ORM\\Table::**afterRules**(EventInterface $event, EntityInterface $entity, ArrayObject $options, $result, $operation): void
292292

293293
The `Model.afterRules` event is fired after an entity has rules applied. By
294294
stopping this event, you can return the final value of the rules checking
295295
operation.
296296

297297
### beforeSave
298298

299-
`method` Cake\\ORM\\Table::**beforeSave**(EventInterface $event, EntityInterface $entity, ArrayObject $options)
299+
`method` Cake\\ORM\\Table::**beforeSave**(EventInterface $event, EntityInterface $entity, ArrayObject $options): void
300300

301301
The `Model.beforeSave` event is fired before each entity is saved. Stopping
302302
this event will abort the save operation. When the event is stopped the result
303303
of the event will be returned.
304304

305305
### afterSave
306306

307-
`method` Cake\\ORM\\Table::**afterSave**(EventInterface $event, EntityInterface $entity, ArrayObject $options)
307+
`method` Cake\\ORM\\Table::**afterSave**(EventInterface $event, EntityInterface $entity, ArrayObject $options): void
308308

309309
The `Model.afterSave` event is fired after an entity is saved.
310310

311311
### afterSaveCommit
312312

313-
`method` Cake\\ORM\\Table::**afterSaveCommit**(EventInterface $event, EntityInterface $entity, ArrayObject $options)
313+
`method` Cake\\ORM\\Table::**afterSaveCommit**(EventInterface $event, EntityInterface $entity, ArrayObject $options): void
314314

315315
The `Model.afterSaveCommit` event is fired after the transaction in which the
316316
save operation is wrapped has been committed. It's also triggered for non atomic
@@ -320,21 +320,21 @@ not triggered if a transaction is started before calling save.
320320

321321
### beforeDelete
322322

323-
`method` Cake\\ORM\\Table::**beforeDelete**(EventInterface $event, EntityInterface $entity, ArrayObject $options)
323+
`method` Cake\\ORM\\Table::**beforeDelete**(EventInterface $event, EntityInterface $entity, ArrayObject $options): void
324324

325325
The `Model.beforeDelete` event is fired before an entity is deleted. By
326326
stopping this event you will abort the delete operation. When the event is stopped the result
327327
of the event will be returned.
328328

329329
### afterDelete
330330

331-
`method` Cake\\ORM\\Table::**afterDelete**(EventInterface $event, EntityInterface $entity, ArrayObject $options)
331+
`method` Cake\\ORM\\Table::**afterDelete**(EventInterface $event, EntityInterface $entity, ArrayObject $options): void
332332

333333
The `Model.afterDelete` event is fired after an entity has been deleted.
334334

335335
### afterDeleteCommit
336336

337-
`method` Cake\\ORM\\Table::**afterDeleteCommit**(EventInterface $event, EntityInterface $entity, ArrayObject $options)
337+
`method` Cake\\ORM\\Table::**afterDeleteCommit**(EventInterface $event, EntityInterface $entity, ArrayObject $options): void
338338

339339
The `Model.afterDeleteCommit` event is fired after the transaction in which the
340340
delete operation is wrapped has been is committed. It's also triggered for non

docs/en/views/helpers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,24 +377,24 @@ does not implement any of the callback methods.
377377

378378
#### beforeRenderFile()
379379

380-
`method` Helper::**beforeRenderFile**(EventInterface $event, $viewFile)
380+
`method` Helper::**beforeRenderFile**(EventInterface $event, $viewFile): void
381381

382382
#### afterRenderFile()
383383

384-
`method` Helper::**afterRenderFile**(EventInterface $event, $viewFile, $content)
384+
`method` Helper::**afterRenderFile**(EventInterface $event, $viewFile, $content): void
385385

386386
#### beforeRender()
387387

388-
`method` Helper::**beforeRender**(EventInterface $event, $viewFile)
388+
`method` Helper::**beforeRender**(EventInterface $event, $viewFile): void
389389

390390
#### afterRender()
391391

392-
`method` Helper::**afterRender**(EventInterface $event, $viewFile)
392+
`method` Helper::**afterRender**(EventInterface $event, $viewFile): void
393393

394394
#### beforeLayout()
395395

396-
`method` Helper::**beforeLayout**(EventInterface $event, $layoutFile)
396+
`method` Helper::**beforeLayout**(EventInterface $event, $layoutFile): void
397397

398398
#### afterLayout()
399399

400-
`method` Helper::**afterLayout**(EventInterface $event, $layoutFile)
400+
`method` Helper::**afterLayout**(EventInterface $event, $layoutFile): void

0 commit comments

Comments
 (0)