Skip to content

Commit

Permalink
Refactor library/Mockery/HigherOrderMessage.php (#1371)
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 Feb 29, 2024
2 parents bcde3d0 + eb1a153 commit 00dd14b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions library/Mockery/HigherOrderMessage.php
Expand Up @@ -5,27 +5,40 @@
*
* @copyright https://github.com/mockery/mockery/blob/HEAD/COPYRIGHT.md
* @license https://github.com/mockery/mockery/blob/HEAD/LICENSE BSD 3-Clause License
*
* @link https://github.com/mockery/mockery for the canonical source repository
*/

namespace Mockery;

use Closure;

/**
* @method \Mockery\Expectation withArgs(\Closure|array $args)
* @method Expectation withArgs(array|Closure $args)
*/
class HigherOrderMessage
{
private $mock;
/**
* @var string
*/
private $method;

/**
* @var LegacyMockInterface|MockInterface
*/
private $mock;

public function __construct(MockInterface $mock, $method)
{
$this->mock = $mock;
$this->method = $method;
}

/**
* @return \Mockery\Expectation
* @param string $method
* @param array $args
*
* @return Expectation|ExpectationInterface|HigherOrderMessage
*/
public function __call($method, $args)
{
Expand All @@ -34,6 +47,7 @@ public function __call($method, $args)
}

$expectation = $this->mock->{$this->method}($method);

return $expectation->withArgs($args);
}
}

0 comments on commit 00dd14b

Please sign in to comment.