Skip to content

Commit 6ee1f86

Browse files
committed
Various minor performance improvements.
1 parent 03240fc commit 6ee1f86

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

SigTool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* SigTool v2.0.1 (last modified: 2026.03.17).
3+
* SigTool v2.0.2 (last modified: 2026.03.17).
44
* @link https://github.com/phpMussel/SigTool
55
*
66
* Generates signatures for phpMussel using main.cvd and daily.cvd from ClamAV.
@@ -720,7 +720,7 @@ private function formatSize(int $Size): string
720720
}
721721
$Replacer = \substr($Replacer, 0, -1) . ')';
722722
$FinalLast = \array_pop($InnerCharRange) ?: '';
723-
$InnerCharCount = count($InnerCharRange);
723+
$InnerCharCount = \count($InnerCharRange);
724724
if (!$InnerCharCount) {
725725
break;
726726
}

YAML.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace Maikuolan\Common;
2020

21-
class YAML extends CommonAbstract implements \Countable, \Stringable
21+
class YAML extends CommonAbstract implements \Countable
2222
{
2323
/**
2424
* @var array An array to contain all the data processed by the handler.
@@ -511,7 +511,7 @@ public function process(string $In, array &$Arr, int $Depth = 0, bool $Refs = fa
511511
public function reconstruct(array $Arr, bool $UseCaptured = false, bool $DoWithAnchors = false): string
512512
{
513513
$Out = '';
514-
$this->DoWithAnchors = (count($this->Anchors) && $DoWithAnchors);
514+
$this->DoWithAnchors = (\count($this->Anchors) && $DoWithAnchors);
515515
if ($UseCaptured) {
516516
if ($this->LastIndent !== '') {
517517
$this->Indent = $this->LastIndent;
@@ -542,7 +542,7 @@ public function tryStringDataTraverseByRef(&$Data): void
542542
) {
543543
return;
544544
}
545-
$MatchCount = count($VarMatches[0]);
545+
$MatchCount = \count($VarMatches[0]);
546546
for ($Index = 0; $Index < $MatchCount; $Index++) {
547547
if (($Extracted = $this->dataTraverse($this->Refs, $VarMatches[1][$Index])) && \is_string($Extracted)) {
548548
$Data = \str_replace($VarMatches[0][$Index], $Extracted, $Data);
@@ -557,7 +557,7 @@ public function tryStringDataTraverseByRef(&$Data): void
557557
*/
558558
public function count(): int
559559
{
560-
return count($this->Data);
560+
return \count($this->Data);
561561
}
562562

563563
/**
@@ -750,7 +750,7 @@ private function processLine(string &$ThisLine, int &$ThisTab, &$Key, &$Value, a
750750
if (\substr($Key, 0, 1) === '[' && \substr($Key, -1) === ']') {
751751
$TryList = [];
752752
$this->flowControl($Key, $TryList, '[', true);
753-
$TryListCount = count($TryList);
753+
$TryListCount = \count($TryList);
754754
} else {
755755
$TryListCount = 0;
756756
if (($EnPos = \strpos($Key, '(')) !== false && \substr($ThisLine, -1, 1) === ')') {
@@ -772,7 +772,7 @@ private function processLine(string &$ThisLine, int &$ThisTab, &$Key, &$Value, a
772772
if ($ValueLen > 0) {
773773
if (($this->LastResolvedTag === '!merge' || $Key === '<<') && \is_array($Value) && !$InlineEntity) {
774774
$Arr += $this->merge($Value);
775-
} elseif ($TryListCount !== 0 && (!\is_array($Value) || count($Value) === $TryListCount)) {
775+
} elseif ($TryListCount !== 0 && (!\is_array($Value) || \count($Value) === $TryListCount)) {
776776
if (\is_array($Value)) {
777777
$Values = $Value;
778778
foreach ($TryList as $Key) {
@@ -838,7 +838,7 @@ private function processLine(string &$ThisLine, int &$ThisTab, &$Key, &$Value, a
838838
*/
839839
private function processInner(array $Arr, string &$Out, int $Depth = 0): void
840840
{
841-
$Sequential = (\array_keys($Arr) === range(0, count($Arr) - 1));
841+
$Sequential = (\array_keys($Arr) === \range(0, \count($Arr) - 1));
842842
$NullSet = $this->isNullSet($Arr);
843843
if ($Depth >= $this->FlowRebuildDepth) {
844844
$Out .= $Sequential ? '[' : '{';
@@ -1208,7 +1208,7 @@ private function coerce($Value, bool $EnforceScalar, string $Tag)
12081208
$ValueLow = \strtolower($Value);
12091209
} else {
12101210
if (\is_array($Value)) {
1211-
$ValueLen = count($Value);
1211+
$ValueLen = \count($Value);
12121212
} else {
12131213
$ValueLen = empty($Value) ? 0 : 1;
12141214
}

0 commit comments

Comments
 (0)