Skip to content

Commit

Permalink
🧹 Fixed code-style
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jun 26, 2023
1 parent 1cf90df commit f0106de
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 52 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"allow-plugins": {
"dragon-code/codestyler": true,
"ergebnis/composer-normalize": true,
"friendsofphp/php-cs-fixer": true
"friendsofphp/php-cs-fixer": true,
"symfony/thanks": true
},
"preferred-install": "dist",
"sort-packages": true
Expand Down
16 changes: 0 additions & 16 deletions src/Concerns/From.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,15 @@
trait From
{
/**
* @param array $array
*
* @throws ReflectionException
*
* @return \DragonCode\Contracts\DataTransferObject\DataTransferObject
*/
public static function fromArray(array $array): Contract
{
return new static($array);
}

/**
* @param $object
*
* @throws ReflectionException
*
* @return \DragonCode\Contracts\DataTransferObject\DataTransferObject
*/
public static function fromObject($object): Contract
{
Expand All @@ -41,11 +33,7 @@ public static function fromObject($object): Contract
}

/**
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @throws ReflectionException
*
* @return \DragonCode\Contracts\DataTransferObject\DataTransferObject
*/
public static function fromRequest(Request $request): Contract
{
Expand All @@ -55,11 +43,7 @@ public static function fromRequest(Request $request): Contract
}

/**
* @param string $json
*
* @throws ReflectionException
*
* @return \DragonCode\Contracts\DataTransferObject\DataTransferObject
*/
public static function fromJson(string $json): Contract
{
Expand Down
8 changes: 1 addition & 7 deletions src/Concerns/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ protected function reflection(): ReflectionClass
}

/**
* @param $object
*
* @throws ReflectionException
*
* @return ReflectionProperty[]
* @return array<ReflectionProperty>
*/
protected function reflectProperties($object): array
{
Expand All @@ -35,11 +33,7 @@ protected function reflectProperties($object): array
}

/**
* @param $object
*
* @throws ReflectionException
*
* @return array
*/
protected function getProperties($object): array
{
Expand Down
1 change: 0 additions & 1 deletion src/Converters/Objects.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
class Objects implements Arrayable
{
use Makeable;

use Reflection;

protected $object;
Expand Down
25 changes: 0 additions & 25 deletions src/DataTransferObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@
abstract class DataTransferObject implements Contract
{
use Castable;

use From;

use Makeable;

use Reflection;

use To;

protected const DISALLOW = ['map', 'only', 'except'];
Expand All @@ -39,8 +35,6 @@ abstract class DataTransferObject implements Contract
protected $except = [];

/**
* @param array $items
*
* @throws ReflectionException
*/
public function __construct(array $items = [])
Expand Down Expand Up @@ -69,8 +63,6 @@ public function set(string $key, $value): DataTransferObject
}

/**
* @param array $items
*
* @throws ReflectionException
*
* @return \DragonCode\SimpleDataTransferObject\DataTransferObject
Expand All @@ -87,8 +79,6 @@ public function merge(array $items): DataTransferObject

/**
* @throws ReflectionException
*
* @return array
*/
public function toArray(): array
{
Expand Down Expand Up @@ -121,8 +111,6 @@ protected function filterExcept(array $items): array
}

/**
* @param array $items
*
* @throws ReflectionException
*/
protected function setMap(array $items): void
Expand All @@ -139,8 +127,6 @@ protected function setMap(array $items): void
}

/**
* @param array $items
*
* @throws ReflectionException
*/
protected function setItems(array $items): void
Expand All @@ -160,9 +146,6 @@ protected function getValueByKey(array $items, string $key, string $default)
}

/**
* @param string $key
* @param mixed $value
*
* @throws ReflectionException
*/
protected function setValue(string $key, $value): void
Expand All @@ -173,23 +156,15 @@ protected function setValue(string $key, $value): void
}

/**
* @param string $key
*
* @throws ReflectionException
*
* @return bool
*/
protected function isAllow(string $key): bool
{
return $this->isAllowKey($key) && $this->isAllowProperty($key);
}

/**
* @param string $key
*
* @throws ReflectionException
*
* @return bool
*/
protected function isAllowProperty(string $key): bool
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Nested/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Company extends DataTransferObject
{
public $title;

/** @var \Tests\Fixtures\Nested\Project[] */
/** @var array<\Tests\Fixtures\Nested\Project> */
public $projects;

protected function castProjects(array $projects): array
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Nested/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Project extends DataTransferObject

public $domain;

/** @var \Tests\Fixtures\Nested\Developer[] */
/** @var array<\Tests\Fixtures\Nested\Developer> */
public $developers;

protected function castDevelopers(array $developers): array
Expand Down

0 comments on commit f0106de

Please sign in to comment.