Skip to content

Commit

Permalink
[NFC] Add in type hints to template upgrade functions
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Sep 7, 2021
1 parent dabcbaf commit 220c854
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CRM/Upgrade/Incremental/php/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CRM_Upgrade_Incremental_php_<?php echo $camelNumber; ?> extends CRM_Upgrad
* a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
* @param null $currentVer
*/
public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL): void {
// Example: Generate a pre-upgrade message.
// if ($rev == '5.12.34') {
// $preUpgradeMessage .= '<p>' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '</p>';
Expand All @@ -48,7 +48,7 @@ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NU
* @param string $rev
* an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
*/
public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
public function setPostUpgradeMessage(&$postUpgradeMessage, $rev): void {
// Example: Generate a post-upgrade message.
// if ($rev == '5.12.34') {
// $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'.");
Expand All @@ -66,15 +66,15 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
// *
// * @param string $rev
// */
// public function upgrade_5_0_x($rev) {
// public function upgrade_5_0_x($rev): void {
// $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
// $this->addTask('Do the foo change', 'taskFoo', ...);
// // Additional tasks here...
// // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
// // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
// }

// public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
// public static function taskFoo(CRM_Queue_TaskContext $ctx, ...): bool {
// return TRUE;
// }

Expand Down

0 comments on commit 220c854

Please sign in to comment.