Documenting CronJob in Function Comment

When defining cronjob, please mention following details:

  • Responsibility
  • When it will be executed

Please apply either @cronjob or @api phpdoc tag (especially if the cronjob is trigger-able via HTTP).

Here’s a sample for that:

class Cronjob
{
    /**
     * Periodic (self defined) cronjob.
     *
     * Currently runs on 5:55 (6am), 8:55 (9am), 11:55 (12pm), 16:55 (5pm) 
     * everyday.
     *
     * Responsible for sending reminder of un-followed-up tesride requests to 
     * dealers everyweekday.
     *
     * @api
     *
     * @return void
     */
    public function periodic_dealer_testride_reminder()
    {
    }
}

An additional notes: There are proposed new PHP Standard for PHP Docs tags: PSR5.

Disclaimer:

Not all articles here are meant to be correct. My notes might be wrong or may no longer be relevant. If you want to try things here, please proceed with caution.


Posted

in

,

by

Tags: