Skip to content

Commit

Permalink
php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Jul 20, 2023
1 parent e64817c commit aa3053c
Show file tree
Hide file tree
Showing 27 changed files with 61 additions and 60 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# 0.13

## What's changed

- **[Feature]** Batch actions ([see more](https://data-table-bundle.swroblewski.pl/features/actions/batch-actions/))
- **[Feature]** Improved DX with row actions ([see more](https://data-table-bundle.swroblewski.pl/features/actions/row-actions/))
- **[Feature]** Actions `visible` option ([see more](https://data-table-bundle.swroblewski.pl/reference/actions/types/action/#visible))
Expand Down
2 changes: 1 addition & 1 deletion src/Action/ActionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ private function createBuilderLockedException(): BadMethodCallException
{
return new BadMethodCallException('ActionConfigBuilder methods cannot be accessed anymore once the builder is turned into a ActionConfigInterface instance.');
}
}
}
2 changes: 1 addition & 1 deletion src/Action/Type/ActionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function buildView(ActionView $view, ActionInterface $action, array $opti
'icon_attr' => $options['icon_attr'],
'confirmation' => $options['confirmation'],
'context' => $action->getConfig()->getContext(),
'batch' => $action->getConfig()->getContext() === ActionContext::Batch,
'batch' => ActionContext::Batch === $action->getConfig()->getContext(),
'visible' => $options['visible'],
]);
}
Expand Down
5 changes: 1 addition & 4 deletions src/Action/Type/ResolvedActionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ public function createBuilder(ActionFactoryInterface $factory, string $name, arr
try {
$options = $this->getOptionsResolver()->resolve($options);
} catch (ExceptionInterface $exception) {
throw new $exception(sprintf(
'An error has occurred resolving the options of the action "%s": ',
get_debug_type($this->getInnerType())).$exception->getMessage(), $exception->getCode(), $exception
);
throw new $exception(sprintf('An error has occurred resolving the options of the action "%s": ', get_debug_type($this->getInnerType())).$exception->getMessage(), $exception->getCode(), $exception);
}

return new ActionBuilder($name, $this, $options);
Expand Down
3 changes: 1 addition & 2 deletions src/Bridge/Doctrine/Orm/Filter/Type/BooleanFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
use Symfony\Component\Form\Extension\Core\Type as Form;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

use Symfony\Component\Translation\TranslatableMessage;

class BooleanFilterType extends AbstractFilterType
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use Kreyu\Bundle\DataTableBundle\Filter\Form\Type\DateRangeType;
use Kreyu\Bundle\DataTableBundle\Query\ProxyQueryInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

use Symfony\Component\Translation\TranslatableMessage;

use function Symfony\Component\Translation\t;

class DateRangeFilterType extends AbstractFilterType
Expand Down
2 changes: 0 additions & 2 deletions src/Bridge/Doctrine/Orm/Query/DoctrineOrmProxyQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Kreyu\Bundle\DataTableBundle\Bridge\Doctrine\Orm\Query;

use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Tools\Pagination\CountWalker;
use Doctrine\ORM\Tools\Pagination\Paginator;
Expand All @@ -13,7 +12,6 @@
use Kreyu\Bundle\DataTableBundle\Pagination\PaginationData;
use Kreyu\Bundle\DataTableBundle\Pagination\PaginationInterface;
use Kreyu\Bundle\DataTableBundle\Query\ProxyQueryInterface;
use Kreyu\Bundle\DataTableBundle\Sorting\Direction;
use Kreyu\Bundle\DataTableBundle\Sorting\SortingData;

/**
Expand Down
9 changes: 4 additions & 5 deletions src/Bridge/OpenSpout/Exporter/Type/AbstractExporterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Kreyu\Bundle\DataTableBundle\Bridge\OpenSpout\Exporter\Type;

use Kreyu\Bundle\DataTableBundle\Column\ColumnHeaderView;
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Kreyu\Bundle\DataTableBundle\Exporter\ExportFile;
use Kreyu\Bundle\DataTableBundle\Exporter\Type\AbstractExporterType as BaseAbstractExporterType;
Expand All @@ -18,7 +17,7 @@
abstract class AbstractExporterType extends BaseAbstractExporterType
{
public function __construct(
private ?TranslatorInterface $translator = null
private ?TranslatorInterface $translator = null,
) {
}

Expand Down Expand Up @@ -77,7 +76,7 @@ public function export(DataTableView $view, string $filename, array $options = [
return new ExportFile($path, "$filename.$extension");
}

protected abstract function getExtension(): string;
abstract protected function getExtension(): string;

protected abstract function getWriter(array $options): WriterInterface;
}
abstract protected function getWriter(array $options): WriterInterface;
}
2 changes: 1 addition & 1 deletion src/Bridge/OpenSpout/Exporter/Type/CsvExporterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ public function configureOptions(OptionsResolver $resolver): void
->setAllowedTypes('flush_threshold', 'int')
;
}
}
}
4 changes: 2 additions & 2 deletions src/Bridge/OpenSpout/Exporter/Type/OdsExporterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace Kreyu\Bundle\DataTableBundle\Bridge\OpenSpout\Exporter\Type;

use OpenSpout\Common\Entity\Style\Style;
use OpenSpout\Writer\WriterInterface;
use OpenSpout\Writer\ODS\Options;
use OpenSpout\Writer\ODS\Writer;
use OpenSpout\Writer\WriterInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class OdsExporterType extends AbstractExporterType
Expand Down Expand Up @@ -45,4 +45,4 @@ public function configureOptions(OptionsResolver $resolver): void
->setAllowedTypes('default_row_height', ['null', 'float'])
;
}
}
}
2 changes: 1 addition & 1 deletion src/Bridge/OpenSpout/Exporter/Type/XlsxExporterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public function configureOptions(OptionsResolver $resolver): void
->setAllowedTypes('default_row_height', ['null', 'float'])
;
}
}
}
2 changes: 1 addition & 1 deletion src/Column/Type/ActionsColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function configureOptions(OptionsResolver $resolver): void
private function resolveAction(
string $name,
array|ActionBuilderInterface|ActionInterface $action,
ColumnHeaderView|ColumnValueView $view
ColumnHeaderView|ColumnValueView $view,
): ?ActionInterface {
if ($action instanceof ActionInterface) {
return $action;
Expand Down
6 changes: 2 additions & 4 deletions src/Column/Type/NumberColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

use Kreyu\Bundle\DataTableBundle\Column\ColumnInterface;
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\Formatter\IntlFormatter;
use Twig\Extra\Intl\IntlExtension;

class NumberColumnType extends AbstractColumnType
{
Expand All @@ -30,12 +28,12 @@ public function configureOptions(OptionsResolver $resolver): void
$resolver
->setDefaults([
'attrs' => [],
'style' => 'decimal'
'style' => 'decimal',
])
->setAllowedTypes('attrs', 'array')
->setAllowedTypes('style', 'string')
;
}
},
])
->setAllowedTypes('use_intl_formatter', 'bool')
;
Expand Down
4 changes: 2 additions & 2 deletions src/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ public function sort(SortingData $data): void

$sortField = $column->getOptions()['sort'];

if ($sortField === false) {
if (false === $sortField) {
continue;
}

if ($sortField === true) {
if (true === $sortField) {
$sortField = $column->getOptions()['property_path'] ?: $column->getName();
}

Expand Down
2 changes: 1 addition & 1 deletion src/DataTableBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class DataTableBuilder implements DataTableBuilderInterface
*/
private bool $locked = false;

public function __construct(string $name, ?ProxyQueryInterface $query = null, array $options = [])
public function __construct(string $name, ProxyQueryInterface $query = null, array $options = [])
{
$this->name = $name;
$this->query = $query;
Expand Down
6 changes: 3 additions & 3 deletions src/DataTableBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function getAction(string $name): ActionBuilderInterface;
public function hasAction(string $name): bool;

/**
* @param null|class-string<ActionTypeInterface> $type
* @param class-string<ActionTypeInterface>|null $type
*/
public function addAction(ActionBuilderInterface|string $action, string $type = null, array $options = []): static;

Expand All @@ -47,7 +47,7 @@ public function getBatchAction(string $name): ActionBuilderInterface;
public function hasBatchAction(string $name): bool;

/**
* @param null|class-string<ActionTypeInterface> $type
* @param class-string<ActionTypeInterface>|null $type
*/
public function addBatchAction(ActionBuilderInterface|string $action, string $type = null, array $options = []): static;

Expand All @@ -70,7 +70,7 @@ public function getRowAction(string $name): ActionBuilderInterface;
public function hasRowAction(string $name): bool;

/**
* @param null|class-string<ActionTypeInterface> $type
* @param class-string<ActionTypeInterface>|null $type
*/
public function addRowAction(ActionBuilderInterface|string $action, string $type = null, array $options = []): static;

Expand Down
1 change: 0 additions & 1 deletion src/DataTableConfigBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Kreyu\Bundle\DataTableBundle;

use Kreyu\Bundle\DataTableBundle\Action\ActionFactoryInterface;
use Kreyu\Bundle\DataTableBundle\Action\Type\ActionTypeInterface;
use Kreyu\Bundle\DataTableBundle\Column\ColumnFactoryInterface;
use Kreyu\Bundle\DataTableBundle\Column\Type\ColumnTypeInterface;
use Kreyu\Bundle\DataTableBundle\Exporter\ExportData;
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->setDeprecated(
'kreyu/data-table-bundle',
'0.12.0',
'The child node "%node%" at path "%path%" is deprecated, use "defaults.themes" instead.'
'The child node "%node%" at path "%path%" is deprecated, use "defaults.themes" instead.',
)
->end()
->arrayNode('defaults')
Expand Down
2 changes: 1 addition & 1 deletion src/Pagination/CurrentPageOutOfRangeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
class CurrentPageOutOfRangeException extends \Exception
{
// ...
}
}
5 changes: 2 additions & 3 deletions src/Persistence/CachePersistenceAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

use Kreyu\Bundle\DataTableBundle\DataTableInterface;
use Psr\Cache\InvalidArgumentException;

use function Symfony\Component\String\u;

use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\Cache\TagAwareCacheInterface;

use function Symfony\Component\String\u;

class CachePersistenceAdapter implements PersistenceAdapterInterface
{
public const TAG_PREFIX = 'kreyu_data_table_persistence_';
Expand Down
2 changes: 1 addition & 1 deletion src/RowIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public function rewind(): void
{
$this->recreateGenerator();
}
}
}
2 changes: 1 addition & 1 deletion src/Sorting/Direction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ enum Direction: string
{
case ASC = 'asc';
case DESC = 'desc';
}
}
3 changes: 1 addition & 2 deletions src/Sorting/SortingColumnData.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
}

/**
* @param array{name: string, direction: string} $data
* @return self
* @param array{name: string, direction: string} $data
*/
public static function fromArray(array $data): self
{
Expand Down
Loading

0 comments on commit aa3053c

Please sign in to comment.