Skip to content

Commit

Permalink
Fix php-cs-fixer errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evertharmeling committed Nov 15, 2023
1 parent d3f0684 commit 6cdbf05
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
9 changes: 3 additions & 6 deletions src/DependencyInjection/SymfonycastsSassExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader;

use function basename;
use function in_array;

class SymfonycastsSassExtension extends Extension implements ConfigurationInterface
{
public function load(array $configs, ContainerBuilder $container): void
Expand Down Expand Up @@ -64,17 +61,17 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->validate()
->ifTrue(static function (array $paths): bool {
if (count($paths) === 1) {
if (1 === \count($paths)) {
return false;
}

$filenames = [];
foreach ($paths as $path) {
$filename = basename($path, '.scss');
$filename = \basename($path, '.scss');
$filenames[$filename] = $filename;
}

return count($filenames) !== count($paths);
return \count($filenames) !== \count($paths);
})
->thenInvalid('The root sass-paths need to end with unique filenames.')
->end()
Expand Down
27 changes: 17 additions & 10 deletions tests/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

declare(strict_types=1);

/*
* This file is part of the SymfonyCasts SassBundle package.
* Copyright (c) SymfonyCasts <https://symfonycasts.com/>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfonycasts\SassBundle\Tests;

use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
Expand All @@ -22,9 +29,9 @@ public function testSingleSassRootPath(): void
$this->assertConfigurationIsValid([
'symfonycasts_sass' => [
'root_sass' => [
'%kernel.project_dir%/assets/scss/app.scss'
]
]
'%kernel.project_dir%/assets/scss/app.scss',
],
],
]);
}

Expand All @@ -34,9 +41,9 @@ public function testMultipleSassRootPaths(): void
'symfonycasts_sass' => [
'root_sass' => [
'%kernel.project_dir%/assets/scss/app.scss',
'%kernel.project_dir%/assets/admin/scss/admin.scss'
]
]
'%kernel.project_dir%/assets/admin/scss/admin.scss',
],
],
]);
}

Expand All @@ -46,10 +53,10 @@ public function testMultipleSassRootPathsWithSameFilename(): void
'symfonycasts_sass' => [
'root_sass' => [
'%kernel.project_dir%/assets/scss/app.scss',
'%kernel.project_dir%/assets/admin/scss/app.scss'
]
]
'%kernel.project_dir%/assets/admin/scss/app.scss',
],
],
],
'Invalid configuration for path "symfonycasts_sass.root_sass": The root sass-paths need to end with unique filenames.');
'Invalid configuration for path "symfonycasts_sass.root_sass": The root sass-paths need to end with unique filenames.');
}
}

0 comments on commit 6cdbf05

Please sign in to comment.