Skip to content

Commit 1bc1e8f

Browse files
authored
[5.3] Remove useless sprintf function call (joomla#45036)
1 parent 1ce0a30 commit 1bc1e8f

File tree

12 files changed

+16
-14
lines changed

12 files changed

+16
-14
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
'combine_consecutive_issets' => true,
9898
// Calling unset on multiple items should be done in one call
9999
'combine_consecutive_unsets' => true,
100+
// There must be no sprintf calls with only the first argument
101+
'no_useless_sprintf' => true,
100102
]
101103
)
102104
->setFinder($finder);

administrator/components/com_actionlogs/src/Model/ActionlogModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function addLog($messages, $messageLanguageKey, $context, $userId = 0)
5858
try {
5959
$user = $userId ? $this->getUserFactory()->loadUserById($userId) : $this->getCurrentUser();
6060
} catch (\UnexpectedValueException $e) {
61-
@trigger_error(\sprintf('UserFactory must be set, this will not be caught anymore in 7.0.'), E_USER_DEPRECATED);
61+
@trigger_error('UserFactory must be set, this will not be caught anymore in 7.0.', E_USER_DEPRECATED);
6262
$user = Factory::getUser($userId);
6363
}
6464

administrator/components/com_fields/src/Model/FieldModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private function checkDefaultValue($data)
330330
try {
331331
$rule->setDatabase($this->getDatabase());
332332
} catch (DatabaseNotFoundException) {
333-
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
333+
@trigger_error('Database must be set, this will not be caught anymore in 5.0.', E_USER_DEPRECATED);
334334
$rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class));
335335
}
336336
}

administrator/components/com_finder/src/Indexer/Indexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Indexer
122122
public function __construct(?DatabaseInterface $db = null)
123123
{
124124
if ($db === null) {
125-
@trigger_error(\sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED);
125+
@trigger_error('Database will be mandatory in 5.0.', E_USER_DEPRECATED);
126126
$db = Factory::getContainer()->get(DatabaseInterface::class);
127127
}
128128

administrator/components/com_finder/src/Indexer/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class Query
208208
public function __construct($options, ?DatabaseInterface $db = null)
209209
{
210210
if ($db === null) {
211-
@trigger_error(\sprintf('Database will be mandatory in 5.0.'), E_USER_DEPRECATED);
211+
@trigger_error('Database will be mandatory in 5.0.', E_USER_DEPRECATED);
212212
$db = Factory::getContainer()->get(DatabaseInterface::class);
213213
}
214214

libraries/src/Categories/Categories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected function _load($id)
237237
try {
238238
$db = $this->getDatabase();
239239
} catch (DatabaseNotFoundException) {
240-
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
240+
@trigger_error('Database must be set, this will not be caught anymore in 5.0.', E_USER_DEPRECATED);
241241
$db = Factory::getContainer()->get(DatabaseInterface::class);
242242
}
243243

libraries/src/Form/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ protected function loadField($element, $group = null, $value = null)
14661466
try {
14671467
$field->setDatabase($this->getDatabase());
14681468
} catch (DatabaseNotFoundException) {
1469-
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
1469+
@trigger_error('Database must be set, this will not be caught anymore in 5.0.', E_USER_DEPRECATED);
14701470
$field->setDatabase(Factory::getContainer()->get(DatabaseInterface::class));
14711471
}
14721472
}

libraries/src/Form/FormField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ public function validate($value, $group = null, ?Registry $input = null)
12181218
try {
12191219
$rule->setDatabase($this->getDatabase());
12201220
} catch (DatabaseNotFoundException) {
1221-
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
1221+
@trigger_error('Database must be set, this will not be caught anymore in 5.0.', E_USER_DEPRECATED);
12221222
$rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class));
12231223
}
12241224
}
@@ -1243,7 +1243,7 @@ public function validate($value, $group = null, ?Registry $input = null)
12431243
try {
12441244
$rule->setDatabase($this->getDatabase());
12451245
} catch (DatabaseNotFoundException) {
1246-
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
1246+
@trigger_error('Database must be set, this will not be caught anymore in 5.0.', E_USER_DEPRECATED);
12471247
$rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class));
12481248
}
12491249
}

libraries/src/MVC/Factory/MVCFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function createModel($name, $prefix = '', array $config = [])
171171
try {
172172
$model->setDatabase($this->getDatabase());
173173
} catch (DatabaseNotFoundException) {
174-
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
174+
@trigger_error('Database must be set, this will not be caught anymore in 5.0.', E_USER_DEPRECATED);
175175
$model->setDatabase(Factory::getContainer()->get(DatabaseInterface::class));
176176
}
177177
}
@@ -267,7 +267,7 @@ public function createTable($name, $prefix = '', array $config = [])
267267
try {
268268
$db = \array_key_exists('dbo', $config) ? $config['dbo'] : $this->getDatabase();
269269
} catch (DatabaseNotFoundException) {
270-
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
270+
@trigger_error('Database must be set, this will not be caught anymore in 5.0.', E_USER_DEPRECATED);
271271
$db = Factory::getContainer()->get(DatabaseInterface::class);
272272
}
273273

libraries/src/MVC/Model/BaseDatabaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function __construct($config = [], ?MVCFactoryInterface $factory = null)
105105
$db = \array_key_exists('dbo', $config) ? $config['dbo'] : Factory::getDbo();
106106

107107
if ($db) {
108-
@trigger_error(\sprintf('Database is not available in constructor in 6.0.'), E_USER_DEPRECATED);
108+
@trigger_error('Database is not available in constructor in 6.0.', E_USER_DEPRECATED);
109109
$this->setDatabase($db);
110110

111111
// Is needed, when models use the deprecated MVC DatabaseAwareTrait, as the trait is overriding the local functions

0 commit comments

Comments
 (0)