Skip to content

Commit 454c710

Browse files
committed
Add support for PHP 8
1 parent c07dcf3 commit 454c710

File tree

5 files changed

+10
-23
lines changed

5 files changed

+10
-23
lines changed

.github/workflows/coding-style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- uses: shivammathur/setup-php@v2
1212
with:
13-
php-version: 7.4
13+
php-version: 8.0
1414
coverage: none
1515

1616
- run: composer create-project nette/code-checker temp/code-checker ^3 --no-progress

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
- name: Install PHP
2020
uses: shivammathur/setup-php@master
2121
with:
22-
php-version: 7.4
22+
php-version: 8.0
2323

2424
- name: Install composer deps
2525
run: |
2626
composer create-project nette/code-checker temp/code-checker ^3 --no-progress
27-
composer create-project nette/coding-standard temp/coding-standard ^2 --no-progress
27+
composer create-project nette/coding-standard temp/coding-standard ^3 --no-progress
2828
2929
# Install app deps
3030
composer install --no-interaction --prefer-dist

composer.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
}
1010
],
1111
"require": {
12-
"php": "^7.4 || ^8.0"
12+
"php": "^8.0"
1313
},
1414
"require-dev": {
15-
"phpstan/phpstan": "^0.12.52",
15+
"phpstan/phpstan": "^0.12.74",
1616
"tracy/tracy": "^2.8",
17-
"phpstan/phpstan-nette": "^0.12.9",
17+
"phpstan/phpstan-nette": "^0.12.14",
1818
"spaze/phpstan-disallowed-calls": "^1.1",
1919
"roave/security-advisories": "dev-master"
2020
},
@@ -23,11 +23,6 @@
2323
"src/"
2424
]
2525
},
26-
"config": {
27-
"platform": {
28-
"php": "7.4.0"
29-
}
30-
},
3126
"scripts": {
3227
"phpstan": [
3328
"vendor/bin/phpstan analyse src -c phpstan.neon --level 8 --no-progress"

src/SelectboxItem.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,14 @@
77

88
final class SelectboxItem
99
{
10-
/** @var int|string */
11-
private $id;
10+
private int|string $id;
1211

1312
private string $name;
1413

15-
/** @var int|string|null */
16-
private $parentId;
14+
private int|string|null $parentId;
1715

1816

19-
/**
20-
* @param int|string $id
21-
* @param int|string|null $parentId
22-
*/
23-
public function __construct($id, string $name, $parentId = null)
17+
public function __construct(int|string $id, string $name, int|string|null $parentId = null)
2418
{
2519
$this->id = $id;
2620
$this->name = $name;

src/SelectboxTree.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public function process(array $data): array
6060

6161
/**
6262
* @param string[] $wheres
63-
* @return string
6463
*/
6564
public function sqlBuilder(
6665
string $table,
@@ -96,10 +95,9 @@ public function setNameFormatter(NameFormatter $nameFormatter): void
9695
* Build category tree to simple selectbox array.
9796
*
9897
* @param string[][]|null[][]|null $categories
99-
* @param int|string|null $parent
10098
* @return mixed[][]
10199
*/
102-
private function serializeCategoriesToSelectbox(?array $categories, int $level = 0, $parent = null): array
100+
private function serializeCategoriesToSelectbox(?array $categories, int $level = 0, int|string|null $parent = null): array
103101
{
104102
static $usedIds = [];
105103

0 commit comments

Comments
 (0)