phan and phpstan fixes for hash uses in CoreLibs
This commit is contained in:
@@ -39,10 +39,10 @@ print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
|||||||
$to_crc = 'Some text block';
|
$to_crc = 'Some text block';
|
||||||
// static
|
// static
|
||||||
print "S::__CRC32B: $to_crc: " . Hash::__crc32b($to_crc) . "<br>";
|
print "S::__CRC32B: $to_crc: " . Hash::__crc32b($to_crc) . "<br>";
|
||||||
print "S::__SHA1SHORT(off): $to_crc: " . Hash::__sha1short($to_crc) . "<br>";
|
// print "S::__SHA1SHORT(off): $to_crc: " . Hash::__sha1short($to_crc) . "<br>";
|
||||||
print "S::hashShort(__sha1Short replace): $to_crc: " . Hash::hashShort($to_crc) . "<br>";
|
print "S::hashShort(__sha1Short replace): $to_crc: " . Hash::hashShort($to_crc) . "<br>";
|
||||||
print "S::__SHA1SHORT(on): $to_crc: " . Hash::__sha1short($to_crc, true) . "<br>";
|
// print "S::__SHA1SHORT(on): $to_crc: " . Hash::__sha1short($to_crc, true) . "<br>";
|
||||||
print "S::sha1Short(__sha1Short replace): $to_crc: " . Hash::sha1Short($to_crc, true) . "<br>";
|
print "S::sha1Short(__sha1Short replace): $to_crc: " . Hash::sha1Short($to_crc) . "<br>";
|
||||||
print "S::__hash(d): " . $to_crc . "/"
|
print "S::__hash(d): " . $to_crc . "/"
|
||||||
. Hash::STANDARD_HASH_SHORT . ": " . $hash_class::__hash($to_crc) . "<br>";
|
. Hash::STANDARD_HASH_SHORT . ": " . $hash_class::__hash($to_crc) . "<br>";
|
||||||
foreach (['adler32', 'fnv132', 'fnv1a32', 'joaat', 'sha512'] as $__hash_c) {
|
foreach (['adler32', 'fnv132', 'fnv1a32', 'joaat', 'sha512'] as $__hash_c) {
|
||||||
@@ -55,7 +55,7 @@ echo "<hr>";
|
|||||||
$text = 'Some String Text';
|
$text = 'Some String Text';
|
||||||
$type = 'crc32b';
|
$type = 'crc32b';
|
||||||
print "Hash: " . $type . ": " . hash($type, $text) . "<br>";
|
print "Hash: " . $type . ": " . hash($type, $text) . "<br>";
|
||||||
print "Class (old): " . $type . ": " . Hash::__hash($text, $type) . "<br>";
|
// print "Class (old): " . $type . ": " . Hash::__hash($text, $type) . "<br>";
|
||||||
print "Class (new): " . $type . ": " . Hash::hash($text, $type) . "<br>";
|
print "Class (new): " . $type . ": " . Hash::hash($text, $type) . "<br>";
|
||||||
|
|
||||||
echo "<hr>";
|
echo "<hr>";
|
||||||
|
|||||||
@@ -1024,8 +1024,12 @@ class Basic
|
|||||||
*/
|
*/
|
||||||
public function __sha1Short(string $string, bool $use_sha = false): string
|
public function __sha1Short(string $string, bool $use_sha = false): string
|
||||||
{
|
{
|
||||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use \CoreLibs\Create\Hash::__sha1Short()', E_USER_DEPRECATED);
|
trigger_error('Method ' . __METHOD__ . ' is deprecated, use \CoreLibs\Create\Hash::sha1Short() or ::__crc32b()', E_USER_DEPRECATED);
|
||||||
return \CoreLibs\Create\Hash::__sha1Short($string, $use_sha);
|
if ($use_sha) {
|
||||||
|
return \CoreLibs\Create\Hash::sha1Short($string);
|
||||||
|
} else {
|
||||||
|
return \CoreLibs\Create\Hash::__crc32b($string);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1040,8 +1044,8 @@ class Basic
|
|||||||
*/
|
*/
|
||||||
public function __hash(string $string, string $hash_type = 'adler32'): string
|
public function __hash(string $string, string $hash_type = 'adler32'): string
|
||||||
{
|
{
|
||||||
trigger_error('Method ' . __METHOD__ . ' is deprecated, use \CoreLibs\Create\Hash::__hash()', E_USER_DEPRECATED);
|
trigger_error('Method ' . __METHOD__ . ' is deprecated, use \CoreLibs\Create\Hash::hash()', E_USER_DEPRECATED);
|
||||||
return \CoreLibs\Create\Hash::__hash($string, $hash_type);
|
return \CoreLibs\Create\Hash::hash($string, $hash_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// *** HASH FUNCTIONS END
|
// *** HASH FUNCTIONS END
|
||||||
|
|||||||
@@ -4056,7 +4056,7 @@ class IO
|
|||||||
*/
|
*/
|
||||||
public function dbGetQueryHash(string $query, array $params = []): string
|
public function dbGetQueryHash(string $query, array $params = []): string
|
||||||
{
|
{
|
||||||
return Hash::__hashLong(
|
return Hash::hashLong(
|
||||||
$query . (
|
$query . (
|
||||||
$params !== [] ?
|
$params !== [] ?
|
||||||
'#' . json_encode($params) : ''
|
'#' . json_encode($params) : ''
|
||||||
|
|||||||
Reference in New Issue
Block a user