Skip to content

Commit dc4eaf7

Browse files
committed
fix: restore phpmd src validation
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 9239505 commit dc4eaf7

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

phpmd.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
77
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 https://pmd.github.io/pmd-6.55.0/ruleset_xml_schema.xsd">
88
<description>PHPMD baseline ruleset.</description>
9-
<rule ref="rulesets/cleancode.xml">
10-
<exclude name="ErrorControlOperator"/>
11-
</rule>
12-
<rule ref="rulesets/codesize.xml">
13-
<exclude name="CyclomaticComplexity"/>
14-
<exclude name="NPathComplexity"/>
15-
</rule>
16-
<exclude-pattern>.*tests/.*Test\.php$</exclude-pattern>
9+
<rule ref="rulesets/cleancode.xml"/>
10+
<rule ref="rulesets/codesize.xml"/>
11+
<exclude-pattern>*tests/*</exclude-pattern>
1712
<rule ref="rulesets/design.xml"/>
1813
<rule ref="rulesets/naming.xml">
1914
<exclude name="ShortVariable"/>
2015
</rule>
16+
<rule ref="rulesets/naming.xml/ShortVariable">
17+
<properties>
18+
<property name="exceptions" value="x,y"/>
19+
</properties>
20+
</rule>
2121
</ruleset>

src/Layout/LinearLayoutEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ public function layout(array $nodes, float $width, float $height): LayoutResult
8686
}
8787

8888
$align = strtolower($this->styleValue($style, 'text-align', 'left'));
89-
$x = match ($align) {
89+
$lineX = match ($align) {
9090
'center' => $leftBase + ($boxWidth / 2.0),
9191
'right' => max($rightBase - 8.0, 0),
9292
default => $leftBase + 8.0,
9393
};
9494

9595
$lines[] = new LayoutLine(
9696
text: $text,
97-
x: $x,
97+
x: $lineX,
9898
y: max($cursorY, 0),
9999
fontSize: $fontSize,
100100
fontAlias: $fontAlias,

src/Pdf/ColorParser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ public function toPdfRgb(string $hexColor): string
2121
}
2222

2323
$channels = str_split($hex, 2);
24-
$r = round(hexdec($channels[0]) / 255, 4);
25-
$g = round(hexdec($channels[1]) / 255, 4);
26-
$b = round(hexdec($channels[2]) / 255, 4);
24+
$redChannel = round(hexdec($channels[0]) / 255, 4);
25+
$greenChannel = round(hexdec($channels[1]) / 255, 4);
26+
$blueChannel = round(hexdec($channels[2]) / 255, 4);
2727

28-
return sprintf('%s %s %s rg', $r, $g, $b);
28+
return sprintf('%s %s %s rg', $redChannel, $greenChannel, $blueChannel);
2929
}
3030
}

0 commit comments

Comments
 (0)