Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nateiler committed Dec 6, 2018
1 parent a736254 commit eeafb38
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/helpers/ObjectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace flipbox\craft\ember\helpers;

use craft\helpers\ArrayHelper;
use craft\helpers\Json as JsonHelper;
use yii\base\BaseObject;
use yii\base\InvalidConfigException;
Expand Down
1 change: 0 additions & 1 deletion src/helpers/QueryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace flipbox\craft\ember\helpers;

use craft\helpers\ArrayHelper;
use craft\helpers\StringHelper;
use yii\db\Query;
use yii\db\QueryInterface;
Expand Down
2 changes: 0 additions & 2 deletions src/helpers/SortOrderHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

namespace flipbox\craft\ember\helpers;

use craft\helpers\ArrayHelper;

/**
* @author Flipbox Factory <[email protected]>
* @since 2.0.0
Expand Down
10 changes: 5 additions & 5 deletions src/objects/FieldMutatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
trait FieldMutatorTrait
{
/**
* @var Field|null
* @var Field|FieldInterface|null
*/
private $field;

Expand Down Expand Up @@ -72,7 +72,7 @@ public function setField($field = null)
}

/**
* @return Field|null
* @return FieldInterface|Field|null
*/
public function getField()
{
Expand All @@ -94,7 +94,7 @@ public function getField()
}

/**
* @return Field|null
* @return FieldInterface|Field|null
*/
protected function resolveField()
{
Expand All @@ -106,7 +106,7 @@ protected function resolveField()
}

/**
* @return Field|null
* @return FieldInterface|Field|null
*/
private function resolveFieldFromId()
{
Expand All @@ -120,7 +120,7 @@ private function resolveFieldFromId()

/**
* @param mixed $field
* @return FieldInterface|Field|null
* @return FieldInterface|FieldInterface|Field|null
*/
protected function internalResolveField($field = null)
{
Expand Down
3 changes: 2 additions & 1 deletion src/records/ElementAttributeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ private function resolveElementFromRelation()
return null;
}

/** @var ElementRecord $record */
if (null === ($record = $this->getRelation('elementRecord'))) {
return null;
}

/** @var ElementRecord $record */

return Craft::$app->getElements()->getElementById($record->id);
}

Expand Down
9 changes: 5 additions & 4 deletions src/records/FieldAttributeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Craft;
use craft\base\Field;
use craft\base\FieldInterface;
use craft\records\Field as FieldRecord;
use flipbox\craft\ember\models\FieldRulesTrait;
use flipbox\craft\ember\objects\FieldMutatorTrait;
Expand Down Expand Up @@ -61,7 +62,7 @@ public function getFieldId()
}

/**
* @return Field|null
* @return FieldInterface|Field|null
*/
protected function resolveField()
{
Expand All @@ -73,20 +74,20 @@ protected function resolveField()
}

/**
* @return Field|null
* @return FieldInterface|Field|null
*/
private function resolveFieldFromRelation()
{
if (false === $this->isRelationPopulated('fieldRecord')) {
return null;
}

/** @var FieldRecord $record */
if (null === ($record = $this->getRelation('fieldRecord'))) {
return null;
}

/** @noinspection PhpIncompatibleReturnTypeInspection */
/** @var FieldRecord $record */

return Craft::$app->getFields()->getFieldById($record->id);
}

Expand Down
3 changes: 2 additions & 1 deletion src/records/FieldLayoutAttributeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ private function resolveFieldLayoutFromRelation()
return null;
}

/** @var FieldLayoutRecord $record */
if (null === ($record = $this->getRelation('fieldLayoutRecord'))) {
return null;
}

/** @var FieldLayoutRecord $record */

return Craft::$app->getFields()->getLayoutById($record->id);
}

Expand Down
3 changes: 2 additions & 1 deletion src/records/SiteAttributeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ private function resolveSiteFromRelation()
return null;
}

/** @var SiteRecord $record */
if (null === ($record = $this->getRelation('siteRecord'))) {
return null;
}

/** @var SiteRecord $record */

return Craft::$app->getSites()->getSiteById($record->id);
}

Expand Down

0 comments on commit eeafb38

Please sign in to comment.