:octocat: fix PHPCS config, add Slevomat rules

This commit is contained in:
smiley
2024-07-21 14:54:15 +02:00
parent 89cdd09044
commit f32696c8a7
97 changed files with 462 additions and 654 deletions
-6
View File
@@ -50,9 +50,6 @@ final class Binarizer{
/** @var int[] */
private array $luminances;
/**
*
*/
public function __construct(LuminanceSourceInterface $source){
$this->source = $source;
$this->luminances = $this->source->getLuminances();
@@ -162,9 +159,6 @@ final class Binarizer{
return $this->getHistogramBlackMatrix($width, $height);
}
/**
*
*/
private function getHistogramBlackMatrix(int $width, int $height):BitMatrix{
// Quickly calculates the histogram by sampling four rows from the image. This proved to be
+1 -10
View File
@@ -221,7 +221,7 @@ final class BitMatrix extends QRMatrix{
// Try again by actually masking the pattern first.
$formatInfo = $this->doDecodeFormatInformation(
($formatInfoBits1 ^ $this::FORMAT_INFO_MASK_QR),
($formatInfoBits2 ^ $this::FORMAT_INFO_MASK_QR)
($formatInfoBits2 ^ $this::FORMAT_INFO_MASK_QR),
);
// still nothing???
@@ -237,9 +237,6 @@ final class BitMatrix extends QRMatrix{
return $this;
}
/**
*
*/
private function copyVersionBit(int $i, int $j, int $versionBits):int{
$bit = $this->mirror
@@ -380,9 +377,6 @@ final class BitMatrix extends QRMatrix{
return null;
}
/**
*
*/
private function uRShift(int $a, int $b):int{
if($b === 0){
@@ -392,9 +386,6 @@ final class BitMatrix extends QRMatrix{
return (($a >> $b) & ~((1 << (8 * PHP_INT_SIZE - 1)) >> ($b - 1)));
}
/**
*
*/
private function numBitsDiffering(int $a, int $b):int{
// a now has a 1 bit exactly where its bit differs with b's
$a ^= $b;
-6
View File
@@ -27,9 +27,6 @@ use function chr, str_replace;
*/
final class Decoder{
/**
* @var \chillerlan\QRCode\QROptions|\chillerlan\Settings\SettingsContainerInterface
*/
private SettingsContainerInterface|QROptions $options;
private Version|null $version = null;
private EccLevel|null $eccLevel = null;
@@ -164,9 +161,6 @@ final class Decoder{
]);
}
/**
*
*/
private function decodeAlphanumSegment(int $versionNumber, bool $fc1InEffect):string{
$str = AlphaNum::decodeSegment($this->bitBuffer, $versionNumber);
+1 -10
View File
@@ -60,10 +60,7 @@ final class DecoderResult{
}
/**
* @return mixed|null
*/
public function __get(string $property){
public function __get(string $property):mixed{
if(property_exists($this, $property)){
return $this->{$property};
@@ -72,16 +69,10 @@ final class DecoderResult{
return null;
}
/**
*
*/
public function __toString():string{
return $this->data;
}
/**
*
*/
public function hasStructuredAppend():bool{
return $this->structuredAppendParity >= 0 && $this->structuredAppendSequence >= 0;
}
+2 -2
View File
@@ -97,7 +97,7 @@ final class ReedSolomonDecoder{
while($longerBlocksStartAt >= 0){
$numCodewords = count($result[$longerBlocksStartAt][1]);
if($numCodewords == $shorterBlocksTotalCodewords){
if($numCodewords === $shorterBlocksTotalCodewords){
break;
}
@@ -193,7 +193,7 @@ final class ReedSolomonDecoder{
[$sigma, $omega] = $this->runEuclideanAlgorithm(
GF256::buildMonomial($numEccCodewords, 1),
new GenericGFPoly(array_reverse($syndromeCoefficients)),
$numEccCodewords
$numEccCodewords,
);
$errorLocations = $this->findErrorLocations($sigma);