Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 9, 2020
1 parent 34e8228 commit e05fca8
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 35 deletions.
5 changes: 1 addition & 4 deletions src/Utils/ArrayHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
*/
class ArrayHash extends \stdClass implements \ArrayAccess, \Countable, \IteratorAggregate
{

/**
* @return static
*/
/** @return static */
public static function from(array $arr, bool $recursive = true)
{
$obj = new static;
Expand Down
4 changes: 1 addition & 3 deletions src/Utils/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ public function __toString(): string
}


/**
* @return static
*/
/** @return static */
public function modifyClone(string $modify = '')
{
$dolly = clone $this;
Expand Down
1 change: 0 additions & 1 deletion src/Utils/IHtmlString.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

interface IHtmlString
{

/**
* Returns string in HTML format
*/
Expand Down
1 change: 0 additions & 1 deletion src/Utils/ITranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
interface ITranslator
{

/**
* Translates the given string.
* @param mixed $message
Expand Down
20 changes: 6 additions & 14 deletions src/Utils/ObjectHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ final class ObjectHelpers
{
use Nette\StaticClass;

/**
* @throws MemberAccessException
*/
/** @throws MemberAccessException */
public static function strictGet(string $class, string $name): void
{
$rc = new \ReflectionClass($class);
Expand All @@ -34,9 +32,7 @@ public static function strictGet(string $class, string $name): void
}


/**
* @throws MemberAccessException
*/
/** @throws MemberAccessException */
public static function strictSet(string $class, string $name): void
{
$rc = new \ReflectionClass($class);
Expand All @@ -48,9 +44,7 @@ public static function strictSet(string $class, string $name): void
}


/**
* @throws MemberAccessException
*/
/** @throws MemberAccessException */
public static function strictCall(string $class, string $method, array $additionalMethods = []): void
{
$hint = self::getSuggestion(array_merge(
Expand All @@ -66,9 +60,7 @@ public static function strictCall(string $class, string $method, array $addition
}


/**
* @throws MemberAccessException
*/
/** @throws MemberAccessException */
public static function strictStaticCall(string $class, string $method): void
{
$hint = self::getSuggestion(
Expand Down Expand Up @@ -103,10 +95,10 @@ public static function getMagicProperties(string $class): array
$uname = ucfirst($name);
$write = $type !== '-read'
&& $rc->hasMethod($nm = 'set' . $uname)
&& ($rm = $rc->getMethod($nm)) && $rm->getName() === $nm && !$rm->isPrivate() && !$rm->isStatic();
&& ($rm = $rc->getMethod($nm))->getName() === $nm && !$rm->isPrivate() && !$rm->isStatic();
$read = $type !== '-write'
&& ($rc->hasMethod($nm = 'get' . $uname) || $rc->hasMethod($nm = 'is' . $uname))
&& ($rm = $rc->getMethod($nm)) && $rm->getName() === $nm && !$rm->isPrivate() && !$rm->isStatic();
&& ($rm = $rc->getMethod($nm))->getName() === $nm && !$rm->isPrivate() && !$rm->isStatic();

if ($read || $write) {
$props[$name] = $read << 0 | ($nm[0] === 'g') << 1 | $rm->returnsReference() << 2 | $write << 3;
Expand Down
8 changes: 3 additions & 5 deletions src/Utils/ObjectMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@ final class ObjectMixin
{
use Nette\StaticClass;

/**
* @deprecated use ObjectHelpers::getSuggestion()
*/
/** @deprecated use ObjectHelpers::getSuggestion() */
public static function getSuggestion(array $possibilities, string $value): ?string
{
trigger_error(__METHOD__ . '() has been renamed to Nette\Utils\ObjectHelpers::getSuggestion()', E_USER_DEPRECATED);
return ObjectHelpers::getSuggestion($possibilities, $value);
}


public static function setExtensionMethod($class, $name, $callback)
public static function setExtensionMethod(): void
{
trigger_error('Class Nette\Utils\ObjectMixin is deprecated', E_USER_DEPRECATED);
}


public static function getExtensionMethod($class, $name)
public static function getExtensionMethod(): void
{
trigger_error('Class Nette\Utils\ObjectMixin is deprecated', E_USER_DEPRECATED);
}
Expand Down
4 changes: 1 addition & 3 deletions src/Utils/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ public static function expandClassName(string $name, \ReflectionClass $rc): stri
}


/**
* @return array of [alias => class]
*/
/** @return array of [alias => class] */
public static function getUseStatements(\ReflectionClass $class): array
{
if ($class->isAnonymous()) {
Expand Down
5 changes: 1 addition & 4 deletions src/Utils/StaticClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*/
trait StaticClass
{

/**
* @throws \Error
*/
/** @throws \Error */
final public function __construct()
{
throw new \Error('Class ' . get_class($this) . ' is static and cannot be instantiated.');
Expand Down

0 comments on commit e05fca8

Please sign in to comment.