Skip to content

Commit

Permalink
Merge pull request #25242 from braders/var-docblock-type-order
Browse files Browse the repository at this point in the history
(NFC) When using @var annotations, ensure type comes first
  • Loading branch information
demeritcowboy authored Dec 30, 2022
2 parents f5bac80 + 05935c2 commit e619bd3
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CRM/Case/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function getPermissions($getAllUnconditionally = FALSE, $descriptions = F
public function getReferenceCounts($dao) {
$result = [];
if ($dao instanceof CRM_Core_DAO_OptionValue) {
/** @var $dao CRM_Core_DAO_OptionValue */
/** @var CRM_Core_DAO_OptionValue $dao */
$activity_type_gid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'activity_type', 'id', 'name');
if ($activity_type_gid == $dao->option_group_id) {
$count = CRM_Case_XMLRepository::singleton()
Expand All @@ -127,7 +127,7 @@ public function getReferenceCounts($dao) {
}
}
elseif ($dao instanceof CRM_Contact_DAO_RelationshipType) {
/** @var $dao CRM_Contact_DAO_RelationshipType */
/** @var CRM_Contact_DAO_RelationshipType $dao */

// Need to look both directions, but no need to translate case role
// direction from XML perspective to client-based perspective
Expand Down
4 changes: 2 additions & 2 deletions CRM/Core/BAO/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,15 +763,15 @@ public static function paperIconAttachment($entityTable, $entityID) {
/**
* Get a reference to the file-search service (if one is available).
*
* @return CRM_Core_FileSearchInterface|NULL
* @return CRM_Core_FileSearchInterface|null
*/
public static function getSearchService() {
$fileSearches = [];
CRM_Utils_Hook::fileSearches($fileSearches);

// use the first available search
/** @var CRM_Core_FileSearchInterface $fileSearch */
foreach ($fileSearches as $fileSearch) {
/** @var $fileSearch CRM_Core_FileSearchInterface */
return $fileSearch;
}
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Extension/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ public function getActiveModuleUrls() {
// TODO optimization/caching
$urls = [];
$urls['civicrm'] = $this->keyToUrl('civicrm');
/** @var CRM_Core_Module $module */
foreach ($this->getModules() as $module) {
/** @var $module CRM_Core_Module */
if ($module->is_active) {
try {
$urls[$module->name] = $this->keyToUrl($module->name);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Extension/MixinLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ protected function loadMixins(CRM_Extension_BootCache $bootCache, array $liveFun
}
}

/** @var \CRM_Extension_MixInfo $ext */
foreach ($mixInfos as $ext) {
/** @var \CRM_Extension_MixInfo $ext */
foreach ($ext->mixins as $verExpr) {
$doneId = $ext->longName . '::' . $verExpr;
if (isset($this->done[$doneId])) {
Expand Down
2 changes: 1 addition & 1 deletion Civi/CCase/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public static function fireCaseChangeForRealz($caseIds) {
public static function delegateToXmlListeners(\Civi\CCase\Event\CaseChangeEvent $event) {
$p = new \CRM_Case_XMLProcessor_Process();
$listeners = $p->getListeners($event->analyzer->getCaseType());
/** @var \Civi\CCase\CaseChangeListener $listener */
foreach ($listeners as $listener) {
/** @var $listener \Civi\CCase\CaseChangeListener */
$listener->onCaseChange($event);
}
}
Expand Down
5 changes: 4 additions & 1 deletion Civi/Test/CiviEnvBuilder/SqlFileStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ public function isValid() {
return is_file($this->file) && is_readable($this->file);
}

/**
* @param \CiviEnvBuilder $ctx
* @throws \RuntimeException
*/
public function run($ctx) {
/** @var $ctx \CiviEnvBuilder */
if (\Civi\Test::execute(@file_get_contents($this->file)) === FALSE) {
throw new \RuntimeException("Cannot load {$this->file}. Aborting.");
}
Expand Down
5 changes: 4 additions & 1 deletion Civi/Test/CiviEnvBuilder/SqlStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ public function isValid() {
return TRUE;
}

/**
* @param \CiviEnvBuilder $ctx
* @throws \RuntimeException
*/
public function run($ctx) {
/** @var $ctx \CiviEnvBuilder */
if (\Civi\Test::execute($this->sql) === FALSE) {
throw new \RuntimeException("Cannot execute: {$this->sql}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ public function buildTempTable() {
}

public function fillTable() {
/** @var CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery $partialQuery */
foreach ($this->_partialQueries as $partialQuery) {
/** @var $partialQuery CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery */
if (!$this->_table || $this->_table == $partialQuery->getName()) {
if ($partialQuery->isActive()) {
$result = $partialQuery->fillTempTable($this->_text, $this->_entityIDTableName, $this->_tableName, $this->_limitClause, $this->_limitDetailClause);
Expand Down Expand Up @@ -301,8 +301,8 @@ public function buildForm(&$form) {

// also add a select box to allow the search to be constrained
$tables = ['' => ts('All tables')];
/** @var CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery $partialQuery */
foreach ($this->_partialQueries as $partialQuery) {
/** @var $partialQuery CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery */
if ($partialQuery->isActive()) {
$tables[$partialQuery->getName()] = $partialQuery->getLabel();
}
Expand Down Expand Up @@ -360,8 +360,8 @@ public function summary() {
$this->initialize();

$summary = [];
/** @var CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery $partialQuery */
foreach ($this->_partialQueries as $partialQuery) {
/** @var $partialQuery CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery */
$summary[$partialQuery->getName()] = [];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function testPostProcess(): void {
];

$contributionId = $this->createContribution();
/** @var $form CRM_Contribute_Form_Task_PDFLetter */
/** @var CRM_Contribute_Form_Task_PDFLetter $form */
$form = $this->getFormObject('CRM_Contribute_Form_Task_PDFLetter', $formValues);
$form->setContributionIds([$contributionId]);
$format = Civi::settings()->get('dateformatFull');
Expand Down Expand Up @@ -244,7 +244,7 @@ public function testNoContributionTokens(): void {
'html_message' => '{contact.display_name}',
'document_type' => 'pdf',
];
/** @var $form CRM_Contribute_Form_Task_PDFLetter */
/** @var CRM_Contribute_Form_Task_PDFLetter $form */
$form = $this->getFormObject('CRM_Contribute_Form_Task_PDFLetter', $formValues);
$form->setContributionIds([$this->createContribution()]);
try {
Expand Down Expand Up @@ -277,7 +277,7 @@ public function testAllContributionTokens(): void {
$formValues['html_message'] .= "$token : {contribution.$token}\n";
}
$formValues['html_message'] .= '{emoji.favourite_emoticon}';
/** @var $form CRM_Contribute_Form_Task_PDFLetter */
/** @var CRM_Contribute_Form_Task_PDFLetter $form */
$form = $this->getFormObject('CRM_Contribute_Form_Task_PDFLetter', $formValues);
$form->setContributionIds([$this->createContribution(array_merge(['campaign_id' => $tokens['campaign_id:label']], $tokens))]);
try {
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CiviTest/CiviCaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function setUp(): void {
$enableResult = CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
$this->assertTrue($enableResult, 'Cannot enable CiviCase in line ' . __LINE__);

/** @var $hooks \CRM_Utils_Hook_UnitTests */
/** @var \CRM_Utils_Hook_UnitTests $hooks */
$hooks = \CRM_Utils_Hook::singleton();
$hooks->setHook('civicrm_caseTypes', array($this, 'hook_caseTypes'));
\CRM_Case_XMLRepository::singleton(TRUE);
Expand Down

0 comments on commit e619bd3

Please sign in to comment.