Skip to content

Commit

Permalink
set minimal version of PHP to 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
efureev committed Apr 28, 2021
1 parent fa2ece2 commit b5713bf
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fail-fast: false
matrix:
setup: [ 'basic', 'lowest' ]
php: [ '7.4' ]
php: [ '8.0' ]

services:
postgres:
Expand All @@ -57,7 +57,7 @@ jobs:
- uses: actions/checkout@v2

- name: Use PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v1 # Action page: <https://github.com/shivammathur/setup-php>
uses: shivammathur/setup-php@v2 # Action page: <https://github.com/shivammathur/setup-php>
with:
php-version: ${{ matrix.php }}
extensions: mbstring
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ categories for shop.
Requirements
------------

- PHP >= 7.4
- Laravel >= 7.30
- PHP >= 8.0
- Laravel >= 8.38

It is highly suggested to use database that supports transactions (like MySql's InnoDb, Postgres)
to secure a tree from possible corruption.
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
}
],
"require": {
"php": "^7.4|^8.0",
"illuminate/database": "^7.30|^8.38",
"illuminate/events": "^7.30|^8.38",
"efureev/support": "^3.1"
"php": "^8.0",
"illuminate/database": "^8.38",
"illuminate/events": "^8.38",
"efureev/support": "^4.1"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"orchestra/testbench": "^5.18",
"orchestra/testbench": "^6.17",
"fakerphp/faker": "^1.14",
"symfony/var-dumper": "^5.2",
"squizlabs/php_codesniffer": "^3.6"
Expand Down
22 changes: 12 additions & 10 deletions src/Config/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function setAttribute(string $name, AbstractAttribute $attribute): self
/**
* Get a list of default columns.
*
* @param bool $names
* @param bool $names
*
* @return array
*/
Expand All @@ -115,7 +115,7 @@ public function columns($names = true): array

return array_map(
static function (AbstractAttribute $item) {
return (string)$item;
return (string) $item;
},
$list
);
Expand All @@ -133,8 +133,10 @@ public function setMultiTree($treeAttribute = null): self
{
if ($treeAttribute === false) {
$treeAttribute = null;
} else if ($treeAttribute === null || $treeAttribute === true) {
$treeAttribute = new TreeAttribute();
} else {
if ($treeAttribute === null || $treeAttribute === true) {
$treeAttribute = new TreeAttribute();
}
}

$this->tree = $treeAttribute;
Expand All @@ -144,7 +146,7 @@ public function setMultiTree($treeAttribute = null): self


/**
* @param Model $model
* @param Model $model
*
* @return bool
*/
Expand All @@ -155,7 +157,7 @@ public static function isNode($model): bool


/**
* @param string $attributeType
* @param string $attributeType
*
* @return string|null
*/
Expand All @@ -168,14 +170,14 @@ public static function getCastForCustomAttribute(string $attributeType): ?string
return 'integer';
case 'string':
case 'uuid':
return 'uuid';
return 'string';
}

return null;
}

/**
* @return string
* @return string|null
*/
public function getCastForParentAttribute(): ?string
{
Expand All @@ -194,7 +196,7 @@ public function getCastForTreeAttribute(): ?string
/**
* Generate function
*
* @param Model|NestedSetTrait $model
* @param Model|NestedSetTrait $model
*
* @return mixed
*/
Expand All @@ -204,7 +206,7 @@ public function generateTreeId(Model $model)
return $model->generateTreeId();
}

return (((int)$model->max($this->tree())) + 1);
return (((int) $model->max($this->tree())) + 1);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/BaseConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public function testMultiCustomColumns(): void

static::assertEquals('_pid', (string)$config->parent());
static::assertEquals('_pid', $config->parent()->name());
static::assertEquals('uuid', $config->parent()->type());
static::assertEquals('string', $config->parent()->type());

static::assertEquals('_tree', (string)$config->tree());
static::assertEquals('_tree', $config->tree()->name());
static::assertEquals('uuid', $config->tree()->type());
static::assertEquals('string', $config->tree()->type());

$config = new Base();
static::assertNull($config->tree());
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/MigrateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testMultiCustomGetColumns(): void
/** @var ColumnDefinition $col */
static::assertContains($column->getAttributes()['name'], $multiColumns);
if ($column->getAttributes()['name'] === 'tid') {
static::assertEquals('uuid', $column->getAttributes()['type']);
static::assertEquals('string', $column->getAttributes()['type']);
static::assertTrue($column->getAttributes()['nullable']);
static::assertNull($column->getAttributes()['default']);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/models/PageUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class PageUuid extends Page
{
protected $keyType = 'uuid';
protected $keyType = 'string';

protected $table = 'pages_uuid';

Expand Down
2 changes: 1 addition & 1 deletion tests/models/Structure.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class Structure extends Page
{
protected $keyType = 'uuid';
protected $keyType = 'string';

protected $hidden = ['_setRoot'];

Expand Down

0 comments on commit b5713bf

Please sign in to comment.