Skip to content

Commit

Permalink
Revert Type fixes and static analysis hints
Browse files Browse the repository at this point in the history
  • Loading branch information
jdarwood007 committed Feb 1, 2024
1 parent 8783b34 commit 5f3a3e2
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 87 deletions.
1 change: 0 additions & 1 deletion Sources/Actions/Admin/ACP.php
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,6 @@ public static function getFileVersions(array &$versionOptions): array
$directories += ['template_versions' => Theme::$current->settings['theme_dir']];
}

/** @var string $dirname */
foreach ($directories as $type => $dirname) {
$this_dir = dir($dirname);

Expand Down
2 changes: 1 addition & 1 deletion Sources/Actions/Admin/Find.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function execute(): void
public function internal(): void
{
// Try to get some more memory.
sapi::setMemoryLimit('128M');
Sapi::setMemoryLimit('128M');

IntegrationHook::call('integrate_admin_search', [&$this->language_files, &$this->include_files, &$this->settings_search]);

Expand Down
1 change: 0 additions & 1 deletion Sources/Actions/Admin/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3258,7 +3258,6 @@ protected static function loadAllPermissions(): void

foreach (self::getPermissions() as $permission => $perm_info) {
// If this permission shouldn't be given to certain groups (e.g. guests), don't.
/** @var string $perm */
foreach ([$permission, $perm_info['generic_name']] as $perm) {
if (isset(Utils::$context['group']['id']) && in_array(Utils::$context['group']['id'], self::$excluded[$perm] ?? [])) {
continue 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Actions/Admin/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ public function boardPerms(): void
// Now cycle through the board permissions array... lots to do ;)
foreach ($board_permissions as $board => $groups) {
// Create the table for this board first.
$this->newTable((string) $boards[$board]['name'], 'x', 'all', '100', 'center', '200', 'left');
$this->newTable($boards[$board]['name'], 'x', 'all', '100', 'center', '200', 'left');

// Add the header row - shows all the membergroups.
$this->addData($member_groups);
Expand Down
10 changes: 5 additions & 5 deletions Sources/Actions/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ public function getXmlNews(): array

// Limit the length of the message, if the option is set.
if (!empty(Config::$modSettings['xmlnews_maxlen']) && Utils::entityStrlen(str_replace('<br>', "\n", $row['body'])) > Config::$modSettings['xmlnews_maxlen']) {
$row['body'] = strtr(Utils::entitySubstr(str_replace('<br>', "\n", $row['body']), 0, (int) (Config::$modSettings['xmlnews_maxlen'] - 3)), ["\n" => '<br>']) . '...';
$row['body'] = strtr(Utils::entitySubstr(str_replace('<br>', "\n", $row['body']), 0, Config::$modSettings['xmlnews_maxlen'] - 3), ["\n" => '<br>']) . '...';
}

$row['body'] = BBCodeParser::load()->parse($row['body'], $row['smileys_enabled'], $row['id_msg']);
Expand Down Expand Up @@ -1208,7 +1208,7 @@ public function getXmlRecent(): array

// Limit the length of the message, if the option is set.
if (!empty(Config::$modSettings['xmlnews_maxlen']) && Utils::entityStrlen(str_replace('<br>', "\n", $row['body'])) > Config::$modSettings['xmlnews_maxlen']) {
$row['body'] = strtr(Utils::entitySubstr(str_replace('<br>', "\n", $row['body']), 0, (int) (Config::$modSettings['xmlnews_maxlen'] - 3)), ["\n" => '<br>']) . '...';
$row['body'] = strtr(Utils::entitySubstr(str_replace('<br>', "\n", $row['body']), 0, Config::$modSettings['xmlnews_maxlen'] - 3), ["\n" => '<br>']) . '...';
}

$row['body'] = BBCodeParser::load()->parse($row['body'], (bool) $row['smileys_enabled'], (int) $row['id_msg']);
Expand Down Expand Up @@ -2916,7 +2916,7 @@ public static function cdataParse(string $data, string $ns = '', bool $force = f
$pos = empty($positions) ? $n : min($positions);

if ($pos - $old > 0) {
$cdata .= substr($data, $old, (int) ($pos - $old));
$cdata .= substr($data, $old, $pos - $old);
}

if ($pos >= $n) {
Expand All @@ -2931,9 +2931,9 @@ public static function cdataParse(string $data, string $ns = '', bool $force = f
}

if (substr($data, $pos + 1, 1) == '/') {
$cdata .= ']]></' . $ns . ':' . substr($data, $pos + 2, (int) ($pos2 - $pos - 1)) . '<![CDATA[';
$cdata .= ']]></' . $ns . ':' . substr($data, $pos + 2, $pos2 - $pos - 1) . '<![CDATA[';
} else {
$cdata .= ']]><' . $ns . ':' . substr($data, $pos + 1, (int) ($pos2 - $pos)) . '<![CDATA[';
$cdata .= ']]><' . $ns . ':' . substr($data, $pos + 1, $pos2 - $pos) . '<![CDATA[';
}

$pos = $pos2 + 1;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Actions/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public function members(): void
Utils::$context['can_send_email'] = User::$me->allowedTo('moderate_forum');

// Load all the group moderators, for fun.
$group->loadModerators();
User::load($group->loadModerators(), User::LOAD_BY_ID, 'minimal');

foreach ($group->moderator_ids as $mod_id) {
$group->moderators[] = [
Expand Down
4 changes: 2 additions & 2 deletions Sources/Actions/Moderation/EndSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public function execute(): void
/**
* Static wrapper for constructor.
*
* @return self An instance of this class.
* @return object An instance of this class.
*/
public static function load(): self
public static function load(): object
{
if (!isset(self::$obj)) {
self::$obj = new self();
Expand Down

0 comments on commit 5f3a3e2

Please sign in to comment.