Skip to content

Commit

Permalink
feat: mark type classes as final
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Feb 11, 2024
1 parent 42d843e commit 0fd01e0
Show file tree
Hide file tree
Showing 35 changed files with 52 additions and 34 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# 0.17

## Breaking changes

### Type classes are now final

Built-in data table, column, filter, action and exporter types are now marked as "final".
This promotes the usage of `getParent()` method instead of PHP inheritance.

### Removed extension mechanisms

The extensions (not *type* extensions!) were a mechanisms copied from Symfony Form component.
Their main purpose was to provide a way to load type and type extension classes manually.
In most cases, that would be used only outside the framework, which is out of scope of this bundle.

Everything related with extensions is now completely removed.
Every type and type extension class defined in the container is now passed directly to the registry classes.

# 0.16

- **[Feature]** French translation (https://github.com/Kreyu/data-table-bundle/pull/53)
Expand Down
2 changes: 1 addition & 1 deletion src/Action/Type/ButtonActionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Kreyu\Bundle\DataTableBundle\Action\Type;

class ButtonActionType extends AbstractActionType
final class ButtonActionType extends AbstractActionType
{
public function getParent(): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Action/Type/FormActionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Kreyu\Bundle\DataTableBundle\DataTableView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class FormActionType extends AbstractActionType
final class FormActionType extends AbstractActionType
{
public function buildView(ActionView $view, ActionInterface $action, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Action/Type/LinkActionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class LinkActionType extends AbstractActionType
final class LinkActionType extends AbstractActionType
{
public function buildView(ActionView $view, ActionInterface $action, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/Type/BooleanFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatableMessage;

class BooleanFilterType extends AbstractDoctrineOrmFilterType
final class BooleanFilterType extends AbstractDoctrineOrmFilterType
{
public function buildFilter(FilterBuilderInterface $builder, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/Type/DateFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DateFilterType extends AbstractDoctrineOrmFilterType
final class DateFilterType extends AbstractDoctrineOrmFilterType
{
public function buildFilter(FilterBuilderInterface $builder, array $options): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Kreyu\Bundle\DataTableBundle\Filter\Operator;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DateRangeFilterType extends AbstractDoctrineOrmFilterType
final class DateRangeFilterType extends AbstractDoctrineOrmFilterType
{
public function buildFilter(FilterBuilderInterface $builder, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/Type/DateTimeFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DateTimeFilterType extends AbstractDoctrineOrmFilterType
final class DateTimeFilterType extends AbstractDoctrineOrmFilterType
{
public function buildFilter(FilterBuilderInterface $builder, array $options): void
{
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 @@ -12,7 +12,7 @@
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class EntityFilterType extends AbstractDoctrineOrmFilterType
final class EntityFilterType extends AbstractDoctrineOrmFilterType
{
public function __construct(
private readonly ?ManagerRegistry $managerRegistry = null,
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/Type/NumericFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class NumericFilterType extends AbstractDoctrineOrmFilterType
final class NumericFilterType extends AbstractDoctrineOrmFilterType
{
public function buildFilter(FilterBuilderInterface $builder, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/Type/StringFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Kreyu\Bundle\DataTableBundle\Filter\Operator;
use Symfony\Component\OptionsResolver\OptionsResolver;

class StringFilterType extends AbstractDoctrineOrmFilterType
final class StringFilterType extends AbstractDoctrineOrmFilterType
{
public function buildFilter(FilterBuilderInterface $builder, array $options): void
{
Expand Down
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 @@ -7,7 +7,7 @@
use OpenSpout\Writer\CSV;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CsvExporterType extends AbstractOpenSpoutExporterType
final class CsvExporterType extends AbstractOpenSpoutExporterType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/OpenSpout/Exporter/Type/OdsExporterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use OpenSpout\Writer\ODS;
use Symfony\Component\OptionsResolver\OptionsResolver;

class OdsExporterType extends AbstractOpenSpoutExporterType
final class OdsExporterType extends AbstractOpenSpoutExporterType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
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 @@ -8,7 +8,7 @@
use OpenSpout\Writer\XLSX;
use Symfony\Component\OptionsResolver\OptionsResolver;

class XlsxExporterType extends AbstractOpenSpoutExporterType
final class XlsxExporterType extends AbstractOpenSpoutExporterType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PhpOffice\PhpSpreadsheet\Writer\IWriter;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CsvExporterType extends AbstractPhpSpreadsheetExporterType
final class CsvExporterType extends AbstractPhpSpreadsheetExporterType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PhpOffice\PhpSpreadsheet\Writer\IWriter;
use Symfony\Component\OptionsResolver\OptionsResolver;

class HtmlExporterType extends AbstractPhpSpreadsheetExporterType
final class HtmlExporterType extends AbstractPhpSpreadsheetExporterType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PhpOffice\PhpSpreadsheet\Writer\IWriter;
use PhpOffice\PhpSpreadsheet\Writer\Ods;

class OdsExporterType extends AbstractPhpSpreadsheetExporterType
final class OdsExporterType extends AbstractPhpSpreadsheetExporterType
{
protected function getWriter(Spreadsheet $spreadsheet, array $options): IWriter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf;
use Symfony\Component\OptionsResolver\OptionsResolver;

class PdfExporterType extends AbstractPhpSpreadsheetExporterType
final class PdfExporterType extends AbstractPhpSpreadsheetExporterType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PhpOffice\PhpSpreadsheet\Writer\IWriter;
use PhpOffice\PhpSpreadsheet\Writer\Xls;

class XlsExporterType extends AbstractPhpSpreadsheetExporterType
final class XlsExporterType extends AbstractPhpSpreadsheetExporterType
{
protected function getWriter(Spreadsheet $spreadsheet, array $options): IWriter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use Symfony\Component\OptionsResolver\OptionsResolver;

class XlsxExporterType extends AbstractPhpSpreadsheetExporterType
final class XlsxExporterType extends AbstractPhpSpreadsheetExporterType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/ActionsColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ActionsColumnType extends AbstractColumnType
final class ActionsColumnType extends AbstractColumnType
{
public function __construct(
private readonly ActionFactoryInterface $actionFactory,
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/BooleanColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatableInterface;

class BooleanColumnType extends AbstractColumnType
final class BooleanColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/CheckboxColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CheckboxColumnType extends AbstractColumnType
final class CheckboxColumnType extends AbstractColumnType
{
public function buildHeaderView(ColumnHeaderView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/CollectionColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CollectionColumnType extends AbstractColumnType
final class CollectionColumnType extends AbstractColumnType
{
public function buildColumn(ColumnBuilderInterface $builder, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/DateColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Symfony\Component\OptionsResolver\OptionsResolver;

class DateColumnType extends AbstractColumnType
final class DateColumnType extends AbstractColumnType
{
public function configureOptions(OptionsResolver $resolver): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/DatePeriodColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DatePeriodColumnType extends AbstractColumnType
final class DatePeriodColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/DateTimeColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class DateTimeColumnType extends AbstractColumnType
final class DateTimeColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/FormColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class FormColumnType extends AbstractColumnType
final class FormColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/LinkColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class LinkColumnType extends AbstractColumnType
final class LinkColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/MoneyColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class MoneyColumnType extends AbstractColumnType
final class MoneyColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/NumberColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\Formatter\IntlFormatter;

class NumberColumnType extends AbstractColumnType
final class NumberColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/TemplateColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Kreyu\Bundle\DataTableBundle\Column\ColumnValueView;
use Symfony\Component\OptionsResolver\OptionsResolver;

class TemplateColumnType extends AbstractColumnType
final class TemplateColumnType extends AbstractColumnType
{
public function buildValueView(ColumnValueView $view, ColumnInterface $column, array $options): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Column/Type/TextColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Kreyu\Bundle\DataTableBundle\Column\Type;

class TextColumnType extends AbstractColumnType
final class TextColumnType extends AbstractColumnType
{
// ...
}
2 changes: 1 addition & 1 deletion src/Exporter/Type/CallbackExporterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Kreyu\Bundle\DataTableBundle\Exporter\ExportFile;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CallbackExporterType extends AbstractExporterType
final class CallbackExporterType extends AbstractExporterType
{
public function export(DataTableView $view, ExporterInterface $exporter, string $filename, array $options = []): ExportFile
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/Type/CallbackFilterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Kreyu\Bundle\DataTableBundle\Query\ProxyQueryInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class CallbackFilterType extends AbstractFilterType implements FilterHandlerInterface
final class CallbackFilterType extends AbstractFilterType implements FilterHandlerInterface
{
public function buildFilter(FilterBuilderInterface $builder, array $options): void
{
Expand Down

0 comments on commit 0fd01e0

Please sign in to comment.