Skip to content

Commit

Permalink
Fix additional issues
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
  • Loading branch information
ghostwriter committed Mar 22, 2024
1 parent 08b2a0a commit 1c67601
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 801 deletions.
6 changes: 3 additions & 3 deletions library/Mockery/Generator/DefinedTargetClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class DefinedTargetClass implements TargetClassInterface
private $rfc;

/**
* @param ReflectionClass $rfc
* @param class-string|null $alias
* @param ReflectionClass $rfc
* @param class-string|null $alias
*/
public function __construct(ReflectionClass $rfc, $alias = null)
{
Expand All @@ -51,7 +51,7 @@ public function __toString()
}

/**
* @param class-string $name
* @param class-string $name
* @param class-string|null $alias
* @return self
*/
Expand Down
31 changes: 15 additions & 16 deletions library/Mockery/Generator/MockConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Mockery\Generator;

use Mockery\Exception;
use ReflectionMethod;
use Serializable;
use function array_filter;
use function array_keys;
use function array_map;
Expand All @@ -33,8 +33,6 @@
use function strpos;
use function strtolower;
use function trait_exists;
use Serializable;
use Mockery\Generator\TargetClassInterface;

/**
* This class describes the configuration of mocks and hides away some of the
Expand All @@ -47,7 +45,7 @@ class MockConfiguration
*
* @var list<Method>
*/
protected $allMethods;
protected $allMethods = [];

/**
* Methods that should specifically not be mocked
Expand Down Expand Up @@ -81,6 +79,8 @@ class MockConfiguration

/**
* Param overrides
*
* @var array<string,mixed>
*/
protected $parameterOverrides = [];

Expand Down Expand Up @@ -134,14 +134,14 @@ class MockConfiguration
protected $whiteListedMethods = [];

/**
* @param array<class-string|object> $targets
* @param array<string> $blackListedMethods
* @param array<string> $whiteListedMethods
* @param string|null $name
* @param bool $instanceMock
* @param array<string,mixed> $parameterOverrides
* @param bool $mockOriginalDestructor
* @param array<string,array<scalar>|scalar> $constantsMap
* @param array<class-string|object> $targets
* @param array<string> $blackListedMethods
* @param array<string> $whiteListedMethods
* @param string|null $name
* @param bool $instanceMock
* @param array<string,mixed> $parameterOverrides
* @param bool $mockOriginalDestructor
* @param array<string,array<scalar>|scalar> $constantsMap
*/
public function __construct(
array $targets = [],
Expand Down Expand Up @@ -172,9 +172,6 @@ public function generateName()
{
$nameBuilder = new MockNameBuilder();

/**
* @var object|null $targetObject
*/
$targetObject = $this->getTargetObject();
if ($targetObject !== null) {
$className = get_class($targetObject);
Expand Down Expand Up @@ -309,7 +306,9 @@ public function getName()
return $this->name;
}

/** @return string */
/**
* @return string
*/
public function getNamespaceName()
{
$parts = explode('\\', $this->getName());
Expand Down
1 change: 0 additions & 1 deletion library/Mockery/Generator/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use ReflectionParameter;
use function class_exists;


/**
* @mixin ReflectionParameter
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function apply($code, MockConfiguration $config)
}
}

$interfaces = array_reduce((array) $config->getTargetInterfaces(), static function ($code, $i) {
$interfaces = array_reduce($config->getTargetInterfaces(), static function ($code, $i) {
return $code . ', \\' . ltrim($i->getName(), '\\');
}, '');

Expand Down
10 changes: 5 additions & 5 deletions library/Mockery/Generator/StringManipulationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
class StringManipulationGenerator implements Generator
{
/**
* @var string
* @var list<Pass>
*/
private $code;
protected $passes = [];

/**
* @var list<Pass>
* @var string
*/
protected $passes = [];
private $code;

/**
* @param list<Pass> $passes
Expand All @@ -50,7 +50,7 @@ public function __construct(array $passes)
}

/**
* @param Pass $pass
* @param Pass $pass
* @return void
*/
public function addPass(Pass $pass)
Expand Down
4 changes: 0 additions & 4 deletions library/Mockery/Generator/TargetClassInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@

namespace Mockery\Generator;

use ReflectionMethod;
use Mockery\Generator\TargetClassInterface;
use Mockery\Generator\Method;

interface TargetClassInterface
{
/**
Expand Down
2 changes: 0 additions & 2 deletions library/Mockery/Generator/UndefinedTargetClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@

namespace Mockery\Generator;

use ReflectionMethod;
use function array_pop;
use function explode;
use function implode;
use function ltrim;
use Mockery\Generator\TargetClassInterface;

class UndefinedTargetClass implements TargetClassInterface
{
Expand Down

0 comments on commit 1c67601

Please sign in to comment.