diff --git a/CRM/Admin/Page/APIExplorer.php b/CRM/Admin/Page/APIExplorer.php
index 13363ee23122..40f6dd1be648 100644
--- a/CRM/Admin/Page/APIExplorer.php
+++ b/CRM/Admin/Page/APIExplorer.php
@@ -205,7 +205,8 @@ private static function getDocBlock($entity, $action) {
/**
* Format a docblock to be a bit more readable
- * Not a proper doc parser... patches welcome :)
+ *
+ * FIXME: APIv4 uses markdown in code docs. Switch to that.
*
* @param string $text
* @return string
@@ -224,8 +225,8 @@ public static function formatDocBlock($text) {
// Extract code blocks - save for later to skip html conversion
$code = [];
- preg_match_all('#@code(.*?)@endcode#is', $text, $code);
- $text = preg_replace('#@code.*?@endcode#is', '
', $text);
+ preg_match_all('#(@code|```)(.*?)(@endcode|```)#is', $text, $code);
+ $text = preg_replace('#(@code|```)(.*?)(@endcode|```)#is', '', $text);
// Convert @annotations to titles
$text = preg_replace_callback(
@@ -242,8 +243,8 @@ function($matches) {
$text = nl2br($text);
// Add unformatted code blocks back in
- if ($code && !empty($code[1])) {
- foreach ($code[1] as $block) {
+ if ($code && !empty($code[2])) {
+ foreach ($code[2] as $block) {
$text = preg_replace('##', "$block
", $text, 1);
}
}
diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php
index b947740e0e59..6e9995ff23a2 100644
--- a/CRM/Core/DAO.php
+++ b/CRM/Core/DAO.php
@@ -2858,11 +2858,11 @@ public function setApiFilter(&$params) {
* Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity
*
* Return format is in the form of fieldname => clauses starting with an operator. e.g.:
- * @code
+ * ```
* array(
* 'location_type_id' => array('IS NOT NULL', 'IN (1,2,3)')
* )
- * @endcode
+ * ```
*
* Note that all array keys must be actual field names in this entity. Use subqueries to filter on other tables e.g. custom values.
*
diff --git a/CRM/Core/Page/Redirect.php b/CRM/Core/Page/Redirect.php
index 90be62a20bc2..15141ae4f021 100644
--- a/CRM/Core/Page/Redirect.php
+++ b/CRM/Core/Page/Redirect.php
@@ -3,13 +3,13 @@
/**
* Placeholder page which generates a redirect
*
- * @code
+ * ```
* -
* civicrm/admin/options/case_type
* CRM_Core_Page_Redirect
* url=civicrm/foo/bar?whiz=bang&passthru=%%passthru%%
*
- * @endcoe
+ * ```
*/
class CRM_Core_Page_Redirect extends CRM_Core_Page {
diff --git a/CRM/Core/Region.php b/CRM/Core/Region.php
index b1809af63629..5d101d1d70ff 100644
--- a/CRM/Core/Region.php
+++ b/CRM/Core/Region.php
@@ -68,7 +68,7 @@ public function __construct($name) {
/**
* Add a snippet of content to a region.
*
- * @code
+ * ```
* CRM_Core_Region::instance('page-header')->add(array(
* 'markup' => 'Hello!
',
* ));
@@ -81,7 +81,7 @@ public function __construct($name) {
* CRM_Core_Region::instance('page-header')->add(array(
* 'callback' => 'myextension_callback_function',
* ));
- * @endcode
+ * ```
*
* Note: This function does not perform any extra encoding of markup, script code, or etc. If
* you're passing in user-data, you must clean it yourself.
diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php
index e45873d4dbbf..86fcab419aa1 100644
--- a/CRM/Core/Smarty.php
+++ b/CRM/Core/Smarty.php
@@ -258,14 +258,14 @@ public function addTemplateDir($path) {
/**
* Temporarily assign a list of variables.
*
- * @code
+ * ```
* $smarty->pushScope(array(
* 'first_name' => 'Alice',
* 'last_name' => 'roberts',
* ));
* $html = $smarty->fetch('view-contact.tpl');
* $smarty->popScope();
- * @endcode
+ * ```
*
* @param array $vars
* (string $name => mixed $value).
diff --git a/CRM/Core/Smarty/plugins/block.crmScope.php b/CRM/Core/Smarty/plugins/block.crmScope.php
index 66bb8bcb4fda..3e0e02800386 100644
--- a/CRM/Core/Smarty/plugins/block.crmScope.php
+++ b/CRM/Core/Smarty/plugins/block.crmScope.php
@@ -5,7 +5,7 @@
*
* Example:
*
- * @code
+ * ```
* {tsScope x=1}
* Expect {$x}==1
* {tsScope x=2}
@@ -13,7 +13,7 @@
* {/tsScope}
* Expect {$x}==1
* {/tsScope}
- * @endcode
+ * ```
*
* @param array $params
* Must define 'name'.
diff --git a/CRM/Core/Smarty/plugins/function.crmVersion.php b/CRM/Core/Smarty/plugins/function.crmVersion.php
index e25693c93a56..6f9ab7c61705 100644
--- a/CRM/Core/Smarty/plugins/function.crmVersion.php
+++ b/CRM/Core/Smarty/plugins/function.crmVersion.php
@@ -20,11 +20,11 @@
/**
* Display the CiviCRM version
*
- * @code
+ * ```
* The version is {crmVersion}.
*
* {crmVersion redact=auto assign=ver}The version is {$ver}.
- * @endcode
+ * ```
*
* @param $params
* @param $smarty
diff --git a/CRM/Core/TemporaryErrorScope.php b/CRM/Core/TemporaryErrorScope.php
index d8853b8ef8cd..ab0cf4b3f800 100644
--- a/CRM/Core/TemporaryErrorScope.php
+++ b/CRM/Core/TemporaryErrorScope.php
@@ -14,9 +14,9 @@
*
* To ensure that they throw exceptions, use:
*
- * @code
+ * ```
* $errorScope = CRM_Core_TemporaryErrorScope::useException();
- * @endcode
+ * ```
*
* Note that relying on this is a code-smell: it can be
* safe to temporarily switch to exception
diff --git a/CRM/Core/Transaction.php b/CRM/Core/Transaction.php
index 04be629fb36f..a2297bee1f2d 100644
--- a/CRM/Core/Transaction.php
+++ b/CRM/Core/Transaction.php
@@ -28,7 +28,7 @@
*
* Examples:
*
- * @code
+ * ```
* // Some business logic using the helper functions
* function my_business_logic() {
* CRM_Core_Transaction::create()->run(function($tx) {
@@ -60,7 +60,7 @@
* }
* }
*
- * @endcode
+ * ```
*
* Note: As of 4.6, the transaction manager supports both reference-counting and nested
* transactions (SAVEPOINTs). In the past, it only supported reference-counting. The two cases
diff --git a/CRM/Queue/ErrorPolicy.php b/CRM/Queue/ErrorPolicy.php
index 110e07bc9199..f7bc774add4f 100644
--- a/CRM/Queue/ErrorPolicy.php
+++ b/CRM/Queue/ErrorPolicy.php
@@ -13,12 +13,12 @@
* To ensure that PHP errors or unhandled exceptions are reported in JSON
* format, wrap this around your code. For example:
*
- * @code
+ * ```
* $errorContainer = new CRM_Queue_ErrorPolicy();
* $errorContainer->call(function() {
* ...include some files, do some work, etc...
* });
- * @endcode
+ * ```
*
* Note: Most of the code in this class is pretty generic vis-a-vis error
* handling -- except for 'reportError', whose message format is only
diff --git a/CRM/Queue/Service.php b/CRM/Queue/Service.php
index c86f790ad469..60d2521cba15 100644
--- a/CRM/Queue/Service.php
+++ b/CRM/Queue/Service.php
@@ -15,7 +15,7 @@
* different queue-providers may store the queue content in different
* ways (in memory, in SQL, or in an external service).
*
- * @code
+ * ```
* $queue = CRM_Queue_Service::singleton()->create(array(
* 'type' => 'interactive',
* 'name' => 'upgrade-tasks',
@@ -31,7 +31,7 @@
* $queue->releaseItem($item);
* }
* }
- * @endcode
+ * ```
*/
class CRM_Queue_Service {
diff --git a/CRM/Utils/API/MatchOption.php b/CRM/Utils/API/MatchOption.php
index f92723c33726..fa87a1cf8b03 100644
--- a/CRM/Utils/API/MatchOption.php
+++ b/CRM/Utils/API/MatchOption.php
@@ -21,7 +21,7 @@
* - "match-mandatory" will generate an error
* - "match" will allow action to proceed -- thus inserting a new record
*
- * @code
+ * ```
* $result = civicrm_api('contact', 'create', array(
* 'options' => array(
* 'match' => array('last_name', 'first_name')
@@ -30,7 +30,7 @@
* 'last_name' => 'Lebowski',
* 'nick_name' => 'The Dude',
* ));
- * @endcode
+ * ```
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
diff --git a/CRM/Utils/API/ReloadOption.php b/CRM/Utils/API/ReloadOption.php
index 764d81bf80c5..3e320d5c1408 100644
--- a/CRM/Utils/API/ReloadOption.php
+++ b/CRM/Utils/API/ReloadOption.php
@@ -13,13 +13,13 @@
* Implement the "reload" option. This option can be used with "create" to force
* the API to reload a clean copy of the entity before returning the result.
*
- * @code
+ * ```
* $clean = civicrm_api('myentity', 'create', array(
* 'options' => array(
* 'reload' => 1
* ),
* ));
- * @endcode
+ * ```
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
diff --git a/CRM/Utils/AutoClean.php b/CRM/Utils/AutoClean.php
index 48e0cf9e2df2..1be38b0ece20 100644
--- a/CRM/Utils/AutoClean.php
+++ b/CRM/Utils/AutoClean.php
@@ -29,14 +29,14 @@ class CRM_Utils_AutoClean {
/**
* Call a cleanup function when the current context shuts down.
*
- * @code
+ * ```
* function doStuff() {
* $ac = CRM_Utils_AutoClean::with(function(){
* MyCleanup::doIt();
* });
* ...
* }
- * @endcode
+ * ```
*
* @param mixed $callback
* @return CRM_Utils_AutoClean
@@ -52,12 +52,12 @@ public static function with($callback) {
* Temporarily swap values using callback functions, and cleanup
* when the current context shuts down.
*
- * @code
+ * ```
* function doStuff() {
* $ac = CRM_Utils_AutoClean::swap('My::get', 'My::set', 'tmpValue');
* ...
* }
- * @endcode
+ * ```
*
* @param mixed $getter
* Function to lookup current value.
diff --git a/CRM/Utils/ConsoleTee.php b/CRM/Utils/ConsoleTee.php
index 75cb7eaec82d..f7adb10695b1 100644
--- a/CRM/Utils/ConsoleTee.php
+++ b/CRM/Utils/ConsoleTee.php
@@ -12,12 +12,12 @@
/**
* Capture the output from the console, copy it to a file, and pass it on.
*
- * @code
+ * ```
* $tee = CRM_Utils_ConsoleTee::create()->start();
* echo "hello world";
* $tee->stop();
* assertEquals("hello world", file_get_contents($tee->getFileName()));
- * @endCode
+ * ```
*
* Loosely speaking, it serves a similar purpose to Unix `tee`.
*
diff --git a/CRM/Utils/FakeObject.php b/CRM/Utils/FakeObject.php
index fef296edbcdc..a20246fe6b20 100644
--- a/CRM/Utils/FakeObject.php
+++ b/CRM/Utils/FakeObject.php
@@ -19,12 +19,12 @@
* This is a quick-and-dirty way to define a vaguely-class-ish structure. It's non-performant, abnormal,
* and not a complete OOP system. Only use for testing/mocking.
*
- * @code
+ * ```
* $object = new CRM_Utils_FakeObject(array(
* 'doIt' => function() { print "It!\n"; }
* ));
* $object->doIt();
- * @endcode
+ * ```
*/
class CRM_Utils_FakeObject {
diff --git a/CRM/Utils/GlobalStack.php b/CRM/Utils/GlobalStack.php
index 047de04c3c7d..50403d9546ea 100644
--- a/CRM/Utils/GlobalStack.php
+++ b/CRM/Utils/GlobalStack.php
@@ -17,7 +17,7 @@
/**
* Temporarily change a global variable.
*
- * @code
+ * ```
* $globals = CRM_Utils_GlobalStack::singleton();
* $globals->push(array(
* '_GET' => array(
@@ -26,7 +26,7 @@
* ));
* ...do stuff...
* $globals->pop();
- * @endcode
+ * ```
*
* Note: for purposes of this class, we'll refer to the array passed into
* push() as a frame.
diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php
index 6e8a7b591003..edad19c9b586 100644
--- a/CRM/Utils/Hook.php
+++ b/CRM/Utils/Hook.php
@@ -2234,10 +2234,8 @@ public static function alterResourceSettings(&$data) {
* If omitted, default to "array('civicrm/a')" for backward compat.
* For a utility that should only be loaded on-demand, use "array()".
* For a utility that should be loaded in all pages use, "array('*')".
- * @return null
- * the return value is ignored
*
- * @code
+ * ```
* function mymod_civicrm_angularModules(&$angularModules) {
* $angularModules['myAngularModule'] = array(
* 'ext' => 'org.example.mymod',
@@ -2252,7 +2250,10 @@ public static function alterResourceSettings(&$data) {
* 'basePages' => array('civicrm/a'),
* );
* }
- * @endcode
+ * ```
+ *
+ * @return null
+ * the return value is ignored
*/
public static function angularModules(&$angularModules) {
return self::singleton()->invoke(['angularModules'], $angularModules,
@@ -2266,7 +2267,7 @@ public static function angularModules(&$angularModules) {
*
* @param \Civi\Angular\Manager $angular
*
- * @code
+ * ```
* function example_civicrm_alterAngular($angular) {
* $changeSet = \Civi\Angular\ChangeSet::create('mychanges')
* ->alterHtml('~/crmMailing/EditMailingCtrl/2step.html', function(phpQueryObject $doc) {
@@ -2275,7 +2276,7 @@ public static function angularModules(&$angularModules) {
* );
* $angular->add($changeSet);
* }
- * @endCode
+ * ```
*/
public static function alterAngular($angular) {
$event = \Civi\Core\Event\GenericHookEvent::create([
@@ -2365,7 +2366,7 @@ public static function crudLink($spec, $bao, &$link) {
/**
* Modify the CiviCRM container - add new services, parameters, extensions, etc.
*
- * @code
+ * ```
* use Symfony\Component\Config\Resource\FileResource;
* use Symfony\Component\DependencyInjection\Definition;
*
@@ -2373,7 +2374,7 @@ public static function crudLink($spec, $bao, &$link) {
* $container->addResource(new FileResource(__FILE__));
* $container->setDefinition('mysvc', new Definition('My\Class', array()));
* }
- * @endcode
+ * ```
*
* Tip: The container configuration will be compiled/cached. The default cache
* behavior is aggressive. When you first implement the hook, be sure to
diff --git a/CRM/Utils/Migrate/Export.php b/CRM/Utils/Migrate/Export.php
index 76a440e26a2c..7dc6b17d7f67 100644
--- a/CRM/Utils/Migrate/Export.php
+++ b/CRM/Utils/Migrate/Export.php
@@ -22,7 +22,7 @@ class CRM_Utils_Migrate_Export {
* @var array
* Description of export field mapping
*
- * @code
+ * ```
* 'exampleEntityMappingName' => array(
* 'data' => array(), // placeholder; this will get filled-in during execution
* 'name' => 'CustomGroup', // per-item XML tag name
@@ -31,7 +31,7 @@ class CRM_Utils_Migrate_Export {
* 'idNameFields' => array('id', 'name'), // name of the (local/autogenerated) "id" and (portable) "name" columns
* 'idNameMap' => array(), // placeholder; this will get filled-in during execution
* ),
- * @endcode
+ * ```
*/
protected $_xml;
diff --git a/CRM/Utils/SQL/BaseParamQuery.php b/CRM/Utils/SQL/BaseParamQuery.php
index 159f56a5fad6..20125db2bdad 100644
--- a/CRM/Utils/SQL/BaseParamQuery.php
+++ b/CRM/Utils/SQL/BaseParamQuery.php
@@ -191,11 +191,11 @@ public function offsetExists($offset) {
/**
* Get the value of a SQL parameter.
*
- * @code
+ * ```
* $select['cid'] = 123;
* $select->where('contact.id = #cid');
* echo $select['cid'];
- * @endCode
+ * ```
*
* @param string $offset
* @return mixed
@@ -209,11 +209,11 @@ public function offsetGet($offset) {
/**
* Set the value of a SQL parameter.
*
- * @code
+ * ```
* $select['cid'] = 123;
* $select->where('contact.id = #cid');
* echo $select['cid'];
- * @endCode
+ * ```
*
* @param string $offset
* @param mixed $value
diff --git a/CRM/Utils/SQL/Delete.php b/CRM/Utils/SQL/Delete.php
index 6bbc076691c7..fcb5443030cc 100644
--- a/CRM/Utils/SQL/Delete.php
+++ b/CRM/Utils/SQL/Delete.php
@@ -13,7 +13,7 @@
* Dear God Why Do I Have To Write This (Dumb SQL Builder)
*
* Usage:
- * @code
+ * ```
* $del = CRM_Utils_SQL_Delete::from('civicrm_activity act')
* ->where('activity_type_id = #type', array('type' => 234))
* ->where('status_id IN (#statuses)', array('statuses' => array(1,2,3))
@@ -24,7 +24,7 @@
* 'value' => $form['foo']
* ))
* echo $del->toSQL();
- * @endcode
+ * ```
*
* Design principles:
* - Portable
@@ -48,7 +48,7 @@
* xor output. The notations for input and output interpolation are a bit different,
* and they may not be mixed.
*
- * @code
+ * ```
* // Interpolate on input. Set params when using them.
* $select->where('activity_type_id = #type', array(
* 'type' => 234,
@@ -58,7 +58,7 @@
* $select
* ->where('activity_type_id = #type')
* ->param('type', 234),
- * @endcode
+ * ```
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
diff --git a/CRM/Utils/SQL/Select.php b/CRM/Utils/SQL/Select.php
index 47707a316fd8..4aa6b7e51669 100644
--- a/CRM/Utils/SQL/Select.php
+++ b/CRM/Utils/SQL/Select.php
@@ -13,7 +13,7 @@
* Dear God Why Do I Have To Write This (Dumb SQL Builder)
*
* Usage:
- * @code
+ * ```
* $select = CRM_Utils_SQL_Select::from('civicrm_activity act')
* ->join('absence', 'inner join civicrm_activity absence on absence.id = act.source_record_id')
* ->where('activity_type_id = #type', array('type' => 234))
@@ -25,7 +25,7 @@
* 'value' => $form['foo']
* ))
* echo $select->toSQL();
- * @endcode
+ * ```
*
* Design principles:
* - Portable
@@ -49,7 +49,7 @@
* xor output. The notations for input and output interpolation are a bit different,
* and they may not be mixed.
*
- * @code
+ * ```
* // Interpolate on input. Set params when using them.
* $select->where('activity_type_id = #type', array(
* 'type' => 234,
@@ -59,7 +59,7 @@
* $select
* ->where('activity_type_id = #type')
* ->param('type', 234),
- * @endcode
+ * ```
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
diff --git a/CRM/Utils/Signer.php b/CRM/Utils/Signer.php
index eb902bc18949..2b6491f9d0b7 100644
--- a/CRM/Utils/Signer.php
+++ b/CRM/Utils/Signer.php
@@ -20,7 +20,7 @@
*
* FIXME: Add TTL support?
*
- * @code
+ * ```
* $signer = new CRM_Utils_Signer('myprivatekey', array('param1','param2'));
* $params = array(
* 'param1' => 'hello',
@@ -29,7 +29,7 @@
* $token = $signer->sign($params);
* ...
* assertTrue($signer->validate($token, $params));
- * @endcode
+ * ```
*/
class CRM_Utils_Signer {
/**
diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php
index 82fe4d85e47f..6e42f703b881 100644
--- a/CRM/Utils/System/Drupal8.php
+++ b/CRM/Utils/System/Drupal8.php
@@ -654,13 +654,13 @@ public function getCurrentLanguage() {
*
* For example, 'civicrm/contact/view?reset=1&cid=66' will be returned as:
*
- * @code
+ * ```
* array(
* 'path' => 'civicrm/contact/view',
* 'route' => 'civicrm.civicrm_contact_view',
* 'query' => array('reset' => '1', 'cid' => '66'),
* );
- * @endcode
+ * ```
*
* @param string $url
* The url to parse.
diff --git a/Civi.php b/Civi.php
index ebd09e8afec7..e52dd1614849 100644
--- a/Civi.php
+++ b/Civi.php
@@ -19,9 +19,9 @@ class Civi {
/**
* A central location for static variable storage.
* @var array
- * @code
+ * ```
* `Civi::$statics[__CLASS__]['foo'] = 'bar';
- * @endcode
+ * ```
*/
public static $statics = array();
diff --git a/Civi/API/Subscriber/ChainSubscriber.php b/Civi/API/Subscriber/ChainSubscriber.php
index ff4f79256e1a..e76220ca0dc0 100644
--- a/Civi/API/Subscriber/ChainSubscriber.php
+++ b/Civi/API/Subscriber/ChainSubscriber.php
@@ -18,7 +18,7 @@
* The ChainSubscriber looks for API parameters which specify a nested or
* chained API call. For example:
*
- * @code
+ * ```
* $result = civicrm_api('Contact', 'create', array(
* 'version' => 3,
* 'first_name' => 'Amy',
@@ -27,7 +27,7 @@
* 'location_type_id' => 123,
* ),
* ));
- * @endcode
+ * ```
*
* The ChainSubscriber looks for any parameters of the form "api.Email.create";
* if found, it issues the nested API call (and passes some extra context --
diff --git a/Civi/API/WhitelistRule.php b/Civi/API/WhitelistRule.php
index c17b41cb2e67..5150b362f828 100644
--- a/Civi/API/WhitelistRule.php
+++ b/Civi/API/WhitelistRule.php
@@ -14,14 +14,14 @@
* A WhitelistRule is used to determine if an API call is authorized.
* For example:
*
- * @code
+ * ```
* new WhitelistRule(array(
* 'entity' => 'Contact',
* 'actions' => array('get','getsingle'),
* 'required' => array('contact_type' => 'Organization'),
* 'fields' => array('id', 'display_name', 'sort_name', 'created_date'),
* ));
- * @endcode
+ * ```
*
* This rule would allow API requests that attempt to get contacts of type "Organization",
* but only a handful of fields ('id', 'display_name', 'sort_name', 'created_date')
diff --git a/Civi/ActionSchedule/Event/MailingQueryEvent.php b/Civi/ActionSchedule/Event/MailingQueryEvent.php
index 0158b41e7d43..873951416995 100644
--- a/Civi/ActionSchedule/Event/MailingQueryEvent.php
+++ b/Civi/ActionSchedule/Event/MailingQueryEvent.php
@@ -13,20 +13,20 @@
*
* The basic mailing query looks a bit like this (depending on configuration):
*
- * @code
+ * ```
* SELECT reminder.id AS reminderID, reminder.contact_id as contactID, ...
* FROM `civicrm_action_log` reminder
* ... JOIN `target_entity` e ON e.id = reminder.entity_id ...
* WHERE reminder.action_schedule_id = #casActionScheduleId
- * @endcode
+ * ```
*
* Listeners may modify the query. For example, suppose we want to load
* additional fields from the related 'foo' entity:
*
- * @code
+ * ```
* $event->query->join('foo', '!casMailingJoinType civicrm_foo foo ON foo.myentity_id = e.id')
* ->select('foo.bar_value AS bar');
- * @endcode
+ * ```
*
* There are several parameters pre-set for use in queries:
* - 'casActionScheduleId'
diff --git a/Civi/ActionSchedule/RecipientBuilder.php b/Civi/ActionSchedule/RecipientBuilder.php
index a54bca3b83ea..c8a32dd97e37 100644
--- a/Civi/ActionSchedule/RecipientBuilder.php
+++ b/Civi/ActionSchedule/RecipientBuilder.php
@@ -37,7 +37,7 @@
* to fire the reminders X days after the registration date. The
* MappingInterface::createQuery() could return a query like:
*
- * @code
+ * ```
* CRM_Utils_SQL_Select::from('civicrm_participant e')
* ->join('event', 'INNER JOIN civicrm_event event ON e.event_id = event.id')
* ->where('e.is_pay_later = 1')
@@ -46,7 +46,7 @@
* ->param('casDateField', 'e.register_date')
* ->param($defaultParams)
* ...etc...
- * @endcode
+ * ```
*
* In the RELATION_FIRST phase, RecipientBuilder adds a LEFT-JOIN+WHERE to find
* participants who have *not* yet received any reminder, and filters those
diff --git a/Civi/Angular/AngularLoader.php b/Civi/Angular/AngularLoader.php
index 58e69987004a..1dca6bcd9e1d 100644
--- a/Civi/Angular/AngularLoader.php
+++ b/Civi/Angular/AngularLoader.php
@@ -8,12 +8,12 @@
* The AngularLoader stops short of bootstrapping AngularJS. You may
* need to `` or `angular.bootstrap(...)`.
*
- * @code
+ * ```
* $loader = new AngularLoader();
* $loader->setPageName('civicrm/case/a');
* $loader->setModules(array('crmApp'));
* $loader->load();
- * @endCode
+ * ```
*
* @link https://docs.angularjs.org/guide/bootstrap
*/
diff --git a/Civi/Core/AssetBuilder.php b/Civi/Core/AssetBuilder.php
index 82e2141461b1..155c32c77970 100644
--- a/Civi/Core/AssetBuilder.php
+++ b/Civi/Core/AssetBuilder.php
@@ -20,7 +20,7 @@
* named "api-fields.json" which lists all the fields of
* all the API entities.
*
- * @code
+ * ```
* // Build a URL to `api-fields.json`.
* $url = \Civi::service('asset_builder')->getUrl('api-fields.json');
*
@@ -37,7 +37,7 @@
* $mimeType = 'application/json';
* $content = json_encode($fields);
* }
- * @endCode
+ * ```
*
* Assets can be parameterized. Each combination of ($asset,$params)
* will be cached separately. For example, we might want a copy of
@@ -45,7 +45,7 @@
* Simply pass the chosen entities into `getUrl()`, then update
* the definition to use `$params['entities']`, as in:
*
- * @code
+ * ```
* // Build a URL to `api-fields.json`.
* $url = \Civi::service('asset_builder')->getUrl('api-fields.json', array(
* 'entities' => array('Contact', 'Phone', 'Email', 'Address'),
@@ -63,7 +63,7 @@
* $mimeType = 'application/json';
* $content = json_encode($fields);
* }
- * @endCode
+ * ```
*
* Note: These assets are designed to hold non-sensitive data, such as
* aggregated JS or common metadata. There probably are ways to
diff --git a/Civi/Core/CiviEventInspector.php b/Civi/Core/CiviEventInspector.php
index 77d91684e25b..34514f9bf750 100644
--- a/Civi/Core/CiviEventInspector.php
+++ b/Civi/Core/CiviEventInspector.php
@@ -7,10 +7,10 @@
* The event inspector is a development tool which provides metadata about events.
* It can be used for code-generators and documentation-generators.
*
- * @code
+ * ```
* $i = new CiviEventInspector();
* print_r(CRM_Utils_Array::collect('name', $i->getAll()));
- * @endCode
+ * ```
*
* An event definition includes these fields:
* - type: string, required. Ex: 'hook' or 'object'
diff --git a/Civi/Core/Event/GenericHookEvent.php b/Civi/Core/Event/GenericHookEvent.php
index 6c62ea498afd..1b29ff76e9a9 100644
--- a/Civi/Core/Event/GenericHookEvent.php
+++ b/Civi/Core/Event/GenericHookEvent.php
@@ -26,7 +26,7 @@
* and methods. This requires some kind of mapping. `GenericHookEvent`
* maps each parameter to a field (using magic methods):
*
- * @code
+ * ```
* // Creating an event object.
* $event = GenericHookEvent::create(array(
* 'bar' => 'abc',
@@ -41,7 +41,7 @@
*
* // Dispatching an event.
* Civi::dispatcher()->dispatch('hook_civicrm_foo', $event);
- * @endCode
+ * ```
*
* Design Discussion:
*
@@ -56,10 +56,10 @@
* as an array, and all the returned values are merged into one big array.
* You can add and retrieve return-values using these methods:
*
- * @code
+ * ```
* $event->addReturnValues(array(...));
* foreach ($event->getReturnValues() as $retVal) { ... }
- * @endCode
+ * ```
*/
class GenericHookEvent extends \Symfony\Component\EventDispatcher\Event {
diff --git a/Civi/Core/Resolver.php b/Civi/Core/Resolver.php
index 379f94d64c37..a1ebfe2b0fdd 100644
--- a/Civi/Core/Resolver.php
+++ b/Civi/Core/Resolver.php
@@ -222,11 +222,11 @@ protected function createPlaceholders($prefix, $args) {
/**
* Recursively interpolate values.
*
- * @code
+ * ```
* $params = array('foo' => '@1');
* $this->interpolate($params, array('@1'=> $object))
* assert $data['foo'] == $object;
- * @endcode
+ * ```
*
* @param array $array
* Array which may or many not contain a mix of tokens.
diff --git a/Civi/Test.php b/Civi/Test.php
index 50d6ebf31c4a..1d9db1207952 100644
--- a/Civi/Test.php
+++ b/Civi/Test.php
@@ -100,12 +100,12 @@ public static function pdo() {
/**
* Create a builder for the headless environment.
*
- * @return \Civi\Test\CiviEnvBuilder
- *
- * @code
+ * ```
* \Civi\Test::headless()->apply();
* \Civi\Test::headless()->sqlFile('ex.sql')->apply();
- * @endCode
+ * ```
+ *
+ * @return \Civi\Test\CiviEnvBuilder
*/
public static function headless() {
$civiRoot = dirname(__DIR__);
@@ -130,12 +130,12 @@ public static function headless() {
/**
* Create a builder for end-to-end testing on the live environment.
*
- * @return \Civi\Test\CiviEnvBuilder
- *
- * @code
+ * ```
* \Civi\Test::e2e()->apply();
* \Civi\Test::e2e()->install('foo.bar')->apply();
- * @endCode
+ * ```
+ *
+ * @return \Civi\Test\CiviEnvBuilder
*/
public static function e2e() {
$builder = new \Civi\Test\CiviEnvBuilder('CiviEnvBuilder');
diff --git a/Civi/Test/HookInterface.php b/Civi/Test/HookInterface.php
index 53d5c8cd1122..4885cd067725 100644
--- a/Civi/Test/HookInterface.php
+++ b/Civi/Test/HookInterface.php
@@ -9,13 +9,13 @@
* This interface allows you to subscribe to hooks as part of the test.
* Simply create an eponymous hook function (e.g. `hook_civicrm_post()`).
*
- * @code
+ * ```
* class MyTest extends \PHPUnit_Framework_TestCase implements \Civi\Test\HookInterface {
* public function hook_civicrm_post($op, $objectName, $objectId, &$objectRef) {
* echo "Running hook_civicrm_post\n";
* }
* }
- * @endCode
+ * ```
*
* At time of writing, there are a few limitations in how HookInterface is handled
* by CiviTestListener:
diff --git a/Civi/Token/Event/TokenRegisterEvent.php b/Civi/Token/Event/TokenRegisterEvent.php
index ee867b949e89..730ddb616c87 100644
--- a/Civi/Token/Event/TokenRegisterEvent.php
+++ b/Civi/Token/Event/TokenRegisterEvent.php
@@ -8,7 +8,7 @@
* The TokenRegisterEvent is fired when constructing a list of available
* tokens. Listeners may register by specifying the entity/field/label for the token.
*
- * @code
+ * ```
* $ev->entity('profile')
* ->register('viewUrl', ts('Default Profile URL (View Mode)')
* ->register('editUrl', ts('Default Profile URL (Edit Mode)');
@@ -17,7 +17,7 @@
* 'field' => 'viewUrl',
* 'label' => ts('Default Profile URL (View Mode)'),
* ));
- * @endcode
+ * ```
*
* Event name: 'civi.token.list'
*/
diff --git a/Civi/Token/Event/TokenValueEvent.php b/Civi/Token/Event/TokenValueEvent.php
index c9a251ccc752..ed7a3e2504bb 100644
--- a/Civi/Token/Event/TokenValueEvent.php
+++ b/Civi/Token/Event/TokenValueEvent.php
@@ -8,7 +8,7 @@
* A TokenValueEvent is fired to convert raw query data into mergeable
* tokens. For example:
*
- * @code
+ * ```
* $event = new TokenValueEvent($myContext, 'text/html', array(
* array('contact_id' => 123),
* array('contact_id' => 456),
diff --git a/Civi/Token/TokenRow.php b/Civi/Token/TokenRow.php
index cb38ead05b98..536b6ab23724 100644
--- a/Civi/Token/TokenRow.php
+++ b/Civi/Token/TokenRow.php
@@ -11,25 +11,25 @@
* (1) When setting up a job, you may specify general/baseline info.
* This is called the "context" data. Here, we create two rows:
*
- * @code
+ * ```
* $proc->addRow()->context('contact_id', 123);
* $proc->addRow()->context('contact_id', 456);
- * @endCode
+ * ```
*
* (2) When defining a token (eg `{profile.viewUrl}`), you might read the
* context-data (`contact_id`) and set the token-data (`profile => viewUrl`):
*
- * @code
+ * ```
* foreach ($proc->getRows() as $row) {
* $row->tokens('profile', [
* 'viewUrl' => 'http://example.com/profile?cid=' . urlencode($row->context['contact_id'];
* ]);
* }
- * @endCode
+ * ```
*
* The context and tokens can be accessed using either methods or attributes.
*
- * @code
+ * ```
* # Setting context data
* $row->context('contact_id', 123);
* $row->context(['contact_id' => 123]);
@@ -43,7 +43,7 @@
*
* # Reading token data
* echo $row->tokens['profile']['viewUrl'];
- * @endCode
+ * ```
*
* Note: The methods encourage a "fluent" style. They were written for PHP 5.3
* (eg before short-array syntax was supported) and are fairly flexible about
diff --git a/api/class.api.php b/api/class.api.php
index 3e93b97a586b..4ba61dd30bde 100644
--- a/api/class.api.php
+++ b/api/class.api.php
@@ -4,36 +4,36 @@
*
* This class allows to consume the API, either from within a module that knows civicrm already:
*
- * @code
+ * ```
* require_once('api/class.api.php');
* $api = new civicrm_api3();
- * @endcode
+ * ```
*
* or from any code on the same server as civicrm
*
- * @code
+ * ```
* require_once('/your/civi/folder/api/class.api.php');
* // the path to civicrm.settings.php
* $api = new civicrm_api3 (array('conf_path'=> '/your/path/to/your/civicrm/or/joomla/site));
- * @endcode
+ * ```
*
* or to query a remote server via the rest api
*
- * @code
+ * ```
* $api = new civicrm_api3 (array ('server' => 'http://example.org',
* 'api_key'=>'theusersecretkey',
* 'key'=>'thesitesecretkey'));
- * @endcode
+ * ```
*
* No matter how initialised and if civicrm is local or remote, you use the class the same way.
*
- * @code
+ * ```
* $api->{entity}->{action}($params);
- * @endcode
+ * ```
*
* So, to get the individual contacts:
*
- * @code
+ * ```
* if ($api->Contact->Get(array('contact_type'=>'Individual','return'=>'sort_name,current_employer')) {
* // each key of the result array is an attribute of the api
* echo "\n contacts found " . $api->count;
@@ -44,37 +44,37 @@
* } else {
* echo $api->errorMsg();
* }
- * @endcode
+ * ```
*
* Or, to create an event:
*
- * @code
+ * ```
* if ($api->Event->Create(array('title'=>'Test','event_type_id' => 1,'is_public' => 1,'start_date' => 19430429))) {
* echo "created event id:". $api->id;
* } else {
* echo $api->errorMsg();
* }
- * @endcode
+ * ```
*
* To make it easier, the Actions can either take for input an
* associative array $params, or simply an id. The following two lines
* are equivalent.
*
- * @code
+ * ```
* $api->Activity->Get (42);
* $api->Activity->Get (array('id'=>42));
- * @endcode
+ * ```
*
*
* You can also get the result like civicrm_api does, but as an object
* instead of an array (eg $entity->attribute instead of
* $entity['attribute']).
*
- * @code
+ * ```
* $result = $api->result;
* // is the json encoded result
* echo $api;
- * @endcode
+ * ```
*/
class civicrm_api3 {
diff --git a/api/v3/Attachment.php b/api/v3/Attachment.php
index 1e78d6796bba..8583f0b8c5ac 100644
--- a/api/v3/Attachment.php
+++ b/api/v3/Attachment.php
@@ -15,7 +15,7 @@
* file content.
* For core fields use "entity_table", for custom fields use "field_name"
*
- * @code
+ * ```
* // Create an attachment for a core field
* $result = civicrm_api3('Attachment', 'create', array(
* 'entity_table' => 'civicrm_activity',
@@ -26,9 +26,9 @@
* ));
* $attachment = $result['values'][$result['id']];
* echo sprintf("View %s", $attachment['url'], $attachment['name']);
- * @endcode
+ * ```
*
- * @code
+ * ```
* // Create an attachment for a custom file field
* $result = civicrm_api3('Attachment', 'create', array(
* 'field_name' => 'custom_6',
@@ -39,9 +39,9 @@
* ));
* $attachment = $result['values'][$result['id']];
* echo sprintf("View %s", $attachment['url'], $attachment['name']);
- * @endcode
+ * ```
*
- * @code
+ * ```
* // Move an existing file and save as an attachment
* $result = civicrm_api3('Attachment', 'create', array(
* 'entity_table' => 'civicrm_activity',
@@ -54,7 +54,7 @@
* ));
* $attachment = $result['values'][$result['id']];
* echo sprintf("View %s", $attachment['url'], $attachment['name']);
- * @endcode
+ * ```
*
* Notes:
* - File content is not returned by default. One must specify 'return => content'.
diff --git a/api/v3/Case.php b/api/v3/Case.php
index 1f5b9b6ae46a..5249010c45b3 100644
--- a/api/v3/Case.php
+++ b/api/v3/Case.php
@@ -21,7 +21,7 @@
*
* @param array $params
*
- * @code
+ * ```
* // REQUIRED for create:
* 'case_type_id' => int OR
* 'case_type' => str (provide one or the other)
@@ -38,7 +38,7 @@
* 'start_date' => str datestamp // defaults to: date('YmdHis')
* 'duration' => int // in minutes
* 'details' => str // html format
- * @endcode
+ * ```
*
* @throws API_Exception
* @return array
@@ -556,13 +556,13 @@ function civicrm_api3_case_update($params) {
*
* @param array $params
*
- * @code
+ * ```
* //REQUIRED:
* 'id' => int
*
* //OPTIONAL
* 'move_to_trash' => bool (defaults to false)
- * @endcode
+ * ```
*
* @throws API_Exception
* @return mixed
diff --git a/api/v3/CustomValue.php b/api/v3/CustomValue.php
index 0711224f0021..34f96a9f2daa 100644
--- a/api/v3/CustomValue.php
+++ b/api/v3/CustomValue.php
@@ -22,7 +22,7 @@
* Expected keys are in format custom_fieldID:recordID or custom_groupName:fieldName:recordID.
*
* @example:
- * @code
+ * ```
* // entity ID. You do not need to specify entity type, we figure it out based on the fields you're using
* 'entity_id' => 123,
* // (omitting :id) inserts or updates a field in a single-valued group
@@ -39,7 +39,7 @@
* 'custom_some_group:my_field' => 'myinfo',
* // updates record ID 8 in my_other_field in multi-valued some_big_group
* 'custom_some_big_group:my_other_field:8' => 'myinfo',
- * @endcode
+ * ```
*
* @throws Exception
* @return array
diff --git a/api/v3/GroupContact.php b/api/v3/GroupContact.php
index 250438378f77..ef1121ccb9f9 100644
--- a/api/v3/GroupContact.php
+++ b/api/v3/GroupContact.php
@@ -72,7 +72,7 @@ function _civicrm_api3_group_contact_create_spec(&$params) {
*
* This api has a legacy/nonstandard signature.
* On success, the return array will be structured as follows:
- * @code
+ * ```
* array(
* "is_error" => 0,
* "version" => 3,
@@ -83,16 +83,16 @@ function _civicrm_api3_group_contact_create_spec(&$params) {
* "total_count" => integer
* )
* )
- * @endcode
+ * ```
*
* On failure, the return array will be structured as follows:
- * @code
+ * ```
* array(
* 'is_error' => 1,
* 'error_message' = string,
* 'error_data' = mixed or undefined
* )
- * @endcode
+ * ```
*
* @param array $params
* Input parameters:
diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php
index af0f28dd4af0..83fff3e4185c 100644
--- a/tests/phpunit/CiviTest/CiviUnitTestCase.php
+++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php
@@ -495,14 +495,14 @@ protected function tearDown() {
* Create a batch of external API calls which can
* be executed concurrently.
*
- * @code
+ * ```
* $calls = $this->createExternalAPI()
* ->addCall('Contact', 'get', ...)
* ->addCall('Contact', 'get', ...)
* ...
* ->run()
* ->getResults();
- * @endcode
+ * ```
*
* @return \Civi\API\ExternalBatch
* @throws PHPUnit_Framework_SkippedTestError