mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-13 01:51:50 +01:00
PHP Coding Standards Fixer > fix coding standard
This commit is contained in:
@@ -57,7 +57,7 @@ trait ArrayAccessTrait
|
||||
/**
|
||||
* Returns information if element with given index/key exists
|
||||
*
|
||||
* @param string|int $index The index/key of element
|
||||
* @param int|string $index The index/key of element
|
||||
* @return bool
|
||||
*/
|
||||
private function exists($index)
|
||||
|
||||
@@ -58,6 +58,7 @@ trait MainTrait
|
||||
foreach ($elements as $index => $element) {
|
||||
if ($useIndexes) {
|
||||
$this->add($element, $index);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -93,6 +94,7 @@ trait MainTrait
|
||||
foreach ($this->elements as $index => $existing) {
|
||||
if ($element === $existing) {
|
||||
unset($this->elements[$index]);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +152,7 @@ trait MainTrait
|
||||
* Returns previous element for given element
|
||||
*
|
||||
* @param mixed $element The element to verify
|
||||
* @return mixed|null
|
||||
* @return null|mixed
|
||||
*/
|
||||
public function getPrevious($element)
|
||||
{
|
||||
@@ -161,7 +163,7 @@ trait MainTrait
|
||||
* Returns next element for given element
|
||||
*
|
||||
* @param mixed $element The element to verify
|
||||
* @return mixed|null
|
||||
* @return null|mixed
|
||||
*/
|
||||
public function getNext($element)
|
||||
{
|
||||
@@ -192,7 +194,7 @@ trait MainTrait
|
||||
* Returns element with given index
|
||||
*
|
||||
* @param mixed $index Index / key of the element
|
||||
* @return mixed|null
|
||||
* @return null|mixed
|
||||
*/
|
||||
public function getByIndex($index)
|
||||
{
|
||||
|
||||
@@ -163,7 +163,7 @@ trait BaseTestCaseTrait
|
||||
* Verifies visibility and arguments of method
|
||||
*
|
||||
* @param string $classNamespace Namespace of class that contains method to verify
|
||||
* @param string|ReflectionMethod $method Name of method or just the method to verify
|
||||
* @param ReflectionMethod|string $method Name of method or just the method to verify
|
||||
* @param string $visibilityType Expected visibility of verified method. One of
|
||||
* OopVisibilityType class constants.
|
||||
* @param int $argumentsCount (optional) Expected count/amount of arguments of the
|
||||
@@ -183,19 +183,15 @@ trait BaseTestCaseTrait
|
||||
$argumentsCount = 0,
|
||||
$requiredArgumentsCount = 0
|
||||
) {
|
||||
/*
|
||||
* Type of visibility is correct?
|
||||
*/
|
||||
// Type of visibility is not correct?
|
||||
if (!(new OopVisibilityType())->isCorrectType($visibilityType)) {
|
||||
throw new UnknownOopVisibilityTypeException($visibilityType);
|
||||
}
|
||||
|
||||
$reflection = new ReflectionClass($classNamespace);
|
||||
|
||||
/*
|
||||
* Name of method provided only?
|
||||
* Let's find instance of the method (based on reflection)
|
||||
*/
|
||||
// Name of method provided only?
|
||||
// Let's find instance of the method (based on reflection)
|
||||
if (!$method instanceof ReflectionMethod) {
|
||||
$method = $reflection->getMethod($method);
|
||||
}
|
||||
@@ -203,14 +199,15 @@ trait BaseTestCaseTrait
|
||||
switch ($visibilityType) {
|
||||
case OopVisibilityType::IS_PUBLIC:
|
||||
static::assertTrue($method->isPublic());
|
||||
break;
|
||||
|
||||
break;
|
||||
case OopVisibilityType::IS_PROTECTED:
|
||||
static::assertTrue($method->isProtected());
|
||||
break;
|
||||
|
||||
break;
|
||||
case OopVisibilityType::IS_PRIVATE:
|
||||
static::assertTrue($method->isPrivate());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -234,9 +231,6 @@ trait BaseTestCaseTrait
|
||||
$argumentsCount = 0,
|
||||
$requiredArgumentsCount = 0
|
||||
) {
|
||||
/*
|
||||
* Let's grab the constructor
|
||||
*/
|
||||
$reflection = new ReflectionClass($classNamespace);
|
||||
$method = $reflection->getConstructor();
|
||||
|
||||
@@ -256,9 +250,6 @@ trait BaseTestCaseTrait
|
||||
*/
|
||||
protected static function assertHasNoConstructor($classNamespace)
|
||||
{
|
||||
/*
|
||||
* Let's grab the constructor
|
||||
*/
|
||||
$reflection = new ReflectionClass($classNamespace);
|
||||
$constructor = $reflection->getConstructor();
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ trait HumanTrait
|
||||
/**
|
||||
* Returns email address
|
||||
*
|
||||
* @return string|null
|
||||
* @return null|string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
@@ -109,7 +109,7 @@ trait HumanTrait
|
||||
/**
|
||||
* Returns birth date
|
||||
*
|
||||
* @return \DateTime|null
|
||||
* @return null|\DateTime
|
||||
*/
|
||||
public function getBirthDate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user