Skip to content

Commit 7842f2e

Browse files
committed
Fix code style and tests
1 parent 92a06d6 commit 7842f2e

14 files changed

+39
-45
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@ All notable changes to `omines\datatables-bundle` will be documented in this fil
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
6+
Nothing yet.
7+
8+
## [0.5.0] - 2020-06-29
9+
### Added
10+
- Support for server-side exportsv (#83)
11+
- Support for per-column searches (#120)
12+
- ORM adapter supporting fetch joins (#121)
13+
- TwigStringColumn type for simple inline templating (#146)
14+
615
### Changed
716
- Fix contract dependency handling by upping Symfony requirement to 4.2+
817

18+
### Fixed
19+
- Use trans() for proper locale fallback when using CDN languages (#141)
20+
921
## [0.4.2] - 2020-04-08
1022
### Added
1123
- Update translations automatically with script (#130)
@@ -116,7 +128,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
116128
### Added
117129
- Basic functionality
118130

119-
[Unreleased]: https://github.com/omines/datatables-bundle/compare/0.4.2...master
131+
[Unreleased]: https://github.com/omines/datatables-bundle/compare/0.5.0...master
132+
[0.5.0]: https://github.com/omines/datatables-bundle/compare/0.4.2...0.5.0
120133
[0.4.2]: https://github.com/omines/datatables-bundle/compare/0.4.1...0.4.2
121134
[0.4.1]: https://github.com/omines/datatables-bundle/compare/0.4.0...0.4.1
122135
[0.4.0]: https://github.com/omines/datatables-bundle/compare/0.3.1...0.4.0

src/Adapter/Doctrine/FetchJoinORMAdapter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
2+
23
/*
34
* Symfony DataTables Bundle
4-
* (c) Jan Böhmer 2020
5+
* (c) Omines Internetbureau B.V. - https://omines.nl/
56
*
67
* For the full copyright and license information, please view the LICENSE
78
* file that was distributed with this source code.

src/DataTable.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ class DataTable
112112

113113
/**
114114
* DataTable constructor.
115-
*
116-
* @param EventDispatcherInterface $eventDispatcher
117-
* @param DataTableExporterManager $exporterManager
118-
* @param array $options
119-
* @param Instantiator|null $instantiator
120115
*/
121116
public function __construct(EventDispatcherInterface $eventDispatcher, DataTableExporterManager $exporterManager, array $options = [], Instantiator $instantiator = null)
122117
{

src/Exporter/Csv/CsvExporter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* Symfony DataTables Bundle
5+
* (c) Omines Internetbureau B.V. - https://omines.nl/
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
311
declare(strict_types=1);
412

513
namespace Omines\DataTablesBundle\Exporter\Csv;

src/Exporter/DataTableExporterCollection.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class DataTableExporterCollection
2727

2828
/**
2929
* DataTableExporterCollection constructor.
30-
*
31-
* @param \Traversable $exporters
3230
*/
3331
public function __construct(\Traversable $exporters)
3432
{
@@ -38,10 +36,6 @@ public function __construct(\Traversable $exporters)
3836
/**
3937
* Finds a DataTable exporter that matches the given name.
4038
*
41-
* @param string $name
42-
*
43-
* @return DataTableExporterInterface
44-
*
4539
* @throws UnknownDataTableExporterException
4640
*/
4741
public function getByName(string $name): DataTableExporterInterface

src/Exporter/DataTableExporterInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,11 @@ interface DataTableExporterInterface
2121
{
2222
/**
2323
* Exports the data from the DataTable to a file.
24-
*
25-
* @param array $columnNames
26-
* @param \Iterator $data
27-
*
28-
* @return \SplFileInfo
2924
*/
3025
public function export(array $columnNames, \Iterator $data): \SplFileInfo;
3126

3227
/**
3328
* A unique name to identify the exporter.
34-
*
35-
* @return string
3629
*/
3730
public function getName(): string;
3831
}

src/Exporter/DataTableExporterManager.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace Omines\DataTablesBundle\Exporter;
1414

1515
use Omines\DataTablesBundle\DataTable;
16-
use Omines\DataTablesBundle\DataTableState;
1716
use Omines\DataTablesBundle\Exception\InvalidArgumentException;
1817
use Omines\DataTablesBundle\Exporter\Event\DataTableExporterResponseEvent;
1918
use Symfony\Component\HttpFoundation\BinaryFileResponse;
@@ -44,7 +43,6 @@ class DataTableExporterManager
4443
/**
4544
* DataTableExporterManager constructor.
4645
*
47-
* @param DataTableExporterCollection $exporterCollection
4846
* @param TranslatorInterface|LegacyTranslatorInterface $translator
4947
*/
5048
public function __construct(DataTableExporterCollection $exporterCollection, $translator)
@@ -58,8 +56,6 @@ public function __construct(DataTableExporterCollection $exporterCollection, $tr
5856
}
5957

6058
/**
61-
* @param string $exporterName
62-
*
6359
* @return DataTableExporterManager
6460
*/
6561
public function setExporterName(string $exporterName): self
@@ -70,8 +66,6 @@ public function setExporterName(string $exporterName): self
7066
}
7167

7268
/**
73-
* @param DataTable $dataTable
74-
*
7569
* @return DataTableExporterManager
7670
*/
7771
public function setDataTable(DataTable $dataTable): self
@@ -82,8 +76,6 @@ public function setDataTable(DataTable $dataTable): self
8276
}
8377

8478
/**
85-
* @return Response
86-
*
8779
* @throws \Omines\DataTablesBundle\Exception\UnknownDataTableExporterException
8880
*/
8981
public function getResponse(): Response
@@ -121,8 +113,6 @@ private function getColumnNames(): array
121113
*
122114
* A Generator is created in order to remove the 'DT_RowId' key
123115
* which is created by some adapters (e.g. ORMAdapter).
124-
*
125-
* @return \Iterator
126116
*/
127117
private function getAllData(): \Iterator
128118
{

src/Exporter/Event/DataTableExporterResponseEvent.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
namespace Omines\DataTablesBundle\Exporter\Event;
1414

15-
use Symfony\Contracts\EventDispatcher\Event;
1615
use Symfony\Component\HttpFoundation\BinaryFileResponse;
16+
use Symfony\Contracts\EventDispatcher\Event;
1717

1818
/**
1919
* DataTableExporterResponseEvent.
@@ -27,17 +27,12 @@ class DataTableExporterResponseEvent extends Event
2727

2828
/**
2929
* DataTableExporterResponseEvent constructor.
30-
*
31-
* @param BinaryFileResponse $response
3230
*/
3331
public function __construct(BinaryFileResponse $response)
3432
{
3533
$this->response = $response;
3634
}
3735

38-
/**
39-
* @return BinaryFileResponse
40-
*/
4136
public function getResponse(): BinaryFileResponse
4237
{
4338
return $this->response;

src/Exporter/Excel/ExcelExporter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ public function export(array $columnNames, \Iterator $data): \SplFileInfo
6262
/**
6363
* Sets the columns width to automatically fit the contents.
6464
*
65-
* @param Worksheet $sheet
66-
*
6765
* @throws \PhpOffice\PhpSpreadsheet\Exception
6866
*/
6967
private function autoSizeColumnWidth(Worksheet $sheet)

src/Twig/DataTablesExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function getFunctions()
5252
*/
5353
private function getLanguageSettings(DataTable $dataTable)
5454
{
55-
if ($dataTable->isLanguageFromCDN() && ($cdnFile = $this->getCDNLanguageFile()) !== null) {
55+
if ($dataTable->isLanguageFromCDN() && null !== ($cdnFile = $this->getCDNLanguageFile())) {
5656
return ['url' => '//cdn.datatables.net/plug-ins/1.10.15/i18n/' . $cdnFile];
5757
}
5858

@@ -98,7 +98,7 @@ private function getCDNLanguageFile()
9898
$file = $this->translator->trans('file', [], 'DataTablesCDN');
9999

100100
// CDN language file does not exists
101-
if ($file === 'file') {
101+
if ('file' === $file) {
102102
return null;
103103
}
104104

0 commit comments

Comments
 (0)