Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/ecs.php export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/phpunit.xml.dist export-ignore
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
branches: ['1.x']

jobs:
php-cs-fixer:
name: PHP CS Fixer (PHP ${{ matrix.php-version }})
easy-coding-standard:
name: Easy Coding Standard (PHP ${{ matrix.php-version }})
runs-on: ubuntu-24.04

strategy:
Expand All @@ -31,5 +31,5 @@ jobs:
- name: Install Composer dependencies
uses: ramsey/composer-install@v3

- name: Run PHP CS Fixer
run: 'vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr'
- name: Run Easy Coding Standard
run: 'vendor/bin/ecs --output-format=checkstyle | cs2pr'
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
symfony-version:
- '6.4.*'
- '7.3.*'
- '7.4.x-dev'
- '7.4.*@dev'
include:
- php-version: '8.4'
symfony-version: '8.0.x-dev'
symfony-version: '8.0.*@dev'
- php-version: '8.5'
symfony-version: '8.0.x-dev'
symfony-version: '8.0.*@dev'

steps:
- name: Checkout code
Expand Down
44 changes: 0 additions & 44 deletions .php-cs-fixer.dist.php

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@
"twig/twig": "^3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.86.0",
"phpstan/phpstan": "^2.1.22",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpunit/phpunit": "^11.5.35",
"symfony/css-selector": "^6.4 || ^7.0 || ^8.0",
"symfony/dom-crawler": "^6.4 || ^7.0 || ^8.0",
"symfony/yaml": "^6.4 || ^7.0 || ^8.0"
"symfony/yaml": "^6.4 || ^7.0 || ^8.0",
"symplify/easy-coding-standard": "^12.5.24"
},
"scripts": {
"ci": [
"@cs:dry",
"@phpstan",
"vendor/bin/phpunit --colors=auto"
],
"cs:dry": "php-cs-fixer fix --diff --dry-run --no-interaction --ansi",
"cs:fix": "php-cs-fixer fix --ansi",
"cs:dry": "vendor/bin/ecs",
"cs:fix": "vendor/bin/ecs --fix",
"phpstan": "vendor/bin/phpstan analyse --ansi"
},
"autoload": {
Expand Down
28 changes: 28 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\ControlStructure\NoUselessElseFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withRootFiles()
->withRules([
NoUselessElseFixer::class,
NoUselessReturnFixer::class,
StrictComparisonFixer::class,
StrictParamFixer::class,
DeclareStrictTypesFixer::class,
NoUnusedImportsFixer::class,
])
->withPhpCsFixerSets(perCS20: true, symfonyRisky: true)
;
4 changes: 1 addition & 3 deletions src/Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

class MediaController
{
public function __construct(private MediaManager $mediaManager, private KernelInterface $kernel)
{
}
public function __construct(private MediaManager $mediaManager, private KernelInterface $kernel) {}

public function uploadImage(Request $request): JsonResponse
{
Expand Down
5 changes: 2 additions & 3 deletions src/Form/Type/FroalaEditorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function __construct(
private ParameterBagInterface $parameterBag,
private OptionManager $optionManager,
private PluginProvider $pluginProvider,
) {
}
) {}

public function buildForm(FormBuilderInterface $builder, array $options): void
{
Expand Down Expand Up @@ -82,7 +81,7 @@ public function buildView(FormView $view, FormInterface $form, array $options):

$arrPlugin = $this->pluginProvider->obtainArrPluginToInclude($arrPluginEnabled, $arrPluginDisabled);

$view->vars['froala_arrOption']['pluginsEnabled'] = array_map(fn (string $plugin): string => 'trackChanges' === $plugin ? 'track_changes' : $plugin, $this->pluginProvider->obtainArrPluginCamelized($arrPlugin));
$view->vars['froala_arrOption']['pluginsEnabled'] = array_map(fn(string $plugin): string => 'trackChanges' === $plugin ? 'track_changes' : $plugin, $this->pluginProvider->obtainArrPluginCamelized($arrPlugin));
$view->vars['froala_arrPluginJS'] = $this->pluginProvider->obtainArrPluginJS($arrPlugin);
$view->vars['froala_arrPluginCSS'] = $this->pluginProvider->obtainArrPluginCSS($arrPlugin);
$view->vars['froala_events'] = $arrEvent;
Expand Down
4 changes: 1 addition & 3 deletions src/LeaptFroalaEditorBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use Symfony\Component\HttpKernel\Bundle\Bundle;

class LeaptFroalaEditorBundle extends Bundle
{
}
class LeaptFroalaEditorBundle extends Bundle {}
4 changes: 1 addition & 3 deletions src/Service/OptionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

final class OptionManager
{
public function __construct(private RouterInterface $router)
{
}
public function __construct(private RouterInterface $router) {}

/**
* Prepare options before building view.
Expand Down
4 changes: 1 addition & 3 deletions src/Twig/FroalaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

final class FroalaExtension extends AbstractExtension
{
public function __construct(private ParameterBagInterface $parameterBag, private Packages $packages)
{
}
public function __construct(private ParameterBagInterface $parameterBag, private Packages $packages) {}

public function getFunctions(): array
{
Expand Down
31 changes: 20 additions & 11 deletions src/Utility/UConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,24 +316,33 @@ public static function getArrOptionAll(): array

public static function getArrOption(): array
{
return array_merge(array_merge(
return array_merge(
array_merge(
array_merge(
array_keys(self::OPTIONS_BOOLEAN),
array_keys(self::OPTIONS_INTEGER)),
array_keys(self::OPTIONS_STRING)),
array_keys(self::OPTIONS_ARRAY)),
array_keys(self::OPTIONS_OBJECT));
array_merge(
array_keys(self::OPTIONS_BOOLEAN),
array_keys(self::OPTIONS_INTEGER),
),
array_keys(self::OPTIONS_STRING),
),
array_keys(self::OPTIONS_ARRAY),
),
array_keys(self::OPTIONS_OBJECT),
);
}

public static function getArrOptionCustom(): array
{
return array_merge(array_merge(
return array_merge(
array_merge(
array_keys(self::OPTIONS_BOOLEAN_CUSTOM),
array_keys(self::OPTIONS_STRING_CUSTOM)),
array_keys(self::OPTIONS_ARRAY_CUSTOM)),
array_keys(self::OPTIONS_OBJECT_CUSTOM));
array_merge(
array_keys(self::OPTIONS_BOOLEAN_CUSTOM),
array_keys(self::OPTIONS_STRING_CUSTOM),
),
array_keys(self::OPTIONS_ARRAY_CUSTOM),
),
array_keys(self::OPTIONS_OBJECT_CUSTOM),
);
}

public static function addArrOptionBoolean(NodeBuilder $nodeBuilder, bool $addDefaultValue = true): void
Expand Down
16 changes: 10 additions & 6 deletions tests/Form/Type/FroalaEditorTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private function getForm(array $options = []): FormInterface
$formType = new FroalaEditorType(
$this->getParameterBag(),
new OptionManager($router),
new PluginProvider()
new PluginProvider(),
);

$factory = Forms::createFormFactoryBuilder()
Expand All @@ -78,11 +78,15 @@ private function getForm(array $options = []): FormInterface
private function getParameterBag(): ParameterBag
{
$array = array_merge(
UConfiguration::OPTIONS_STRING, UConfiguration::OPTIONS_STRING_CUSTOM,
UConfiguration::OPTIONS_BOOLEAN, UConfiguration::OPTIONS_BOOLEAN_CUSTOM,
UConfiguration::OPTIONS_ARRAY, UConfiguration::OPTIONS_ARRAY_CUSTOM,
UConfiguration::OPTIONS_OBJECT, UConfiguration::OPTIONS_OBJECT_CUSTOM,
UConfiguration::OPTIONS_INTEGER
UConfiguration::OPTIONS_STRING,
UConfiguration::OPTIONS_STRING_CUSTOM,
UConfiguration::OPTIONS_BOOLEAN,
UConfiguration::OPTIONS_BOOLEAN_CUSTOM,
UConfiguration::OPTIONS_ARRAY,
UConfiguration::OPTIONS_ARRAY_CUSTOM,
UConfiguration::OPTIONS_OBJECT,
UConfiguration::OPTIONS_OBJECT_CUSTOM,
UConfiguration::OPTIONS_INTEGER,
);
$parameters = [];

Expand Down