Skip to content

Commit 9219a79

Browse files
authored
Merge pull request #619 from ysfks/fix/php84-warnings
Revert changing method signatures
2 parents afb1373 + 1807352 commit 9219a79

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/NodeTrait.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ public function newEloquentBuilder($query)
671671
*
672672
* @return QueryBuilder
673673
*/
674-
public function newNestedSetQuery(?string $table = null)
674+
public function newNestedSetQuery($table = null)
675675
{
676676
$builder = $this->usesSoftDelete()
677677
? $this->withTrashed()
@@ -681,19 +681,22 @@ public function newNestedSetQuery(?string $table = null)
681681
}
682682

683683
/**
684+
* @param string|null $table
685+
*
684686
* @return QueryBuilder
685687
*/
686-
public function newScopedQuery(?string $table = null)
688+
public function newScopedQuery($table = null)
687689
{
688690
return $this->applyNestedSetScope($this->newQuery(), $table);
689691
}
690692

691693
/**
692694
* @param mixed $query
695+
* @param string|null $table
693696
*
694697
* @return mixed
695698
*/
696-
public function applyNestedSetScope($query, ?string $table = null)
699+
public function applyNestedSetScope($query, $table = null)
697700
{
698701
if ( ! $scoped = $this->getScopeAttributes()) {
699702
return $query;
@@ -745,6 +748,8 @@ public function newCollection(array $models = array())
745748
* {@inheritdoc}
746749
*
747750
* Use `children` key on `$attributes` to create child nodes.
751+
*
752+
* @param self|null $parent
748753
*/
749754
public static function create(array $attributes = [], ?self $parent = null)
750755
{
@@ -1216,6 +1221,8 @@ protected function isSameScope(self $node): bool
12161221
}
12171222

12181223
/**
1224+
* @param array|null $except
1225+
*
12191226
* @return \Illuminate\Database\Eloquent\Model
12201227
*/
12211228
public function replicate(?array $except = null)

src/QueryBuilder.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function ancestorsAndSelf($id, array $columns = [ '*' ])
188188
*
189189
* @return $this
190190
*/
191-
public function whereNodeBetween($values, $boolean = 'and', $not = false, ?Query $query = null)
191+
public function whereNodeBetween($values, $boolean = 'and', $not = false, $query = null)
192192
{
193193
($query ?? $this->query)->whereBetween($this->model->getTable() . '.' . $this->model->getLftName(), $values, $boolean, $not);
194194

@@ -861,7 +861,7 @@ public function isBroken()
861861
*
862862
* @return int The number of changed nodes
863863
*/
864-
public function fixTree(?Model $root = null)
864+
public function fixTree($root = null)
865865
{
866866
$columns = [
867867
$this->model->getKeyName(),
@@ -899,7 +899,7 @@ public function fixSubtree($root)
899899
*
900900
* @return int
901901
*/
902-
protected function fixNodes(array &$dictionary, ?Model $parent = null)
902+
protected function fixNodes(array &$dictionary, $parent = null)
903903
{
904904
$parentId = $parent ? $parent->getKey() : null;
905905
$cut = $parent ? $parent->getLft() + 1 : 1;
@@ -941,7 +941,7 @@ protected function fixNodes(array &$dictionary, ?Model $parent = null)
941941
* @internal param int $fixed
942942
*/
943943
protected static function reorderNodes(
944-
array &$dictionary, array &$updated, null|int|string $parentId = null, $cut = 1
944+
array &$dictionary, array &$updated, $parentId = null, $cut = 1
945945
) {
946946
if ( ! isset($dictionary[$parentId])) {
947947
return $cut;
@@ -973,11 +973,11 @@ protected static function reorderNodes(
973973
* @param array $data
974974
* @param bool $delete Whether to delete nodes that exists but not in the data
975975
* array
976-
* @param ?Model|NodeTrait $root
976+
* @param null $root
977977
*
978978
* @return int
979979
*/
980-
public function rebuildTree(array $data, $delete = false, ?Model $root = null)
980+
public function rebuildTree(array $data, $delete = false, $root = null)
981981
{
982982
if ($this->model->usesSoftDelete()) {
983983
$this->withTrashed();
@@ -1084,7 +1084,7 @@ protected function buildRebuildDictionary(array &$dictionary,
10841084
*
10851085
* @return $this
10861086
*/
1087-
public function applyNestedSetScope(?string $table = null)
1087+
public function applyNestedSetScope($table = null)
10881088
{
10891089
return $this->model->applyNestedSetScope($this, $table);
10901090
}

tests/NodeTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function assertTreeNotBroken($table = 'categories')
8282
$this->assertEquals(array('errors' => null), $actual, "The tree structure of $table is broken!");
8383
}
8484

85-
public function dumpTree(?array $items = null)
85+
public function dumpTree($items = null)
8686
{
8787
if ( ! $items) $items = Category::withTrashed()->defaultOrder()->get();
8888

0 commit comments

Comments
 (0)