Skip to content

Commit

Permalink
PHP CS Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Apr 6, 2023
1 parent 28271f1 commit fa907c5
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/Action/Type/ActionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function getActionBlockPrefixes(ActionInterface $action, array $options)

private function getConfirmationOptionsResolver(): OptionsResolver
{
return (new OptionsResolver)
return (new OptionsResolver())
->setDefaults([
'translation_domain' => 'KreyuDataTable',
'label_title' => 'Action confirmation',
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/Type/EntityFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function configureOptions(OptionsResolver $resolver): void
$choiceLabel = $options['choice_label'];

if (is_string($choiceLabel)) {
return (PropertyAccess::createPropertyAccessor())->getValue($data->getValue(), $choiceLabel);
return PropertyAccess::createPropertyAccessor()->getValue($data->getValue(), $choiceLabel);
}

if (is_callable($choiceLabel)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Kreyu\Bundle\DataTableBundle\Column\ColumnHeaderView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnView;
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Kreyu\Bundle\DataTableBundle\Exporter\ExportFile;
use Kreyu\Bundle\DataTableBundle\Exporter\Type\AbstractExporterType as BaseAbstractType;
Expand Down
1 change: 0 additions & 1 deletion src/Column/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Kreyu\Bundle\DataTableBundle\Column;

use Kreyu\Bundle\DataTableBundle\Column\Type\ResolvedColumnTypeInterface;
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Kreyu\Bundle\DataTableBundle\HeaderRowView;
use Kreyu\Bundle\DataTableBundle\ValueRowView;

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

use Kreyu\Bundle\DataTableBundle\Column\Type\ResolvedColumnTypeInterface;
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Kreyu\Bundle\DataTableBundle\HeaderRowView;
use Kreyu\Bundle\DataTableBundle\ValueRowView;

Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/ColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function getParent(): ?string
}

/**
* Retrieves the column norm data from the row data by either:
* Retrieves the column norm data from the row data by either:.
*
* - using the "getter" option;
* - using the property accessor with the "property_path" option;
Expand Down
2 changes: 0 additions & 2 deletions src/Column/Type/ResolvedColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnHeaderView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnInterface;
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnView;
use Kreyu\Bundle\DataTableBundle\Column\Extension\ColumnTypeExtensionInterface;
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Kreyu\Bundle\DataTableBundle\HeaderRowView;
use Kreyu\Bundle\DataTableBundle\ValueRowView;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand Down
1 change: 0 additions & 1 deletion src/Column/Type/ResolvedColumnTypeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnInterface;
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Kreyu\Bundle\DataTableBundle\Column\Extension\ColumnTypeExtensionInterface;
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Kreyu\Bundle\DataTableBundle\HeaderRowView;
use Kreyu\Bundle\DataTableBundle\ValueRowView;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand Down
1 change: 0 additions & 1 deletion src/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Kreyu\Bundle\DataTableBundle\Query\ProxyQueryInterface;
use Kreyu\Bundle\DataTableBundle\Sorting\SortingData;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;

class DataTable implements DataTableInterface
{
Expand Down
3 changes: 0 additions & 3 deletions src/DataTableView.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ class DataTableView
*/
public array $valueRows = [];

/**
* @var PaginationView
*/
public PaginationView $pagination;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Exporter/ExportData.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ExportData

public static function fromArray(array $data): static
{
$resolver = (new OptionsResolver)
$resolver = (new OptionsResolver())
->setRequired('exporter')
->setDefaults([
'filename' => 'export',
Expand Down
4 changes: 2 additions & 2 deletions src/Filter/FiltrationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(array $filters = [])

/**
* Creates a new instance of filtration data from an array.
* The array keys are the filter names, and values can be either:
* The array keys are the filter names, and values can be either:.
*
* - an instance of {@see FilterData}
* - an array of filter data
Expand Down Expand Up @@ -119,7 +119,7 @@ public function removeFilter(string|FilterInterface $filter): void
/**
* @param array<FilterInterface> $filters
*/
public function appendMissingFilters(array $filters, FilterData $data = new FilterData): void
public function appendMissingFilters(array $filters, FilterData $data = new FilterData()): void
{
foreach ($filters as $column) {
if (null === $this->getFilterData($column)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Filter/Form/Type/FiltrationDataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'setter' => function (FiltrationData $filtrationData, FilterData $filterData, FormInterface $form) {
$filtrationData->setFilterData($form->getName(), $filterData);
},
'empty_data' => new FilterData,
'empty_data' => new FilterData(),
]));
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public function configureOptions(OptionsResolver $resolver): void
->setRequired('data_table')
->setAllowedTypes('data_table', DataTableInterface::class)
->setAllowedTypes('data_table_view', ['null', DataTableView::class])
->setAllowedTypes('filters', FilterInterface::class . '[]')
->setAllowedTypes('filters', FilterInterface::class.'[]')
;
}

Expand Down
1 change: 0 additions & 1 deletion src/Filter/Type/FilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Kreyu\Bundle\DataTableBundle\Filter\FilterData;
use Kreyu\Bundle\DataTableBundle\Filter\FilterInterface;
use Kreyu\Bundle\DataTableBundle\Filter\FilterView;
use Kreyu\Bundle\DataTableBundle\Filter\FiltrationData;
use Kreyu\Bundle\DataTableBundle\Filter\Form\Type\OperatorType;
use Kreyu\Bundle\DataTableBundle\Query\ProxyQueryInterface;
use Kreyu\Bundle\DataTableBundle\Util\StringUtil;
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/Type/SearchFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function configureOptions(OptionsResolver $resolver): void
'operator_options' => [
'visible' => false,
'choices' => [],
]
],
])
->setRequired('handler')
->setAllowedTypes('handler', 'callable')
Expand Down
3 changes: 1 addition & 2 deletions src/HeaderRowView.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\Column\ColumnHeaderView;
use Traversable;

class HeaderRowView implements \ArrayAccess, \IteratorAggregate, \Countable
{
Expand All @@ -23,7 +22,7 @@ public function __construct(
) {
}

public function getIterator(): Traversable
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->children);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Kreyu\Bundle\DataTableBundle\Personalization\PersonalizationColumnData;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand Down Expand Up @@ -34,4 +33,4 @@ public function getBlockPrefix(): string
{
return 'kreyu_data_table_personalization_column_data';
}
}
}
7 changes: 1 addition & 6 deletions src/Personalization/PersonalizationData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnInterface;
use Kreyu\Bundle\DataTableBundle\DataTableInterface;
use Kreyu\Bundle\DataTableBundle\Exception\UnexpectedTypeException;
use Kreyu\Bundle\DataTableBundle\Personalization\Form\Type\PersonalizationColumnDataType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class PersonalizationData
{
Expand Down Expand Up @@ -49,9 +47,6 @@ public static function fromArray(array $data): static
* Creates a new instance from a {@see DataTableInterface}.
* The columns are be added in order they are defined in the data table.
* Every column is marked as "visible" by default.
*
* @param DataTableInterface $dataTable
* @return static
*/
public static function fromDataTable(DataTableInterface $dataTable): static
{
Expand Down Expand Up @@ -205,7 +200,7 @@ private function appendColumn(string|ColumnInterface $column, bool $visible): vo
array_filter(
$this->columns,
fn (PersonalizationColumnData $columnData) => $columnData->isVisible() === $visible,
)
),
);

$columnOrder = 0;
Expand Down
4 changes: 0 additions & 4 deletions src/Request/HttpFoundationRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@

use Kreyu\Bundle\DataTableBundle\DataTableInterface;
use Kreyu\Bundle\DataTableBundle\Exception\UnexpectedTypeException;
use Kreyu\Bundle\DataTableBundle\Exporter\ExportData;
use Kreyu\Bundle\DataTableBundle\Exporter\ExportStrategy;
use Kreyu\Bundle\DataTableBundle\Filter\FiltrationData;
use Kreyu\Bundle\DataTableBundle\Pagination\PaginationData;
use Kreyu\Bundle\DataTableBundle\Pagination\PaginationInterface;
use Kreyu\Bundle\DataTableBundle\Personalization\PersonalizationData;
use Kreyu\Bundle\DataTableBundle\Sorting\SortingData;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\PropertyAccess\PropertyAccess;
Expand Down
5 changes: 2 additions & 3 deletions src/Twig/DataTableExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Kreyu\Bundle\DataTableBundle\Action\ActionView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnHeaderView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Kreyu\Bundle\DataTableBundle\Column\ColumnView;
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Kreyu\Bundle\DataTableBundle\HeaderRowView;
use Kreyu\Bundle\DataTableBundle\Pagination\PaginationView;
Expand Down Expand Up @@ -272,10 +271,10 @@ private function renderBlock(Environment $environment, string $blockName, array
private function getDecoratedViewContext(Environment $environment, ColumnHeaderView|ColumnValueView|ActionView $view, array $variables, string $prefix, string $suffix): array
{
$context = array_merge($view->vars, $variables);
$context['block_name'] = $prefix . '_' . $suffix;
$context['block_name'] = $prefix.'_'.$suffix;

foreach ($view->vars['block_prefixes'] as $blockPrefix) {
$blockName = $prefix . '_' . $blockPrefix . '_' . $suffix;
$blockName = $prefix.'_'.$blockPrefix.'_'.$suffix;

foreach ($this->themes as $theme) {
$wrapper = $environment->load($theme);
Expand Down
4 changes: 2 additions & 2 deletions src/Util/StringUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public static function camelToSentence(string $string): string
{
return ucfirst(strtolower(preg_replace_callback(
'/(([A-Z]{1}))/',
function ($matches) {return " " .$matches[0];},
$string
function ($matches) {return ' '.$matches[0]; },
$string,
)));
}
}
3 changes: 1 addition & 2 deletions src/ValueRowView.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\Column\ColumnValueView;
use Traversable;

class ValueRowView implements \ArrayAccess, \IteratorAggregate, \Countable
{
Expand All @@ -27,7 +26,7 @@ public function __construct(
) {
}

public function getIterator(): Traversable
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->children);
}
Expand Down

0 comments on commit fa907c5

Please sign in to comment.