From: Seamus Lee Date: Sat, 6 Apr 2019 05:12:54 +0000 (+1100) Subject: (NFC) Upgrade Civi Folder to the new coder version X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=34f3bbd96c35d9758ab4f702b6020e203a2febbe;p=civicrm-core.git (NFC) Upgrade Civi Folder to the new coder version --- diff --git a/Civi/API/Event/PrepareEvent.php b/Civi/API/Event/PrepareEvent.php index 7d8d7738d2..cc06e179ec 100644 --- a/Civi/API/Event/PrepareEvent.php +++ b/Civi/API/Event/PrepareEvent.php @@ -32,6 +32,7 @@ namespace Civi\API\Event; * @package Civi\API\Event */ class PrepareEvent extends Event { + /** * @param array $apiRequest * The full description of the API request. diff --git a/Civi/API/Event/ResolveEvent.php b/Civi/API/Event/ResolveEvent.php index b41da5b22b..3964186491 100644 --- a/Civi/API/Event/ResolveEvent.php +++ b/Civi/API/Event/ResolveEvent.php @@ -32,6 +32,7 @@ namespace Civi\API\Event; * @package Civi\API\Event */ class ResolveEvent extends Event { + /** * @param array $apiRequest * The full description of the API request. diff --git a/Civi/API/Exception/NotImplementedException.php b/Civi/API/Exception/NotImplementedException.php index 0c263d4f8b..b8f253f13e 100644 --- a/Civi/API/Exception/NotImplementedException.php +++ b/Civi/API/Exception/NotImplementedException.php @@ -8,6 +8,7 @@ require_once 'api/Exception.php'; * @package Civi\API\Exception */ class NotImplementedException extends \API_Exception { + /** * @param string $message * The human friendly error message. diff --git a/Civi/API/Exception/UnauthorizedException.php b/Civi/API/Exception/UnauthorizedException.php index e35cf3faa3..4e3bdbf737 100644 --- a/Civi/API/Exception/UnauthorizedException.php +++ b/Civi/API/Exception/UnauthorizedException.php @@ -8,6 +8,7 @@ require_once 'api/Exception.php'; * @package Civi\API\Exception */ class UnauthorizedException extends \API_Exception { + /** * @param string $message * The human friendly error message. diff --git a/Civi/API/ExternalBatch.php b/Civi/API/ExternalBatch.php index d2f039a854..f9ea3ae69c 100644 --- a/Civi/API/ExternalBatch.php +++ b/Civi/API/ExternalBatch.php @@ -119,7 +119,7 @@ class ExternalBatch { while (!empty($this->processes)) { usleep(self::POLL_INTERVAL); foreach (array_keys($this->processes) as $idx) { - /** @var Process $process */ + /** @var \Symfony\Component\Process\Process $process */ $process = $this->processes[$idx]; if (!$process->isRunning()) { $parsed = json_decode($process->getOutput(), TRUE); @@ -179,7 +179,7 @@ class ExternalBatch { /** * @param array $apiCall * Array with keys: entity, action, params. - * @return Process + * @return \Symfony\Component\Process\Process * @throws \CRM_Core_Exception */ public function createProcess($apiCall) { diff --git a/Civi/API/Kernel.php b/Civi/API/Kernel.php index 96167a8e8e..cc0cc3805f 100644 --- a/Civi/API/Kernel.php +++ b/Civi/API/Kernel.php @@ -31,7 +31,6 @@ use Civi\API\Event\PrepareEvent; use Civi\API\Event\ExceptionEvent; use Civi\API\Event\ResolveEvent; use Civi\API\Event\RespondEvent; -use Civi\API\Provider\ProviderInterface; /** * @package Civi @@ -217,7 +216,7 @@ class Kernel { * Array(0 => ProviderInterface, 1 => array $apiRequest). */ public function resolve($apiRequest) { - /** @var ResolveEvent $resolveEvent */ + /** @var \Civi\API\Event\ResolveEvent $resolveEvent */ $resolveEvent = $this->dispatcher->dispatch(Events::RESOLVE, new ResolveEvent($apiRequest, $this)); $apiRequest = $resolveEvent->getApiRequest(); if (!$resolveEvent->getApiProvider()) { @@ -229,14 +228,14 @@ class Kernel { /** * Determine if the API request is allowed (under current policy) * - * @param ProviderInterface $apiProvider + * @param \Civi\API\Provider\ProviderInterface $apiProvider * The API provider responsible for executing the request. * @param array $apiRequest * The full description of the API request. * @throws Exception\UnauthorizedException */ public function authorize($apiProvider, $apiRequest) { - /** @var AuthorizeEvent $event */ + /** @var \Civi\API\Event\AuthorizeEvent $event */ $event = $this->dispatcher->dispatch(Events::AUTHORIZE, new AuthorizeEvent($apiProvider, $apiRequest, $this)); if (!$event->isAuthorized()) { throw new \Civi\API\Exception\UnauthorizedException("Authorization failed"); @@ -246,7 +245,7 @@ class Kernel { /** * Allow third-party code to manipulate the API request before execution. * - * @param ProviderInterface $apiProvider + * @param \Civi\API\Provider\ProviderInterface $apiProvider * The API provider responsible for executing the request. * @param array $apiRequest * The full description of the API request. @@ -254,7 +253,7 @@ class Kernel { * The revised API request. */ public function prepare($apiProvider, $apiRequest) { - /** @var PrepareEvent $event */ + /** @var \Civi\API\Event\PrepareEvent $event */ $event = $this->dispatcher->dispatch(Events::PREPARE, new PrepareEvent($apiProvider, $apiRequest, $this)); return $event->getApiRequest(); } @@ -262,7 +261,7 @@ class Kernel { /** * Allow third-party code to manipulate the API response after execution. * - * @param ProviderInterface $apiProvider + * @param \Civi\API\Provider\ProviderInterface $apiProvider * The API provider responsible for executing the request. * @param array $apiRequest * The full description of the API request. @@ -272,7 +271,7 @@ class Kernel { * The revised $result. */ public function respond($apiProvider, $apiRequest, $result) { - /** @var RespondEvent $event */ + /** @var \Civi\API\Event\RespondEvent $event */ $event = $this->dispatcher->dispatch(Events::RESPOND, new RespondEvent($apiProvider, $apiRequest, $result, $this)); return $event->getResponse(); } @@ -287,7 +286,7 @@ class Kernel { // Question: Would it better to eliminate $this->apiProviders and just use $this->dispatcher? $entityNames = []; foreach ($this->getApiProviders() as $provider) { - /** @var ProviderInterface $provider */ + /** @var \Civi\API\Provider\ProviderInterface $provider */ $entityNames = array_merge($entityNames, $provider->getEntityNames($version)); } $entityNames = array_unique($entityNames); @@ -307,7 +306,7 @@ class Kernel { // Question: Would it better to eliminate $this->apiProviders and just use $this->dispatcher? $actionNames = []; foreach ($this->getApiProviders() as $provider) { - /** @var ProviderInterface $provider */ + /** @var \Civi\API\Provider\ProviderInterface $provider */ $actionNames = array_merge($actionNames, $provider->getActionNames($version, $entity)); } $actionNames = array_unique($actionNames); @@ -345,7 +344,8 @@ class Kernel { $data['action'] = \CRM_Utils_Array::value('action', $apiRequest); if (\CRM_Utils_Array::value('debug', \CRM_Utils_Array::value('params', $apiRequest)) - && empty($data['trace']) // prevent recursion + // prevent recursion + && empty($data['trace']) ) { $data['trace'] = $e->getTraceAsString(); } @@ -459,7 +459,7 @@ class Kernel { } /** - * @param ProviderInterface $apiProvider + * @param \Civi\API\Provider\ProviderInterface $apiProvider * The API provider responsible for executing the request. * @return Kernel */ diff --git a/Civi/API/Provider/MagicFunctionProvider.php b/Civi/API/Provider/MagicFunctionProvider.php index 27324e452e..346b470359 100644 --- a/Civi/API/Provider/MagicFunctionProvider.php +++ b/Civi/API/Provider/MagicFunctionProvider.php @@ -35,6 +35,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * conventions. */ class MagicFunctionProvider implements EventSubscriberInterface, ProviderInterface { + /** * @return array */ @@ -285,7 +286,8 @@ class MagicFunctionProvider implements EventSubscriberInterface, ProviderInterfa } // Check for standalone action files; to match _civicrm_api_resolve(), only load the first one - $loaded_files = []; // array($relativeFilePath => TRUE) + // array($relativeFilePath => TRUE) + $loaded_files = []; $include_dirs = array_unique(explode(PATH_SEPARATOR, get_include_path())); foreach ($include_dirs as $include_dir) { foreach ([$camelName, 'Generic'] as $name) { @@ -299,7 +301,8 @@ class MagicFunctionProvider implements EventSubscriberInterface, ProviderInterfa foreach ($iterator as $fileinfo) { $file = $fileinfo->getFilename(); if (array_key_exists($file, $loaded_files)) { - continue; // action provided by an earlier item on include_path + // action provided by an earlier item on include_path + continue; } $parts = explode(".", $file); diff --git a/Civi/API/Provider/ProviderInterface.php b/Civi/API/Provider/ProviderInterface.php index c002eeec01..4fbc8b7e31 100644 --- a/Civi/API/Provider/ProviderInterface.php +++ b/Civi/API/Provider/ProviderInterface.php @@ -27,13 +27,11 @@ namespace Civi\API\Provider; -use Civi\API\Events; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - /** * An API "provider" provides a means to execute API requests. */ interface ProviderInterface { + /** * @param array $apiRequest * The full description of the API request. diff --git a/Civi/API/Provider/ReflectionProvider.php b/Civi/API/Provider/ReflectionProvider.php index 48a680d29f..e3c74e5183 100644 --- a/Civi/API/Provider/ReflectionProvider.php +++ b/Civi/API/Provider/ReflectionProvider.php @@ -34,6 +34,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * This class defines operations for inspecting the API's metadata. */ class ReflectionProvider implements EventSubscriberInterface, ProviderInterface { + /** * @return array */ @@ -68,7 +69,8 @@ class ReflectionProvider implements EventSubscriberInterface, ProviderInterface $this->apiKernel = $apiKernel; $this->actions = [ 'Entity' => ['get', 'getactions'], - '*' => ['getactions'], // 'getfields' + // 'getfields' + '*' => ['getactions'], ]; } diff --git a/Civi/API/Provider/StaticProvider.php b/Civi/API/Provider/StaticProvider.php index f4e2701e05..0a10aee85a 100644 --- a/Civi/API/Provider/StaticProvider.php +++ b/Civi/API/Provider/StaticProvider.php @@ -102,7 +102,7 @@ class StaticProvider extends AdhocProvider { * @param array $apiRequest * The full description of the API request. * @return array - * Formatted API result + * Formatted API result * @throws \API_Exception */ public function doCreate($apiRequest) { @@ -131,7 +131,7 @@ class StaticProvider extends AdhocProvider { * @param array $apiRequest * The full description of the API request. * @return array - * Formatted API result + * Formatted API result * @throws \API_Exception */ public function doGet($apiRequest) { @@ -142,7 +142,7 @@ class StaticProvider extends AdhocProvider { * @param array $apiRequest * The full description of the API request. * @return array - * Formatted API result + * Formatted API result * @throws \API_Exception */ public function doDelete($apiRequest) { diff --git a/Civi/API/SelectQuery.php b/Civi/API/SelectQuery.php index 9a03d7eb39..f7b61cd891 100644 --- a/Civi/API/SelectQuery.php +++ b/Civi/API/SelectQuery.php @@ -25,6 +25,7 @@ +--------------------------------------------------------------------+ */ namespace Civi\API; + use Civi\API\Exception\UnauthorizedException; /** diff --git a/Civi/API/Subscriber/APIv3SchemaAdapter.php b/Civi/API/Subscriber/APIv3SchemaAdapter.php index af77d3b7ea..e6428711eb 100644 --- a/Civi/API/Subscriber/APIv3SchemaAdapter.php +++ b/Civi/API/Subscriber/APIv3SchemaAdapter.php @@ -35,6 +35,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * and validates that the fields are provided correctly. */ class APIv3SchemaAdapter implements EventSubscriberInterface { + /** * @return array */ diff --git a/Civi/API/Subscriber/ChainSubscriber.php b/Civi/API/Subscriber/ChainSubscriber.php index 5fb27c1ed6..84b55753a0 100644 --- a/Civi/API/Subscriber/ChainSubscriber.php +++ b/Civi/API/Subscriber/ChainSubscriber.php @@ -50,6 +50,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * eg Amy's contact_id). */ class ChainSubscriber implements EventSubscriberInterface { + /** * @return array */ diff --git a/Civi/API/Subscriber/DynamicFKAuthorization.php b/Civi/API/Subscriber/DynamicFKAuthorization.php index 03ba52d0b4..647172cedd 100644 --- a/Civi/API/Subscriber/DynamicFKAuthorization.php +++ b/Civi/API/Subscriber/DynamicFKAuthorization.php @@ -227,7 +227,8 @@ class DynamicFKAuthorization implements EventSubscriberInterface { $exception = NULL; $self = $this; \CRM_Core_Transaction::create(TRUE)->run(function($tx) use ($entity, $action, $entityId, &$exception, $self) { - $tx->rollback(); // Just to be safe. + // Just to be safe. + $tx->rollback(); $params = [ 'version' => 3, diff --git a/Civi/API/Subscriber/I18nSubscriber.php b/Civi/API/Subscriber/I18nSubscriber.php index 632064f3cf..c430928202 100644 --- a/Civi/API/Subscriber/I18nSubscriber.php +++ b/Civi/API/Subscriber/I18nSubscriber.php @@ -35,6 +35,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * @package Civi\API\Subscriber */ class I18nSubscriber implements EventSubscriberInterface { + /** * @return array */ diff --git a/Civi/API/Subscriber/PermissionCheck.php b/Civi/API/Subscriber/PermissionCheck.php index 0a8248ef57..c4fe5c7481 100644 --- a/Civi/API/Subscriber/PermissionCheck.php +++ b/Civi/API/Subscriber/PermissionCheck.php @@ -36,6 +36,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * Civi\API\Annotation\Permission. */ class PermissionCheck implements EventSubscriberInterface { + /** * @return array */ diff --git a/Civi/API/Subscriber/TransactionSubscriber.php b/Civi/API/Subscriber/TransactionSubscriber.php index 8b110ab70c..4f7b0c64d8 100644 --- a/Civi/API/Subscriber/TransactionSubscriber.php +++ b/Civi/API/Subscriber/TransactionSubscriber.php @@ -44,6 +44,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * @package Civi\API\Subscriber */ class TransactionSubscriber implements EventSubscriberInterface { + /** * @return array */ diff --git a/Civi/API/Subscriber/WhitelistSubscriber.php b/Civi/API/Subscriber/WhitelistSubscriber.php index 3c69c04af1..fbb272d395 100644 --- a/Civi/API/Subscriber/WhitelistSubscriber.php +++ b/Civi/API/Subscriber/WhitelistSubscriber.php @@ -29,7 +29,6 @@ namespace Civi\API\Subscriber; use Civi\API\Events; use Civi\API\Event\AuthorizeEvent; use Civi\API\Event\RespondEvent; -use Civi\API\WhitelistRule; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -75,7 +74,7 @@ class WhitelistSubscriber implements EventSubscriberInterface { public function __construct($rules) { $this->rules = []; foreach ($rules as $rule) { - /** @var WhitelistRule $rule */ + /** @var \Civi\API\WhitelistRule $rule */ if ($rule->isValid()) { $this->rules[] = $rule; } @@ -89,7 +88,7 @@ class WhitelistSubscriber implements EventSubscriberInterface { * Determine which, if any, whitelist rules apply this request. * Reject unauthorized requests. * - * @param AuthorizeEvent $event + * @param \Civi\API\Event\AuthorizeEvent $event * @throws \CRM_Core_Exception */ public function onApiAuthorize(AuthorizeEvent $event) { @@ -108,7 +107,7 @@ class WhitelistSubscriber implements EventSubscriberInterface { /** * Apply any filtering rules based on the chosen whitelist rule. - * @param RespondEvent $event + * @param \Civi\API\Event\RespondEvent $event */ public function onApiRespond(RespondEvent $event) { $apiRequest = $event->getApiRequest(); diff --git a/Civi/API/Subscriber/XDebugSubscriber.php b/Civi/API/Subscriber/XDebugSubscriber.php index 294ed9fd23..0648cf50b7 100644 --- a/Civi/API/Subscriber/XDebugSubscriber.php +++ b/Civi/API/Subscriber/XDebugSubscriber.php @@ -35,6 +35,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * @package Civi\API\Subscriber */ class XDebugSubscriber implements EventSubscriberInterface { + /** * @return array */ diff --git a/Civi/API/WhitelistRule.php b/Civi/API/WhitelistRule.php index 50d5b3e232..0cc9ef0129 100644 --- a/Civi/API/WhitelistRule.php +++ b/Civi/API/WhitelistRule.php @@ -48,7 +48,7 @@ namespace Civi\API; */ class WhitelistRule { - static $IGNORE_FIELDS = [ + public static $IGNORE_FIELDS = [ 'check_permissions', 'debug', 'offset', diff --git a/Civi/ActionSchedule/Event/MailingQueryEvent.php b/Civi/ActionSchedule/Event/MailingQueryEvent.php index 472c1c3bcd..e8b136e84d 100644 --- a/Civi/ActionSchedule/Event/MailingQueryEvent.php +++ b/Civi/ActionSchedule/Event/MailingQueryEvent.php @@ -1,7 +1,6 @@ res = $res; diff --git a/Civi/CCase/CaseChangeListener.php b/Civi/CCase/CaseChangeListener.php index 65f115b6e9..b473a090e0 100644 --- a/Civi/CCase/CaseChangeListener.php +++ b/Civi/CCase/CaseChangeListener.php @@ -32,6 +32,7 @@ namespace Civi\CCase; * @package Civi\CCase */ interface CaseChangeListener { + /** * @param \Civi\CCase\Event\CaseChangeEvent $event * diff --git a/Civi/CCase/Event/CaseChangeEvent.php b/Civi/CCase/Event/CaseChangeEvent.php index e091ac4ba7..a873b519f9 100644 --- a/Civi/CCase/Event/CaseChangeEvent.php +++ b/Civi/CCase/Event/CaseChangeEvent.php @@ -26,6 +26,7 @@ */ namespace Civi\CCase\Event; + use Civi\Core\Event\GenericHookEvent; /** diff --git a/Civi/CCase/Events.php b/Civi/CCase/Events.php index 278590dfa9..a3890248f2 100644 --- a/Civi/CCase/Events.php +++ b/Civi/CCase/Events.php @@ -37,7 +37,7 @@ class Events { * * We do not want to fire case-change events recursively. */ - static $isActive = []; + public static $isActive = []; /** * Following a change to an activity or case, fire the case-change event. diff --git a/Civi/CiUtil/Arrays.php b/Civi/CiUtil/Arrays.php index 48b6c226d4..e3933ee126 100644 --- a/Civi/CiUtil/Arrays.php +++ b/Civi/CiUtil/Arrays.php @@ -7,6 +7,7 @@ namespace Civi\CiUtil; * @package Civi\CiUtil */ class Arrays { + /** * @param $arr * @param $col diff --git a/Civi/CiUtil/Command/AntagonistCommand.php b/Civi/CiUtil/Command/AntagonistCommand.php index 4f7e479116..d8d9761ffe 100644 --- a/Civi/CiUtil/Command/AntagonistCommand.php +++ b/Civi/CiUtil/Command/AntagonistCommand.php @@ -7,6 +7,7 @@ namespace Civi\CiUtil\Command; * @package Civi\CiUtil\Command */ class AntagonistCommand { + /** * @param $argv */ diff --git a/Civi/CiUtil/Command/CompareCommand.php b/Civi/CiUtil/Command/CompareCommand.php index 84b7064239..beae7ac779 100644 --- a/Civi/CiUtil/Command/CompareCommand.php +++ b/Civi/CiUtil/Command/CompareCommand.php @@ -7,6 +7,7 @@ namespace Civi\CiUtil\Command; * @package Civi\CiUtil\Command */ class CompareCommand { + /** * @param $argv */ @@ -19,7 +20,8 @@ class CompareCommand { $parser = ['\Civi\CiUtil\PHPUnitParser', 'parseJsonResults']; $printerType = 'txt'; - $suites = []; // array('file' => string, 'results' => array) + // array('file' => string, 'results' => array) + $suites = []; for ($i = 1; $i < count($argv); $i++) { switch ($argv[$i]) { case '--phpunit-json': @@ -50,7 +52,8 @@ class CompareCommand { } } - $tests = []; // array(string $name) + // array(string $name) + $tests = []; foreach ($suites as $suite) { $tests = array_unique(array_merge( $tests, diff --git a/Civi/CiUtil/Command/LsCommand.php b/Civi/CiUtil/Command/LsCommand.php index 88f0d84947..f0db547cf5 100644 --- a/Civi/CiUtil/Command/LsCommand.php +++ b/Civi/CiUtil/Command/LsCommand.php @@ -7,6 +7,7 @@ namespace Civi\CiUtil\Command; * @package Civi\CiUtil\Command */ class LsCommand { + /** * @param $argv */ diff --git a/Civi/CiUtil/ComparisonPrinter.php b/Civi/CiUtil/ComparisonPrinter.php index a58a83eb67..27acd8908c 100644 --- a/Civi/CiUtil/ComparisonPrinter.php +++ b/Civi/CiUtil/ComparisonPrinter.php @@ -7,8 +7,8 @@ namespace Civi\CiUtil; * @package Civi\CiUtil */ class ComparisonPrinter { - var $headers; - var $hasHeader = FALSE; + public $headers; + public $hasHeader = FALSE; /** * @param $headers diff --git a/Civi/CiUtil/CsvPrinter.php b/Civi/CiUtil/CsvPrinter.php index 4c4ec185a3..55c7dbba43 100644 --- a/Civi/CiUtil/CsvPrinter.php +++ b/Civi/CiUtil/CsvPrinter.php @@ -7,9 +7,9 @@ namespace Civi\CiUtil; * @package Civi\CiUtil */ class CsvPrinter { - var $file; - var $headers; - var $hasHeader = FALSE; + public $file; + public $headers; + public $hasHeader = FALSE; /** * @param $file diff --git a/Civi/CiUtil/JenkinsParser.php b/Civi/CiUtil/JenkinsParser.php index 616219ced2..4a14298768 100644 --- a/Civi/CiUtil/JenkinsParser.php +++ b/Civi/CiUtil/JenkinsParser.php @@ -5,6 +5,7 @@ namespace Civi\CiUtil; * Parse Jenkins result files */ class JenkinsParser { + /** * @param string $content * Xml data. diff --git a/Civi/CiUtil/PHPUnitParser.php b/Civi/CiUtil/PHPUnitParser.php index e956388adf..9ff2b7d572 100644 --- a/Civi/CiUtil/PHPUnitParser.php +++ b/Civi/CiUtil/PHPUnitParser.php @@ -5,6 +5,7 @@ namespace Civi\CiUtil; * Parse phpunit result files */ class PHPUnitParser { + /** * @param string $content * Phpunit streaming JSON. diff --git a/Civi/CiUtil/PHPUnitScanner.php b/Civi/CiUtil/PHPUnitScanner.php index 8264e9e266..a1028f52f5 100644 --- a/Civi/CiUtil/PHPUnitScanner.php +++ b/Civi/CiUtil/PHPUnitScanner.php @@ -7,6 +7,7 @@ use Symfony\Component\Finder\Finder; * Search for PHPUnit test cases */ class PHPUnitScanner { + /** * @param $path * @return array class names diff --git a/Civi/Core/AssetBuilder.php b/Civi/Core/AssetBuilder.php index 595a53ce40..b60f41e20b 100644 --- a/Civi/Core/AssetBuilder.php +++ b/Civi/Core/AssetBuilder.php @@ -84,6 +84,9 @@ class AssetBuilder { ]; } + /** + * @var mixed + */ protected $cacheEnabled; /** @@ -238,8 +241,7 @@ class AssetBuilder { protected function getCachePath($fileName = NULL) { // imageUploadDir has the correct functional properties but a wonky name. $suffix = ($fileName === NULL) ? '' : (DIRECTORY_SEPARATOR . $fileName); - return - \CRM_Utils_File::addTrailingSlash(\CRM_Core_Config::singleton()->imageUploadDir) + return \CRM_Utils_File::addTrailingSlash(\CRM_Core_Config::singleton()->imageUploadDir) . 'dyn' . $suffix; } @@ -255,8 +257,7 @@ class AssetBuilder { protected function getCacheUrl($fileName = NULL) { // imageUploadURL has the correct functional properties but a wonky name. $suffix = ($fileName === NULL) ? '' : ('/' . $fileName); - return - \CRM_Utils_File::addTrailingSlash(\CRM_Core_Config::singleton()->imageUploadURL, '/') + return \CRM_Utils_File::addTrailingSlash(\CRM_Core_Config::singleton()->imageUploadURL, '/') . 'dyn' . $suffix; } diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 2763d763d7..4e01f4a9db 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -1,23 +1,13 @@ SettingsBag $bag). */ - protected $bagsByDomain = [], $bagsByContact = []; + protected $bagsByDomain = []; + + + /** + * @var array + * Array (int $id => SettingsBag $bag). + */ + protected $bagsByContact = []; /** * @var array|NULL @@ -310,7 +317,8 @@ class SettingsManager { $this->mandatory = NULL; $this->cache->flush(); - \Civi::cache('settings')->flush(); // SettingsMetadata; not guaranteed to use same cache. + // SettingsMetadata; not guaranteed to use same cache. + \Civi::cache('settings')->flush(); foreach ($this->bagsByDomain as $bag) { /** @var SettingsBag $bag */ diff --git a/Civi/Core/SqlTrigger/StaticTriggers.php b/Civi/Core/SqlTrigger/StaticTriggers.php index e97213967f..c0f6f981b7 100644 --- a/Civi/Core/SqlTrigger/StaticTriggers.php +++ b/Civi/Core/SqlTrigger/StaticTriggers.php @@ -56,7 +56,6 @@ class StaticTriggers { $this->triggers = $triggers; } - /** * Add our list of triggers to the global list. * diff --git a/Civi/Core/SqlTrigger/TimestampTriggers.php b/Civi/Core/SqlTrigger/TimestampTriggers.php index 235ce70b60..c2249cf07d 100644 --- a/Civi/Core/SqlTrigger/TimestampTriggers.php +++ b/Civi/Core/SqlTrigger/TimestampTriggers.php @@ -28,8 +28,6 @@ namespace Civi\Core\SqlTrigger; -use Civi\Core\Event\GenericHookEvent; - /** * Build a set of SQL triggers for tracking timestamps on an entity. * diff --git a/Civi/Core/SqlTriggers.php b/Civi/Core/SqlTriggers.php index 172e7d0e79..ce54d18448 100644 --- a/Civi/Core/SqlTriggers.php +++ b/Civi/Core/SqlTriggers.php @@ -207,8 +207,8 @@ class SqlTriggers { if (!file_exists($this->getFile())) { // Ugh. Need to let user know somehow. This is the first change. \CRM_Core_Session::setStatus(ts('The mysql commands you need to run are stored in %1', [ - 1 => $this->getFile(), - ]), + 1 => $this->getFile(), + ]), '', 'alert', ['expires' => 0] diff --git a/Civi/Install/Requirements.php b/Civi/Install/Requirements.php index e4423e8f51..7d8fd3821c 100644 --- a/Civi/Install/Requirements.php +++ b/Civi/Install/Requirements.php @@ -23,6 +23,9 @@ class Requirements { */ const REQUIREMENT_ERROR = 2; + /** + * @var array + */ protected $system_checks = [ 'checkMemory', 'checkServerVariables', @@ -106,7 +109,7 @@ class Requirements { /** * Generates a mysql connection * - * @param $db_confic array + * @param $db_config array * @return object mysqli connection */ protected function connect($db_config) { @@ -488,7 +491,8 @@ class Requirements { return $results; } - $r = mysqli_query($conn, "SHOW VARIABLES LIKE 'thread_stack'"); // bytes => kb + // bytes => kb + $r = mysqli_query($conn, "SHOW VARIABLES LIKE 'thread_stack'"); if (!$r) { $results['severity'] = $this::REQUIREMENT_ERROR; $results['details'] = 'Could not query thread_stack value'; diff --git a/Civi/Test.php b/Civi/Test.php index 8e44fcd509..51d929054d 100644 --- a/Civi/Test.php +++ b/Civi/Test.php @@ -45,7 +45,7 @@ class Test { /** * Get a connection to the test database. * - * @return PDO + * @return \PDO */ public static function pdo() { if (!isset(self::$singletons['pdo'])) { @@ -127,7 +127,6 @@ class Test { return self::$singletons['schema']; } - /** * @return \Civi\Test\Data */ diff --git a/Civi/Test/Api3TestTrait.php b/Civi/Test/Api3TestTrait.php index 4b85837021..5386e93969 100644 --- a/Civi/Test/Api3TestTrait.php +++ b/Civi/Test/Api3TestTrait.php @@ -16,6 +16,7 @@ trait Api3TestTrait { /** * Api version - easier to override than just a define + * @var int */ protected $_apiversion = 3; @@ -206,7 +207,7 @@ trait Api3TestTrait { throw new \Exception( 'Invalid getsingle result' . print_r($result, TRUE) . "\n entity: $entity . \n params \n " . print_r($params, TRUE) - . "\n entities retrieved with blank params \n" . print_r($unfilteredResult, TRUE) + . "\n entities retrieved with blank params \n" . print_r($unfilteredResult, TRUE) ); } if ($checkAgainst) { diff --git a/Civi/Test/CiviEnvBuilder/CallbackStep.php b/Civi/Test/CiviEnvBuilder/CallbackStep.php index 6d0c9f055c..8e6110bee3 100644 --- a/Civi/Test/CiviEnvBuilder/CallbackStep.php +++ b/Civi/Test/CiviEnvBuilder/CallbackStep.php @@ -1,5 +1,6 @@ file = $file; } - public function getSig() { return implode(' ', [ $this->file, diff --git a/Civi/Test/CiviEnvBuilder/SqlStep.php b/Civi/Test/CiviEnvBuilder/SqlStep.php index 7a2736b019..e892883e03 100644 --- a/Civi/Test/CiviEnvBuilder/SqlStep.php +++ b/Civi/Test/CiviEnvBuilder/SqlStep.php @@ -1,5 +1,6 @@ sql = $sql; } - public function getSig() { return md5($this->sql); } diff --git a/Civi/Test/CiviEnvBuilder/StepInterface.php b/Civi/Test/CiviEnvBuilder/StepInterface.php index 3d6dc95cc1..8ed2c2ce77 100644 --- a/Civi/Test/CiviEnvBuilder/StepInterface.php +++ b/Civi/Test/CiviEnvBuilder/StepInterface.php @@ -2,6 +2,7 @@ namespace Civi\Test\CiviEnvBuilder; interface StepInterface { + public function getSig(); public function isValid(); diff --git a/Civi/Test/CiviTestListener.php b/Civi/Test/CiviTestListener.php index 8eca8cbf75..255eb8628f 100644 --- a/Civi/Test/CiviTestListener.php +++ b/Civi/Test/CiviTestListener.php @@ -98,7 +98,8 @@ class CiviTestListener extends \PHPUnit_Framework_BaseTestListener { \CRM_Utils_System::flushCache(); \Civi::reset(); \CRM_Core_Session::singleton()->set('userID', NULL); - $config = \CRM_Core_Config::singleton(TRUE, TRUE); // ugh, performance + // ugh, performance + $config = \CRM_Core_Config::singleton(TRUE, TRUE); if (property_exists($config->userPermissionClass, 'permissions')) { $config->userPermissionClass->permissions = NULL; diff --git a/Civi/Token/AbstractTokenSubscriber.php b/Civi/Token/AbstractTokenSubscriber.php index 38d2875ce3..012d306930 100644 --- a/Civi/Token/AbstractTokenSubscriber.php +++ b/Civi/Token/AbstractTokenSubscriber.php @@ -110,7 +110,7 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface { /** * Register the declared tokens. * - * @param TokenRegisterEvent $e + * @param \Civi\Token\Event\TokenRegisterEvent $e * The registration event. Add new tokens using register(). */ public function registerTokens(TokenRegisterEvent $e) { @@ -133,7 +133,7 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface { * This is method is not always appropriate, but if you're specifically * focused on scheduled reminders, it can be convenient. * - * @param MailingQueryEvent $e + * @param \Civi\ActionSchedule\Event\MailingQueryEvent $e * The pending query which may be modified. See discussion on * MailingQueryEvent::$query. */ @@ -143,7 +143,7 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface { /** * Populate the token data. * - * @param TokenValueEvent $e + * @param \Civi\Token\Event\TokenValueEvent $e * The event, which includes a list of rows and tokens. */ public function evaluateTokens(TokenValueEvent $e) { @@ -204,6 +204,6 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface { * Any data that was returned by the prefetch(). * @return mixed */ - public abstract function evaluateToken(TokenRow $row, $entity, $field, $prefetch = NULL); + abstract public function evaluateToken(TokenRow $row, $entity, $field, $prefetch = NULL); } diff --git a/Civi/Token/TokenCompatSubscriber.php b/Civi/Token/TokenCompatSubscriber.php index 2e8721e676..672080d29b 100644 --- a/Civi/Token/TokenCompatSubscriber.php +++ b/Civi/Token/TokenCompatSubscriber.php @@ -33,7 +33,7 @@ class TokenCompatSubscriber implements EventSubscriberInterface { /** * Load token data. * - * @param TokenValueEvent $e + * @param \Civi\Token\Event\TokenValueEvent $e * @throws TokenException */ public function onEvaluate(TokenValueEvent $e) { @@ -59,7 +59,8 @@ class TokenCompatSubscriber implements EventSubscriberInterface { ['contact_id', '=', $contactId, 0, 0], ]; list($contact, $_) = \CRM_Contact_BAO_Query::apiQuery($params); - $contact = reset($contact); //CRM-4524 + //CRM-4524 + $contact = reset($contact); if (!$contact || is_a($contact, 'CRM_Core_Error')) { // FIXME: Need to differentiate errors which kill the batch vs the individual row. throw new TokenException("Failed to generate token data. Invalid contact ID: " . $row->context['contactId']); @@ -109,7 +110,7 @@ class TokenCompatSubscriber implements EventSubscriberInterface { /** * Apply the various CRM_Utils_Token helpers. * - * @param TokenRenderEvent $e + * @param \Civi\Token\Event\TokenRenderEvent $e */ public function onRender(TokenRenderEvent $e) { $isHtml = ($e->message['format'] == 'text/html'); diff --git a/Civi/Token/TokenProcessor.php b/Civi/Token/TokenProcessor.php index c989773435..1364ed714f 100644 --- a/Civi/Token/TokenProcessor.php +++ b/Civi/Token/TokenProcessor.php @@ -4,7 +4,6 @@ namespace Civi\Token; use Civi\Token\Event\TokenRegisterEvent; use Civi\Token\Event\TokenRenderEvent; use Civi\Token\Event\TokenValueEvent; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Traversable; class TokenProcessor { @@ -33,7 +32,7 @@ class TokenProcessor { public $context; /** - * @var EventDispatcherInterface + * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ protected $dispatcher; @@ -82,7 +81,7 @@ class TokenProcessor { protected $next = 0; /** - * @param EventDispatcherInterface $dispatcher + * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher * @param array $context */ public function __construct($dispatcher, $context) { @@ -188,6 +187,7 @@ class TokenProcessor { * * @param string $field * Ex: 'contactId'. + * @param $subfield * @return array * Ex: [12, 34, 56]. */ @@ -278,7 +278,9 @@ class TokenProcessor { $row->fill($message['format']); $useSmarty = !empty($row->context['smarty']); - // FIXME preg_callback. + /** + *@FIXME preg_callback. + */ $tokens = $this->rowValues[$row->tokenRow][$message['format']]; $flatTokens = []; \CRM_Utils_Array::flatten($tokens, $flatTokens, '', '.'); @@ -304,10 +306,11 @@ class TokenRowIterator extends \IteratorIterator { /** * @param TokenProcessor $tokenProcessor - * @param Traversable $iterator + * @param \Traversable $iterator */ public function __construct(TokenProcessor $tokenProcessor, Traversable $iterator) { - parent::__construct($iterator); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub + parent::__construct($iterator); $this->tokenProcessor = $tokenProcessor; } diff --git a/Civi/Token/TokenRow.php b/Civi/Token/TokenRow.php index a57a37b5d0..5287219a94 100644 --- a/Civi/Token/TokenRow.php +++ b/Civi/Token/TokenRow.php @@ -65,7 +65,8 @@ class TokenRow { public function __construct(TokenProcessor $tokenProcessor, $key) { $this->tokenProcessor = $tokenProcessor; $this->tokenRow = $key; - $this->format('text/plain'); // Set a default. + // Set a default. + $this->format('text/plain'); $this->context = new TokenRowContext($tokenProcessor, $key); } @@ -138,7 +139,7 @@ class TokenRow { $customFieldName = "custom_" . $customFieldID; $record = civicrm_api3($entity, "getSingle", [ 'return' => $customFieldName, - 'id' => $entityID, + 'id' => $entityID, ]); $fieldValue = \CRM_Utils_Array::value($customFieldName, $record, ''); @@ -305,8 +306,7 @@ class TokenRowContext implements \ArrayAccess, \IteratorAggregate, \Countable { * @return bool */ public function offsetExists($offset) { - return - isset($this->tokenProcessor->rowContexts[$this->tokenRow][$offset]) + return isset($this->tokenProcessor->rowContexts[$this->tokenRow][$offset]) || isset($this->tokenProcessor->context[$offset]); }