Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Migrate to PHP-CS-Fixer #230

Merged
merged 9 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup PHP and PHPCS
- name: Setup PHP and PHP-CS-Fixer
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: phpcs
tools: php-cs-fixer
coverage: none

- name: Validate composer.json and composer.lock
Expand All @@ -36,8 +36,8 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run PHPCS
run: phpcs
- name: Run PHP-CS-Fixer
run: php-cs-fixer check --diff

test:
runs-on: ubuntu-latest
Expand Down
19 changes: 19 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude(['rector.php'])
;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
])
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion src/Nodes/SVGNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function getSerializableNamespaces(): array
public function getIdAndClassPattern(): ?string
{
$id = $this->getAttribute('id') != null ? Str::trim($this->getAttribute('id')) : '';
$class = $this->getAttribute('class') != null ? Str::trim($this->getAttribute('class')) : '';
$class = $this->getAttribute('class') != null ? Str::trim($this->getAttribute('class')) : '';

$pattern = '';
if ($id !== '') {
Expand Down
4 changes: 2 additions & 2 deletions src/Rasterization/Path/ArcApproximator.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ private static function endpointToCenter(
($y1prime - $cyprime) / $radiusY
);
$angleDelta = self::vectorAngle2(
( $x1prime - $cxprime) / $radiusX,
( $y1prime - $cyprime) / $radiusY,
($x1prime - $cxprime) / $radiusX,
($y1prime - $cyprime) / $radiusY,
(-$x1prime - $cxprime) / $radiusX,
(-$y1prime - $cyprime) / $radiusY
);
Expand Down
2 changes: 1 addition & 1 deletion src/Rasterization/Renderers/PathRendererImplementation.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function fillMultipath($image, array $subpaths, int $color, string
// Loop over the path area from bottom to top, so that we can make good use of the sort order of $edges.
for ($scanline = $maxY; $scanline >= $minY; --$scanline) {
// An edge becomes irrelevant when the scanline is higher up than the edge's minY.
$activeEdges = array_values(array_filter($activeEdges, fn($edge) => $edge->minY < $scanline));
$activeEdges = array_values(array_filter($activeEdges, fn ($edge) => $edge->minY < $scanline));

// An edge becomes relevant when its y range starts to include $scanline.
for ($n = count($edges); $lastActiveEdge < $n; ++$lastActiveEdge) {
Expand Down
Loading