From 689cde90a16de7900bd7bd90211f848e1cb2f353 Mon Sep 17 00:00:00 2001 From: Thomas Kuschel Date: Wed, 11 Sep 2024 20:58:49 +0200 Subject: [PATCH] [5.2] sprintf as compiler optimized function (#44037) --- .../src/Helper/ActionlogsHelper.php | 2 +- .../src/Model/ActionlogModel.php | 2 +- administrator/components/com_admin/script.php | 6 +-- .../com_fields/src/Model/FieldModel.php | 2 +- .../com_finder/src/Indexer/Indexer.php | 4 +- .../com_finder/src/Indexer/Query.php | 2 +- .../components/com_joomlaupdate/extract.php | 32 ++++++------- .../com_joomlaupdate/finalisation.php | 4 +- .../src/Model/UpdateModel.php | 6 +-- .../com_menus/src/Field/Modal/MenuField.php | 4 +- .../com_newsfeeds/src/Model/NewsfeedModel.php | 2 +- .../com_scheduler/src/Model/TaskModel.php | 4 +- .../com_scheduler/src/Model/TasksModel.php | 2 +- .../com_scheduler/src/Task/Task.php | 2 +- .../com_scheduler/src/Task/TaskOption.php | 2 +- .../src/Traits/TaskPluginTrait.php | 6 +-- .../src/DataShape/DataShapeObject.php | 10 ++-- .../com_users/src/Model/BackupcodesModel.php | 2 +- .../com_users/src/Model/MethodModel.php | 2 +- .../com_users/src/Model/MethodsModel.php | 2 +- .../com_users/src/Model/UserModel.php | 14 +++--- .../com_users/src/View/Method/HtmlView.php | 2 +- api/index.php | 2 +- build/helpTOC.php | 22 ++++----- .../com_users/src/Model/ProfileModel.php | 2 +- .../src/Rule/LoginUniqueFieldRule.php | 4 +- .../src/Rule/LogoutUniqueFieldRule.php | 4 +- composer.lock | 34 +++++++------- libraries/src/Application/CLI/ColorStyle.php | 6 +-- libraries/src/Application/CMSApplication.php | 2 +- libraries/src/Application/CliApplication.php | 4 +- .../src/Application/ConsoleApplication.php | 4 +- .../src/Application/DaemonApplication.php | 2 +- libraries/src/Application/EventAware.php | 2 +- .../MultiFactorAuthenticationHandler.php | 2 +- libraries/src/Application/WebApplication.php | 2 +- libraries/src/Cache/Cache.php | 2 +- libraries/src/Cache/CacheController.php | 2 +- .../CacheControllerFactoryAwareTrait.php | 2 +- libraries/src/Cache/CacheStorage.php | 6 +-- libraries/src/Captcha/CaptchaRegistry.php | 2 +- libraries/src/Categories/Categories.php | 2 +- libraries/src/Changelog/Changelog.php | 2 +- libraries/src/Console/FinderIndexCommand.php | 2 +- .../Loader/WritableContainerLoader.php | 2 +- .../src/Console/RemoveOldFilesCommand.php | 4 +- libraries/src/Console/SessionGcCommand.php | 2 +- libraries/src/Console/TasksRunCommand.php | 2 +- libraries/src/Document/Document.php | 6 +-- libraries/src/Document/Factory.php | 2 +- .../Renderer/Html/ScriptsRenderer.php | 2 +- .../Document/Renderer/Html/StylesRenderer.php | 2 +- libraries/src/Editor/EditorsRegistry.php | 2 +- libraries/src/Encrypt/Base32.php | 2 +- libraries/src/Encrypt/Totp.php | 2 +- libraries/src/Error/AbstractRenderer.php | 2 +- libraries/src/Event/AbstractEvent.php | 8 ++-- .../src/Event/AbstractImmutableEvent.php | 6 +-- .../src/Event/Content/ContentPrepareEvent.php | 2 +- .../MultiFactor/BeforeDisplayMethods.php | 2 +- libraries/src/Event/MultiFactor/Callback.php | 2 +- libraries/src/Event/MultiFactor/Captive.php | 2 +- libraries/src/Event/MultiFactor/GetSetup.php | 2 +- .../src/Event/MultiFactor/NotifyActionLog.php | 2 +- libraries/src/Event/MultiFactor/SaveSetup.php | 4 +- libraries/src/Event/MultiFactor/Validate.php | 4 +- .../Plugin/System/Webauthn/AjaxChallenge.php | 2 +- .../src/Event/Privacy/CanRemoveDataEvent.php | 2 +- .../src/Event/Privacy/ExportRequestEvent.php | 4 +- .../src/Event/QuickIcon/GetIconEvent.php | 2 +- libraries/src/Event/Result/ResultAware.php | 4 +- .../src/Event/Result/ResultTypeArrayAware.php | 2 +- .../Event/Result/ResultTypeBooleanAware.php | 2 +- .../src/Event/Result/ResultTypeFloatAware.php | 2 +- .../Event/Result/ResultTypeIntegerAware.php | 2 +- .../Event/Result/ResultTypeNumericAware.php | 2 +- .../Event/Result/ResultTypeObjectAware.php | 4 +- .../Event/Result/ResultTypeStringAware.php | 2 +- .../src/Event/User/AuthorisationEvent.php | 2 +- libraries/src/Exception/ExceptionHandler.php | 2 +- libraries/src/Extension/ExtensionHelper.php | 4 +- libraries/src/Factory.php | 22 ++++----- libraries/src/Feed/Feed.php | 6 +-- libraries/src/Feed/FeedEntry.php | 6 +-- libraries/src/Filesystem/Folder.php | 2 +- libraries/src/Form/Field/CalendarField.php | 2 +- libraries/src/Form/Field/CheckboxesField.php | 2 +- libraries/src/Form/Field/ComboField.php | 2 +- .../src/Form/Field/ContenthistoryField.php | 2 +- libraries/src/Form/Field/GroupedlistField.php | 2 +- libraries/src/Form/Field/MediaField.php | 2 +- libraries/src/Form/Field/ModalSelectField.php | 2 +- libraries/src/Form/Field/SubformField.php | 2 +- libraries/src/Form/Field/UserField.php | 2 +- libraries/src/Form/Form.php | 46 +++++++++---------- libraries/src/Form/FormField.php | 14 +++--- libraries/src/Form/FormRule.php | 2 +- libraries/src/Form/Rule/EqualsRule.php | 6 +-- libraries/src/Form/Rule/NotequalsRule.php | 4 +- libraries/src/Form/Rule/SubformRule.php | 2 +- libraries/src/HTML/HTMLHelper.php | 10 ++-- libraries/src/HTML/Helpers/Select.php | 2 +- libraries/src/HTML/Registry.php | 2 +- libraries/src/Helper/RouteHelper.php | 2 +- .../src/Http/Transport/SocketTransport.php | 2 +- .../src/Http/Transport/StreamTransport.php | 2 +- .../Installer/Adapter/ComponentAdapter.php | 2 +- libraries/src/Installer/Installer.php | 4 +- .../src/Installer/LegacyInstallerScript.php | 2 +- libraries/src/Language/Language.php | 2 +- libraries/src/Language/Text.php | 2 +- libraries/src/Log/Log.php | 2 +- libraries/src/Log/Logger/CallbackLogger.php | 2 +- .../src/MVC/Controller/BaseController.php | 22 ++++----- libraries/src/MVC/Factory/MVCFactory.php | 10 ++-- libraries/src/MVC/Model/BaseDatabaseModel.php | 6 +-- .../src/MVC/Model/LegacyModelLoaderTrait.php | 2 +- libraries/src/MVC/Model/State.php | 8 ++-- libraries/src/MVC/View/AbstractView.php | 6 +-- libraries/src/MVC/View/CanDo.php | 8 ++-- libraries/src/Mail/Mail.php | 4 +- libraries/src/Menu/SiteMenu.php | 2 +- libraries/src/Profiler/Profiler.php | 2 +- libraries/src/Proxy/ArrayReadOnlyProxy.php | 2 +- libraries/src/Proxy/ObjectReadOnlyProxy.php | 2 +- libraries/src/Router/ApiRouter.php | 4 +- libraries/src/Router/Router.php | 12 ++--- libraries/src/Schema/ChangeItem.php | 2 +- libraries/src/Serializer/JoomlaSerializer.php | 2 +- .../src/Service/Provider/Authentication.php | 4 +- libraries/src/Service/Provider/Session.php | 2 +- libraries/src/Session/SessionFactory.php | 2 +- libraries/src/String/PunycodeHelper.php | 2 +- libraries/src/Table/Asset.php | 2 +- libraries/src/Table/ContentType.php | 4 +- libraries/src/Table/Nested.php | 26 +++++------ libraries/src/Table/Table.php | 12 ++--- .../Toolbar/ContainerAwareToolbarFactory.php | 2 +- libraries/src/Toolbar/Toolbar.php | 12 ++--- libraries/src/Toolbar/ToolbarButton.php | 4 +- libraries/src/Updater/Update.php | 2 +- libraries/src/Updater/UpdateAdapter.php | 2 +- libraries/src/User/CurrentUserTrait.php | 2 +- libraries/src/User/User.php | 2 +- libraries/src/User/UserHelper.php | 2 +- libraries/src/WebAsset/WebAssetManager.php | 12 ++--- libraries/src/WebAsset/WebAssetRegistry.php | 8 ++-- .../cookie/src/Extension/Cookie.php | 2 +- .../ldap/src/Extension/Ldap.php | 26 +++++------ .../content/joomla/src/Extension/Joomla.php | 2 +- .../totp/src/Extension/Totp.php | 2 +- .../webauthn/src/Helper/Credentials.php | 2 +- plugins/quickicon/eos/src/Extension/Eos.php | 2 +- plugins/system/debug/src/Extension/Debug.php | 4 +- .../system/debug/src/JavascriptRenderer.php | 8 ++-- .../remember/src/Extension/Remember.php | 2 +- .../system/webauthn/src/Authentication.php | 4 +- .../webauthn/src/CredentialRepository.php | 4 +- .../src/PluginTraits/AjaxHandlerLogin.php | 8 ++-- .../checkfiles/src/Extension/Checkfiles.php | 2 +- .../src/Extension/DeleteActionLogs.php | 2 +- .../task/requests/src/Extension/Requests.php | 2 +- .../sitestatus/src/Extension/SiteStatus.php | 2 +- .../src/Extension/Notification.php | 4 +- 164 files changed, 383 insertions(+), 383 deletions(-) diff --git a/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php b/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php index 658788a9486c4..d253348661abe 100644 --- a/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php +++ b/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php @@ -53,7 +53,7 @@ public static function getCsvData($data): \Generator { if (!is_iterable($data)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%s() requires an array or object implementing the Traversable interface, a %s was given.', __METHOD__, \is_object($data) ? \get_class($data) : \gettype($data) diff --git a/administrator/components/com_actionlogs/src/Model/ActionlogModel.php b/administrator/components/com_actionlogs/src/Model/ActionlogModel.php index 932de5be9698a..f11c3bf87c034 100644 --- a/administrator/components/com_actionlogs/src/Model/ActionlogModel.php +++ b/administrator/components/com_actionlogs/src/Model/ActionlogModel.php @@ -52,7 +52,7 @@ class ActionlogModel extends BaseDatabaseModel implements UserFactoryAwareInterf public function addLog($messages, $messageLanguageKey, $context, $userId = 0) { if (!is_numeric($userId)) { - @trigger_error(sprintf('User ID must be an integer in %s.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(\sprintf('User ID must be an integer in %s.', __METHOD__), E_USER_DEPRECATED); } $user = $userId ? $this->getUserFactory()->loadUserById($userId) : $this->getCurrentUser(); diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index d95337516ba3a..035103d764dc9 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -543,7 +543,7 @@ protected function updateManifestCaches() if (!$installer->refreshManifestCache($extension->extension_id)) { $this->collectError( __METHOD__, - new \Exception(sprintf( + new \Exception(\sprintf( 'Error on updating manifest cache: (type, element, folder, client) = (%s, %s, %s, %s)', $extension->type, $extension->element, @@ -2636,7 +2636,7 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false) if (File::delete(JPATH_ROOT . $file)) { $status['files_deleted'][] = $file; } else { - $status['files_errors'][] = sprintf('Error on deleting file or folder %s', $file); + $status['files_errors'][] = \sprintf('Error on deleting file or folder %s', $file); } } } @@ -2650,7 +2650,7 @@ public function deleteUnexistingFiles($dryRun = false, $suppressOutput = false) if (Folder::delete(JPATH_ROOT . $folder)) { $status['folders_deleted'][] = $folder; } else { - $status['folders_errors'][] = sprintf('Error on deleting file or folder %s', $folder); + $status['folders_errors'][] = \sprintf('Error on deleting file or folder %s', $folder); } } } diff --git a/administrator/components/com_fields/src/Model/FieldModel.php b/administrator/components/com_fields/src/Model/FieldModel.php index e09499cb116be..1b8031d1042b7 100644 --- a/administrator/components/com_fields/src/Model/FieldModel.php +++ b/administrator/components/com_fields/src/Model/FieldModel.php @@ -330,7 +330,7 @@ private function checkDefaultValue($data) try { $rule->setDatabase($this->getDatabase()); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } } diff --git a/administrator/components/com_finder/src/Indexer/Indexer.php b/administrator/components/com_finder/src/Indexer/Indexer.php index fb97cd0af9dcd..b0791b3d1795d 100644 --- a/administrator/components/com_finder/src/Indexer/Indexer.php +++ b/administrator/components/com_finder/src/Indexer/Indexer.php @@ -122,7 +122,7 @@ class Indexer public function __construct(?DatabaseInterface $db = null) { if ($db === null) { - @trigger_error(sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED); $db = Factory::getContainer()->get(DatabaseInterface::class); } @@ -506,7 +506,7 @@ public function index($item, $format = 'html') // Iterate through the contexts and aggregate the tokens per context. foreach ($state->weights as $context => $multiplier) { // Run the query to aggregate the tokens for this context.. - $db->setQuery(sprintf($query, $multiplier, $context, $context)); + $db->setQuery(\sprintf($query, $multiplier, $context, $context)); $db->execute(); } diff --git a/administrator/components/com_finder/src/Indexer/Query.php b/administrator/components/com_finder/src/Indexer/Query.php index 4f5f8f19b5aaa..708f4d046c5fd 100644 --- a/administrator/components/com_finder/src/Indexer/Query.php +++ b/administrator/components/com_finder/src/Indexer/Query.php @@ -208,7 +208,7 @@ class Query public function __construct($options, ?DatabaseInterface $db = null) { if ($db === null) { - @trigger_error(sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED); $db = Factory::getContainer()->get(DatabaseInterface::class); } diff --git a/administrator/components/com_joomlaupdate/extract.php b/administrator/components/com_joomlaupdate/extract.php index dc37945ef38de..57dd84ef4d8c8 100644 --- a/administrator/components/com_joomlaupdate/extract.php +++ b/administrator/components/com_joomlaupdate/extract.php @@ -630,7 +630,7 @@ public function setIgnoreDirectories(array $ignoreDirectories): void */ public function initialize(): void { - $this->debugMsg(sprintf('Initializing extraction. Filepath: %s', $this->filename)); + $this->debugMsg(\sprintf('Initializing extraction. Filepath: %s', $this->filename)); $this->totalSize = @filesize($this->filename) ?: 0; $this->archiveFileIsBeingRead = false; $this->currentOffset = 0; @@ -639,7 +639,7 @@ public function initialize(): void $this->readArchiveHeader(); if (!empty($this->getError())) { - $this->debugMsg(sprintf('Error: %s', $this->getError()), self::LOG_ERROR); + $this->debugMsg(\sprintf('Error: %s', $this->getError()), self::LOG_ERROR); return; } @@ -688,7 +688,7 @@ public function step(): bool case self::AK_STATE_HEADER: case self::AK_STATE_DATA: $runStateHuman = $this->runState === self::AK_STATE_HEADER ? 'HEADER' : 'DATA'; - $this->debugMsg(sprintf('Current run state: %s', $runStateHuman), self::LOG_DEBUG); + $this->debugMsg(\sprintf('Current run state: %s', $runStateHuman), self::LOG_DEBUG); $status = $this->processFileData(); break; @@ -696,7 +696,7 @@ public function step(): bool case self::AK_STATE_DATAREAD: case self::AK_STATE_POSTPROC: $runStateHuman = $this->runState === self::AK_STATE_DATAREAD ? 'DATAREAD' : 'POSTPROC'; - $this->debugMsg(sprintf('Current run state: %s', $runStateHuman), self::LOG_DEBUG); + $this->debugMsg(\sprintf('Current run state: %s', $runStateHuman), self::LOG_DEBUG); $this->setLastExtractedFileTimestamp($this->fileHeader->timestamp); $this->processLastExtractedFile(); @@ -728,7 +728,7 @@ public function step(): bool $error = $this->getError(); if (!empty($error)) { - $this->debugMsg(sprintf('Step failed with error: %s', $error), self::LOG_ERROR); + $this->debugMsg(\sprintf('Step failed with error: %s', $error), self::LOG_ERROR); } // Did we just finish or run into an error? @@ -790,7 +790,7 @@ private function getRunningTime(): float */ private function processLastExtractedFile(): void { - $this->debugMsg(sprintf('Processing last extracted entity: %s', $this->lastExtractedFilename), self::LOG_DEBUG); + $this->debugMsg(\sprintf('Processing last extracted entity: %s', $this->lastExtractedFilename), self::LOG_DEBUG); if (@is_file($this->lastExtractedFilename)) { @chmod($this->lastExtractedFilename, 0644); @@ -1076,7 +1076,7 @@ private function readFileHeader(): bool default: $messageTemplate = 'This script cannot handle ZIP compression method %d. ' . 'Only 0 (no compression) and 8 (DEFLATE, gzip) can be handled.'; - $actualMessage = sprintf($messageTemplate, $headerData['compmethod']); + $actualMessage = \sprintf($messageTemplate, $headerData['compmethod']); $this->setError($actualMessage); return false; @@ -1094,7 +1094,7 @@ private function readFileHeader(): bool // If we have a banned file, let's skip it if ($isBannedFile) { - $debugMessage = sprintf('Current entity (%s) is banned from extraction and will be skipped over.', $this->fileHeader->file); + $debugMessage = \sprintf('Current entity (%s) is banned from extraction and will be skipped over.', $this->fileHeader->file); $this->debugMsg($debugMessage, self::LOG_DEBUG); // Advance the file pointer, skipping exactly the size of the compressed data @@ -1178,7 +1178,7 @@ private function createDirectory(): void } if ((@mkdir($dirName, $perms, true) === false) && (!$ignore)) { - $this->setError(sprintf('Could not create %s folder', $dirName)); + $this->setError(\sprintf('Could not create %s folder', $dirName)); } } @@ -1216,14 +1216,14 @@ private function processFileData(): bool return $this->processTypeFileCompressed(); case 'default': - $this->setError(sprintf('Unknown compression type %s.', $this->fileHeader->compression)); + $this->setError(\sprintf('Unknown compression type %s.', $this->fileHeader->compression)); return false; } break; } - $this->setError(sprintf('Unknown entry type %s.', $this->fileHeader->type)); + $this->setError(\sprintf('Unknown entry type %s.', $this->fileHeader->type)); return false; } @@ -1414,7 +1414,7 @@ private function processTypeFileUncompressed(): bool // Can we write to the file? if (($outfp === false) && (!$ignore)) { // An error occurred - $this->setError(sprintf('Could not open %s for writing.', $this->fileHeader->realFile)); + $this->setError(\sprintf('Could not open %s for writing.', $this->fileHeader->realFile)); return false; } @@ -1470,7 +1470,7 @@ private function processTypeFileUncompressed(): bool // Was this a pre-timeout bail out? if ($leftBytes > 0) { - $this->debugMsg(sprintf('We have %d bytes left to extract in the next step', $leftBytes), self::LOG_DEBUG); + $this->debugMsg(\sprintf('We have %d bytes left to extract in the next step', $leftBytes), self::LOG_DEBUG); $this->runState = self::AK_STATE_DATA; return true; @@ -1505,7 +1505,7 @@ private function processTypeFileCompressed(): bool if (($outfp === false) && (!$ignore)) { // An error occurred - $this->setError(sprintf('Could not open %s for writing.', $this->fileHeader->realFile)); + $this->setError(\sprintf('Could not open %s for writing.', $this->fileHeader->realFile)); return false; } @@ -1550,7 +1550,7 @@ private function processTypeFileCompressed(): bool break; default: - $this->setError(sprintf('Unknown compression method %s', $this->fileHeader->compression)); + $this->setError(\sprintf('Unknown compression method %s', $this->fileHeader->compression)); return false; } @@ -1656,7 +1656,7 @@ private function debugMsg(string $message, int $priority = self::LOG_INFO): void break; } - fwrite(self::$logFP, sprintf('%s | %7s | %s' . "\r\n", gmdate('Y-m-d H:i:s'), $priorityString, $message)); + fwrite(self::$logFP, \sprintf('%s | %7s | %s' . "\r\n", gmdate('Y-m-d H:i:s'), $priorityString, $message)); } /** diff --git a/administrator/components/com_joomlaupdate/finalisation.php b/administrator/components/com_joomlaupdate/finalisation.php index ca25ce5064393..06f733de5339e 100644 --- a/administrator/components/com_joomlaupdate/finalisation.php +++ b/administrator/components/com_joomlaupdate/finalisation.php @@ -12,8 +12,8 @@ * - Also unlike other files, the normal constant defined checks must be within the global namespace declaration and can't be outside of it */ -namespace -{ +namespace { + // Require the restoration environment or fail cold. Prevents direct web access. \defined('_JOOMLA_UPDATE') or die(); diff --git a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php index c686fc5d34263..c2ebb09c28c2f 100644 --- a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php +++ b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php @@ -1795,7 +1795,7 @@ public function collectError(string $context, \Throwable $error) // Log it Log::add( - sprintf( + \sprintf( 'An error has occurred while running "%s". Code: %s. Message: %s.', $context, $error->getCode(), @@ -1807,7 +1807,7 @@ public function collectError(string $context, \Throwable $error) if (JDEBUG) { $trace = $error->getFile() . ':' . $error->getLine() . PHP_EOL . $error->getTraceAsString(); - Log::add(sprintf('An error trace: %s.', $trace), Log::DEBUG, 'Update'); + Log::add(\sprintf('An error trace: %s.', $trace), Log::DEBUG, 'Update'); } } @@ -2081,7 +2081,7 @@ public function resetUpdateSource() $db->execute(); } catch (\Exception $e) { Log::add( - sprintf( + \sprintf( 'An error has occurred while running "resetUpdateSource". Code: %s. Message: %s.', $e->getCode(), $e->getMessage() diff --git a/administrator/components/com_menus/src/Field/Modal/MenuField.php b/administrator/components/com_menus/src/Field/Modal/MenuField.php index fe90c5e32dad7..683583a150444 100644 --- a/administrator/components/com_menus/src/Field/Modal/MenuField.php +++ b/administrator/components/com_menus/src/Field/Modal/MenuField.php @@ -67,7 +67,7 @@ public function __get($name) $newName = $map[$name]; @trigger_error( - sprintf( + \sprintf( 'MenuField::__get property "%s" is deprecated, and will not work in Joomla 6. Use "%s" property instead.', $name, $newName @@ -110,7 +110,7 @@ public function __set($name, $value) $newName = $map[$name]; @trigger_error( - sprintf( + \sprintf( 'MenuField::__set property "%s" is deprecated, and will not work in Joomla 6. Use "%s" property instead.', $name, $newName diff --git a/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php b/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php index b165d3134b4b2..ab11a89c62fc5 100644 --- a/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php +++ b/administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php @@ -271,7 +271,7 @@ public function getItem($pk = null) } if (!empty($item->id)) { - $item->tags = new TagsHelper(); + $item->tags = new TagsHelper(); $item->tags->getTagIds($item->id, 'com_newsfeeds.newsfeed'); // @todo: We probably don't need this in any client - but needs careful validation diff --git a/administrator/components/com_scheduler/src/Model/TaskModel.php b/administrator/components/com_scheduler/src/Model/TaskModel.php index 20ae7564d346c..fce9591b2c38a 100644 --- a/administrator/components/com_scheduler/src/Model/TaskModel.php +++ b/administrator/components/com_scheduler/src/Model/TaskModel.php @@ -623,7 +623,7 @@ private function processExecutionRules(array $unprocessedRules): array */ private function buildExecutionRules(array $executionRules): array { - // Maps interval strings, use with sprintf($map[intType], $interval) + // Maps interval strings, use with \sprintf($map[intType], $interval) $intervalStringMap = [ 'minutes' => 'PT%dM', 'hours' => 'PT%dH', @@ -640,7 +640,7 @@ private function buildExecutionRules(array $executionRules): array // Rule type for intervals interval- $intervalType = explode('-', $ruleType)[1]; $interval = $executionRules["interval-$intervalType"]; - $buildExpression = sprintf($intervalStringMap[$intervalType], $interval); + $buildExpression = \sprintf($intervalStringMap[$intervalType], $interval); } if ($ruleClass === 'cron-expression') { diff --git a/administrator/components/com_scheduler/src/Model/TasksModel.php b/administrator/components/com_scheduler/src/Model/TasksModel.php index d792bafe7d32f..92bc2780ff135 100644 --- a/administrator/components/com_scheduler/src/Model/TasksModel.php +++ b/administrator/components/com_scheduler/src/Model/TasksModel.php @@ -270,7 +270,7 @@ static function (TaskOption $taskOption): string { if (is_numeric($locked) && $locked != 0) { $now = Factory::getDate('now', 'GMT'); $timeout = ComponentHelper::getParams('com_scheduler')->get('timeout', 300); - $timeout = new \DateInterval(sprintf('PT%dS', $timeout)); + $timeout = new \DateInterval(\sprintf('PT%dS', $timeout)); $timeoutThreshold = (clone $now)->sub($timeout)->toSql(); $now = $now->toSql(); diff --git a/administrator/components/com_scheduler/src/Task/Task.php b/administrator/components/com_scheduler/src/Task/Task.php index bfd16a0989658..e4d58a933a734 100644 --- a/administrator/components/com_scheduler/src/Task/Task.php +++ b/administrator/components/com_scheduler/src/Task/Task.php @@ -310,7 +310,7 @@ public function acquireLock(): bool $now = Factory::getDate('now', 'GMT'); $timeout = ComponentHelper::getParams('com_scheduler')->get('timeout', 300); - $timeout = new \DateInterval(sprintf('PT%dS', $timeout)); + $timeout = new \DateInterval(\sprintf('PT%dS', $timeout)); $timeoutThreshold = (clone $now)->sub($timeout)->toSql(); $now = $now->toSql(); diff --git a/administrator/components/com_scheduler/src/Task/TaskOption.php b/administrator/components/com_scheduler/src/Task/TaskOption.php index c085e23c0546b..d8bc2bd7257f7 100644 --- a/administrator/components/com_scheduler/src/Task/TaskOption.php +++ b/administrator/components/com_scheduler/src/Task/TaskOption.php @@ -97,7 +97,7 @@ public function __get(string $name) if ($name === 'type') { try { Log::add( - sprintf( + \sprintf( 'The %1$s property is deprecated. Use %2$s instead.', $name, 'id' diff --git a/administrator/components/com_scheduler/src/Traits/TaskPluginTrait.php b/administrator/components/com_scheduler/src/Traits/TaskPluginTrait.php index 2de696411a005..01ab8b9d1e0e3 100644 --- a/administrator/components/com_scheduler/src/Traits/TaskPluginTrait.php +++ b/administrator/components/com_scheduler/src/Traits/TaskPluginTrait.php @@ -115,7 +115,7 @@ public function enhanceTaskItemForm($context, $data = null): bool $form = $context; } else { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Argument 0 of %1$s must be an instance of %2$s or %3$s', __METHOD__, EventInterface::class, @@ -284,7 +284,7 @@ public function standardRoutineHandler(ExecuteTaskEvent $event): void || $method->getReturnType()->getName() !== 'int' ) { $this->logTask( - sprintf( + \sprintf( 'Incorrect routine method signature for %1$s(). See checks in %2$s()', $method->getName(), __METHOD__ @@ -306,7 +306,7 @@ public function standardRoutineHandler(ExecuteTaskEvent $event): void } } else { $this->logTask( - sprintf( + \sprintf( 'Incorrectly configured TASKS_MAP in class %s. Missing valid method for `routine_id` %s', static::class, $routineId diff --git a/administrator/components/com_users/src/DataShape/DataShapeObject.php b/administrator/components/com_users/src/DataShape/DataShapeObject.php index c714d5fcde4d0..464affca2b754 100644 --- a/administrator/components/com_users/src/DataShape/DataShapeObject.php +++ b/administrator/components/com_users/src/DataShape/DataShapeObject.php @@ -27,7 +27,7 @@ abstract class DataShapeObject implements \ArrayAccess public function __construct(array $array = []) { if (!\is_array($array) && !($array instanceof self)) { - throw new \InvalidArgumentException(sprintf('%s needs an array or a %s object', __METHOD__, __CLASS__)); + throw new \InvalidArgumentException(\sprintf('%s needs an array or a %s object', __METHOD__, __CLASS__)); } foreach (($array instanceof self) ? $array->asArray() : $array as $k => $v) { @@ -59,7 +59,7 @@ public function asArray(): array public function merge($newValues): self { if (!\is_array($newValues) && !($newValues instanceof self)) { - throw new \InvalidArgumentException(sprintf('%s needs an array or a %s object', __METHOD__, __CLASS__)); + throw new \InvalidArgumentException(\sprintf('%s needs an array or a %s object', __METHOD__, __CLASS__)); } foreach (($newValues instanceof self) ? $newValues->asArray() : $newValues as $k => $v) { @@ -94,7 +94,7 @@ public function __get($name) return $this->{$name}; } - throw new \InvalidArgumentException(sprintf('Property %s not found in %s', $name, __CLASS__)); + throw new \InvalidArgumentException(\sprintf('Property %s not found in %s', $name, __CLASS__)); } /** @@ -118,7 +118,7 @@ public function __set($name, $value) $this->{$name} = $value; } - throw new \InvalidArgumentException(sprintf('Property %s not found in %s', $name, __CLASS__)); + throw new \InvalidArgumentException(\sprintf('Property %s not found in %s', $name, __CLASS__)); } /** @@ -186,6 +186,6 @@ public function offsetSet($offset, $value): void */ public function offsetUnset($offset): void { - throw new \LogicException(sprintf('You cannot unset members of %s', __CLASS__)); + throw new \LogicException(\sprintf('You cannot unset members of %s', __CLASS__)); } } diff --git a/administrator/components/com_users/src/Model/BackupcodesModel.php b/administrator/components/com_users/src/Model/BackupcodesModel.php index 5f16e45417570..098005a310dd4 100644 --- a/administrator/components/com_users/src/Model/BackupcodesModel.php +++ b/administrator/components/com_users/src/Model/BackupcodesModel.php @@ -90,7 +90,7 @@ public function regenerateBackupCodes(?User $user = null): void for ($i = 0; $i < 10; $i++) { // Each backup code is 2 groups of 4 digits - $backupCodes[$i] = sprintf('%04u%04u', random_int(0, 9999), random_int(0, 9999)); + $backupCodes[$i] = \sprintf('%04u%04u', random_int(0, 9999), random_int(0, 9999)); } // Save the backup codes to the database and update the cache diff --git a/administrator/components/com_users/src/Model/MethodModel.php b/administrator/components/com_users/src/Model/MethodModel.php index 7b2d3ce02c176..b00bda2b1a2a8 100644 --- a/administrator/components/com_users/src/Model/MethodModel.php +++ b/administrator/components/com_users/src/Model/MethodModel.php @@ -176,7 +176,7 @@ public function getPageTitle(): string break; default: - $key = sprintf('COM_USERS_MFA_%s_PAGE_HEAD', $task); + $key = \sprintf('COM_USERS_MFA_%s_PAGE_HEAD', $task); break; } diff --git a/administrator/components/com_users/src/Model/MethodsModel.php b/administrator/components/com_users/src/Model/MethodsModel.php index ba0d086118f65..26cc80e566330 100644 --- a/administrator/components/com_users/src/Model/MethodsModel.php +++ b/administrator/components/com_users/src/Model/MethodsModel.php @@ -170,7 +170,7 @@ public function formatRelative(?string $dateTimeText): string } } - return sprintf($containerString, $jDate->format($formatString, true)); + return \sprintf($containerString, $jDate->format($formatString, true)); } /** diff --git a/administrator/components/com_users/src/Model/UserModel.php b/administrator/components/com_users/src/Model/UserModel.php index e6204d3064bca..889add8c3d370 100644 --- a/administrator/components/com_users/src/Model/UserModel.php +++ b/administrator/components/com_users/src/Model/UserModel.php @@ -915,7 +915,7 @@ public function getAssignedGroups($userId = null) public function getOtpConfig($userId = null) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. Use \Joomla\Component\Users\Administrator\Helper\Mfa::getUserMfaRecords() instead.', __METHOD__ ), @@ -946,7 +946,7 @@ public function getOtpConfig($userId = null) public function setOtpConfig($userId, $otpConfig) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. Multi-factor Authentication actions are handled by plugins in the multifactorauth folder.', __METHOD__ ), @@ -969,7 +969,7 @@ public function setOtpConfig($userId, $otpConfig) public function getOtpConfigEncryptionKey() { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. Use \Joomla\CMS\Factory::getApplication()->get(\'secret\') instead', __METHOD__ ), @@ -995,7 +995,7 @@ public function getOtpConfigEncryptionKey() public function getTwofactorform($userId = null) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. Use \Joomla\Component\Users\Administrator\Helper\Mfa::getConfigurationInterface()', __METHOD__ ), @@ -1021,7 +1021,7 @@ public function getTwofactorform($userId = null) public function generateOteps($userId, $count = 10) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. See \Joomla\Component\Users\Administrator\Model\BackupcodesModel::saveBackupCodes()', __METHOD__ ), @@ -1049,7 +1049,7 @@ public function generateOteps($userId, $count = 10) public function isValidSecretKey($userId, $secretKey, $options = []) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. Multi-factor Authentication actions are handled by plugins in the multifactorauth folder.', __METHOD__ ), @@ -1076,7 +1076,7 @@ public function isValidSecretKey($userId, $secretKey, $options = []) public function isValidOtep($userId, $otep, $otpConfig = null) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. Multi-factor Authentication actions are handled by plugins in the multifactorauth folder.', __METHOD__ ), diff --git a/administrator/components/com_users/src/View/Method/HtmlView.php b/administrator/components/com_users/src/View/Method/HtmlView.php index 7a0c52c9925df..55b96ebfa07da 100644 --- a/administrator/components/com_users/src/View/Method/HtmlView.php +++ b/administrator/components/com_users/src/View/Method/HtmlView.php @@ -199,7 +199,7 @@ function ($x) { $button = (new LinkButton('user-mfa-edit-cancel')) ->url( Route::_( - sprintf( + \sprintf( "index.php?option=com_users&task=method.regenerateBackupCodes&user_id=%s&%s=1&returnurl=%s", $this->user->id, Factory::getApplication()->getFormToken(), diff --git a/api/index.php b/api/index.php index e8a1306cbcdae..3785e00f2cf5c 100644 --- a/api/index.php +++ b/api/index.php @@ -15,7 +15,7 @@ if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { header('HTTP/1.1 500 Internal Server Error'); echo json_encode( - ['error' => sprintf('Joomla requires PHP version %s to run', JOOMLA_MINIMUM_PHP)] + ['error' => \sprintf('Joomla requires PHP version %s to run', JOOMLA_MINIMUM_PHP)] ); return; diff --git a/build/helpTOC.php b/build/helpTOC.php index 70a6f2d35e55c..ad8915276a86a 100644 --- a/build/helpTOC.php +++ b/build/helpTOC.php @@ -89,14 +89,14 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in $cleanMembers = []; - $io->comment(sprintf('Loop through docs wiki categories since Joomla Version %d.0 - Takes a while ...', Version::MAJOR_VERSION)); + $io->comment(\sprintf('Loop through docs wiki categories since Joomla Version %d.0 - Takes a while ...', Version::MAJOR_VERSION)); // Loop through the Versions since 5.0 to get all HelpTocs - Temporary fix for ($helpScreenMinor=Version::MINOR_VERSION; $helpScreenMinor >= 0; $helpScreenMinor--) { // Get the category members (local hack) $categoryMembers = $mediawiki->categories->getCategoryMembers( - sprintf('Category:Help_screen_%s.%s', Version::MAJOR_VERSION, $helpScreenMinor), + \sprintf('Category:Help_screen_%s.%s', Version::MAJOR_VERSION, $helpScreenMinor), null, 'max' ); @@ -115,7 +115,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in */ // Strip the namespace prefix off the titles and replace spaces with underscores - $namespace = sprintf('Help%d.x:', Version::MAJOR_VERSION); + $namespace = \sprintf('Help%d.x:', Version::MAJOR_VERSION); foreach ($members as $member) { $cleanMembers[str_replace([$namespace, ' '], ['', '_'], $member)] = trim(str_replace($namespace, ' ', $member)); @@ -142,15 +142,15 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in $string = strtoupper($key); // Validate the key exists - $io->comment(sprintf('Validating key COM_ADMIN_HELP_%s', $string)); + $io->comment(\sprintf('Validating key COM_ADMIN_HELP_%s', $string)); if ($language->hasKey('COM_ADMIN_HELP_' . $string)) { - $io->comment(sprintf('Adding %s', $string)); + $io->comment(\sprintf('Adding %s', $string)); $toc[$key] = $string; } else { // We check the string for words in singular/plural form and check again - $io->comment(sprintf('Inflecting %s', $string)); + $io->comment(\sprintf('Inflecting %s', $string)); $inflected = ''; @@ -170,10 +170,10 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in // Now try to validate the key if ($inflected !== '') { - $io->comment(sprintf('Validating key COM_ADMIN_HELP_%s', $inflected)); + $io->comment(\sprintf('Validating key COM_ADMIN_HELP_%s', $inflected)); if ($language->hasKey('COM_ADMIN_HELP_' . $inflected)) { - $io->comment(sprintf('Adding %s', $inflected)); + $io->comment(\sprintf('Adding %s', $inflected)); $toc[$key] = $inflected; } @@ -181,7 +181,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in } } - $io->comment(sprintf('Number of strings: %d', \count($toc))); + $io->comment(\sprintf('Number of strings: %d', \count($toc))); // JSON encode the file and write it to JPATH_ADMINISTRATOR/help/en-GB/toc.json file_put_contents(JPATH_ADMINISTRATOR . '/help/en-GB/toc.json', json_encode($toc)); @@ -197,9 +197,9 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in // write missing strings to JPATH_BASE/tmp/missing-helptoc.txt file_put_contents(JPATH_BASE . '/tmp/missing-helptoc.txt', $str_missing); - $io->caution(sprintf('Number of media-wiki articles without string: %d', \count($missing))); + $io->caution(\sprintf('Number of media-wiki articles without string: %d', \count($missing))); - $io->note(sprintf('Missing strings are saved in: %s and should be revised and added to %s', 'tmp/missing-helptoc.txt', 'administrator/language/en-GB/com_admin.ini')); + $io->note(\sprintf('Missing strings are saved in: %s and should be revised and added to %s', 'tmp/missing-helptoc.txt', 'administrator/language/en-GB/com_admin.ini')); $io->caution('TODO: For a complete TOC, please run this script again after adding the missing language strings!'); diff --git a/components/com_users/src/Model/ProfileModel.php b/components/com_users/src/Model/ProfileModel.php index 3abfa00c247ce..99831c892194a 100644 --- a/components/com_users/src/Model/ProfileModel.php +++ b/components/com_users/src/Model/ProfileModel.php @@ -321,7 +321,7 @@ public function getTwofactorform($userId = null) public function getOtpConfig($userId = null) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. Use \Joomla\Component\Users\Administrator\Helper\Mfa::getUserMfaRecords() instead.', __METHOD__ ), diff --git a/components/com_users/src/Rule/LoginUniqueFieldRule.php b/components/com_users/src/Rule/LoginUniqueFieldRule.php index 6a8227c146d27..b4660226c5733 100644 --- a/components/com_users/src/Rule/LoginUniqueFieldRule.php +++ b/components/com_users/src/Rule/LoginUniqueFieldRule.php @@ -49,11 +49,11 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr $loginRedirectMenuitem = $input['params']->login_redirect_menuitem; if ($form === null) { - throw new \InvalidArgumentException(sprintf('The value for $form must not be null in %s', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('The value for $form must not be null in %s', \get_class($this))); } if ($input === null) { - throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('The value for $input must not be null in %s', \get_class($this))); } // Test the input values for login. diff --git a/components/com_users/src/Rule/LogoutUniqueFieldRule.php b/components/com_users/src/Rule/LogoutUniqueFieldRule.php index 299de562a4dea..d079e1816ea6b 100644 --- a/components/com_users/src/Rule/LogoutUniqueFieldRule.php +++ b/components/com_users/src/Rule/LogoutUniqueFieldRule.php @@ -49,11 +49,11 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr $logoutRedirectMenuitem = $input['params']->logout_redirect_menuitem; if ($form === null) { - throw new \InvalidArgumentException(sprintf('The value for $form must not be null in %s', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('The value for $form must not be null in %s', \get_class($this))); } if ($input === null) { - throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('The value for $input must not be null in %s', \get_class($this))); } // Test the input values for logout. diff --git a/composer.lock b/composer.lock index f0be1183e324a..19108ee0b42d5 100644 --- a/composer.lock +++ b/composer.lock @@ -2864,16 +2864,16 @@ }, { "name": "maximebf/debugbar", - "version": "v1.22.3", + "version": "v1.22.4", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96" + "reference": "ec4979077ff5ddf987eb2457055ee343f466c250" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", - "reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/ec4979077ff5ddf987eb2457055ee343f466c250", + "reference": "ec4979077ff5ddf987eb2457055ee343f466c250", "shasum": "" }, "require": { @@ -2926,9 +2926,9 @@ ], "support": { "issues": "https://github.com/maximebf/php-debugbar/issues", - "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.3" + "source": "https://github.com/maximebf/php-debugbar/tree/v1.22.4" }, - "time": "2024-04-03T19:39:26+00:00" + "time": "2024-09-06T17:37:59+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -7203,16 +7203,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.59.3", + "version": "v3.64.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" + "reference": "58dd9c931c785a79739310aef5178928305ffa67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/58dd9c931c785a79739310aef5178928305ffa67", + "reference": "58dd9c931c785a79739310aef5178928305ffa67", "shasum": "" }, "require": { @@ -7294,7 +7294,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.64.0" }, "funding": [ { @@ -7302,7 +7302,7 @@ "type": "github" } ], - "time": "2024-06-16T14:17:03+00:00" + "time": "2024-08-30T23:09:38+00:00" }, { "name": "joomla/mediawiki", @@ -7682,16 +7682,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.0", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "384af967d35b2162f69526c7276acadce534d0e1" + "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", - "reference": "384af967d35b2162f69526c7276acadce534d0e1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", + "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", "shasum": "" }, "require": { @@ -7736,7 +7736,7 @@ "type": "github" } ], - "time": "2024-08-27T09:18:05+00:00" + "time": "2024-09-05T16:09:28+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", diff --git a/libraries/src/Application/CLI/ColorStyle.php b/libraries/src/Application/CLI/ColorStyle.php index 3017f61b75ca6..9bf56abb5cf07 100644 --- a/libraries/src/Application/CLI/ColorStyle.php +++ b/libraries/src/Application/CLI/ColorStyle.php @@ -108,7 +108,7 @@ public function __construct(string $fg = '', string $bg = '', array $options = [ if ($fg) { if (\array_key_exists($fg, static::$knownColors) == false) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Invalid foreground color "%1$s" [%2$s]', $fg, implode(', ', $this->getKnownColors()) @@ -122,7 +122,7 @@ public function __construct(string $fg = '', string $bg = '', array $options = [ if ($bg) { if (\array_key_exists($bg, static::$knownColors) == false) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Invalid background color "%1$s" [%2$s]', $bg, implode(', ', $this->getKnownColors()) @@ -136,7 +136,7 @@ public function __construct(string $fg = '', string $bg = '', array $options = [ foreach ($options as $option) { if (\array_key_exists($option, static::$knownOptions) == false) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Invalid option "%1$s" [%2$s]', $option, implode(', ', $this->getKnownOptions()) diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php index 11271b5be7e38..3625dd841cb1e 100644 --- a/libraries/src/Application/CMSApplication.php +++ b/libraries/src/Application/CMSApplication.php @@ -445,7 +445,7 @@ public function getCfg($varname, $default = null) { try { Log::add( - sprintf('%s() is deprecated and will be removed in 6.0. Use Factory->getApplication()->get() instead.', __METHOD__), + \sprintf('%s() is deprecated and will be removed in 6.0. Use Factory->getApplication()->get() instead.', __METHOD__), Log::WARNING, 'deprecated' ); diff --git a/libraries/src/Application/CliApplication.php b/libraries/src/Application/CliApplication.php index 18f2dc9bda8cb..9acaae1fc84ab 100644 --- a/libraries/src/Application/CliApplication.php +++ b/libraries/src/Application/CliApplication.php @@ -178,7 +178,7 @@ public function __get($name) default: $trace = debug_backtrace(); trigger_error( - sprintf( + \sprintf( 'Undefined property via __get(): %1$s in %2$s on line %3$s', $name, $trace[0]['file'], @@ -235,7 +235,7 @@ public static function getInstance($name = null) // Only create the object if it doesn't exist. if (empty(static::$instance)) { if (!class_exists($name)) { - throw new \RuntimeException(sprintf('Unable to load application: %s', $name), 500); + throw new \RuntimeException(\sprintf('Unable to load application: %s', $name), 500); } static::$instance = new $name(); diff --git a/libraries/src/Application/ConsoleApplication.php b/libraries/src/Application/ConsoleApplication.php index a4f0e1f0e3bfd..5941c4225c993 100644 --- a/libraries/src/Application/ConsoleApplication.php +++ b/libraries/src/Application/ConsoleApplication.php @@ -177,7 +177,7 @@ public function __get($name) default: $trace = debug_backtrace(); trigger_error( - sprintf( + \sprintf( 'Undefined property via __get(): %1$s in %2$s on line %3$s', $name, $trace[0]['file'], @@ -444,7 +444,7 @@ public function flushAssets() */ public function getLongVersion(): string { - return sprintf('Joomla! %s (debug: %s)', (new Version())->getShortVersion(), (\defined('JDEBUG') && JDEBUG ? 'Yes' : 'No')); + return \sprintf('Joomla! %s (debug: %s)', (new Version())->getShortVersion(), (\defined('JDEBUG') && JDEBUG ? 'Yes' : 'No')); } /** diff --git a/libraries/src/Application/DaemonApplication.php b/libraries/src/Application/DaemonApplication.php index ed904ca78a9f6..a68780a9f4a05 100644 --- a/libraries/src/Application/DaemonApplication.php +++ b/libraries/src/Application/DaemonApplication.php @@ -671,7 +671,7 @@ protected function setupSignalHandlers() // Attach the signal handler for the signal. if (!$this->pcntlSignal(\constant($signal), ['DaemonApplication', 'signal'])) { - Log::add(sprintf('Unable to reroute signal handler: %s', $signal), Log::EMERGENCY); + Log::add(\sprintf('Unable to reroute signal handler: %s', $signal), Log::EMERGENCY); return false; } diff --git a/libraries/src/Application/EventAware.php b/libraries/src/Application/EventAware.php index f8a3d75cfa9e7..ff78555627a7c 100644 --- a/libraries/src/Application/EventAware.php +++ b/libraries/src/Application/EventAware.php @@ -94,7 +94,7 @@ public function triggerEvent($eventName, $args = []) try { $dispatcher = $this->getDispatcher(); } catch (\UnexpectedValueException $exception) { - $this->getLogger()->error(sprintf('Dispatcher not set in %s, cannot trigger events.', \get_class($this))); + $this->getLogger()->error(\sprintf('Dispatcher not set in %s, cannot trigger events.', \get_class($this))); return []; } diff --git a/libraries/src/Application/MultiFactorAuthenticationHandler.php b/libraries/src/Application/MultiFactorAuthenticationHandler.php index bcec88ab3f7e8..049ca9fd6afcc 100644 --- a/libraries/src/Application/MultiFactorAuthenticationHandler.php +++ b/libraries/src/Application/MultiFactorAuthenticationHandler.php @@ -419,7 +419,7 @@ private function migrateFromLegacyMFA(): void Factory::getApplication()->bootComponent('com_users')->getMVCFactory()->createTable('Mfa', 'Administrator')->save( [ 'user_id' => $user->id, - 'title' => sprintf("%s %s", Text::_('PLG_MULTIFACTORAUTH_YUBIKEY_METHOD_TITLE'), $config['yubikey']), + 'title' => \sprintf("%s %s", Text::_('PLG_MULTIFACTORAUTH_YUBIKEY_METHOD_TITLE'), $config['yubikey']), 'method' => 'yubikey', 'default' => 0, 'created_on' => Date::getInstance()->toSql(), diff --git a/libraries/src/Application/WebApplication.php b/libraries/src/Application/WebApplication.php index 6b8e435791ada..c1099afc01d09 100644 --- a/libraries/src/Application/WebApplication.php +++ b/libraries/src/Application/WebApplication.php @@ -145,7 +145,7 @@ public static function getInstance($name = null) // Only create the object if it doesn't exist. if (empty(static::$instance)) { if (!is_subclass_of($name, '\\Joomla\\CMS\\Application\\WebApplication')) { - throw new \RuntimeException(sprintf('Unable to load application: %s', $name), 500); + throw new \RuntimeException(\sprintf('Unable to load application: %s', $name), 500); } static::$instance = new $name(); diff --git a/libraries/src/Cache/Cache.php b/libraries/src/Cache/Cache.php index 9f132ed019cc0..eb9de4a46ee9f 100644 --- a/libraries/src/Cache/Cache.php +++ b/libraries/src/Cache/Cache.php @@ -94,7 +94,7 @@ public function __construct($options) public static function getInstance($type = 'output', $options = []) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. The cache controller should be fetched from the factory.', __METHOD__ ), diff --git a/libraries/src/Cache/CacheController.php b/libraries/src/Cache/CacheController.php index d574b7481dce0..2c446ebe29df1 100644 --- a/libraries/src/Cache/CacheController.php +++ b/libraries/src/Cache/CacheController.php @@ -94,7 +94,7 @@ public function __call($name, $arguments) public static function getInstance($type = 'output', $options = []) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. The cache controller should be fetched from the factory.', __METHOD__ ), diff --git a/libraries/src/Cache/CacheControllerFactoryAwareTrait.php b/libraries/src/Cache/CacheControllerFactoryAwareTrait.php index 664e6d22919a7..b7a5446bcd246 100644 --- a/libraries/src/Cache/CacheControllerFactoryAwareTrait.php +++ b/libraries/src/Cache/CacheControllerFactoryAwareTrait.php @@ -45,7 +45,7 @@ protected function getCacheControllerFactory(): CacheControllerFactoryInterface } @trigger_error( - sprintf('A cache controller is needed in %s. An UnexpectedValueException will be thrown in 5.0.', __CLASS__), + \sprintf('A cache controller is needed in %s. An UnexpectedValueException will be thrown in 5.0.', __CLASS__), E_USER_DEPRECATED ); diff --git a/libraries/src/Cache/CacheStorage.php b/libraries/src/Cache/CacheStorage.php index 1684cce651e24..d1cf00e177fd3 100644 --- a/libraries/src/Cache/CacheStorage.php +++ b/libraries/src/Cache/CacheStorage.php @@ -162,20 +162,20 @@ public static function getInstance($handler = null, $options = []) $path = Path::find(self::addIncludePath(), strtolower($handler) . '.php'); if ($path === false) { - throw new UnsupportedCacheException(sprintf('Unable to load Cache Storage: %s', $handler)); + throw new UnsupportedCacheException(\sprintf('Unable to load Cache Storage: %s', $handler)); } \JLoader::register($class, $path); // The class should now be loaded if (!class_exists($class)) { - throw new UnsupportedCacheException(sprintf('Unable to load Cache Storage: %s', $handler)); + throw new UnsupportedCacheException(\sprintf('Unable to load Cache Storage: %s', $handler)); } } // Validate the cache storage is supported on this platform if (!$class::isSupported()) { - throw new UnsupportedCacheException(sprintf('The %s Cache Storage is not supported on this platform.', $handler)); + throw new UnsupportedCacheException(\sprintf('The %s Cache Storage is not supported on this platform.', $handler)); } return new $class($options); diff --git a/libraries/src/Captcha/CaptchaRegistry.php b/libraries/src/Captcha/CaptchaRegistry.php index 49c21182083fd..4546b5cbcd132 100644 --- a/libraries/src/Captcha/CaptchaRegistry.php +++ b/libraries/src/Captcha/CaptchaRegistry.php @@ -78,7 +78,7 @@ public function has(string $name): bool public function get(string $name): CaptchaProviderInterface { if (empty($this->registry[$name])) { - throw new CaptchaNotFoundException(sprintf('Captcha element "%s" not found in the registry.', $name)); + throw new CaptchaNotFoundException(\sprintf('Captcha element "%s" not found in the registry.', $name)); } return $this->registry[$name]; diff --git a/libraries/src/Categories/Categories.php b/libraries/src/Categories/Categories.php index 1a4181b69f6af..55bf834755f73 100644 --- a/libraries/src/Categories/Categories.php +++ b/libraries/src/Categories/Categories.php @@ -237,7 +237,7 @@ protected function _load($id) try { $db = $this->getDatabase(); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $db = Factory::getContainer()->get(DatabaseInterface::class); } diff --git a/libraries/src/Changelog/Changelog.php b/libraries/src/Changelog/Changelog.php index 37ff5c1f8e9b7..ef21696991ab0 100644 --- a/libraries/src/Changelog/Changelog.php +++ b/libraries/src/Changelog/Changelog.php @@ -374,7 +374,7 @@ public function loadFromXml($url) if (!xml_parse($this->xmlParser, $response->body)) { Log::add( - sprintf( + \sprintf( 'XML error: %s at line %d', xml_error_string(xml_get_error_code($this->xmlParser)), xml_get_current_line_number($this->xmlParser) diff --git a/libraries/src/Console/FinderIndexCommand.php b/libraries/src/Console/FinderIndexCommand.php index 1d91e843baf16..9c594e9e026ac 100644 --- a/libraries/src/Console/FinderIndexCommand.php +++ b/libraries/src/Console/FinderIndexCommand.php @@ -246,7 +246,7 @@ private function configureIO(InputInterface $input, OutputInterface $output): vo try { $language = $this->getLanguage(); } catch (\UnexpectedValueException $e) { - @trigger_error(sprintf('Language must be set in 6.0 in %s', __METHOD__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Language must be set in 6.0 in %s', __METHOD__), E_USER_DEPRECATED); $language = Factory::getLanguage(); } diff --git a/libraries/src/Console/Loader/WritableContainerLoader.php b/libraries/src/Console/Loader/WritableContainerLoader.php index e41b0d789da01..7d5efc0fc95f9 100644 --- a/libraries/src/Console/Loader/WritableContainerLoader.php +++ b/libraries/src/Console/Loader/WritableContainerLoader.php @@ -82,7 +82,7 @@ public function add(string $commandName, string $className) public function get(string $name): AbstractCommand { if (!$this->has($name)) { - throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); + throw new CommandNotFoundException(\sprintf('Command "%s" does not exist.', $name)); } return $this->container->get($this->commandMap[$name]); diff --git a/libraries/src/Console/RemoveOldFilesCommand.php b/libraries/src/Console/RemoveOldFilesCommand.php index 7ea3c970e5eef..26362cccdacd2 100644 --- a/libraries/src/Console/RemoveOldFilesCommand.php +++ b/libraries/src/Console/RemoveOldFilesCommand.php @@ -99,7 +99,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in } $symfonyStyle->success( - sprintf( + \sprintf( $dryRun ? '%s Files checked and %s would be deleted' : '%s Files checked and %s deleted', \count($status['files_checked']), ($dryRun ? \count($status['files_exist']) : \count($status['files_deleted'])) @@ -107,7 +107,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in ); $symfonyStyle->success( - sprintf( + \sprintf( $dryRun ? '%s Folders checked and %s would be deleted' : '%s Folders checked and %s deleted', \count($status['folders_checked']), ($dryRun ? \count($status['folders_exist']) : \count($status['folders_deleted'])) diff --git a/libraries/src/Console/SessionGcCommand.php b/libraries/src/Console/SessionGcCommand.php index c7b5ee557a09a..b49d72a1e4a16 100644 --- a/libraries/src/Console/SessionGcCommand.php +++ b/libraries/src/Console/SessionGcCommand.php @@ -107,7 +107,7 @@ private function getSessionService(string $application): SessionInterface { if (!$this->getContainer()->has("session.web.$application")) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'The `%s` application is not a valid option.', $application ) diff --git a/libraries/src/Console/TasksRunCommand.php b/libraries/src/Console/TasksRunCommand.php index 3a5db7de13928..3d09eeecd8b1b 100644 --- a/libraries/src/Console/TasksRunCommand.php +++ b/libraries/src/Console/TasksRunCommand.php @@ -107,7 +107,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in $exit = empty($task) ? Status::NO_RUN : $task->getContent()['status']; $duration = microtime(true) - $cStart; $key = (\array_key_exists($exit, $outTextMap)) ? $exit : 'N/A'; - $this->ioStyle->writeln(sprintf($outTextMap[$key], $record->id, $record->title, $duration, $exit)); + $this->ioStyle->writeln(\sprintf($outTextMap[$key], $record->id, $record->title, $duration, $exit)); } $netTime = round(microtime(true) - $status['startTime'], 2); diff --git a/libraries/src/Document/Document.php b/libraries/src/Document/Document.php index 7ef30a00167b9..1d42437f031c1 100644 --- a/libraries/src/Document/Document.php +++ b/libraries/src/Document/Document.php @@ -977,7 +977,7 @@ public function setModifiedDate($date) { if (!\is_string($date) && !($date instanceof Date)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'The $date parameter of %1$s must be a string or a %2$s instance, a %3$s was given.', __METHOD__ . '()', 'Joomla\\CMS\\Date\\Date', @@ -1197,7 +1197,7 @@ protected function preloadAssets() } elseif (\in_array($preloadMethod, $this->preloadTypes)) { $this->getPreloadManager()->$preloadMethod($link); } else { - throw new \InvalidArgumentException(sprintf('The "%s" method is not supported for preloading.', $preloadMethod), 500); + throw new \InvalidArgumentException(\sprintf('The "%s" method is not supported for preloading.', $preloadMethod), 500); } } } @@ -1215,7 +1215,7 @@ protected function preloadAssets() } elseif (\in_array($preloadMethod, $this->preloadTypes)) { $this->getPreloadManager()->$preloadMethod($link); } else { - throw new \InvalidArgumentException(sprintf('The "%s" method is not supported for preloading.', $preloadMethod), 500); + throw new \InvalidArgumentException(\sprintf('The "%s" method is not supported for preloading.', $preloadMethod), 500); } } } diff --git a/libraries/src/Document/Factory.php b/libraries/src/Document/Factory.php index 4db13db833b9f..3dfb172a43ade 100644 --- a/libraries/src/Document/Factory.php +++ b/libraries/src/Document/Factory.php @@ -98,7 +98,7 @@ public function createRenderer(Document $document, string $type, string $docType $class = '\\JDocumentRenderer' . $type; if (!class_exists($class)) { - throw new \RuntimeException(sprintf('Unable to load renderer class %s', $type), 500); + throw new \RuntimeException(\sprintf('Unable to load renderer class %s', $type), 500); } } diff --git a/libraries/src/Document/Renderer/Html/ScriptsRenderer.php b/libraries/src/Document/Renderer/Html/ScriptsRenderer.php index 65cc0674444d5..e329fcf62c3e4 100644 --- a/libraries/src/Document/Renderer/Html/ScriptsRenderer.php +++ b/libraries/src/Document/Renderer/Html/ScriptsRenderer.php @@ -165,7 +165,7 @@ private function renderElement($item): string if ($asset->getOption('deprecated')) { @trigger_error( - sprintf('Web Asset script [%s] is deprecated. %s', $asset->getName(), $asset->getOption('deprecatedMsg', '')), + \sprintf('Web Asset script [%s] is deprecated. %s', $asset->getName(), $asset->getOption('deprecatedMsg', '')), E_USER_DEPRECATED ); } diff --git a/libraries/src/Document/Renderer/Html/StylesRenderer.php b/libraries/src/Document/Renderer/Html/StylesRenderer.php index e1cd1a98aefa3..9f32922cc608f 100644 --- a/libraries/src/Document/Renderer/Html/StylesRenderer.php +++ b/libraries/src/Document/Renderer/Html/StylesRenderer.php @@ -154,7 +154,7 @@ private function renderElement($item): string if ($asset->getOption('deprecated')) { @trigger_error( - sprintf('Web Asset style [%s] is deprecated. %s', $asset->getName(), $asset->getOption('deprecatedMsg', '')), + \sprintf('Web Asset style [%s] is deprecated. %s', $asset->getName(), $asset->getOption('deprecatedMsg', '')), E_USER_DEPRECATED ); } diff --git a/libraries/src/Editor/EditorsRegistry.php b/libraries/src/Editor/EditorsRegistry.php index ec0712b671bcf..669deab8e7f1a 100644 --- a/libraries/src/Editor/EditorsRegistry.php +++ b/libraries/src/Editor/EditorsRegistry.php @@ -78,7 +78,7 @@ public function has(string $name): bool public function get(string $name): EditorProviderInterface { if (empty($this->registry[$name])) { - throw new EditorNotFoundException(sprintf('Editor element "%s" not found in the registry.', $name)); + throw new EditorNotFoundException(\sprintf('Editor element "%s" not found in the registry.', $name)); } return $this->registry[$name]; diff --git a/libraries/src/Encrypt/Base32.php b/libraries/src/Encrypt/Base32.php index d0c938bae2a84..1efa8fd97d0c6 100644 --- a/libraries/src/Encrypt/Base32.php +++ b/libraries/src/Encrypt/Base32.php @@ -215,6 +215,6 @@ private function _mapcharset($str) */ private function _mapbin($chr) { - return sprintf('%08b', strpos(self::CSRFC3548, $chr)); + return \sprintf('%08b', strpos(self::CSRFC3548, $chr)); } } diff --git a/libraries/src/Encrypt/Totp.php b/libraries/src/Encrypt/Totp.php index 9c243a42b9068..395e378ac8eef 100644 --- a/libraries/src/Encrypt/Totp.php +++ b/libraries/src/Encrypt/Totp.php @@ -180,7 +180,7 @@ protected function hashToInt($bytes, $start) */ public function getUrl($user, $hostname, $secret) { - $url = sprintf("otpauth://totp/%s@%s?secret=%s", $user, $hostname, $secret); + $url = \sprintf("otpauth://totp/%s@%s?secret=%s", $user, $hostname, $secret); $encoder = "https://chart.googleapis.com/chart?chs=200x200&chld=Q|2&cht=qr&chl="; $encoderURL = $encoder . urlencode($url); diff --git a/libraries/src/Error/AbstractRenderer.php b/libraries/src/Error/AbstractRenderer.php index 4f21e5138b7cb..c9a2e99624ad7 100644 --- a/libraries/src/Error/AbstractRenderer.php +++ b/libraries/src/Error/AbstractRenderer.php @@ -83,7 +83,7 @@ public static function getRenderer(string $type) } // 404 Resource Not Found - throw new \InvalidArgumentException(sprintf('There is not an error renderer for the "%s" format.', $type)); + throw new \InvalidArgumentException(\sprintf('There is not an error renderer for the "%s" format.', $type)); } /** diff --git a/libraries/src/Event/AbstractEvent.php b/libraries/src/Event/AbstractEvent.php index c5d150074e0bc..18743fdb2945c 100644 --- a/libraries/src/Event/AbstractEvent.php +++ b/libraries/src/Event/AbstractEvent.php @@ -144,7 +144,7 @@ public function getArgument($name, $default = null) } @trigger_error( - sprintf( + \sprintf( 'Numeric access to named event arguments is deprecated, and will not work in Joomla 6. Event %s argument %s', \get_class($this), $name @@ -166,7 +166,7 @@ public function getArgument($name, $default = null) if (method_exists($this, $methodName2)) { @trigger_error( - sprintf( + \sprintf( 'Use method "%s" for value pre-processing is deprecated, and will not work in Joomla 6. Use "%s" instead. Event %s', $methodName2, $methodName1, @@ -209,7 +209,7 @@ public function setArgument($name, $value) } @trigger_error( - sprintf( + \sprintf( 'Numeric access to named event arguments is deprecated, and will not work in Joomla 6. Event %s argument %s', \get_class($this), $name @@ -227,7 +227,7 @@ public function setArgument($name, $value) $value = $this->{$methodName1}($value); } elseif (method_exists($this, $methodName2)) { @trigger_error( - sprintf( + \sprintf( 'Use method "%s" for value pre-processing is deprecated, and will not work in Joomla 6. Use "%s" instead. Event %s', $methodName2, $methodName1, diff --git a/libraries/src/Event/AbstractImmutableEvent.php b/libraries/src/Event/AbstractImmutableEvent.php index 2b27101360b9e..d877251fba172 100644 --- a/libraries/src/Event/AbstractImmutableEvent.php +++ b/libraries/src/Event/AbstractImmutableEvent.php @@ -42,7 +42,7 @@ public function __construct(string $name, array $arguments = []) { if ($this->constructed) { throw new \BadMethodCallException( - sprintf('Cannot reconstruct the AbstractImmutableEvent %s.', $this->name) + \sprintf('Cannot reconstruct the AbstractImmutableEvent %s.', $this->name) ); } @@ -77,7 +77,7 @@ public function offsetSet($name, $value) } throw new \BadMethodCallException( - sprintf( + \sprintf( 'Cannot set the argument %s of the immutable event %s.', $name, $this->name @@ -98,7 +98,7 @@ public function offsetSet($name, $value) public function offsetUnset($name) { throw new \BadMethodCallException( - sprintf( + \sprintf( 'Cannot remove the argument %s of the immutable event %s.', $name, $this->name diff --git a/libraries/src/Event/Content/ContentPrepareEvent.php b/libraries/src/Event/Content/ContentPrepareEvent.php index 492c7e7b105cf..87f7f6d198414 100644 --- a/libraries/src/Event/Content/ContentPrepareEvent.php +++ b/libraries/src/Event/Content/ContentPrepareEvent.php @@ -65,7 +65,7 @@ protected function onSetParams($value): Registry // @TODO: In 6.0 throw an exception @trigger_error( - sprintf('The "params" attribute for the event "%s" must be type of Registry. In 6.0 it will throw an exception', $this->getName()), + \sprintf('The "params" attribute for the event "%s" must be type of Registry. In 6.0 it will throw an exception', $this->getName()), E_USER_DEPRECATED ); } diff --git a/libraries/src/Event/MultiFactor/BeforeDisplayMethods.php b/libraries/src/Event/MultiFactor/BeforeDisplayMethods.php index e1b5be9cabdac..15864b872a972 100644 --- a/libraries/src/Event/MultiFactor/BeforeDisplayMethods.php +++ b/libraries/src/Event/MultiFactor/BeforeDisplayMethods.php @@ -52,7 +52,7 @@ public function __construct(User $user) public function setUser(User $value): User { if (empty($value) || ($value->id <= 0) || ($value->guest == 1)) { - throw new \DomainException(sprintf('Argument \'user\' of event %s must be a non-guest User object.', $this->name)); + throw new \DomainException(\sprintf('Argument \'user\' of event %s must be a non-guest User object.', $this->name)); } return $value; diff --git a/libraries/src/Event/MultiFactor/Callback.php b/libraries/src/Event/MultiFactor/Callback.php index 89957e6a8c329..72d5be7bbb813 100644 --- a/libraries/src/Event/MultiFactor/Callback.php +++ b/libraries/src/Event/MultiFactor/Callback.php @@ -49,7 +49,7 @@ public function __construct(string $method) public function setMethod(string $value): string { if (empty($value)) { - throw new \DomainException(sprintf("Argument 'method' of event %s must be a non-empty string.", $this->name)); + throw new \DomainException(\sprintf("Argument 'method' of event %s must be a non-empty string.", $this->name)); } return $value; diff --git a/libraries/src/Event/MultiFactor/Captive.php b/libraries/src/Event/MultiFactor/Captive.php index dc113a27aaab9..13bbe1001b4eb 100644 --- a/libraries/src/Event/MultiFactor/Captive.php +++ b/libraries/src/Event/MultiFactor/Captive.php @@ -61,7 +61,7 @@ public function __construct(MfaTable $record) public function setRecord(MfaTable $value): MfaTable { if (empty($value)) { - throw new \DomainException(sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); + throw new \DomainException(\sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); } return $value; diff --git a/libraries/src/Event/MultiFactor/GetSetup.php b/libraries/src/Event/MultiFactor/GetSetup.php index 4254f1240cf44..ed3ea61520702 100644 --- a/libraries/src/Event/MultiFactor/GetSetup.php +++ b/libraries/src/Event/MultiFactor/GetSetup.php @@ -61,7 +61,7 @@ public function __construct(MfaTable $record) public function setRecord(MfaTable $value): MfaTable { if (empty($value)) { - throw new \DomainException(sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); + throw new \DomainException(\sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); } return $value; diff --git a/libraries/src/Event/MultiFactor/NotifyActionLog.php b/libraries/src/Event/MultiFactor/NotifyActionLog.php index e8cde3eefe8dd..a7eb152331fac 100644 --- a/libraries/src/Event/MultiFactor/NotifyActionLog.php +++ b/libraries/src/Event/MultiFactor/NotifyActionLog.php @@ -52,7 +52,7 @@ class NotifyActionLog extends AbstractImmutableEvent public function __construct(string $name, array $arguments = []) { if (!\in_array($name, self::ACCEPTABLE_EVENTS)) { - throw new \InvalidArgumentException(sprintf('The %s event class does not support the %s event name.', __CLASS__, $name)); + throw new \InvalidArgumentException(\sprintf('The %s event class does not support the %s event name.', __CLASS__, $name)); } parent::__construct($name, $arguments); diff --git a/libraries/src/Event/MultiFactor/SaveSetup.php b/libraries/src/Event/MultiFactor/SaveSetup.php index a696ebe5eb8d3..014df273b5cc8 100644 --- a/libraries/src/Event/MultiFactor/SaveSetup.php +++ b/libraries/src/Event/MultiFactor/SaveSetup.php @@ -65,7 +65,7 @@ public function __construct(MfaTable $record, Input $input) public function setRecord(MfaTable $value): MfaTable { if (empty($value)) { - throw new \DomainException(sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); + throw new \DomainException(\sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); } return $value; @@ -85,7 +85,7 @@ public function setRecord(MfaTable $value): MfaTable public function setInput(Input $value): Input { if (empty($value)) { - throw new \DomainException(sprintf('Argument \'input\' of event %s must be an Input object.', $this->name)); + throw new \DomainException(\sprintf('Argument \'input\' of event %s must be an Input object.', $this->name)); } return $value; diff --git a/libraries/src/Event/MultiFactor/Validate.php b/libraries/src/Event/MultiFactor/Validate.php index 7fd77893b59f6..272c59c0cec84 100644 --- a/libraries/src/Event/MultiFactor/Validate.php +++ b/libraries/src/Event/MultiFactor/Validate.php @@ -65,7 +65,7 @@ public function __construct(MfaTable $record, User $user, string $code) public function setRecord(MfaTable $value): MfaTable { if (empty($value)) { - throw new \DomainException(sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); + throw new \DomainException(\sprintf('Argument \'record\' of event %s must be a MfaTable object.', $this->name)); } return $value; @@ -85,7 +85,7 @@ public function setRecord(MfaTable $value): MfaTable public function setUser(User $value): User { if (empty($value) || ($value->id <= 0) || ($value->guest == 1)) { - throw new \DomainException(sprintf('Argument \'user\' of event %s must be a non-guest User object.', $this->name)); + throw new \DomainException(\sprintf('Argument \'user\' of event %s must be a non-guest User object.', $this->name)); } return $value; diff --git a/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php b/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php index d4880fc430eb7..b55c91872aefc 100644 --- a/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php +++ b/libraries/src/Event/Plugin/System/Webauthn/AjaxChallenge.php @@ -41,7 +41,7 @@ public function typeCheckResult($data): void } if (!\is_string($data) || @json_decode($data) === null) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts JSON results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts JSON results.', $this->getName())); } } } diff --git a/libraries/src/Event/Privacy/CanRemoveDataEvent.php b/libraries/src/Event/Privacy/CanRemoveDataEvent.php index c20235d3af2b8..c0c94731a2526 100644 --- a/libraries/src/Event/Privacy/CanRemoveDataEvent.php +++ b/libraries/src/Event/Privacy/CanRemoveDataEvent.php @@ -105,7 +105,7 @@ protected function onSetUser(?User $value): ?User public function typeCheckResult($data): void { if (!$data instanceof Status) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts Joomla\Component\Privacy\Administrator\Removal\Status results.', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts Joomla\Component\Privacy\Administrator\Removal\Status results.', \get_class($this))); } } diff --git a/libraries/src/Event/Privacy/ExportRequestEvent.php b/libraries/src/Event/Privacy/ExportRequestEvent.php index 74b94aed61213..91462ddaf2ade 100644 --- a/libraries/src/Event/Privacy/ExportRequestEvent.php +++ b/libraries/src/Event/Privacy/ExportRequestEvent.php @@ -129,14 +129,14 @@ public function getUser(): ?User public function typeCheckResult($data): void { if (!\is_array($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts Array results.', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts Array results.', \get_class($this))); } // Validate items in array foreach ($data as $item) { if (!$item instanceof Domain) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Event %s only accepts Joomla\Component\Privacy\Administrator\Export\Domain in result array.', \get_class($this) ) diff --git a/libraries/src/Event/QuickIcon/GetIconEvent.php b/libraries/src/Event/QuickIcon/GetIconEvent.php index 084d77f6d9c9c..4b7f47970dc98 100644 --- a/libraries/src/Event/QuickIcon/GetIconEvent.php +++ b/libraries/src/Event/QuickIcon/GetIconEvent.php @@ -61,7 +61,7 @@ public function __construct(string $name, array $arguments = []) public function setContext(string $value) { if (empty($value)) { - throw new \DomainException(sprintf("Argument 'context' of event %s must be a non-empty string.", $this->name)); + throw new \DomainException(\sprintf("Argument 'context' of event %s must be a non-empty string.", $this->name)); } return $value; diff --git a/libraries/src/Event/Result/ResultAware.php b/libraries/src/Event/Result/ResultAware.php index 07c528c259aac..e3045abc78d6f 100644 --- a/libraries/src/Event/Result/ResultAware.php +++ b/libraries/src/Event/Result/ResultAware.php @@ -51,12 +51,12 @@ public function addResult($data): void { // Ensure this trait is applied to an Event object. if (!($this instanceof BaseEvent)) { - throw new \LogicException(sprintf('Event class ‘%s‘ must implement %s.', \get_class($this), BaseEvent::class)); + throw new \LogicException(\sprintf('Event class ‘%s‘ must implement %s.', \get_class($this), BaseEvent::class)); } // Ensure the Event object fully implements the ResultAwareInterface. if (!($this instanceof ResultAwareInterface)) { - throw new \LogicException(sprintf('Event class ‘%s‘ must implement %s.', \get_class($this), ResultAwareInterface::class)); + throw new \LogicException(\sprintf('Event class ‘%s‘ must implement %s.', \get_class($this), ResultAwareInterface::class)); } // Make sure the data type is correct diff --git a/libraries/src/Event/Result/ResultTypeArrayAware.php b/libraries/src/Event/Result/ResultTypeArrayAware.php index 56e20b63f8de8..b52b04e1443db 100644 --- a/libraries/src/Event/Result/ResultTypeArrayAware.php +++ b/libraries/src/Event/Result/ResultTypeArrayAware.php @@ -64,7 +64,7 @@ public function typeCheckResult($data): void } if (!\is_array($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts Array results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts Array results.', $this->getName())); } } } diff --git a/libraries/src/Event/Result/ResultTypeBooleanAware.php b/libraries/src/Event/Result/ResultTypeBooleanAware.php index 50d68ddf60457..e375b7e925105 100644 --- a/libraries/src/Event/Result/ResultTypeBooleanAware.php +++ b/libraries/src/Event/Result/ResultTypeBooleanAware.php @@ -49,7 +49,7 @@ public function typeCheckResult($data): void } if (!\is_bool($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts Boolean results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts Boolean results.', $this->getName())); } } } diff --git a/libraries/src/Event/Result/ResultTypeFloatAware.php b/libraries/src/Event/Result/ResultTypeFloatAware.php index 44979c9a38a9b..ab5b6f4640204 100644 --- a/libraries/src/Event/Result/ResultTypeFloatAware.php +++ b/libraries/src/Event/Result/ResultTypeFloatAware.php @@ -64,7 +64,7 @@ public function typeCheckResult($data): void } if (!\is_float($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts Float results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts Float results.', $this->getName())); } } } diff --git a/libraries/src/Event/Result/ResultTypeIntegerAware.php b/libraries/src/Event/Result/ResultTypeIntegerAware.php index b5f0e37c0e06e..6524066aa0db2 100644 --- a/libraries/src/Event/Result/ResultTypeIntegerAware.php +++ b/libraries/src/Event/Result/ResultTypeIntegerAware.php @@ -64,7 +64,7 @@ public function typeCheckResult($data): void } if (!\is_int($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts Integer results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts Integer results.', $this->getName())); } } } diff --git a/libraries/src/Event/Result/ResultTypeNumericAware.php b/libraries/src/Event/Result/ResultTypeNumericAware.php index a5304dfb0ae1d..f518069f49f3c 100644 --- a/libraries/src/Event/Result/ResultTypeNumericAware.php +++ b/libraries/src/Event/Result/ResultTypeNumericAware.php @@ -64,7 +64,7 @@ public function typeCheckResult($data): void } if (!is_numeric($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts Numeric results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts Numeric results.', $this->getName())); } } } diff --git a/libraries/src/Event/Result/ResultTypeObjectAware.php b/libraries/src/Event/Result/ResultTypeObjectAware.php index 16f8faba453d3..9fa09be12242f 100644 --- a/libraries/src/Event/Result/ResultTypeObjectAware.php +++ b/libraries/src/Event/Result/ResultTypeObjectAware.php @@ -74,7 +74,7 @@ public function typeCheckResult($data): void } if (!\is_object($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts object results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts object results.', $this->getName())); } if (empty($this->resultAcceptableClasses)) { @@ -89,6 +89,6 @@ public function typeCheckResult($data): void $acceptableTypes = implode(', ', $this->resultAcceptableClasses); $messageTemplate = 'Event %s only accepts object results which are instances of one of %s.'; - throw new \InvalidArgumentException(sprintf($messageTemplate, $this->getName(), $acceptableTypes)); + throw new \InvalidArgumentException(\sprintf($messageTemplate, $this->getName(), $acceptableTypes)); } } diff --git a/libraries/src/Event/Result/ResultTypeStringAware.php b/libraries/src/Event/Result/ResultTypeStringAware.php index 9b1d6a6796f4b..2f5493745c25d 100644 --- a/libraries/src/Event/Result/ResultTypeStringAware.php +++ b/libraries/src/Event/Result/ResultTypeStringAware.php @@ -64,7 +64,7 @@ public function typeCheckResult($data): void } if (!\is_string($data)) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts String results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts String results.', $this->getName())); } } } diff --git a/libraries/src/Event/User/AuthorisationEvent.php b/libraries/src/Event/User/AuthorisationEvent.php index 2fbece50dc74d..d5f6c143a8fad 100644 --- a/libraries/src/Event/User/AuthorisationEvent.php +++ b/libraries/src/Event/User/AuthorisationEvent.php @@ -80,7 +80,7 @@ protected function onSetOptions(array $value): array public function typeCheckResult($data): void { if (!$data instanceof AuthenticationResponse) { - throw new \InvalidArgumentException(sprintf('Event %s only accepts AuthenticationResponse results.', $this->getName())); + throw new \InvalidArgumentException(\sprintf('Event %s only accepts AuthenticationResponse results.', $this->getName())); } } diff --git a/libraries/src/Exception/ExceptionHandler.php b/libraries/src/Exception/ExceptionHandler.php index f3e09e99514f2..c8816c941511e 100644 --- a/libraries/src/Exception/ExceptionHandler.php +++ b/libraries/src/Exception/ExceptionHandler.php @@ -216,7 +216,7 @@ protected static function logException(\Throwable $error) // Try to log the error, but don't let the logging cause a fatal error try { Log::add( - sprintf( + \sprintf( 'Uncaught Throwable of type %1$s thrown with message "%2$s". Stack trace: %3$s', \get_class($error), $error->getMessage(), diff --git a/libraries/src/Extension/ExtensionHelper.php b/libraries/src/Extension/ExtensionHelper.php index d7f555d039b3a..f17b506296849 100644 --- a/libraries/src/Extension/ExtensionHelper.php +++ b/libraries/src/Extension/ExtensionHelper.php @@ -463,12 +463,12 @@ public static function checkIfCoreExtension($type, $element, $clientId = 0, $fol public static function getExtensionRecord(string $element, string $type, ?int $clientId = null, ?string $folder = null): ?\stdClass { if ($type === 'plugin' && $folder === null) { - throw new \InvalidArgumentException(sprintf('`$folder` is required when `$type` is `plugin` in %s()', __METHOD__)); + throw new \InvalidArgumentException(\sprintf('`$folder` is required when `$type` is `plugin` in %s()', __METHOD__)); } if (\in_array($type, ['module', 'language', 'template'], true) && $clientId === null) { throw new \InvalidArgumentException( - sprintf('`$clientId` is required when `$type` is `module`, `language` or `template` in %s()', __METHOD__) + \sprintf('`$clientId` is required when `$type` is `module`, `language` or `template` in %s()', __METHOD__) ); } diff --git a/libraries/src/Factory.php b/libraries/src/Factory.php index fba5557f9d0de..cbe5709d4bcce 100644 --- a/libraries/src/Factory.php +++ b/libraries/src/Factory.php @@ -183,7 +183,7 @@ public static function getApplication() public static function getConfig($file = null, $type = 'PHP', $namespace = '') { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. The configuration object should be read from the application.', __METHOD__ ), @@ -264,7 +264,7 @@ public static function getContainer(): Container public static function getSession(array $options = []) { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the session from the dependency injection container or via %2$s::getApplication()->getSession().', __METHOD__, __CLASS__ @@ -293,7 +293,7 @@ public static function getSession(array $options = []) public static function getLanguage() { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the language from the dependency injection container or via %2$s::getApplication()->getLanguage().', __METHOD__, __CLASS__ @@ -326,7 +326,7 @@ public static function getLanguage() public static function getDocument() { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the document from the dependency injection container or via %2$s::getApplication()->getDocument().', __METHOD__, __CLASS__ @@ -361,7 +361,7 @@ public static function getDocument() public static function getUser($id = null) { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the user from the dependency injection container or via %2$s::getApplication()->getIdentity().', __METHOD__, __CLASS__ @@ -405,7 +405,7 @@ public static function getUser($id = null) public static function getCache($group = '', $handler = 'callback', $storage = null) { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. The cache controller should be fetched from the factory.', __METHOD__ ), @@ -451,7 +451,7 @@ public static function getCache($group = '', $handler = 'callback', $storage = n public static function getDbo() { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the database from the dependency injection container.', __METHOD__ ), @@ -561,7 +561,7 @@ public static function getDate($time = 'now', $tzOffset = null) protected static function createConfig($file, $type = 'PHP', $namespace = '') { @trigger_error( - sprintf( + \sprintf( '%s() is deprecated. The configuration object should be read from the application.', __METHOD__ ), @@ -646,7 +646,7 @@ protected static function createContainer(): Container protected static function createDbo() { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated, register a service provider to create a %2$s instance instead.', __METHOD__, DatabaseInterface::class @@ -731,7 +731,7 @@ protected static function createMailer() protected static function createLanguage() { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the language from the dependency injection container or via %2$s::getApplication()->getLanguage().', __METHOD__, __CLASS__ @@ -762,7 +762,7 @@ protected static function createLanguage() protected static function createDocument() { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the document from the dependency injection container or via %2$s::getApplication()->getDocument().', __METHOD__, __CLASS__ diff --git a/libraries/src/Feed/Feed.php b/libraries/src/Feed/Feed.php index f249fa6151f36..b256bcda7d44d 100644 --- a/libraries/src/Feed/Feed.php +++ b/libraries/src/Feed/Feed.php @@ -87,7 +87,7 @@ public function __set($name, $value) // Validate that any authors that are set are instances of JFeedPerson or null. if (($name === 'author') && (!($value instanceof FeedPerson) || ($value === null))) { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%1$s "author" must be an instance of Joomla\\CMS\\Feed\\FeedPerson. %2$s given.', \get_class($this), \is_object($value) ? \get_class($value) : \gettype($value) @@ -98,7 +98,7 @@ public function __set($name, $value) // Disallow setting categories or contributors directly. if (\in_array($name, ['categories', 'contributors'])) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Cannot directly set %1$s property "%2$s".', \get_class($this), $name @@ -239,7 +239,7 @@ public function offsetSet($offset, $value): void { if (!($value instanceof FeedEntry)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%1$s entries must be an instance of Joomla\\CMS\\Feed\\FeedPerson. %2$s given.', \get_class($this), \is_object($value) ? \get_class($value) : \gettype($value) diff --git a/libraries/src/Feed/FeedEntry.php b/libraries/src/Feed/FeedEntry.php index ecb8998072c6b..7f9f7bb1f6261 100644 --- a/libraries/src/Feed/FeedEntry.php +++ b/libraries/src/Feed/FeedEntry.php @@ -82,7 +82,7 @@ public function __set($name, $value) // Validate that any authors that are set are instances of JFeedPerson or null. if (($name === 'author') && (!($value instanceof FeedPerson) || ($value === null))) { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%1$s "author" must be an instance of Joomla\\CMS\\Feed\\FeedPerson. %2$s given.', \get_class($this), \is_object($value) ? \get_class($value) : \gettype($value) @@ -93,7 +93,7 @@ public function __set($name, $value) // Validate that any sources that are set are instances of JFeed or null. if (($name === 'source') && (!($value instanceof Feed) || ($value === null))) { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%1$s "source" must be an instance of Joomla\\CMS\\Feed\\Feed. %2$s given.', \get_class($this), \is_object($value) ? \get_class($value) : \gettype($value) @@ -104,7 +104,7 @@ public function __set($name, $value) // Disallow setting categories, contributors, or links directly. if (\in_array($name, ['categories', 'contributors', 'links'])) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Cannot directly set %1$s property "%2$s".', \get_class($this), $name diff --git a/libraries/src/Filesystem/Folder.php b/libraries/src/Filesystem/Folder.php index 73a27b5da87d0..49d5af0d08ae9 100644 --- a/libraries/src/Filesystem/Folder.php +++ b/libraries/src/Filesystem/Folder.php @@ -136,7 +136,7 @@ public static function copy($src, $dest, $path = '', $force = false, $useStreams if (!$stream->copy($sfid, $dfid)) { throw new \RuntimeException( - sprintf( + \sprintf( "Cannot copy file: %s", Path::removeRoot($stream->getError()) ), diff --git a/libraries/src/Form/Field/CalendarField.php b/libraries/src/Form/Field/CalendarField.php index fb820f2d5e663..0c72d801cfa23 100644 --- a/libraries/src/Form/Field/CalendarField.php +++ b/libraries/src/Form/Field/CalendarField.php @@ -393,7 +393,7 @@ public function filter($value, $group = null, ?Registry $input = null) { // Make sure there is a valid SimpleXMLElement. if (!($this->element instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::filter `element` is not an instance of SimpleXMLElement', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s::filter `element` is not an instance of SimpleXMLElement', \get_class($this))); } if ((int) $value <= 0) { diff --git a/libraries/src/Form/Field/CheckboxesField.php b/libraries/src/Form/Field/CheckboxesField.php index ee904ac49271c..dfe3fc2c5a2b1 100644 --- a/libraries/src/Form/Field/CheckboxesField.php +++ b/libraries/src/Form/Field/CheckboxesField.php @@ -107,7 +107,7 @@ public function __set($name, $value) protected function getInput() { if (empty($this->layout)) { - throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name)); + throw new \UnexpectedValueException(\sprintf('%s has no layout assigned.', $this->name)); } return $this->getRenderer($this->layout)->render($this->collectLayoutData()); diff --git a/libraries/src/Form/Field/ComboField.php b/libraries/src/Form/Field/ComboField.php index 24d57b55e261a..8651db16fb251 100644 --- a/libraries/src/Form/Field/ComboField.php +++ b/libraries/src/Form/Field/ComboField.php @@ -47,7 +47,7 @@ class ComboField extends ListField protected function getInput() { if (empty($this->layout)) { - throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name)); + throw new \UnexpectedValueException(\sprintf('%s has no layout assigned.', $this->name)); } return $this->getRenderer($this->layout)->render($this->collectLayoutData()); diff --git a/libraries/src/Form/Field/ContenthistoryField.php b/libraries/src/Form/Field/ContenthistoryField.php index 68f192f12159b..ee96e8933bd94 100644 --- a/libraries/src/Form/Field/ContenthistoryField.php +++ b/libraries/src/Form/Field/ContenthistoryField.php @@ -74,7 +74,7 @@ public function getLayoutData() protected function getInput() { if (empty($this->layout)) { - throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name)); + throw new \UnexpectedValueException(\sprintf('%s has no layout assigned.', $this->name)); } return $this->getRenderer($this->layout)->render($this->collectLayoutData()); diff --git a/libraries/src/Form/Field/GroupedlistField.php b/libraries/src/Form/Field/GroupedlistField.php index 79d79014d87b0..9cf88ba6e76f8 100644 --- a/libraries/src/Form/Field/GroupedlistField.php +++ b/libraries/src/Form/Field/GroupedlistField.php @@ -138,7 +138,7 @@ protected function getGroups() default: // Unknown element type. - throw new \UnexpectedValueException(sprintf('Unsupported element %s in GroupedlistField', $element->getName()), 500); + throw new \UnexpectedValueException(\sprintf('Unsupported element %s in GroupedlistField', $element->getName()), 500); } } diff --git a/libraries/src/Form/Field/MediaField.php b/libraries/src/Form/Field/MediaField.php index b4cd1ad5842b8..73004903c7b6f 100644 --- a/libraries/src/Form/Field/MediaField.php +++ b/libraries/src/Form/Field/MediaField.php @@ -251,7 +251,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) protected function getInput() { if (empty($this->layout)) { - throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name)); + throw new \UnexpectedValueException(\sprintf('%s has no layout assigned.', $this->name)); } return $this->getRenderer($this->layout)->render($this->collectLayoutData()); diff --git a/libraries/src/Form/Field/ModalSelectField.php b/libraries/src/Form/Field/ModalSelectField.php index e6e71dec4c4df..8a56938b6001a 100644 --- a/libraries/src/Form/Field/ModalSelectField.php +++ b/libraries/src/Form/Field/ModalSelectField.php @@ -247,7 +247,7 @@ public function __set($name, $value) protected function getInput() { if (empty($this->layout)) { - throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name)); + throw new \UnexpectedValueException(\sprintf('%s has no layout assigned.', $this->name)); } // Get the layout data diff --git a/libraries/src/Form/Field/SubformField.php b/libraries/src/Form/Field/SubformField.php index 828607166aa02..cd2213e647718 100644 --- a/libraries/src/Form/Field/SubformField.php +++ b/libraries/src/Form/Field/SubformField.php @@ -411,7 +411,7 @@ public function filter($value, $group = null, ?Registry $input = null) { // Make sure there is a valid SimpleXMLElement. if (!($this->element instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::filter `element` is not an instance of SimpleXMLElement', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s::filter `element` is not an instance of SimpleXMLElement', \get_class($this))); } // Get the field filter type. diff --git a/libraries/src/Form/Field/UserField.php b/libraries/src/Form/Field/UserField.php index 65c1edc7e20cf..24b187e89867a 100644 --- a/libraries/src/Form/Field/UserField.php +++ b/libraries/src/Form/Field/UserField.php @@ -95,7 +95,7 @@ public function setup(\SimpleXMLElement $element, $value, $group = null) protected function getInput() { if (empty($this->layout)) { - throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name)); + throw new \UnexpectedValueException(\sprintf('%s has no layout assigned.', $this->name)); } return $this->getRenderer($this->layout)->render($this->collectLayoutData()); diff --git a/libraries/src/Form/Form.php b/libraries/src/Form/Form.php index 391089c5108cf..a411ea97e0bf7 100644 --- a/libraries/src/Form/Form.php +++ b/libraries/src/Form/Form.php @@ -131,7 +131,7 @@ public function bind($data) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // The data must be an object or array. @@ -208,7 +208,7 @@ public function getField($name, $group = null, $value = null) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Attempt to find the field by name and group. @@ -240,7 +240,7 @@ public function getFieldAttribute($name, $attribute, $default = null, $group = n { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Find the form field element from the definition. @@ -314,7 +314,7 @@ public function getFieldsets($group = null) // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } if ($group) { @@ -711,7 +711,7 @@ public function removeField($name, $group = null) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Find the form field element from the definition. @@ -742,7 +742,7 @@ public function removeGroup($group) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Get the fields elements for a given group. @@ -797,7 +797,7 @@ public function setField(\SimpleXMLElement $element, $group = null, $replace = t { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Find the form field element from the definition. @@ -883,7 +883,7 @@ public function setFieldAttribute($name, $attribute, $value, $group = null) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Find the form field element from the definition. @@ -922,13 +922,13 @@ public function setFields(&$elements, $group = null, $replace = true, $fieldset { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Make sure the elements to set are valid. foreach ($elements as $element) { if (!($element instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } } @@ -1013,7 +1013,7 @@ public function filter($data, $group = null) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } $input = new Registry($data); @@ -1070,7 +1070,7 @@ public function validate($data, $group = null) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } $return = true; @@ -1156,7 +1156,7 @@ public function postProcess($data, $group = null) { // Make sure there is a valid SimpleXMLElement if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } $input = new Registry($data); @@ -1208,7 +1208,7 @@ protected function findField($name, $group = null) // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Let's get the appropriate field element based on the method arguments. @@ -1281,7 +1281,7 @@ protected function &findFieldsByFieldset($name) { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } /* @@ -1313,7 +1313,7 @@ protected function &findFieldsByGroup($group = null, $nested = false) // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Get only fields in a specific group? @@ -1372,7 +1372,7 @@ protected function &findGroup($group) // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Make sure there is actually a group to find. @@ -1442,7 +1442,7 @@ protected function loadField($element, $group = null, $value = null) { // Make sure there is a valid SimpleXMLElement. if (!($element instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Get the field type. @@ -1455,7 +1455,7 @@ protected function loadField($element, $group = null, $value = null) try { $field->setDatabase($this->getDatabase()); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $field->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } } @@ -1515,7 +1515,7 @@ protected function syncPaths() { // Make sure there is a valid Form XML document. if (!($this->xml instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); + throw new \UnexpectedValueException(\sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__)); } // Get any addfieldpath attributes from the form definition. @@ -1687,7 +1687,7 @@ public static function getInstance($name, $data = null, $options = [], $replace $data = trim($data); if (empty($data)) { - throw new \InvalidArgumentException(sprintf('%1$s(%2$s, *%3$s*)', __METHOD__, $name, \gettype($data))); + throw new \InvalidArgumentException(\sprintf('%1$s(%2$s, *%3$s*)', __METHOD__, $name, \gettype($data))); } // Instantiate the form. @@ -1696,11 +1696,11 @@ public static function getInstance($name, $data = null, $options = [], $replace // Load the data. if (substr($data, 0, 1) === '<') { if ($forms[$name]->load($data, $replace, $xpath) == false) { - throw new \RuntimeException(sprintf('%s() could not load form', __METHOD__)); + throw new \RuntimeException(\sprintf('%s() could not load form', __METHOD__)); } } else { if ($forms[$name]->loadFile($data, $replace, $xpath) == false) { - throw new \RuntimeException(sprintf('%s() could not load file', __METHOD__)); + throw new \RuntimeException(\sprintf('%s() could not load file', __METHOD__)); } } } diff --git a/libraries/src/Form/FormField.php b/libraries/src/Form/FormField.php index c307df956279f..c0c0c9274662f 100644 --- a/libraries/src/Form/FormField.php +++ b/libraries/src/Form/FormField.php @@ -776,7 +776,7 @@ protected function getId($fieldId, $fieldName) protected function getInput() { if (empty($this->layout)) { - throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name)); + throw new \UnexpectedValueException(\sprintf('%s has no layout assigned.', $this->name)); } return $this->getRenderer($this->layout)->render($this->collectLayoutData()); @@ -1080,7 +1080,7 @@ public function filter($value, $group = null, ?Registry $input = null) { // Make sure there is a valid SimpleXMLElement. if (!($this->element instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::filter `element` is not an instance of SimpleXMLElement', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s::filter `element` is not an instance of SimpleXMLElement', \get_class($this))); } // Get the field filter type. @@ -1103,7 +1103,7 @@ public function filter($value, $group = null, ?Registry $input = null) [$class, $method] = explode('::', $filter); if ($class === 'JComponentHelper') { throw new \UnexpectedValueException( - sprintf( + \sprintf( '%s::filter field `%s` calls a deprecated filter class %s, the class needs to be namespaced use %s instead or activate the backward compatible plugin.', \get_class($this), $this->element['name'], @@ -1176,7 +1176,7 @@ public function validate($value, $group = null, ?Registry $input = null) { // Make sure there is a valid SimpleXMLElement. if (!($this->element instanceof \SimpleXMLElement)) { - throw new \UnexpectedValueException(sprintf('%s::validate `element` is not an instance of SimpleXMLElement', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s::validate `element` is not an instance of SimpleXMLElement', \get_class($this))); } $valid = true; @@ -1211,14 +1211,14 @@ public function validate($value, $group = null, ?Registry $input = null) // If the object could not be loaded return an error message. if ($rule === false) { - throw new \UnexpectedValueException(sprintf('%s::validate() rule `%s` missing.', \get_class($this), $type)); + throw new \UnexpectedValueException(\sprintf('%s::validate() rule `%s` missing.', \get_class($this), $type)); } if ($rule instanceof DatabaseAwareInterface) { try { $rule->setDatabase($this->getDatabase()); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } } @@ -1243,7 +1243,7 @@ public function validate($value, $group = null, ?Registry $input = null) try { $rule->setDatabase($this->getDatabase()); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } } diff --git a/libraries/src/Form/FormRule.php b/libraries/src/Form/FormRule.php index 922aa70aa9b77..2fe8c5c7c1b2f 100644 --- a/libraries/src/Form/FormRule.php +++ b/libraries/src/Form/FormRule.php @@ -73,7 +73,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr { // Check for a valid regex. if (empty($this->regex)) { - throw new \UnexpectedValueException(sprintf('%s has invalid regex.', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s has invalid regex.', \get_class($this))); } // Detect if we have full UTF-8 and unicode PCRE support. diff --git a/libraries/src/Form/Rule/EqualsRule.php b/libraries/src/Form/Rule/EqualsRule.php index a2fc1123accbb..e7fb6d3deff34 100644 --- a/libraries/src/Form/Rule/EqualsRule.php +++ b/libraries/src/Form/Rule/EqualsRule.php @@ -49,15 +49,15 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr // Check that a validation field is set. if (!$field) { - throw new \UnexpectedValueException(sprintf('$field empty in %s::test', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('$field empty in %s::test', \get_class($this))); } if (\is_null($form)) { - throw new \InvalidArgumentException(sprintf('The value for $form must not be null in %s', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('The value for $form must not be null in %s', \get_class($this))); } if (\is_null($input)) { - throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('The value for $input must not be null in %s', \get_class($this))); } $test = $input->get($field); diff --git a/libraries/src/Form/Rule/NotequalsRule.php b/libraries/src/Form/Rule/NotequalsRule.php index eb9e8d24cd035..ab7d520ff7fda 100644 --- a/libraries/src/Form/Rule/NotequalsRule.php +++ b/libraries/src/Form/Rule/NotequalsRule.php @@ -49,11 +49,11 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr // Check that a validation field is set. if (!$field) { - throw new \UnexpectedValueException(sprintf('$field empty in %s::test', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('$field empty in %s::test', \get_class($this))); } if ($input === null) { - throw new \InvalidArgumentException(sprintf('The value for $input must not be null in %s', \get_class($this))); + throw new \InvalidArgumentException(\sprintf('The value for $input must not be null in %s', \get_class($this))); } // Test the two values against each other. diff --git a/libraries/src/Form/Rule/SubformRule.php b/libraries/src/Form/Rule/SubformRule.php index 07d167c919cae..b34f40beab2cc 100644 --- a/libraries/src/Form/Rule/SubformRule.php +++ b/libraries/src/Form/Rule/SubformRule.php @@ -46,7 +46,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr $field = $form->getField($element['name'], $group); if (!($field instanceof SubformField)) { - throw new \UnexpectedValueException(sprintf('%s is no subform field.', $element['name'])); + throw new \UnexpectedValueException(\sprintf('%s is no subform field.', $element['name'])); } if ($value === null) { diff --git a/libraries/src/HTML/HTMLHelper.php b/libraries/src/HTML/HTMLHelper.php index dbfe050bdfb77..aeb74f1266eaf 100644 --- a/libraries/src/HTML/HTMLHelper.php +++ b/libraries/src/HTML/HTMLHelper.php @@ -142,7 +142,7 @@ final public static function _(string $key, ...$methodArgs) $toCall = [$service, $func]; if (!\is_callable($toCall)) { - throw new \InvalidArgumentException(sprintf('%s::%s not found.', $file, $func), 500); + throw new \InvalidArgumentException(\sprintf('%s::%s not found.', $file, $func), 500); } static::register($key, $toCall); @@ -156,14 +156,14 @@ final public static function _(string $key, ...$methodArgs) $path = Path::find(static::$includePaths, strtolower($file) . '.php'); if (!$path) { - throw new \InvalidArgumentException(sprintf('%s %s not found.', $prefix, $file), 500); + throw new \InvalidArgumentException(\sprintf('%s %s not found.', $prefix, $file), 500); } \JLoader::register($className, $path); if (!class_exists($className)) { if ($prefix !== 'Joomla\\CMS\\HTML\\HTMLHelper') { - throw new \InvalidArgumentException(sprintf('%s not found.', $className), 500); + throw new \InvalidArgumentException(\sprintf('%s not found.', $className), 500); } // @deprecated with 5.0 remove with 6.0 or 7.0 (depends on other relevant code) @@ -172,7 +172,7 @@ final public static function _(string $key, ...$methodArgs) \JLoader::register($className, $path); if (!class_exists($className)) { - throw new \InvalidArgumentException(sprintf('%s not found.', $className), 500); + throw new \InvalidArgumentException(\sprintf('%s not found.', $className), 500); } } } @@ -187,7 +187,7 @@ final public static function _(string $key, ...$methodArgs) $toCall = [$className, $func]; if (!\is_callable($toCall)) { - throw new \InvalidArgumentException(sprintf('%s::%s not found.', $className, $func), 500); + throw new \InvalidArgumentException(\sprintf('%s::%s not found.', $className, $func), 500); } static::register($key, $toCall); diff --git a/libraries/src/HTML/Helpers/Select.php b/libraries/src/HTML/Helpers/Select.php index 7a1b20abc293a..476e976c2818f 100644 --- a/libraries/src/HTML/Helpers/Select.php +++ b/libraries/src/HTML/Helpers/Select.php @@ -321,7 +321,7 @@ public static function integerlist($start, $end, $inc, $name, $attribs = null, $ $data = []; for ($i = $start; $i <= $end; $i += $inc) { - $data[$i] = $format ? sprintf($format, $i) : $i; + $data[$i] = $format ? \sprintf($format, $i) : $i; } // Tell genericlist() to use array keys diff --git a/libraries/src/HTML/Registry.php b/libraries/src/HTML/Registry.php index 3e28893dd4338..2ca78318c3f7c 100644 --- a/libraries/src/HTML/Registry.php +++ b/libraries/src/HTML/Registry.php @@ -120,7 +120,7 @@ public function register(string $key, $handler, bool $replace = false) // Otherwise the handler must be a class object if (!\is_string($handler) && !\is_object($handler)) { throw new \RuntimeException( - sprintf( + \sprintf( 'The handler for service key %1$s must be a PHP class name or class object, a %2$s was given.', $key, \gettype($handler) diff --git a/libraries/src/Helper/RouteHelper.php b/libraries/src/Helper/RouteHelper.php index 09648931e433d..b63349b08d789 100644 --- a/libraries/src/Helper/RouteHelper.php +++ b/libraries/src/Helper/RouteHelper.php @@ -221,7 +221,7 @@ public static function getCategoryRoute($catid, $language = 0, $extension = '') { // Note: $extension is required but has to be an optional argument in the function call due to argument order if (empty($extension)) { - throw new \InvalidArgumentException(sprintf('$extension is a required argument in %s()', __METHOD__)); + throw new \InvalidArgumentException(\sprintf('$extension is a required argument in %s()', __METHOD__)); } if ($catid instanceof CategoryNode) { diff --git a/libraries/src/Http/Transport/SocketTransport.php b/libraries/src/Http/Transport/SocketTransport.php index a7e64e766ce0a..45c10da198e7a 100644 --- a/libraries/src/Http/Transport/SocketTransport.php +++ b/libraries/src/Http/Transport/SocketTransport.php @@ -242,7 +242,7 @@ protected function connect(UriInterface $uri, $timeout = null) if (!$connection) { // Error but nothing from php? Create our own if (!$err) { - $err = sprintf('Could not connect to host: %s:%s', $host, $port); + $err = \sprintf('Could not connect to host: %s:%s', $host, $port); } throw new \Exception($err); diff --git a/libraries/src/Http/Transport/StreamTransport.php b/libraries/src/Http/Transport/StreamTransport.php index cb821727cc9e0..320db7b78268c 100644 --- a/libraries/src/Http/Transport/StreamTransport.php +++ b/libraries/src/Http/Transport/StreamTransport.php @@ -154,7 +154,7 @@ public function request($method, UriInterface $uri, $data = null, array $headers if (!$stream) { // Error but nothing from php? Create our own - throw new \Exception(sprintf('Could not connect to resource: %s', $uri)); + throw new \Exception(\sprintf('Could not connect to resource: %s', $uri)); } } catch (\Exception $e) { throw new \RuntimeException($e->getMessage()); diff --git a/libraries/src/Installer/Adapter/ComponentAdapter.php b/libraries/src/Installer/Adapter/ComponentAdapter.php index 4a3fbc7138760..eaa2c5f2a60bc 100644 --- a/libraries/src/Installer/Adapter/ComponentAdapter.php +++ b/libraries/src/Installer/Adapter/ComponentAdapter.php @@ -559,7 +559,7 @@ public function loadLanguage($path = null) default: throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Unsupported client ID %d for component %s', $this->parent->extension->client_id, $this->parent->extension->element diff --git a/libraries/src/Installer/Installer.php b/libraries/src/Installer/Installer.php index b8a240771a998..dcdd10f90699c 100644 --- a/libraries/src/Installer/Installer.php +++ b/libraries/src/Installer/Installer.php @@ -1265,7 +1265,7 @@ public function parseSchemaUpdates(\SimpleXMLElement $schema, $eid) continue; } - $buffer = file_get_contents(sprintf("%s/%s/%s.sql", $this->getPath('extension_root'), $schemapath, $file)); + $buffer = file_get_contents(\sprintf("%s/%s/%s.sql", $this->getPath('extension_root'), $schemapath, $file)); // Graceful exit and rollback if read not successful if ($buffer === false) { @@ -2435,7 +2435,7 @@ public function loadAdapter($adapter, $options = []) } if (!class_exists($class)) { - throw new \InvalidArgumentException(sprintf('The %s install adapter does not exist.', $adapter)); + throw new \InvalidArgumentException(\sprintf('The %s install adapter does not exist.', $adapter)); } // Ensure the adapter type is part of the options array diff --git a/libraries/src/Installer/LegacyInstallerScript.php b/libraries/src/Installer/LegacyInstallerScript.php index 9b017ebde0a01..51a95e46dcf35 100644 --- a/libraries/src/Installer/LegacyInstallerScript.php +++ b/libraries/src/Installer/LegacyInstallerScript.php @@ -180,7 +180,7 @@ private function callOnScript(string $name, array $arguments): bool try { $this->installerScript->setDatabase($this->getDatabase()); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 6.0 in %s.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 6.0 in %s.', __METHOD__), E_USER_DEPRECATED); $this->installerScript->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } } diff --git a/libraries/src/Language/Language.php b/libraries/src/Language/Language.php index 33e03ae72b307..6709047a9cc31 100644 --- a/libraries/src/Language/Language.php +++ b/libraries/src/Language/Language.php @@ -739,7 +739,7 @@ public function debugFile(string $filename): int // Make sure our file actually exists if (!is_file($filename)) { throw new \InvalidArgumentException( - sprintf('Unable to locate file "%s" for debugging', $filename) + \sprintf('Unable to locate file "%s" for debugging', $filename) ); } diff --git a/libraries/src/Language/Text.php b/libraries/src/Language/Text.php index da5c56568875a..90c910e651682 100644 --- a/libraries/src/Language/Text.php +++ b/libraries/src/Language/Text.php @@ -327,7 +327,7 @@ public static function script($string = null, $jsSafe = false, $interpretBackSla { if ($string === null) { @trigger_error( - sprintf( + \sprintf( 'As of 3.7.0, passing a null value for the first argument of %1$s() is deprecated and will not be supported in 4.0.' . ' Use the %2$s::getScriptStrings() method to get the strings from the JavaScript language store instead.', __METHOD__, diff --git a/libraries/src/Log/Log.php b/libraries/src/Log/Log.php index 69e3d1f47e445..7027dada9e235 100644 --- a/libraries/src/Log/Log.php +++ b/libraries/src/Log/Log.php @@ -329,7 +329,7 @@ protected function addLogEntry(LogEntry $entry) $class = $this->loggerRegistry->getLoggerClass($this->configurations[$signature]['logger']); } else { @trigger_error( - sprintf( + \sprintf( 'Attempting to automatically resolve loggers to the %s namespace is deprecated as of 4.0 and will be removed in 5.0.' . ' Use the logger registry instead.', __NAMESPACE__ diff --git a/libraries/src/Log/Logger/CallbackLogger.php b/libraries/src/Log/Logger/CallbackLogger.php index 20b26b328d6a8..87b6bf7bc27d4 100644 --- a/libraries/src/Log/Logger/CallbackLogger.php +++ b/libraries/src/Log/Logger/CallbackLogger.php @@ -49,7 +49,7 @@ public function __construct(array &$options) // Throw an exception if there is not a valid callback if (!isset($this->options['callback']) || !\is_callable($this->options['callback'])) { - throw new \RuntimeException(sprintf('%s created without valid callback function.', \get_class($this))); + throw new \RuntimeException(\sprintf('%s created without valid callback function.', \get_class($this))); } $this->callback = $this->options['callback']; diff --git a/libraries/src/MVC/Controller/BaseController.php b/libraries/src/MVC/Controller/BaseController.php index 4cb22b9c9ba77..34c7547e7bdf5 100644 --- a/libraries/src/MVC/Controller/BaseController.php +++ b/libraries/src/MVC/Controller/BaseController.php @@ -274,7 +274,7 @@ public static function getInstance($prefix, $config = []) } @trigger_error( - sprintf( + \sprintf( '%1$s::getInstance() is deprecated. Load it through the MVC factory.', self::class ), @@ -524,7 +524,7 @@ protected function checkEditId($context, $id) { if (!($this->app instanceof CMSWebApplicationInterface)) { throw new \Exception( - sprintf( + \sprintf( 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, @@ -540,7 +540,7 @@ protected function checkEditId($context, $id) if (\defined('JDEBUG') && JDEBUG) { $this->getLogger()->info( - sprintf( + \sprintf( 'Checking edit ID %s.%s: %d %s', $context, $id, @@ -638,7 +638,7 @@ public function display($cachable = false, $urlparams = []) { if (!($this->app instanceof CMSWebApplicationInterface)) { throw new \Exception( - sprintf( + \sprintf( 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, @@ -900,7 +900,7 @@ protected function holdEditId($context, $id) { if (!($this->app instanceof CMSWebApplicationInterface)) { throw new \Exception( - sprintf( + \sprintf( 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, @@ -919,7 +919,7 @@ protected function holdEditId($context, $id) if (\defined('JDEBUG') && JDEBUG) { $this->getLogger()->info( - sprintf( + \sprintf( 'Holding edit ID %s.%s %s', $context, $id, @@ -943,7 +943,7 @@ public function redirect() { if (!($this->app instanceof CMSWebApplicationInterface)) { throw new \Exception( - sprintf( + \sprintf( 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, @@ -1029,7 +1029,7 @@ protected function releaseEditId($context, $id) { if (!($this->app instanceof CMSWebApplicationInterface)) { throw new \Exception( - sprintf( + \sprintf( 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, @@ -1049,7 +1049,7 @@ protected function releaseEditId($context, $id) if (\defined('JDEBUG') && JDEBUG) { $this->getLogger()->info( - sprintf( + \sprintf( 'Releasing edit ID %s.%s %s', $context, $id, @@ -1134,7 +1134,7 @@ public function checkToken($method = 'post', $redirect = true) { if (!($this->app instanceof CMSWebApplicationInterface)) { throw new \Exception( - sprintf( + \sprintf( 'The %s method requires an instance of %s but instead %s was supplied', __METHOD__, CMSWebApplicationInterface::class, @@ -1236,7 +1236,7 @@ public function getDispatcher() { if (!$this->dispatcher) { @trigger_error( - sprintf('Dispatcher for %s should be set through MVC factory. It will throw an exception in 6.0', __CLASS__), + \sprintf('Dispatcher for %s should be set through MVC factory. It will throw an exception in 6.0', __CLASS__), E_USER_DEPRECATED ); diff --git a/libraries/src/MVC/Factory/MVCFactory.php b/libraries/src/MVC/Factory/MVCFactory.php index d3f02193c279a..a0282f2b4d69b 100644 --- a/libraries/src/MVC/Factory/MVCFactory.php +++ b/libraries/src/MVC/Factory/MVCFactory.php @@ -143,7 +143,7 @@ public function createModel($name, $prefix = '', array $config = []) if (!$prefix) { @trigger_error( - sprintf( + \sprintf( 'Calling %s() without a prefix is deprecated.', __METHOD__ ), @@ -171,7 +171,7 @@ public function createModel($name, $prefix = '', array $config = []) try { $model->setDatabase($this->getDatabase()); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $model->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } } @@ -201,7 +201,7 @@ public function createView($name, $prefix = '', $type = '', array $config = []) if (!$prefix) { @trigger_error( - sprintf( + \sprintf( 'Calling %s() without a prefix is deprecated.', __METHOD__ ), @@ -247,7 +247,7 @@ public function createTable($name, $prefix = '', array $config = []) if (!$prefix) { @trigger_error( - sprintf( + \sprintf( 'Calling %s() without a prefix is deprecated.', __METHOD__ ), @@ -267,7 +267,7 @@ public function createTable($name, $prefix = '', array $config = []) try { $db = \array_key_exists('dbo', $config) ? $config['dbo'] : $this->getDatabase(); } catch (DatabaseNotFoundException $e) { - @trigger_error(sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $db = Factory::getContainer()->get(DatabaseInterface::class); } diff --git a/libraries/src/MVC/Model/BaseDatabaseModel.php b/libraries/src/MVC/Model/BaseDatabaseModel.php index 82e7778cfe5da..0d6a89d532ad6 100644 --- a/libraries/src/MVC/Model/BaseDatabaseModel.php +++ b/libraries/src/MVC/Model/BaseDatabaseModel.php @@ -105,7 +105,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null) $db = \array_key_exists('dbo', $config) ? $config['dbo'] : Factory::getDbo(); if ($db) { - @trigger_error(sprintf('Database is not available in constructor in 6.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database is not available in constructor in 6.0.'), E_USER_DEPRECATED); $this->setDatabase($db); // Is needed, when models use the deprecated MVC DatabaseAwareTrait, as the trait is overriding the local functions @@ -348,7 +348,7 @@ public function getDispatcher() { if (!$this->dispatcher) { @trigger_error( - sprintf('Dispatcher for %s should be set through MVC factory. It will throw an exception in 6.0', __CLASS__), + \sprintf('Dispatcher for %s should be set through MVC factory. It will throw an exception in 6.0', __CLASS__), E_USER_DEPRECATED ); @@ -374,7 +374,7 @@ protected function dispatchEvent(EventInterface $event) $this->getDispatcher()->dispatch($event->getName(), $event); @trigger_error( - sprintf( + \sprintf( 'Method %s is deprecated and will be removed in 6.0. Use getDispatcher()->dispatch() directly.', __METHOD__ ), diff --git a/libraries/src/MVC/Model/LegacyModelLoaderTrait.php b/libraries/src/MVC/Model/LegacyModelLoaderTrait.php index 3e475cb44b4d5..ee8a93d14273b 100644 --- a/libraries/src/MVC/Model/LegacyModelLoaderTrait.php +++ b/libraries/src/MVC/Model/LegacyModelLoaderTrait.php @@ -67,7 +67,7 @@ protected static function _createFileName($type, $parts = []) public static function getInstance($type, $prefix = '', $config = []) { @trigger_error( - sprintf( + \sprintf( '%1$s::getInstance() is deprecated. Load it through the MVC factory.', self::class ), diff --git a/libraries/src/MVC/Model/State.php b/libraries/src/MVC/Model/State.php index eb26955ab553d..654f4a3669106 100644 --- a/libraries/src/MVC/Model/State.php +++ b/libraries/src/MVC/Model/State.php @@ -54,7 +54,7 @@ public function get($path, $default = null) { if (isset($this->data->$path) && empty($this->data->$path)) { @trigger_error( - sprintf('Instead of an empty value, the default value will be returned in 7.0 in %s::%s.', __METHOD__, __CLASS__), + \sprintf('Instead of an empty value, the default value will be returned in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED ); return $this->data->$path; @@ -91,7 +91,7 @@ public function getProperties() */ public function __get($name) { - @trigger_error(sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); return $this->get($name); } @@ -111,7 +111,7 @@ public function __get($name) */ public function __set($name, $value) { - @trigger_error(sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); return $this->set($name, $value); } @@ -130,7 +130,7 @@ public function __set($name, $value) */ public function __isset($name) { - @trigger_error(sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); return $this->exists($name); } diff --git a/libraries/src/MVC/View/AbstractView.php b/libraries/src/MVC/View/AbstractView.php index c223f2881eb27..df92ff5094e66 100644 --- a/libraries/src/MVC/View/AbstractView.php +++ b/libraries/src/MVC/View/AbstractView.php @@ -239,7 +239,7 @@ public function getName() } if (empty($this->_name)) { - throw new \Exception(sprintf($this->getLanguage()->_('JLIB_APPLICATION_ERROR_GET_NAME'), __METHOD__), 500); + throw new \Exception(\sprintf($this->getLanguage()->_('JLIB_APPLICATION_ERROR_GET_NAME'), __METHOD__), 500); } } @@ -292,7 +292,7 @@ public function getDispatcher() { if (!$this->dispatcher) { @trigger_error( - sprintf('Dispatcher for %s should be set through MVC factory. It will throw an exception in 6.0', __CLASS__), + \sprintf('Dispatcher for %s should be set through MVC factory. It will throw an exception in 6.0', __CLASS__), E_USER_DEPRECATED ); @@ -318,7 +318,7 @@ protected function dispatchEvent(EventInterface $event) $this->getDispatcher()->dispatch($event->getName(), $event); @trigger_error( - sprintf( + \sprintf( 'Method %s is deprecated and will be removed in 6.0. Use getDispatcher()->dispatch() directly.', __METHOD__ ), diff --git a/libraries/src/MVC/View/CanDo.php b/libraries/src/MVC/View/CanDo.php index 96e1417cbed23..6132d5e8e4dbd 100644 --- a/libraries/src/MVC/View/CanDo.php +++ b/libraries/src/MVC/View/CanDo.php @@ -54,7 +54,7 @@ public function get($path, $default = null) { if (isset($this->data->$path) && empty($this->data->$path)) { @trigger_error( - sprintf('Instead of an empty value, the default value will be returned in 7.0 in %s::%s.', __METHOD__, __CLASS__), + \sprintf('Instead of an empty value, the default value will be returned in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED ); return $this->data->$path; @@ -91,7 +91,7 @@ public function getProperties() */ public function __get($name) { - @trigger_error(sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); return $this->get($name); } @@ -111,7 +111,7 @@ public function __get($name) */ public function __set($name, $value) { - @trigger_error(sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); return $this->set($name, $value); } @@ -130,7 +130,7 @@ public function __set($name, $value) */ public function __isset($name) { - @trigger_error(sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Direct property access will not be supported in 7.0 in %s::%s.', __METHOD__, __CLASS__), E_USER_DEPRECATED); return $this->exists($name); } diff --git a/libraries/src/Mail/Mail.php b/libraries/src/Mail/Mail.php index 0c33af51780c2..4e20c60dda811 100644 --- a/libraries/src/Mail/Mail.php +++ b/libraries/src/Mail/Mail.php @@ -62,7 +62,7 @@ public function __construct($exceptions = true) // Configure a callback function to handle errors when $this->debug() is called $this->Debugoutput = function ($message, $level) { - Log::add(sprintf('Error in Mail API: %s', $message), Log::ERROR, 'mail'); + Log::add(\sprintf('Error in Mail API: %s', $message), Log::ERROR, 'mail'); }; // If debug mode is enabled then set SMTPDebug to the maximum level @@ -211,7 +211,7 @@ public function setSender($from, $name = '') // If it is neither, we log a message and throw an exception Log::add(Text::sprintf('JLIB_MAIL_INVALID_EMAIL_SENDER', $from), Log::WARNING, 'jerror'); - throw new \UnexpectedValueException(sprintf('Invalid email sender: %s', $from)); + throw new \UnexpectedValueException(\sprintf('Invalid email sender: %s', $from)); } if ($result === false) { diff --git a/libraries/src/Menu/SiteMenu.php b/libraries/src/Menu/SiteMenu.php index 2f6023c2fef7a..a0dba70a0943c 100644 --- a/libraries/src/Menu/SiteMenu.php +++ b/libraries/src/Menu/SiteMenu.php @@ -72,7 +72,7 @@ public function __construct($options = []) $this->language = isset($options['language']) && $options['language'] instanceof Language ? $options['language'] : Factory::getLanguage(); if (!isset($options['db']) || !($options['db'] instanceof DatabaseDriver)) { - @trigger_error(sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED); + @trigger_error(\sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED); $options['db'] = Factory::getContainer()->get(DatabaseDriver::class); } diff --git a/libraries/src/Profiler/Profiler.php b/libraries/src/Profiler/Profiler.php index 6bc1dcbe26581..73b755c895e24 100644 --- a/libraries/src/Profiler/Profiler.php +++ b/libraries/src/Profiler/Profiler.php @@ -121,7 +121,7 @@ public function mark($label) ]; $this->marks[] = $m; - $mark = sprintf( + $mark = \sprintf( '%s %.3f seconds (%.3f); %0.2f MB (%0.3f) - %s', $m->prefix, $m->totalTime / 1000, diff --git a/libraries/src/Proxy/ArrayReadOnlyProxy.php b/libraries/src/Proxy/ArrayReadOnlyProxy.php index 8bb657de28a69..ad57a64d96e06 100644 --- a/libraries/src/Proxy/ArrayReadOnlyProxy.php +++ b/libraries/src/Proxy/ArrayReadOnlyProxy.php @@ -62,6 +62,6 @@ public function offsetGet(mixed $offset): mixed */ public function offsetSet(mixed $offset, mixed $value): void { - throw new \RuntimeException(sprintf('ArrayReadOnlyProxy: trying to modify read-only element, by key "%s"', $offset)); + throw new \RuntimeException(\sprintf('ArrayReadOnlyProxy: trying to modify read-only element, by key "%s"', $offset)); } } diff --git a/libraries/src/Proxy/ObjectReadOnlyProxy.php b/libraries/src/Proxy/ObjectReadOnlyProxy.php index d61d7e6f6f304..938972e342d30 100644 --- a/libraries/src/Proxy/ObjectReadOnlyProxy.php +++ b/libraries/src/Proxy/ObjectReadOnlyProxy.php @@ -64,7 +64,7 @@ public function __get($key): mixed */ public function __set($key, $value): void { - throw new \RuntimeException(sprintf('ObjectReadOnlyProxy: trying to modify read-only element, by key "%s"', $key)); + throw new \RuntimeException(\sprintf('ObjectReadOnlyProxy: trying to modify read-only element, by key "%s"', $key)); } /** diff --git a/libraries/src/Router/ApiRouter.php b/libraries/src/Router/ApiRouter.php index e7d7387fd5dd7..c10cfe396bbb9 100644 --- a/libraries/src/Router/ApiRouter.php +++ b/libraries/src/Router/ApiRouter.php @@ -93,7 +93,7 @@ public function parseApiRoute($method = 'GET') $validMethods = ["GET", "POST", "PUT", "DELETE", "HEAD", "TRACE", "PATCH"]; if (!\in_array($method, $validMethods)) { - throw new \InvalidArgumentException(sprintf('%s is not a valid HTTP method.', $method)); + throw new \InvalidArgumentException(\sprintf('%s is not a valid HTTP method.', $method)); } // Get the path from the route and remove and leading or trailing slash. @@ -121,7 +121,7 @@ public function parseApiRoute($method = 'GET') } } - throw new RouteNotFoundException(sprintf('Unable to handle request for route `%s`.', $routePath)); + throw new RouteNotFoundException(\sprintf('Unable to handle request for route `%s`.', $routePath)); } /** diff --git a/libraries/src/Router/Router.php b/libraries/src/Router/Router.php index 16237592222c5..1e40cd40cd0cf 100644 --- a/libraries/src/Router/Router.php +++ b/libraries/src/Router/Router.php @@ -286,7 +286,7 @@ public function getVars() public function attachBuildRule(callable $callback, $stage = self::PROCESS_DURING) { if (!\array_key_exists('build' . $stage, $this->rules)) { - throw new \InvalidArgumentException(sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); + throw new \InvalidArgumentException(\sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); } $this->rules['build' . $stage][] = $callback; @@ -308,7 +308,7 @@ public function attachBuildRule(callable $callback, $stage = self::PROCESS_DURIN public function attachParseRule(callable $callback, $stage = self::PROCESS_DURING) { if (!\array_key_exists('parse' . $stage, $this->rules)) { - throw new \InvalidArgumentException(sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); + throw new \InvalidArgumentException(\sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); } $this->rules['parse' . $stage][] = $callback; @@ -332,11 +332,11 @@ public function attachParseRule(callable $callback, $stage = self::PROCESS_DURIN public function detachRule($type, $rule, $stage = self::PROCESS_DURING) { if (!\in_array($type, ['parse', 'build'])) { - throw new \InvalidArgumentException(sprintf('The %s type is not supported. (%s)', $type, __METHOD__)); + throw new \InvalidArgumentException(\sprintf('The %s type is not supported. (%s)', $type, __METHOD__)); } if (!\array_key_exists($type . $stage, $this->rules)) { - throw new \InvalidArgumentException(sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); + throw new \InvalidArgumentException(\sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); } foreach ($this->rules[$type . $stage] as $id => $r) { @@ -377,7 +377,7 @@ public function getRules() protected function processParseRules(&$uri, $stage = self::PROCESS_DURING) { if (!\array_key_exists('parse' . $stage, $this->rules)) { - throw new \InvalidArgumentException(sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); + throw new \InvalidArgumentException(\sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); } foreach ($this->rules['parse' . $stage] as $rule) { @@ -400,7 +400,7 @@ protected function processParseRules(&$uri, $stage = self::PROCESS_DURING) protected function processBuildRules(&$uri, $stage = self::PROCESS_DURING) { if (!\array_key_exists('build' . $stage, $this->rules)) { - throw new \InvalidArgumentException(sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); + throw new \InvalidArgumentException(\sprintf('The %s stage is not registered. (%s)', $stage, __METHOD__)); } foreach ($this->rules['build' . $stage] as $rule) { diff --git a/libraries/src/Schema/ChangeItem.php b/libraries/src/Schema/ChangeItem.php index 70080080d5630..97d11315e1c81 100644 --- a/libraries/src/Schema/ChangeItem.php +++ b/libraries/src/Schema/ChangeItem.php @@ -156,7 +156,7 @@ public static function getInstance($db, $file, $query) return new $class($db, $file, $query); } - throw new \RuntimeException(sprintf('ChangeItem child class not found for the %s database driver', $serverType), 500); + throw new \RuntimeException(\sprintf('ChangeItem child class not found for the %s database driver', $serverType), 500); } /** diff --git a/libraries/src/Serializer/JoomlaSerializer.php b/libraries/src/Serializer/JoomlaSerializer.php index e2e1bcd551da4..70dad8978239c 100644 --- a/libraries/src/Serializer/JoomlaSerializer.php +++ b/libraries/src/Serializer/JoomlaSerializer.php @@ -52,7 +52,7 @@ public function __construct(string $type) public function getAttributes($post, ?array $fields = null) { if (!\is_array($post) && !\is_object($post)) { - $message = sprintf( + $message = \sprintf( 'Invalid argument for %s. Expected array or object. Got %s', static::class, \gettype($post) diff --git a/libraries/src/Service/Provider/Authentication.php b/libraries/src/Service/Provider/Authentication.php index bc61cea1b5037..5ebb90e67f611 100644 --- a/libraries/src/Service/Provider/Authentication.php +++ b/libraries/src/Service/Provider/Authentication.php @@ -105,7 +105,7 @@ function (Container $container) { MD5Handler::class, function (Container $container) { @trigger_error( - sprintf( + \sprintf( 'The "%1$s" class service is deprecated, use the "%2$s" service for the active password handler instead.', MD5Handler::class, 'password.handler.default' @@ -123,7 +123,7 @@ function (Container $container) { PHPassHandler::class, function (Container $container) { @trigger_error( - sprintf( + \sprintf( 'The "%1$s" class service is deprecated, use the "%2$s" service for the active password handler instead.', PHPassHandler::class, 'password.handler.default' diff --git a/libraries/src/Service/Provider/Session.php b/libraries/src/Service/Provider/Session.php index 4fe992d9e3589..a65039891c7d3 100644 --- a/libraries/src/Service/Provider/Session.php +++ b/libraries/src/Service/Provider/Session.php @@ -258,7 +258,7 @@ function (Container $container) { */ if (!Factory::$application) { throw new DependencyResolutionException( - sprintf( + \sprintf( 'Creating the "session.metadata_manager" service requires %s::$application be initialised.', Factory::class ) diff --git a/libraries/src/Session/SessionFactory.php b/libraries/src/Session/SessionFactory.php index 61b0af9438dae..35707c596098d 100644 --- a/libraries/src/Session/SessionFactory.php +++ b/libraries/src/Session/SessionFactory.php @@ -126,7 +126,7 @@ public function createSessionHandler(array $options): HandlerInterface return new Handler\RedisHandler($redis, ['ttl' => $options['expire']]); default: - throw new \InvalidArgumentException(sprintf('The "%s" session handler is not recognised.', $handlerType)); + throw new \InvalidArgumentException(\sprintf('The "%s" session handler is not recognised.', $handlerType)); } } diff --git a/libraries/src/String/PunycodeHelper.php b/libraries/src/String/PunycodeHelper.php index 0946a3874c040..48e397e56e118 100644 --- a/libraries/src/String/PunycodeHelper.php +++ b/libraries/src/String/PunycodeHelper.php @@ -196,7 +196,7 @@ public static function urlToUTF8($uri) public static function emailToPunycode($email) { if ($email === null) { - @trigger_error(sprintf('Passing null value is deprecated in %s and will throw an exception in 6.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(\sprintf('Passing null value is deprecated in %s and will throw an exception in 6.0.', __METHOD__), E_USER_DEPRECATED); return ''; } diff --git a/libraries/src/Table/Asset.php b/libraries/src/Table/Asset.php index 306a335183f86..fedf2b6797879 100644 --- a/libraries/src/Table/Asset.php +++ b/libraries/src/Table/Asset.php @@ -175,7 +175,7 @@ public function rebuild($parentId = null, $leftId = 0, $level = 0, $path = null) // Make a shortcut to database object. // Assemble the query to find all children of this node. - $this->_db->setQuery(sprintf($this->_cache['rebuild.sql'], (int) $parentId)); + $this->_db->setQuery(\sprintf($this->_cache['rebuild.sql'], (int) $parentId)); $children = $this->_db->loadObjectList(); diff --git a/libraries/src/Table/ContentType.php b/libraries/src/Table/ContentType.php index 862e388d0393a..d72de3dd52380 100644 --- a/libraries/src/Table/ContentType.php +++ b/libraries/src/Table/ContentType.php @@ -57,13 +57,13 @@ public function check() // Check for valid name. if (trim($this->type_title) === '') { - throw new \UnexpectedValueException(sprintf('The title is empty')); + throw new \UnexpectedValueException(\sprintf('The title is empty')); } $this->type_title = ucfirst($this->type_title); if (empty($this->type_alias)) { - throw new \UnexpectedValueException(sprintf('The type_alias is empty')); + throw new \UnexpectedValueException(\sprintf('The type_alias is empty')); } return true; diff --git a/libraries/src/Table/Nested.php b/libraries/src/Table/Nested.php index 6eedf829bec34..156f5265357a2 100644 --- a/libraries/src/Table/Nested.php +++ b/libraries/src/Table/Nested.php @@ -235,7 +235,7 @@ public function setLocation($referenceId, $position = 'after') // Make sure the location is valid. if (!\in_array($position, $this->_validLocations)) { throw new \InvalidArgumentException( - sprintf('Invalid location "%1$s" given, valid values are %2$s', $position, implode(', ', $this->_validLocations)) + \sprintf('Invalid location "%1$s" given, valid values are %2$s', $position, implode(', ', $this->_validLocations)) ); } @@ -334,7 +334,7 @@ public function moveByReference($referenceId, $position = 'after', $pk = null, $ if (\in_array($referenceId, $children)) { $this->setError( new \UnexpectedValueException( - sprintf('%1$s::moveByReference() is trying to make record ID %2$d a child of itself.', \get_class($this), $pk) + \sprintf('%1$s::moveByReference() is trying to make record ID %2$d a child of itself.', \get_class($this), $pk) ) ); @@ -663,7 +663,7 @@ public function check() try { // Check that the parent_id field is valid. if ($this->parent_id == 0) { - throw new \UnexpectedValueException(sprintf('Invalid `parent_id` [%1$d] in %2$s::check()', $this->parent_id, \get_class($this))); + throw new \UnexpectedValueException(\sprintf('Invalid `parent_id` [%1$d] in %2$s::check()', $this->parent_id, \get_class($this))); } $query = $this->_db->getQuery(true) @@ -672,7 +672,7 @@ public function check() ->where($this->_tbl_key . ' = ' . $this->parent_id); if (!$this->_db->setQuery($query)->loadResult()) { - throw new \UnexpectedValueException(sprintf('Invalid `parent_id` [%1$d] in %2$s::check()', $this->parent_id, \get_class($this))); + throw new \UnexpectedValueException(\sprintf('Invalid `parent_id` [%1$d] in %2$s::check()', $this->parent_id, \get_class($this))); } } catch (\UnexpectedValueException $e) { // Validation error - record it and return false. @@ -786,7 +786,7 @@ public function store($updateNulls = false) $this->rgt = $repositionData->new_rgt; } else { // Negative parent ids are invalid - $e = new \UnexpectedValueException(sprintf('%s::store() used a negative _location_id', \get_class($this))); + $e = new \UnexpectedValueException(\sprintf('%s::store() used a negative _location_id', \get_class($this))); $this->setError($e); return false; @@ -893,7 +893,7 @@ public function publish($pks = null, $state = 1, $userId = 0) $pks = explode(',', $this->$k); } else { // Nothing to set publishing state on, return false. - $e = new \UnexpectedValueException(sprintf('%s::publish(%s, %d, %d) empty.', \get_class($this), implode(',', $pks), $state, $userId)); + $e = new \UnexpectedValueException(\sprintf('%s::publish(%s, %d, %d) empty.', \get_class($this), implode(',', $pks), $state, $userId)); $this->setError($e); return false; @@ -924,7 +924,7 @@ public function publish($pks = null, $state = 1, $userId = 0) // Check for checked out children. if ($this->_db->loadResult()) { // @todo Convert to a conflict exception when available. - $e = new \RuntimeException(sprintf('%s::publish(%s, %d, %d) checked-out conflict.', \get_class($this), $pks[0], $state, $userId)); + $e = new \RuntimeException(\sprintf('%s::publish(%s, %d, %d) checked-out conflict.', \get_class($this), $pks[0], $state, $userId)); $this->setError($e); @@ -949,7 +949,7 @@ public function publish($pks = null, $state = 1, $userId = 0) if ($this->_db->loadResult()) { $e = new \UnexpectedValueException( - sprintf('%s::publish(%s, %d, %d) ancestors have lower state.', \get_class($this), $pks[0], $state, $userId) + \sprintf('%s::publish(%s, %d, %d) ancestors have lower state.', \get_class($this), $pks[0], $state, $userId) ); $this->setError($e); @@ -1193,7 +1193,7 @@ public function getRootId() } } - $e = new \UnexpectedValueException(sprintf('%s::getRootId', \get_class($this))); + $e = new \UnexpectedValueException(\sprintf('%s::getRootId', \get_class($this))); $this->setError($e); self::$root_id = false; @@ -1247,7 +1247,7 @@ public function rebuild($parentId = null, $leftId = 0, $level = 0, $path = '') // Make a shortcut to database object. // Assemble the query to find all children of this node. - $this->_db->setQuery(sprintf($this->_cache['rebuild.sql'], (int) $parentId)); + $this->_db->setQuery(\sprintf($this->_cache['rebuild.sql'], (int) $parentId)); $children = $this->_db->loadObjectList(); @@ -1524,7 +1524,7 @@ protected function _getNode($id, $key = null) // Check for no $row returned if (empty($row)) { - $e = new \UnexpectedValueException(sprintf('%s::_getNode(%d, %s) failed.', \get_class($this), $id, $k)); + $e = new \UnexpectedValueException(\sprintf('%s::_getNode(%d, %s) failed.', \get_class($this), $id, $k)); $this->setError($e); return false; @@ -1649,11 +1649,11 @@ protected function _logtable($showData = true, $showQuery = true) $this->_db->setQuery($query); $rows = $this->_db->loadRowList(); - $buffer .= sprintf("\n| %4s | %4s | %4s | %4s |", $this->_tbl_key, 'par', 'lft', 'rgt'); + $buffer .= \sprintf("\n| %4s | %4s | %4s | %4s |", $this->_tbl_key, 'par', 'lft', 'rgt'); $buffer .= $sep; foreach ($rows as $row) { - $buffer .= sprintf("\n| %4s | %4s | %4s | %4s |", $row[0], $row[1], $row[2], $row[3]); + $buffer .= \sprintf("\n| %4s | %4s | %4s | %4s |", $row[0], $row[1], $row[2], $row[3]); } $buffer .= $sep; diff --git a/libraries/src/Table/Table.php b/libraries/src/Table/Table.php index baa7b17192bae..af25216eb0ab0 100644 --- a/libraries/src/Table/Table.php +++ b/libraries/src/Table/Table.php @@ -251,7 +251,7 @@ public function getFields($reload = false) $fields = $this->_db->getTableColumns($name, false); if (empty($fields)) { - throw new \UnexpectedValueException(sprintf('No columns found for %s table', $name)); + throw new \UnexpectedValueException(\sprintf('No columns found for %s table', $name)); } self::$tableFields[$key] = $fields; @@ -639,7 +639,7 @@ public function bind($src, $ignore = []) // Check if the source value is an array or object if (!\is_object($src) && !\is_array($src)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Could not bind the data source in %1$s::bind(), the source must be an array or object but a "%2$s" was given.', \get_class($this), \gettype($src) @@ -768,7 +768,7 @@ public function load($keys = null, $reset = true) foreach ($keys as $field => $value) { // Check that $field is in the table. if (!\in_array($field, $fields)) { - throw new \UnexpectedValueException(sprintf('Missing field in database: %s   %s.', \get_class($this), $field)); + throw new \UnexpectedValueException(\sprintf('Missing field in database: %s   %s.', \get_class($this), $field)); } // Add the search tuple to the query. @@ -1422,7 +1422,7 @@ public function getNextOrder($where = '') { // Check if there is an ordering field set if (!$this->hasField('ordering')) { - throw new \UnexpectedValueException(sprintf('%s does not support ordering.', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s does not support ordering.', \get_class($this))); } // Get the largest ordering value for a given where clause. @@ -1477,7 +1477,7 @@ public function reorder($where = '') { // Check if there is an ordering field set if (!$this->hasField('ordering')) { - throw new \UnexpectedValueException(sprintf('%s does not support ordering.', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s does not support ordering.', \get_class($this))); } $quotedOrderingField = $this->_db->quoteName($this->getColumnAlias('ordering')); @@ -1556,7 +1556,7 @@ public function move($delta, $where = '') { // Check if there is an ordering field set if (!$this->hasField('ordering')) { - throw new \UnexpectedValueException(sprintf('%s does not support ordering.', \get_class($this))); + throw new \UnexpectedValueException(\sprintf('%s does not support ordering.', \get_class($this))); } $orderingField = $this->getColumnAlias('ordering'); diff --git a/libraries/src/Toolbar/ContainerAwareToolbarFactory.php b/libraries/src/Toolbar/ContainerAwareToolbarFactory.php index 365a241190cb0..99ff06e3ac6c7 100644 --- a/libraries/src/Toolbar/ContainerAwareToolbarFactory.php +++ b/libraries/src/Toolbar/ContainerAwareToolbarFactory.php @@ -60,7 +60,7 @@ public function createButton(Toolbar $toolbar, string $type): ToolbarButton } if (!class_exists($buttonClass)) { - throw new \InvalidArgumentException(sprintf('Class `%1$s` does not exist, could not create a toolbar button.', $buttonClass)); + throw new \InvalidArgumentException(\sprintf('Class `%1$s` does not exist, could not create a toolbar button.', $buttonClass)); } // Check for a possible service from the container otherwise manually instantiate the class diff --git a/libraries/src/Toolbar/Toolbar.php b/libraries/src/Toolbar/Toolbar.php index 4a5904fa96e17..6e761db08e4ba 100644 --- a/libraries/src/Toolbar/Toolbar.php +++ b/libraries/src/Toolbar/Toolbar.php @@ -107,7 +107,7 @@ public function __construct($name = 'toolbar', ?ToolbarFactoryInterface $factory // At 5.0, require the factory to be injected if (!$factory) { @trigger_error( - sprintf( + \sprintf( 'As of Joomla! 5.0, a %1$s must be provided to a %2$s object when creating it.', ToolbarFactoryInterface::class, \get_class($this) @@ -197,7 +197,7 @@ public function appendButton($button, ...$args) $this->_bar[] = $args; @trigger_error( - sprintf( + \sprintf( '%s::appendButton() should only accept %s instance in Joomla 6.0.', static::class, ToolbarButton::class @@ -274,7 +274,7 @@ public function prependButton($button, ...$args) array_unshift($this->_bar, $args); @trigger_error( - sprintf( + \sprintf( '%s::prependButton() should only accept %s instance in Joomla 6.0.', static::class, ToolbarButton::class @@ -408,7 +408,7 @@ public function loadButtonType($type, $new = false) public function addButtonPath($path) { @trigger_error( - sprintf( + \sprintf( 'Registering lookup paths for toolbar buttons is deprecated and will be removed in Joomla 6.0.' . ' %1$s objects should be autoloaded or a custom %2$s implementation supporting path lookups provided.', ToolbarButton::class, @@ -445,7 +445,7 @@ public function addButtonPath($path) public function getButtonPath(): array { @trigger_error( - sprintf( + \sprintf( 'Lookup paths for %s objects is deprecated and will be removed in Joomla 6.0.', ToolbarButton::class ), @@ -496,7 +496,7 @@ public function __call($name, $args) } throw new \BadMethodCallException( - sprintf( + \sprintf( 'Method %s() not found in class: %s', $name, static::class diff --git a/libraries/src/Toolbar/ToolbarButton.php b/libraries/src/Toolbar/ToolbarButton.php index 48e31df54f621..7c98b47f4a235 100644 --- a/libraries/src/Toolbar/ToolbarButton.php +++ b/libraries/src/Toolbar/ToolbarButton.php @@ -448,7 +448,7 @@ public function __call(string $name, array $args) if ($fieldName !== false) { if (!\array_key_exists(0, $args)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%s::%s() miss first argument.', \get_called_class(), $name @@ -461,7 +461,7 @@ public function __call(string $name, array $args) } throw new \BadMethodCallException( - sprintf( + \sprintf( 'Method %s() not found in class: %s', $name, \get_called_class() diff --git a/libraries/src/Updater/Update.php b/libraries/src/Updater/Update.php index 2d27eb41f9e5b..54826d1badd0f 100644 --- a/libraries/src/Updater/Update.php +++ b/libraries/src/Updater/Update.php @@ -663,7 +663,7 @@ public function loadFromXml($url, $minimumStability = Updater::STABILITY_STABLE, if (!xml_parse($this->xmlParser, $response->body)) { Log::add( - sprintf( + \sprintf( 'XML error: %s at line %d', xml_error_string(xml_get_error_code($this->xmlParser)), xml_get_current_line_number($this->xmlParser) diff --git a/libraries/src/Updater/UpdateAdapter.php b/libraries/src/Updater/UpdateAdapter.php index fb3add2241c6e..537c3a0385e5b 100644 --- a/libraries/src/Updater/UpdateAdapter.php +++ b/libraries/src/Updater/UpdateAdapter.php @@ -258,7 +258,7 @@ protected function getUpdateSiteResponse($options = []) // Log the time it took to load this update site's information $endTime = microtime(true); - $timeToLoad = sprintf('%0.2f', $endTime - $startTime); + $timeToLoad = \sprintf('%0.2f', $endTime - $startTime); Log::add( "Loading information from update site #{$this->updateSiteId} with name " . "\"$this->updateSiteName\" and URL $url took $timeToLoad seconds", diff --git a/libraries/src/User/CurrentUserTrait.php b/libraries/src/User/CurrentUserTrait.php index 5a1f57b58052a..bafe46e0a3e81 100644 --- a/libraries/src/User/CurrentUserTrait.php +++ b/libraries/src/User/CurrentUserTrait.php @@ -42,7 +42,7 @@ protected function getCurrentUser(): User { if (!$this->currentUser) { @trigger_error( - sprintf('User must be set in %s. This will not be caught anymore in 6.0', __METHOD__), + \sprintf('User must be set in %s. This will not be caught anymore in 6.0', __METHOD__), E_USER_DEPRECATED ); $this->currentUser = Factory::getApplication()->getIdentity() ?: Factory::getUser(); diff --git a/libraries/src/User/User.php b/libraries/src/User/User.php index 9025767512ef6..bb7dcb76568cd 100644 --- a/libraries/src/User/User.php +++ b/libraries/src/User/User.php @@ -298,7 +298,7 @@ public function __construct($identifier = 0) public static function getInstance($identifier = 0) { @trigger_error( - sprintf( + \sprintf( '%1$s() is deprecated. Load the user from the dependency injection container or via %2$s::getApplication()->getIdentity().', __METHOD__, __CLASS__ diff --git a/libraries/src/User/UserHelper.php b/libraries/src/User/UserHelper.php index df178918a61da..b3c1ae9c0f2c5 100644 --- a/libraries/src/User/UserHelper.php +++ b/libraries/src/User/UserHelper.php @@ -443,7 +443,7 @@ public static function hashPassword($password, $algorithm = self::HASH_BCRYPT, a } // Unsupported algorithm, sorry! - throw new \InvalidArgumentException(sprintf('The %s algorithm is not supported for hashing passwords.', $algorithm)); + throw new \InvalidArgumentException(\sprintf('The %s algorithm is not supported for hashing passwords.', $algorithm)); } /** diff --git a/libraries/src/WebAsset/WebAssetManager.php b/libraries/src/WebAsset/WebAssetManager.php index 63b5c88d9c192..b7d6dd4633baf 100644 --- a/libraries/src/WebAsset/WebAssetManager.php +++ b/libraries/src/WebAsset/WebAssetManager.php @@ -248,7 +248,7 @@ public function __call($method, $arguments) return $this->registerAsset($type, ...$arguments); } - throw new \BadMethodCallException(sprintf('Undefined method %s in class %s', $method, \get_class($this))); + throw new \BadMethodCallException(\sprintf('Undefined method %s in class %s', $method, \get_class($this))); } /** @@ -383,7 +383,7 @@ protected function usePresetItems($name): WebAssetManagerInterface // Make sure dependency exists if (!$this->registry->exists($depType, $depName)) { throw new UnsatisfiedDependencyException( - sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $dependency, $name, 'preset') + \sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $dependency, $name, 'preset') ); } @@ -426,7 +426,7 @@ protected function disablePresetItems($name): WebAssetManagerInterface // Make sure dependency exists if (!$this->registry->exists($depType, $depName)) { throw new UnsatisfiedDependencyException( - sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $dependency, $name, 'preset') + \sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $dependency, $name, 'preset') ); } @@ -525,7 +525,7 @@ public function registerAsset(string $type, $asset, string $uri = '', array $opt $this->registry->add($type, $assetInstance); } else { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%s(): Argument #2 ($asset) must be a string or an instance of %s, %s given.', __METHOD__, WebAssetItemInterface::class, @@ -696,7 +696,7 @@ public function addInline(string $type, $content, array $options = [], array $at $assetInstance->setOption('content', $content); } else { throw new \InvalidArgumentException( - sprintf( + \sprintf( '%s(): Argument #2 ($content) must be a string or an instance of %s, %s given.', __METHOD__, WebAssetItemInterface::class, @@ -1004,7 +1004,7 @@ protected function getDependenciesForAsset( if (!$this->registry->exists($depType, $depName)) { throw new UnsatisfiedDependencyException( - sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $depName, $asset->getName(), $depType) + \sprintf('Unsatisfied dependency "%s" for an asset "%s" of type "%s"', $depName, $asset->getName(), $depType) ); } diff --git a/libraries/src/WebAsset/WebAssetRegistry.php b/libraries/src/WebAsset/WebAssetRegistry.php index c0dfa2d4aeda1..7f74b11db8330 100644 --- a/libraries/src/WebAsset/WebAssetRegistry.php +++ b/libraries/src/WebAsset/WebAssetRegistry.php @@ -132,7 +132,7 @@ public function get(string $type, string $name): WebAssetItemInterface $this->parseRegistryFiles(); if (empty($this->assets[$type][$name])) { - throw new UnknownAssetException(sprintf('There is no "%s" asset of a "%s" type in the registry.', $name, $type)); + throw new UnknownAssetException(\sprintf('There is no "%s" asset of a "%s" type in the registry.', $name, $type)); } return $this->assets[$type][$name]; @@ -374,7 +374,7 @@ protected function parseRegistryFile($path) $data = $data ? json_decode($data, true) : null; if ($data === null) { - throw new \RuntimeException(sprintf('Asset registry file "%s" contains invalid JSON', $path)); + throw new \RuntimeException(\sprintf('Asset registry file "%s" contains invalid JSON', $path)); } // Check if asset field exists and contains data. If it doesn't - we can just bail here. @@ -393,13 +393,13 @@ protected function parseRegistryFile($path) foreach ($data['assets'] as $i => $item) { if (empty($item['name'])) { throw new \RuntimeException( - sprintf('Failed parsing asset registry file "%s". Property "name" is required for asset index "%s"', $path, $i) + \sprintf('Failed parsing asset registry file "%s". Property "name" is required for asset index "%s"', $path, $i) ); } if (empty($item['type'])) { throw new \RuntimeException( - sprintf('Failed parsing asset registry file "%s". Property "type" is required for asset "%s"', $path, $item['name']) + \sprintf('Failed parsing asset registry file "%s". Property "type" is required for asset "%s"', $path, $item['name']) ); } diff --git a/plugins/authentication/cookie/src/Extension/Cookie.php b/plugins/authentication/cookie/src/Extension/Cookie.php index 8d9d8993c50d7..20b33d8623160 100644 --- a/plugins/authentication/cookie/src/Extension/Cookie.php +++ b/plugins/authentication/cookie/src/Extension/Cookie.php @@ -182,7 +182,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void } catch (\RuntimeException $e) { // Log an alert for the site admin Log::add( - sprintf('Failed to delete cookie token for user %s with the following error: %s', $results[0]->user_id, $e->getMessage()), + \sprintf('Failed to delete cookie token for user %s with the following error: %s', $results[0]->user_id, $e->getMessage()), Log::WARNING, 'security' ); diff --git a/plugins/authentication/ldap/src/Extension/Ldap.php b/plugins/authentication/ldap/src/Extension/Ldap.php index ece6caa677971..326171b6f9f88 100644 --- a/plugins/authentication/ldap/src/Extension/Ldap.php +++ b/plugins/authentication/ldap/src/Extension/Ldap.php @@ -125,10 +125,10 @@ public function onUserAuthenticate(AuthenticationEvent $event): void } else { $cacertfile = $cacert; $cacertdir = $cacert; - Log::add(sprintf('Certificate path for LDAP client is neither an existing file nor directory: "%s"', $cacert), Log::ERROR, $logcategory); + Log::add(\sprintf('Certificate path for LDAP client is neither an existing file nor directory: "%s"', $cacert), Log::ERROR, $logcategory); } } else { - Log::add(sprintf('Not setting any LDAP TLS CA certificate options because %s, system wide settings are used', $ignore_reqcert_tls ? "certificate is ignored" : "no certificate location is configured"), Log::DEBUG, $logcategory); + Log::add(\sprintf('Not setting any LDAP TLS CA certificate options because %s, system wide settings are used', $ignore_reqcert_tls ? "certificate is ignored" : "no certificate location is configured"), Log::DEBUG, $logcategory); } $options = [ @@ -148,16 +148,16 @@ public function onUserAuthenticate(AuthenticationEvent $event): void $options['options']['x_tls_cacertfile'] = $cacertfile; } - Log::add(sprintf('Creating LDAP session with options: %s', json_encode($options)), Log::DEBUG, $logcategory); - $connection_string = sprintf('ldap%s://%s:%s', 'ssl' === $options['encryption'] ? 's' : '', $options['host'], $options['port']); - Log::add(sprintf('Creating LDAP session to connect to "%s" while binding', $connection_string), Log::DEBUG, $logcategory); + Log::add(\sprintf('Creating LDAP session with options: %s', json_encode($options)), Log::DEBUG, $logcategory); + $connection_string = \sprintf('ldap%s://%s:%s', 'ssl' === $options['encryption'] ? 's' : '', $options['host'], $options['port']); + Log::add(\sprintf('Creating LDAP session to connect to "%s" while binding', $connection_string), Log::DEBUG, $logcategory); $ldap = $this->factory->createLdap($options); switch ($auth_method) { case 'search': try { $dn = $this->params->get('username', ''); - Log::add(sprintf('Binding to LDAP server with administrative dn "%s" and given administrative password (anonymous if user dn is blank)', $dn), Log::DEBUG, $logcategory); + Log::add(\sprintf('Binding to LDAP server with administrative dn "%s" and given administrative password (anonymous if user dn is blank)', $dn), Log::DEBUG, $logcategory); $ldap->bind($dn, $this->params->get('password', '')); } catch (ConnectionException | LdapException $exception) { $response->status = Authentication::STATUS_FAILURE; @@ -174,7 +174,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void str_replace(';', '\3b', $ldap->escape($credentials['username'], '', LDAP_ESCAPE_FILTER)), $this->params->get('search_string', '') ); - Log::add(sprintf('Searching LDAP entry with filter: "%s"', $searchstring), Log::DEBUG, $logcategory); + Log::add(\sprintf('Searching LDAP entry with filter: "%s"', $searchstring), Log::DEBUG, $logcategory); $entry = $this->searchByString($searchstring, $ldap); } catch (LdapException $exception) { $response->status = Authentication::STATUS_FAILURE; @@ -193,11 +193,11 @@ public function onUserAuthenticate(AuthenticationEvent $event): void return; } - Log::add(sprintf('LDAP entry found at "%s"', $entry->getDn()), Log::DEBUG, $logcategory); + Log::add(\sprintf('LDAP entry found at "%s"', $entry->getDn()), Log::DEBUG, $logcategory); try { // Verify Users Credentials - Log::add(sprintf('Binding to LDAP server with found user dn "%s" and user entered password', $entry->getDn()), Log::DEBUG, $logcategory); + Log::add(\sprintf('Binding to LDAP server with found user dn "%s" and user entered password', $entry->getDn()), Log::DEBUG, $logcategory); $ldap->bind($entry->getDn(), $credentials['password']); } catch (ConnectionException $exception) { $response->status = Authentication::STATUS_FAILURE; @@ -222,7 +222,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void ); } - Log::add(sprintf('Direct binding to LDAP server with entered user dn "%s" and user entered password', $dn), Log::DEBUG, $logcategory); + Log::add(\sprintf('Direct binding to LDAP server with entered user dn "%s" and user entered password', $dn), Log::DEBUG, $logcategory); $ldap->bind($dn, $credentials['password']); } catch (ConnectionException | LdapException $exception) { $response->status = Authentication::STATUS_FAILURE; @@ -238,7 +238,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void str_replace(';', '\3b', $ldap->escape($credentials['username'], '', LDAP_ESCAPE_FILTER)), $this->params->get('search_string', '') ); - Log::add(sprintf('Searching LDAP entry with filter: "%s"', $searchstring), Log::DEBUG, $logcategory); + Log::add(\sprintf('Searching LDAP entry with filter: "%s"', $searchstring), Log::DEBUG, $logcategory); $entry = $this->searchByString($searchstring, $ldap); } catch (LdapException $exception) { $response->status = Authentication::STATUS_FAILURE; @@ -257,7 +257,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void return; } - Log::add(sprintf('LDAP entry found at "%s"', $entry->getDn()), Log::DEBUG, $logcategory); + Log::add(\sprintf('LDAP entry found at "%s"', $entry->getDn()), Log::DEBUG, $logcategory); break; @@ -276,7 +276,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void $response->fullname = $entry->getAttribute($ldap_fullname)[0] ?? $credentials['username']; // Were good - So say so. - Log::add(sprintf('LDAP login succeeded; username: "%s", email: "%s", fullname: "%s"', $response->username, $response->email, $response->fullname), Log::DEBUG, $logcategory); + Log::add(\sprintf('LDAP login succeeded; username: "%s", email: "%s", fullname: "%s"', $response->username, $response->email, $response->fullname), Log::DEBUG, $logcategory); $response->status = Authentication::STATUS_SUCCESS; $response->error_message = ''; diff --git a/plugins/content/joomla/src/Extension/Joomla.php b/plugins/content/joomla/src/Extension/Joomla.php index 58d3d197b7a78..3aa4e99608b82 100644 --- a/plugins/content/joomla/src/Extension/Joomla.php +++ b/plugins/content/joomla/src/Extension/Joomla.php @@ -144,7 +144,7 @@ public function onContentAfterSave($context, $article, $isNew): void $message = [ 'user_id_to' => $user_id, 'subject' => $lang->_('COM_CONTENT_NEW_ARTICLE'), - 'message' => sprintf($lang->_('COM_CONTENT_ON_NEW_CONTENT'), $user->name, $article->title), + 'message' => \sprintf($lang->_('COM_CONTENT_ON_NEW_CONTENT'), $user->name, $article->title), ]; $model_message = $this->getApplication()->bootComponent('com_messages')->getMVCFactory() ->createModel('Message', 'Administrator'); diff --git a/plugins/multifactorauth/totp/src/Extension/Totp.php b/plugins/multifactorauth/totp/src/Extension/Totp.php index ab483317b6768..acfd42e9cc0ce 100644 --- a/plugins/multifactorauth/totp/src/Extension/Totp.php +++ b/plugins/multifactorauth/totp/src/Extension/Totp.php @@ -210,7 +210,7 @@ public function onUserMultifactorGetSetup(GetSetup $event): void // Generate a QR code for the key $user = $this->getUserFactory()->loadUserById($record->user_id); $hostname = Uri::getInstance()->toString(['host']); - $otpURL = sprintf("otpauth://totp/%s@%s?secret=%s", $user->username, $hostname, $key); + $otpURL = \sprintf("otpauth://totp/%s@%s?secret=%s", $user->username, $hostname, $key); $document = $this->getApplication()->getDocument(); $wam = $document->getWebAssetManager(); diff --git a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php index b03628b25c410..c9a8026199859 100644 --- a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php +++ b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php @@ -239,7 +239,7 @@ private static function getAvatar(User $user, int $size = 64) $scheme = Uri::getInstance()->getScheme(); $subdomain = ($scheme == 'https') ? 'secure' : 'www'; - return sprintf('%s://%s.gravatar.com/avatar/%s.jpg?s=%u&d=mm', $scheme, $subdomain, md5($user->email), $size); + return \sprintf('%s://%s.gravatar.com/avatar/%s.jpg?s=%u&d=mm', $scheme, $subdomain, md5($user->email), $size); } /** diff --git a/plugins/quickicon/eos/src/Extension/Eos.php b/plugins/quickicon/eos/src/Extension/Eos.php index c6c361c04c3cf..f87c5fccbaf0e 100644 --- a/plugins/quickicon/eos/src/Extension/Eos.php +++ b/plugins/quickicon/eos/src/Extension/Eos.php @@ -112,7 +112,7 @@ public function getEndOfServiceNotification(QuickIconsEvent $event): void // Show this only when not snoozed if ($this->params->get('last_snoozed_id', 0) < $this->currentMessage['id']) { // Build the message to be displayed in the cpanel - $messageText = sprintf( + $messageText = \sprintf( $app->getLanguage()->_($this->currentMessage['messageText']), HTMLHelper::_('date', Eos::EOS_DATE, $app->getLanguage()->_('DATE_FORMAT_LC3')), $this->currentMessage['messageLink'] diff --git a/plugins/system/debug/src/Extension/Debug.php b/plugins/system/debug/src/Extension/Debug.php index e17756cf82ad6..3f98f0409d778 100644 --- a/plugins/system/debug/src/Extension/Debug.php +++ b/plugins/system/debug/src/Extension/Debug.php @@ -210,7 +210,7 @@ public function __construct(DispatcherInterface $dispatcher, array $config, CMSA if ($this->showLogs && $this->getApplication()->get('log_deprecated')) { foreach (\JLoader::getDeprecatedAliases() as $deprecation) { Log::add( - sprintf( + \sprintf( '%1$s has been aliased to %2$s and the former class name is deprecated. The alias will be removed in %3$s.', $deprecation['old'], $deprecation['new'], @@ -691,7 +691,7 @@ public function onBeforeRespond(): void $desc = str_ireplace('after', '', $mark->label); $name = preg_replace('/[^\da-z]/i', '', $desc); - $metrics .= sprintf('%s;dur=%f;desc="%s", ', $index . $name, $mark->time, $desc); + $metrics .= \sprintf('%s;dur=%f;desc="%s", ', $index . $name, $mark->time, $desc); // Do not create too large headers, some web servers don't love them if (\strlen($metrics) > 3000) { diff --git a/plugins/system/debug/src/JavascriptRenderer.php b/plugins/system/debug/src/JavascriptRenderer.php index f67b8127c23d0..d2daeea496bd9 100644 --- a/plugins/system/debug/src/JavascriptRenderer.php +++ b/plugins/system/debug/src/JavascriptRenderer.php @@ -60,15 +60,15 @@ public function renderHead() $doc = Factory::getApplication()->getDocument(); foreach ($cssFiles as $file) { - $html .= sprintf('' . "\n", $file); + $html .= \sprintf('' . "\n", $file); } foreach ($inlineCss as $content) { - $html .= sprintf('' . "\n", $content); + $html .= \sprintf('' . "\n", $content); } foreach ($jsFiles as $file) { - $html .= sprintf('' . "\n", $file); + $html .= \sprintf('' . "\n", $file); } $nonce = ''; @@ -78,7 +78,7 @@ public function renderHead() } foreach ($inlineJs as $content) { - $html .= sprintf('' . "\n", $nonce, $content); + $html .= \sprintf('' . "\n", $nonce, $content); } foreach ($inlineHead as $content) { diff --git a/plugins/system/remember/src/Extension/Remember.php b/plugins/system/remember/src/Extension/Remember.php index bf626d11e95a6..3956f750b9104 100644 --- a/plugins/system/remember/src/Extension/Remember.php +++ b/plugins/system/remember/src/Extension/Remember.php @@ -119,7 +119,7 @@ public function onUserBeforeSave($user, $isnew, $data) } catch (\RuntimeException $e) { // Log an alert for the site admin Log::add( - sprintf('Failed to delete cookie token for user %s with the following error: %s', $user['username'], $e->getMessage()), + \sprintf('Failed to delete cookie token for user %s with the following error: %s', $user['username'], $e->getMessage()), Log::WARNING, 'security' ); diff --git a/plugins/system/webauthn/src/Authentication.php b/plugins/system/webauthn/src/Authentication.php index 240b5c46bab35..c8b12f620ad5a 100644 --- a/plugins/system/webauthn/src/Authentication.php +++ b/plugins/system/webauthn/src/Authentication.php @@ -323,7 +323,7 @@ public function validateAttestationResponse(string $data): PublicKeyCredentialSo $myUserId = $myUser->id; if (($myUser->guest) || ($myUserId != $storedUserId)) { - $message = sprintf('Invalid user! We asked the authenticator to attest user ID %d, the current user ID is %d', $storedUserId, $myUserId); + $message = \sprintf('Invalid user! We asked the authenticator to attest user ID %d, the current user ID is %d', $storedUserId, $myUserId); Log::add($message, Log::NOTICE, 'webauthn.system'); throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_USER')); @@ -452,7 +452,7 @@ private function getAvatar(User $user, int $size = 64) $scheme = Uri::getInstance()->getScheme(); $subdomain = ($scheme == 'https') ? 'secure' : 'www'; - return sprintf('%s://%s.gravatar.com/avatar/%s.jpg?s=%u&d=mm', $scheme, $subdomain, md5($user->email), $size); + return \sprintf('%s://%s.gravatar.com/avatar/%s.jpg?s=%u&d=mm', $scheme, $subdomain, md5($user->email), $size); } /** diff --git a/plugins/system/webauthn/src/CredentialRepository.php b/plugins/system/webauthn/src/CredentialRepository.php index 6e20e2822c111..e23a3e34f0870 100644 --- a/plugins/system/webauthn/src/CredentialRepository.php +++ b/plugins/system/webauthn/src/CredentialRepository.php @@ -430,7 +430,7 @@ public function getUserHandleFor(string $credentialId): string public function getHandleFromUserId(int $id): string { $key = $this->getEncryptionKey(); - $data = sprintf('%010u', $id); + $data = \sprintf('%010u', $id); return hash_hmac('sha256', $data, $key, false); } @@ -510,7 +510,7 @@ public function getUserIdFromHandle(?string $userHandle): ?int } foreach ($ids as $userId) { - $data = sprintf('%010u', $userId); + $data = \sprintf('%010u', $userId); $thisHandle = hash_hmac('sha256', $data, $key, false); if ($thisHandle == $userHandle) { diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php index 97d75d770f74a..c053c02a25305 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php @@ -67,7 +67,7 @@ public function onAjaxWebauthnLogin(AjaxLogin $event): void $user = Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById($userId); if ($user->id != $userId) { - $message = sprintf('User #%d does not exist', $userId); + $message = \sprintf('User #%d does not exist', $userId); Log::add($message, Log::NOTICE, 'webauthn.system'); throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); @@ -86,7 +86,7 @@ public function onAjaxWebauthnLogin(AjaxLogin $event): void $validUserHandle = $credentialRepository->getHandleFromUserId($userId); if ($userHandle != $validUserHandle) { - $message = sprintf('Invalid user handle; expected %s, got %s', $validUserHandle, $userHandle); + $message = \sprintf('Invalid user handle; expected %s, got %s', $validUserHandle, $userHandle); Log::add($message, Log::NOTICE, 'webauthn.system'); throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); @@ -96,7 +96,7 @@ public function onAjaxWebauthnLogin(AjaxLogin $event): void $user = Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById($userId); if ($user->id != $userId) { - $message = sprintf('Invalid user ID; expected %d, got %d', $userId, $user->id); + $message = \sprintf('Invalid user ID; expected %d, got %d', $userId, $user->id); Log::add($message, Log::NOTICE, 'webauthn.system'); throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); @@ -112,7 +112,7 @@ public function onAjaxWebauthnLogin(AjaxLogin $event): void $response->status = Authentication::STATUS_UNKNOWN; $response->error_message = $e->getMessage(); - Log::add(sprintf("Received login failure. Message: %s", $e->getMessage()), Log::ERROR, 'webauthn.system'); + Log::add(\sprintf("Received login failure. Message: %s", $e->getMessage()), Log::ERROR, 'webauthn.system'); // This also enqueues the login failure message for display after redirection. Look for JLog in that method. $this->processLoginFailure($response); diff --git a/plugins/task/checkfiles/src/Extension/Checkfiles.php b/plugins/task/checkfiles/src/Extension/Checkfiles.php index 51649a0d01500..7c1ab16a9cbe0 100644 --- a/plugins/task/checkfiles/src/Extension/Checkfiles.php +++ b/plugins/task/checkfiles/src/Extension/Checkfiles.php @@ -130,7 +130,7 @@ protected function checkImages(ExecuteTaskEvent $event): int $newHeight = $dimension === 'height' ? $limit : $height * $limit / $width; $newWidth = $dimension === 'width' ? $limit : $width * $limit / $height; - $this->logTask(sprintf( + $this->logTask(\sprintf( $this->getApplication()->getLanguage()->_('PLG_TASK_CHECK_FILES_LOG_RESIZING_IMAGE'), $width, $height, diff --git a/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php b/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php index 21c4be6c83a6b..1b756739ca27c 100644 --- a/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php +++ b/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php @@ -78,7 +78,7 @@ public static function getSubscribedEvents(): array private function deleteLogs(ExecuteTaskEvent $event): int { $daysToDeleteAfter = (int) $event->getArgument('params')->logDeletePeriod ?? 0; - $this->logTask(sprintf('Delete Logs after %d days', $daysToDeleteAfter)); + $this->logTask(\sprintf('Delete Logs after %d days', $daysToDeleteAfter)); $now = Factory::getDate()->toSql(); $db = $this->getDatabase(); $query = $db->getQuery(true); diff --git a/plugins/task/requests/src/Extension/Requests.php b/plugins/task/requests/src/Extension/Requests.php index a70fba520954c..606d1d9a00b9a 100644 --- a/plugins/task/requests/src/Extension/Requests.php +++ b/plugins/task/requests/src/Extension/Requests.php @@ -158,7 +158,7 @@ protected function makeGetRequest(ExecuteTaskEvent $event): int > Response: $responseStatus EOF; - $this->logTask(sprintf($this->getApplication()->getLanguage()->_('PLG_TASK_REQUESTS_TASK_GET_REQUEST_LOG_RESPONSE'), $responseCode)); + $this->logTask(\sprintf($this->getApplication()->getLanguage()->_('PLG_TASK_REQUESTS_TASK_GET_REQUEST_LOG_RESPONSE'), $responseCode)); if ($response->code !== 200) { return TaskStatus::KNOCKOUT; diff --git a/plugins/task/sitestatus/src/Extension/SiteStatus.php b/plugins/task/sitestatus/src/Extension/SiteStatus.php index d28b5cae6ed0a..da446799f2282 100644 --- a/plugins/task/sitestatus/src/Extension/SiteStatus.php +++ b/plugins/task/sitestatus/src/Extension/SiteStatus.php @@ -142,7 +142,7 @@ public function alterSiteStatus(ExecuteTaskEvent $event): void $newStatus = $config['offline'] ? 'offline' : 'online'; $exit = $this->writeConfigFile(new Registry($config)); - $this->logTask(sprintf($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_TASK_LOG_SITE_STATUS'), $oldStatus, $newStatus)); + $this->logTask(\sprintf($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_TASK_LOG_SITE_STATUS'), $oldStatus, $newStatus)); $this->endRoutine($event, $exit); } diff --git a/plugins/workflow/notification/src/Extension/Notification.php b/plugins/workflow/notification/src/Extension/Notification.php index 042eda6110f8b..ff8d83a053fe7 100644 --- a/plugins/workflow/notification/src/Extension/Notification.php +++ b/plugins/workflow/notification/src/Extension/Notification.php @@ -210,7 +210,7 @@ public function onWorkflowAfterTransition(WorkflowTransitionEvent $event) // Load language for messaging $lang = $this->languageFactory->createLanguage($user->getParam('admin_language', $defaultLanguage), $debug); $lang->load('plg_workflow_notification'); - $messageText = sprintf( + $messageText = \sprintf( $lang->_('PLG_WORKFLOW_NOTIFICATION_ON_TRANSITION_MSG'), $title, $lang->_($transitionName), @@ -225,7 +225,7 @@ public function onWorkflowAfterTransition(WorkflowTransitionEvent $event) $message = [ 'id' => 0, 'user_id_to' => $receiver->id, - 'subject' => sprintf($lang->_('PLG_WORKFLOW_NOTIFICATION_ON_TRANSITION_SUBJECT'), $title), + 'subject' => \sprintf($lang->_('PLG_WORKFLOW_NOTIFICATION_ON_TRANSITION_SUBJECT'), $title), 'message' => $messageText, ];