Skip to content

Commit

Permalink
Requires PHP 7.2 or newer
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Jul 7, 2023
1 parent 0eb6bf7 commit 6461f3c
Show file tree
Hide file tree
Showing 34 changed files with 79 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
tests:
uses: janpecha/actions/.github/workflows/nette-tester-library.yml@master
with:
phpVersions: '["5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]'
phpVersions: '["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]'
lowestDependencies: true

coding-style:
Expand Down
2 changes: 1 addition & 1 deletion code-checker.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return function (JP\CodeChecker\CheckerConfig $config) {
$config->setPhpVersion(new JP\CodeChecker\Version('5.6.0'));
$config->setPhpVersion(new JP\CodeChecker\Version('7.2.0'));
$config->addPath('./src');
$config->addPath('./tests');
JP\CodeChecker\Sets\CzProjectMinimum::configure($config);
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
{"type": "other", "url": "https://www.janpecha.cz/donate/"}
],
"require": {
"php": ">=5.6.0",
"php": ">=7.2.0",
"czproject/assert": "^1.3",
"nette/application": "^2.4 || ^3.0",
"nette/forms": "^2.4 || ^3.0",
"nette/utils": "^2.4 || ^3.0 || ^4.0"
"nette/application": "^3.0",
"nette/forms": "^3.0",
"nette/utils": "^3.0 || ^4.0"
},
"autoload": {
"classmap": ["src/"]
},
"require-dev": {
"nette/tester": "^2.0",
"mbohuslavek/leanmapper-query": "^1.1"
"mbohuslavek/leanmapper-query": "^1.2"
},
"extra": {
"assets-files": "assets/",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DataGrid component for Nette.
composer require inteve/datagrid
```

Inteve\Datagrid requires PHP 5.6.0 or later.
Inteve\Datagrid requires PHP 7.2.0 or later.


## Usage
Expand Down
2 changes: 2 additions & 0 deletions src/Action.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/BulkAction.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/Columns/AbstractColumn.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Columns;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/Columns/DateTimeColumn.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Columns;

use CzProject\Assert\Assert;
Expand Down
4 changes: 3 additions & 1 deletion src/Columns/LinkColumn.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Columns;

use Nette\Utils\Html;
Expand Down Expand Up @@ -34,7 +36,7 @@ protected function processDefaultFormat($value, $row)
$url = call_user_func($this->linkFactory, $value, $row);
}

if (Validators::isUrl($url)) { // external URL
if (is_string($url) && Validators::isUrl($url)) { // external URL
$target = '_blank';
}

Expand Down
2 changes: 2 additions & 0 deletions src/Columns/NumberColumn.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Columns;


Expand Down
2 changes: 2 additions & 0 deletions src/Columns/TextColumn.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Columns;


Expand Down
11 changes: 8 additions & 3 deletions src/DataGrid.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down Expand Up @@ -442,9 +444,8 @@ public function processBulkAction(\Nette\Application\UI\Form $form)

/**
* @param array<string, mixed> $params
* @return void
*/
public function loadState(array $params)
public function loadState(array $params): void
{
parent::loadState($params);

Expand Down Expand Up @@ -515,7 +516,11 @@ public function render()
$result = $this->getDataResult();
$template = $this->createTemplate();
assert($template instanceof \Nette\Bridges\ApplicationLatte\Template);
$template->setParameters($this->templateParameters);

foreach ($this->templateParameters as $templateParameter => $templateParameterValue) {
$template->{$templateParameter} = $templateParameterValue;
}

$template->grid = $this;
$template->rows = $result->getRows();
$template->paginator = $this->createPaginator($result, $this->page, $this->getItemsOnPage());
Expand Down
2 changes: 2 additions & 0 deletions src/DataPaging.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/DataProxy.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/DataSourceResult.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/DataSources/ArrayDataSource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\DataSources;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/DataSources/LeanMapperQuery.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\DataSources;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/DataSources/MergedDataSource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\DataSources;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/FilterCondition.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/FilterModifier.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
2 changes: 2 additions & 0 deletions src/Filters/AbstractFilter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Filters;

use CzProject\Assert\Assert;
Expand Down
6 changes: 5 additions & 1 deletion src/Filters/MultiSelectFilter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Filters;

use Inteve\DataGrid\IFilter;
Expand Down Expand Up @@ -37,7 +39,9 @@ public function setValue($value)
}

$values = explode(',', $value);
array_walk($values, ['Nette\Utils\Strings', 'trim']);
array_walk($values, function (string $value, $key) {
return \Nette\Utils\Strings::trim($value);
});
array_filter($values, function ($value) {
return $value !== '';
});
Expand Down
2 changes: 2 additions & 0 deletions src/Filters/SelectFilter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Filters;

use Inteve\DataGrid\IFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/Filters/TextFilter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid\Filters;

use Inteve\DataGrid\IFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/Helpers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use CzProject\Assert\Assert;
Expand Down
4 changes: 3 additions & 1 deletion src/IColumn.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;


Expand Down Expand Up @@ -36,7 +38,7 @@ function getRowField();

/**
* @param array<string, mixed>|object $row
* @return string
* @return string|\Nette\Utils\Html
*/
function formatValue($row);

Expand Down
2 changes: 2 additions & 0 deletions src/IDataSource.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;


Expand Down
2 changes: 2 additions & 0 deletions src/IFilter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;

use Nette\Forms\Controls\BaseControl;
Expand Down
2 changes: 2 additions & 0 deletions src/LinkHelper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;


Expand Down
2 changes: 2 additions & 0 deletions src/exceptions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Inteve\DataGrid;


Expand Down
2 changes: 2 additions & 0 deletions tests/DataGrid/DataSources/ArrayDataSource.objects.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Inteve\DataGrid\DataSources\ArrayDataSource;
use Tester\Assert;

Expand Down
2 changes: 2 additions & 0 deletions tests/DataGrid/DataSources/ArrayDataSource.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Inteve\DataGrid\DataPaging;
use Inteve\DataGrid\DataSources\ArrayDataSource;
use Tester\Assert;
Expand Down
2 changes: 2 additions & 0 deletions tests/DataGrid/DataSources/MergedDataSource.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Inteve\DataGrid\DataPaging;
use Inteve\DataGrid\DataSources\ArrayDataSource;
use Inteve\DataGrid\DataSources\MergedDataSource;
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

require __DIR__ . '/../vendor/autoload.php';

Tester\Environment::setup();
Expand Down

0 comments on commit 6461f3c

Please sign in to comment.