Skip to content

Commit

Permalink
ci: Migrate to PHP-CS-Fixer (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
smnandre authored Mar 30, 2024
1 parent 6207bde commit cd666e3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 60 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/.codeclimate.yml export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpcs.xml export-ignore
/.php-cs-fixer.dist.php export-ignore
/rector.php export-ignore
/phpmd.xml export-ignore
/phpunit.xml export-ignore
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
18 changes: 18 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
])
->setFinder($finder)
;
51 changes: 0 additions & 51 deletions phpcs.xml

This file was deleted.

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

0 comments on commit cd666e3

Please sign in to comment.