Skip to content

Commit

Permalink
Better namespace. (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Nov 20, 2023
1 parent 4fa74ab commit 0a460b8
Show file tree
Hide file tree
Showing 53 changed files with 107 additions and 179 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
},
"autoload": {
"psr-4": {
"yii\\behavior\\nested\\sets\\": "src"
"Yii2\\Extensions\\NestedSets\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"yii\\behavior\\nested\\sets\\tests\\": "tests"
"Yii2\\Extensions\\NestedSets\\Tests\\": "tests"
}
},
"extra": {
Expand Down
7 changes: 4 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
includes:
- vendor/yii2-extensions/phpstan/extension.neon

parameters:
bootstrapFiles:
- tests/bootstrap.php

dynamicConstantNames:
- YII_DEBUG
- YII_ENV
- YII_ENV_DEV
- YII_ENV_PROD
- YII_ENV_TEST

level: 1

Expand Down
25 changes: 7 additions & 18 deletions src/NestedSetsBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@

declare(strict_types=1);

/**
* @link https://github.com/creocoder/yii2-nested-sets
*
* @copyright Copyright (c) 2015 Alexander Kochetov
* @license http://opensource.org/licenses/BSD-3-Clause
*/

namespace yii\behavior\nested\sets;
namespace Yii2\Extensions\NestedSets;

use yii\base\Behavior;
use yii\base\NotSupportedException;
Expand All @@ -18,13 +11,6 @@
use yii\db\Exception;
use yii\db\Expression;

/**
* NestedSetsBehavior
*
* @property ActiveRecord $owner
*
* @author Alexander Kochetov <creocoder@gmail.com>
*/
class NestedSetsBehavior extends Behavior
{
public const OPERATION_MAKE_ROOT = 'makeRoot';
Expand Down Expand Up @@ -379,8 +365,9 @@ public function beforeInsert(): void
$this->beforeInsertNode($this->node->getAttribute($this->rightAttribute) + 1, 0);
break;
default:
throw new NotSupportedException('Method "' . get_class($this->owner) .
'::insert" is not supported for inserting new nodes.');
throw new NotSupportedException(
'Method "' . get_class($this->owner) . '::insert" is not supported for inserting new nodes.'
);
}
}

Expand Down Expand Up @@ -631,7 +618,9 @@ public function beforeDelete(): void
}

if ($this->owner->isRoot() && $this->operation !== self::OPERATION_DELETE_WITH_CHILDREN) {
throw new NotSupportedException('Method "' . get_class($this->owner) . '::delete" is not supported for deleting root nodes.');
throw new NotSupportedException(
'Method "' . get_class($this->owner) . '::delete" is not supported for deleting root nodes.'
);
}

$this->owner->refresh();
Expand Down
16 changes: 1 addition & 15 deletions src/NestedSetsQueryBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,12 @@

declare(strict_types=1);

/**
* @link https://github.com/creocoder/yii2-nested-sets
*
* @copyright Copyright (c) 2015 Alexander Kochetov
* @license http://opensource.org/licenses/BSD-3-Clause
*/

namespace yii\behavior\nested\sets;
namespace Yii2\Extensions\NestedSets;

use yii\base\Behavior;
use yii\db\ActiveQuery;
use yii\db\Expression;

/**
* NestedSetsQueryBehavior
*
* @property ActiveQuery $owner
*
* @author Alexander Kochetov <creocoder@gmail.com>
*/
class NestedSetsQueryBehavior extends Behavior
{
/**
Expand Down
Loading

0 comments on commit 0a460b8

Please sign in to comment.