summaryrefslogtreecommitdiff
path: root/vendor/phpunit/phpunit/src/Framework/MockObject
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
committerAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
commit1c4f7ab3b838b23afb2ee4dab14acbf75956e952 (patch)
tree0a19274107d717efe92d2c0376cd3105fead5a11 /vendor/phpunit/phpunit/src/Framework/MockObject
parent711662948768492e8d05b778a7d80eacaec368d2 (diff)
* add phpunit as a dev dependency
* add some basic tests for UrlHelper::rewrite_relative() * fix UrlHelper::rewrite_relative() to work better on non-absolute relative URL paths
Diffstat (limited to 'vendor/phpunit/phpunit/src/Framework/MockObject')
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Api/Api.php97
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Api/Method.php30
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Api/MockedCloneMethod.php21
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Api/UnmockedCloneMethod.php23
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php25
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php306
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationStubber.php65
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php26
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php58
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php24
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php53
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php17
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseAddMethodsException.php29
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php29
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassAlreadyExistsException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsFinalException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php17
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/DuplicateMethodException.php32
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php19
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php33
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/InvalidMethodNameException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatchBuilderNotFoundException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodCannotBeConfiguredException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.php21
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameNotConfiguredException.php21
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.php21
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/OriginalConstructorInvocationRequiredException.php21
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReflectionException.php19
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php27
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php17
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/SoapExtensionNotAvailableException.php23
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownClassException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTraitException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTypeException.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php1004
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl2
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl6
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl22
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl20
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl5
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl22
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl22
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl6
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl9
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl4
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php254
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/InvocationHandler.php186
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php272
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MethodNameConstraint.php48
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php516
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MockClass.php69
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php398
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php45
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php27
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MockTrait.php54
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/MockType.php21
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyInvokedCount.php36
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyParameters.php31
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ConsecutiveParameters.php130
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvocationOrder.php47
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtIndex.php75
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastCount.php64
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastOnce.php50
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtMostCount.php64
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedCount.php102
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/MethodName.php68
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/Parameters.php160
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ParametersRule.php28
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php26
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php57
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php46
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php41
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php59
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php45
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php32
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php45
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php53
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Stub.php27
-rw-r--r--vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php26
80 files changed, 5650 insertions, 0 deletions
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Api/Api.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/Api.php
new file mode 100644
index 000000000..e2f0a2802
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/Api.php
@@ -0,0 +1,97 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use PHPUnit\Framework\MockObject\Builder\InvocationMocker as InvocationMockerBuilder;
+use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
+
+/**
+ * @internal This trait is not covered by the backward compatibility promise for PHPUnit
+ */
+trait Api
+{
+ /**
+ * @var ConfigurableMethod[]
+ */
+ private static $__phpunit_configurableMethods;
+
+ /**
+ * @var object
+ */
+ private $__phpunit_originalObject;
+
+ /**
+ * @var bool
+ */
+ private $__phpunit_returnValueGeneration = true;
+
+ /**
+ * @var InvocationHandler
+ */
+ private $__phpunit_invocationMocker;
+
+ /** @noinspection MagicMethodsValidityInspection */
+ public static function __phpunit_initConfigurableMethods(ConfigurableMethod ...$configurableMethods): void
+ {
+ if (isset(static::$__phpunit_configurableMethods)) {
+ throw new ConfigurableMethodsAlreadyInitializedException(
+ 'Configurable methods is already initialized and can not be reinitialized'
+ );
+ }
+
+ static::$__phpunit_configurableMethods = $configurableMethods;
+ }
+
+ /** @noinspection MagicMethodsValidityInspection */
+ public function __phpunit_setOriginalObject($originalObject): void
+ {
+ $this->__phpunit_originalObject = $originalObject;
+ }
+
+ /** @noinspection MagicMethodsValidityInspection */
+ public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration): void
+ {
+ $this->__phpunit_returnValueGeneration = $returnValueGeneration;
+ }
+
+ /** @noinspection MagicMethodsValidityInspection */
+ public function __phpunit_getInvocationHandler(): InvocationHandler
+ {
+ if ($this->__phpunit_invocationMocker === null) {
+ $this->__phpunit_invocationMocker = new InvocationHandler(
+ static::$__phpunit_configurableMethods,
+ $this->__phpunit_returnValueGeneration
+ );
+ }
+
+ return $this->__phpunit_invocationMocker;
+ }
+
+ /** @noinspection MagicMethodsValidityInspection */
+ public function __phpunit_hasMatchers(): bool
+ {
+ return $this->__phpunit_getInvocationHandler()->hasMatchers();
+ }
+
+ /** @noinspection MagicMethodsValidityInspection */
+ public function __phpunit_verify(bool $unsetInvocationMocker = true): void
+ {
+ $this->__phpunit_getInvocationHandler()->verify();
+
+ if ($unsetInvocationMocker) {
+ $this->__phpunit_invocationMocker = null;
+ }
+ }
+
+ public function expects(InvocationOrder $matcher): InvocationMockerBuilder
+ {
+ return $this->__phpunit_getInvocationHandler()->expects($matcher);
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Api/Method.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/Method.php
new file mode 100644
index 000000000..f6df7533c
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/Method.php
@@ -0,0 +1,30 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function call_user_func_array;
+use function func_get_args;
+use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount;
+
+/**
+ * @internal This trait is not covered by the backward compatibility promise for PHPUnit
+ */
+trait Method
+{
+ public function method()
+ {
+ $expects = $this->expects(new AnyInvokedCount);
+
+ return call_user_func_array(
+ [$expects, 'method'],
+ func_get_args()
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Api/MockedCloneMethod.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/MockedCloneMethod.php
new file mode 100644
index 000000000..91e35f937
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/MockedCloneMethod.php
@@ -0,0 +1,21 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This trait is not covered by the backward compatibility promise for PHPUnit
+ */
+trait MockedCloneMethod
+{
+ public function __clone()
+ {
+ $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler();
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Api/UnmockedCloneMethod.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/UnmockedCloneMethod.php
new file mode 100644
index 000000000..3f493d203
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Api/UnmockedCloneMethod.php
@@ -0,0 +1,23 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This trait is not covered by the backward compatibility promise for PHPUnit
+ */
+trait UnmockedCloneMethod
+{
+ public function __clone()
+ {
+ $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationHandler();
+
+ parent::__clone();
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php
new file mode 100644
index 000000000..a68bfadf9
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Identity.php
@@ -0,0 +1,25 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Builder;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface Identity
+{
+ /**
+ * Sets the identification of the expectation to $id.
+ *
+ * @note The identifier is unique per mock object.
+ *
+ * @param string $id unique identification of expectation
+ */
+ public function id($id);
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php
new file mode 100644
index 000000000..89b1e31ab
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php
@@ -0,0 +1,306 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Builder;
+
+use function array_map;
+use function array_merge;
+use function count;
+use function in_array;
+use function is_string;
+use function strtolower;
+use PHPUnit\Framework\Constraint\Constraint;
+use PHPUnit\Framework\MockObject\ConfigurableMethod;
+use PHPUnit\Framework\MockObject\IncompatibleReturnValueException;
+use PHPUnit\Framework\MockObject\InvocationHandler;
+use PHPUnit\Framework\MockObject\Matcher;
+use PHPUnit\Framework\MockObject\MatcherAlreadyRegisteredException;
+use PHPUnit\Framework\MockObject\MethodCannotBeConfiguredException;
+use PHPUnit\Framework\MockObject\MethodNameAlreadyConfiguredException;
+use PHPUnit\Framework\MockObject\MethodNameNotConfiguredException;
+use PHPUnit\Framework\MockObject\MethodParametersAlreadyConfiguredException;
+use PHPUnit\Framework\MockObject\Rule;
+use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls;
+use PHPUnit\Framework\MockObject\Stub\Exception;
+use PHPUnit\Framework\MockObject\Stub\ReturnArgument;
+use PHPUnit\Framework\MockObject\Stub\ReturnCallback;
+use PHPUnit\Framework\MockObject\Stub\ReturnReference;
+use PHPUnit\Framework\MockObject\Stub\ReturnSelf;
+use PHPUnit\Framework\MockObject\Stub\ReturnStub;
+use PHPUnit\Framework\MockObject\Stub\ReturnValueMap;
+use PHPUnit\Framework\MockObject\Stub\Stub;
+use Throwable;
+
+/**
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ */
+final class InvocationMocker implements InvocationStubber, MethodNameMatch
+{
+ /**
+ * @var InvocationHandler
+ */
+ private $invocationHandler;
+
+ /**
+ * @var Matcher
+ */
+ private $matcher;
+
+ /**
+ * @var ConfigurableMethod[]
+ */
+ private $configurableMethods;
+
+ public function __construct(InvocationHandler $handler, Matcher $matcher, ConfigurableMethod ...$configurableMethods)
+ {
+ $this->invocationHandler = $handler;
+ $this->matcher = $matcher;
+ $this->configurableMethods = $configurableMethods;
+ }
+
+ /**
+ * @throws MatcherAlreadyRegisteredException
+ *
+ * @return $this
+ */
+ public function id($id): self
+ {
+ $this->invocationHandler->registerMatcher($id, $this->matcher);
+
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function will(Stub $stub): Identity
+ {
+ $this->matcher->setStub($stub);
+
+ return $this;
+ }
+
+ /**
+ * @param mixed $value
+ * @param mixed[] $nextValues
+ *
+ * @throws IncompatibleReturnValueException
+ */
+ public function willReturn($value, ...$nextValues): self
+ {
+ if (count($nextValues) === 0) {
+ $this->ensureTypeOfReturnValues([$value]);
+
+ $stub = $value instanceof Stub ? $value : new ReturnStub($value);
+ } else {
+ $values = array_merge([$value], $nextValues);
+
+ $this->ensureTypeOfReturnValues($values);
+
+ $stub = new ConsecutiveCalls($values);
+ }
+
+ return $this->will($stub);
+ }
+
+ public function willReturnReference(&$reference): self
+ {
+ $stub = new ReturnReference($reference);
+
+ return $this->will($stub);
+ }
+
+ public function willReturnMap(array $valueMap): self
+ {
+ $stub = new ReturnValueMap($valueMap);
+
+ return $this->will($stub);
+ }
+
+ public function willReturnArgument($argumentIndex): self
+ {
+ $stub = new ReturnArgument($argumentIndex);
+
+ return $this->will($stub);
+ }
+
+ public function willReturnCallback($callback): self
+ {
+ $stub = new ReturnCallback($callback);
+
+ return $this->will($stub);
+ }
+
+ public function willReturnSelf(): self
+ {
+ $stub = new ReturnSelf;
+
+ return $this->will($stub);
+ }
+
+ public function willReturnOnConsecutiveCalls(...$values): self
+ {
+ $stub = new ConsecutiveCalls($values);
+
+ return $this->will($stub);
+ }
+
+ public function willThrowException(Throwable $exception): self
+ {
+ $stub = new Exception($exception);
+
+ return $this->will($stub);
+ }
+
+ /**
+ * @return $this
+ */
+ public function after($id): self
+ {
+ $this->matcher->setAfterMatchBuilderId($id);
+
+ return $this;
+ }
+
+ /**
+ * @param mixed[] $arguments
+ *
+ * @throws \PHPUnit\Framework\Exception
+ * @throws MethodNameNotConfiguredException
+ * @throws MethodParametersAlreadyConfiguredException
+ *
+ * @return $this
+ */
+ public function with(...$arguments): self
+ {
+ $this->ensureParametersCanBeConfigured();
+
+ $this->matcher->setParametersRule(new Rule\Parameters($arguments));
+
+ return $this;
+ }
+
+ /**
+ * @param array ...$arguments
+ *
+ * @throws \PHPUnit\Framework\Exception
+ * @throws MethodNameNotConfiguredException
+ * @throws MethodParametersAlreadyConfiguredException
+ *
+ * @return $this
+ */
+ public function withConsecutive(...$arguments): self
+ {
+ $this->ensureParametersCanBeConfigured();
+
+ $this->matcher->setParametersRule(new Rule\ConsecutiveParameters($arguments));
+
+ return $this;
+ }
+
+ /**
+ * @throws MethodNameNotConfiguredException
+ * @throws MethodParametersAlreadyConfiguredException
+ *
+ * @return $this
+ */
+ public function withAnyParameters(): self
+ {
+ $this->ensureParametersCanBeConfigured();
+
+ $this->matcher->setParametersRule(new Rule\AnyParameters);
+
+ return $this;
+ }
+
+ /**
+ * @param Constraint|string $constraint
+ *
+ * @throws \PHPUnit\Framework\InvalidArgumentException
+ * @throws MethodCannotBeConfiguredException
+ * @throws MethodNameAlreadyConfiguredException
+ *
+ * @return $this
+ */
+ public function method($constraint): self
+ {
+ if ($this->matcher->hasMethodNameRule()) {
+ throw new MethodNameAlreadyConfiguredException;
+ }
+
+ $configurableMethodNames = array_map(
+ static function (ConfigurableMethod $configurable)
+ {
+ return strtolower($configurable->getName());
+ },
+ $this->configurableMethods
+ );
+
+ if (is_string($constraint) && !in_array(strtolower($constraint), $configurableMethodNames, true)) {
+ throw new MethodCannotBeConfiguredException($constraint);
+ }
+
+ $this->matcher->setMethodNameRule(new Rule\MethodName($constraint));
+
+ return $this;
+ }
+
+ /**
+ * @throws MethodNameNotConfiguredException
+ * @throws MethodParametersAlreadyConfiguredException
+ */
+ private function ensureParametersCanBeConfigured(): void
+ {
+ if (!$this->matcher->hasMethodNameRule()) {
+ throw new MethodNameNotConfiguredException;
+ }
+
+ if ($this->matcher->hasParametersRule()) {
+ throw new MethodParametersAlreadyConfiguredException;
+ }
+ }
+
+ private function getConfiguredMethod(): ?ConfigurableMethod
+ {
+ $configuredMethod = null;
+
+ foreach ($this->configurableMethods as $configurableMethod) {
+ if ($this->matcher->getMethodNameRule()->matchesName($configurableMethod->getName())) {
+ if ($configuredMethod !== null) {
+ return null;
+ }
+
+ $configuredMethod = $configurableMethod;
+ }
+ }
+
+ return $configuredMethod;
+ }
+
+ /**
+ * @throws IncompatibleReturnValueException
+ */
+ private function ensureTypeOfReturnValues(array $values): void
+ {
+ $configuredMethod = $this->getConfiguredMethod();
+
+ if ($configuredMethod === null) {
+ return;
+ }
+
+ foreach ($values as $value) {
+ if (!$configuredMethod->mayReturn($value)) {
+ throw new IncompatibleReturnValueException(
+ $configuredMethod,
+ $value
+ );
+ }
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationStubber.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationStubber.php
new file mode 100644
index 000000000..f32ff0e7c
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationStubber.php
@@ -0,0 +1,65 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Builder;
+
+use PHPUnit\Framework\MockObject\Stub\Stub;
+use Throwable;
+
+/**
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ */
+interface InvocationStubber
+{
+ public function will(Stub $stub): Identity;
+
+ /** @return self */
+ public function willReturn($value, ...$nextValues)/*: self */;
+
+ /**
+ * @param mixed $reference
+ *
+ * @return self
+ */
+ public function willReturnReference(&$reference)/*: self */;
+
+ /**
+ * @param array<int, array<int, mixed>> $valueMap
+ *
+ * @return self
+ */
+ public function willReturnMap(array $valueMap)/*: self */;
+
+ /**
+ * @param int $argumentIndex
+ *
+ * @return self
+ */
+ public function willReturnArgument($argumentIndex)/*: self */;
+
+ /**
+ * @param callable $callback
+ *
+ * @return self
+ */
+ public function willReturnCallback($callback)/*: self */;
+
+ /** @return self */
+ public function willReturnSelf()/*: self */;
+
+ /**
+ * @param mixed $values
+ *
+ * @return self
+ */
+ public function willReturnOnConsecutiveCalls(...$values)/*: self */;
+
+ /** @return self */
+ public function willThrowException(Throwable $exception)/*: self */;
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php
new file mode 100644
index 000000000..543d596cc
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/MethodNameMatch.php
@@ -0,0 +1,26 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Builder;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface MethodNameMatch extends ParametersMatch
+{
+ /**
+ * Adds a new method name match and returns the parameter match object for
+ * further matching possibilities.
+ *
+ * @param \PHPUnit\Framework\Constraint\Constraint $constraint Constraint for matching method, if a string is passed it will use the PHPUnit_Framework_Constraint_IsEqual
+ *
+ * @return ParametersMatch
+ */
+ public function method($constraint);
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php
new file mode 100644
index 000000000..707d82551
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php
@@ -0,0 +1,58 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Builder;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface ParametersMatch extends Stub
+{
+ /**
+ * Defines the expectation which must occur before the current is valid.
+ *
+ * @param string $id the identification of the expectation that should
+ * occur before this one
+ *
+ * @return Stub
+ */
+ public function after($id);
+
+ /**
+ * Sets the parameters to match for, each parameter to this function will
+ * be part of match. To perform specific matches or constraints create a
+ * new PHPUnit\Framework\Constraint\Constraint and use it for the parameter.
+ * If the parameter value is not a constraint it will use the
+ * PHPUnit\Framework\Constraint\IsEqual for the value.
+ *
+ * Some examples:
+ * <code>
+ * // match first parameter with value 2
+ * $b->with(2);
+ * // match first parameter with value 'smock' and second identical to 42
+ * $b->with('smock', new PHPUnit\Framework\Constraint\IsEqual(42));
+ * </code>
+ *
+ * @return ParametersMatch
+ */
+ public function with(...$arguments);
+
+ /**
+ * Sets a rule which allows any kind of parameters.
+ *
+ * Some examples:
+ * <code>
+ * // match any number of parameters
+ * $b->withAnyParameters();
+ * </code>
+ *
+ * @return ParametersMatch
+ */
+ public function withAnyParameters();
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php
new file mode 100644
index 000000000..d7cb78fc4
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Builder/Stub.php
@@ -0,0 +1,24 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Builder;
+
+use PHPUnit\Framework\MockObject\Stub\Stub as BaseStub;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface Stub extends Identity
+{
+ /**
+ * Stubs the matching method with the stub object $stub. Any invocations of
+ * the matched method will now be handled by the stub instead.
+ */
+ public function will(BaseStub $stub): Identity;
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php b/vendor/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php
new file mode 100644
index 000000000..4757dc637
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/ConfigurableMethod.php
@@ -0,0 +1,53 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use SebastianBergmann\Type\Type;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ConfigurableMethod
+{
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @var Type
+ */
+ private $returnType;
+
+ public function __construct(string $name, Type $returnType)
+ {
+ $this->name = $name;
+ $this->returnType = $returnType;
+ }
+
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ public function mayReturn($value): bool
+ {
+ if ($value === null && $this->returnType->allowsNull()) {
+ return true;
+ }
+
+ return $this->returnType->isAssignable(Type::fromValue($value, false));
+ }
+
+ public function getReturnTypeDeclaration(): string
+ {
+ return $this->returnType->asString();
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php
new file mode 100644
index 000000000..7e655e235
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/BadMethodCallException.php
@@ -0,0 +1,17 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class BadMethodCallException extends \BadMethodCallException implements Exception
+{
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseAddMethodsException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseAddMethodsException.php
new file mode 100644
index 000000000..0698870bc
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseAddMethodsException.php
@@ -0,0 +1,29 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CannotUseAddMethodsException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $type, string $methodName)
+ {
+ parent::__construct(
+ sprintf(
+ 'Trying to configure method "%s" with addMethods(), but it exists in class "%s". Use onlyMethods() for methods that exist in the class',
+ $methodName,
+ $type
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php
new file mode 100644
index 000000000..35a29b731
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/CannotUseOnlyMethodsException.php
@@ -0,0 +1,29 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class CannotUseOnlyMethodsException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $type, string $methodName)
+ {
+ parent::__construct(
+ sprintf(
+ 'Trying to configure method "%s" with onlyMethods(), but it does not exist in class "%s". Use addMethods() for methods that do not exist in the class',
+ $methodName,
+ $type
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassAlreadyExistsException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassAlreadyExistsException.php
new file mode 100644
index 000000000..0ba9a187d
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassAlreadyExistsException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ClassAlreadyExistsException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $className)
+ {
+ parent::__construct(
+ sprintf(
+ 'Class "%s" already exists',
+ $className
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsFinalException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsFinalException.php
new file mode 100644
index 000000000..e648f0263
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ClassIsFinalException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ClassIsFinalException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $className)
+ {
+ parent::__construct(
+ sprintf(
+ 'Class "%s" is declared "final" and cannot be doubled',
+ $className
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php
new file mode 100644
index 000000000..d12ac9973
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ConfigurableMethodsAlreadyInitializedException.php
@@ -0,0 +1,17 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ConfigurableMethodsAlreadyInitializedException extends \PHPUnit\Framework\Exception implements Exception
+{
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/DuplicateMethodException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/DuplicateMethodException.php
new file mode 100644
index 000000000..864523acb
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/DuplicateMethodException.php
@@ -0,0 +1,32 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class DuplicateMethodException extends \PHPUnit\Framework\Exception implements Exception
+{
+ /**
+ * @psalm-param list<string> $methods
+ */
+ public function __construct(array $methods)
+ {
+ parent::__construct(
+ sprintf(
+ 'Cannot double using a method list that contains duplicates: "%s" (duplicate: "%s")',
+ implode(', ', $methods),
+ implode(', ', array_unique(array_diff_assoc($methods, array_unique($methods))))
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php
new file mode 100644
index 000000000..5880bc033
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/Exception.php
@@ -0,0 +1,19 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use Throwable;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface Exception extends Throwable
+{
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php
new file mode 100644
index 000000000..00febaf56
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/IncompatibleReturnValueException.php
@@ -0,0 +1,33 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class IncompatibleReturnValueException extends \PHPUnit\Framework\Exception implements Exception
+{
+ /**
+ * @param mixed $value
+ */
+ public function __construct(ConfigurableMethod $method, $value)
+ {
+ parent::__construct(
+ sprintf(
+ 'Method %s may not return value of type %s, its declared return type is "%s"',
+ $method->getName(),
+ is_object($value) ? get_class($value) : gettype($value),
+ $method->getReturnTypeDeclaration()
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/InvalidMethodNameException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/InvalidMethodNameException.php
new file mode 100644
index 000000000..d2444cf12
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/InvalidMethodNameException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class InvalidMethodNameException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $method)
+ {
+ parent::__construct(
+ sprintf(
+ 'Cannot double method with invalid name "%s"',
+ $method
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatchBuilderNotFoundException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatchBuilderNotFoundException.php
new file mode 100644
index 000000000..c05b2bce6
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatchBuilderNotFoundException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MatchBuilderNotFoundException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $id)
+ {
+ parent::__construct(
+ sprintf(
+ 'No builder found for match builder identification <%s>',
+ $id
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.php
new file mode 100644
index 000000000..efcc13ed9
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MatcherAlreadyRegisteredException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MatcherAlreadyRegisteredException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $id)
+ {
+ parent::__construct(
+ sprintf(
+ 'Matcher with id <%s> is already registered',
+ $id
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodCannotBeConfiguredException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodCannotBeConfiguredException.php
new file mode 100644
index 000000000..707290439
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodCannotBeConfiguredException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MethodCannotBeConfiguredException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $method)
+ {
+ parent::__construct(
+ sprintf(
+ 'Trying to configure method "%s" which cannot be configured because it does not exist, has not been specified, is final, or is static',
+ $method
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.php
new file mode 100644
index 000000000..1e9f2c04c
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameAlreadyConfiguredException.php
@@ -0,0 +1,21 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MethodNameAlreadyConfiguredException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct()
+ {
+ parent::__construct('Method name is already configured');
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameNotConfiguredException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameNotConfiguredException.php
new file mode 100644
index 000000000..89565b77e
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodNameNotConfiguredException.php
@@ -0,0 +1,21 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MethodNameNotConfiguredException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct()
+ {
+ parent::__construct('Method name is not configured');
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.php
new file mode 100644
index 000000000..1609c6ffb
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/MethodParametersAlreadyConfiguredException.php
@@ -0,0 +1,21 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MethodParametersAlreadyConfiguredException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct()
+ {
+ parent::__construct('Method parameters already configured');
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/OriginalConstructorInvocationRequiredException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/OriginalConstructorInvocationRequiredException.php
new file mode 100644
index 000000000..ecb9b63cf
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/OriginalConstructorInvocationRequiredException.php
@@ -0,0 +1,21 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class OriginalConstructorInvocationRequiredException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct()
+ {
+ parent::__construct('Proxying to original methods requires invoking the original constructor');
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReflectionException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReflectionException.php
new file mode 100644
index 000000000..d6319c694
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReflectionException.php
@@ -0,0 +1,19 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use RuntimeException;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReflectionException extends RuntimeException implements Exception
+{
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php
new file mode 100644
index 000000000..8121e369b
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/ReturnValueNotConfiguredException.php
@@ -0,0 +1,27 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReturnValueNotConfiguredException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(Invocation $invocation)
+ {
+ parent::__construct(
+ sprintf(
+ 'Return value inference disabled and no expectation set up for %s::%s()',
+ $invocation->getClassName(),
+ $invocation->getMethodName()
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php
new file mode 100644
index 000000000..33b6a5be3
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/RuntimeException.php
@@ -0,0 +1,17 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class RuntimeException extends \RuntimeException implements Exception
+{
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/SoapExtensionNotAvailableException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/SoapExtensionNotAvailableException.php
new file mode 100644
index 000000000..98837c954
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/SoapExtensionNotAvailableException.php
@@ -0,0 +1,23 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class SoapExtensionNotAvailableException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct()
+ {
+ parent::__construct(
+ 'The SOAP extension is required to generate a test double from WSDL'
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownClassException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownClassException.php
new file mode 100644
index 000000000..e124f9b18
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownClassException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class UnknownClassException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $className)
+ {
+ parent::__construct(
+ sprintf(
+ 'Class "%s" does not exist',
+ $className
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTraitException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTraitException.php
new file mode 100644
index 000000000..90fc8d848
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTraitException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class UnknownTraitException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $traitName)
+ {
+ parent::__construct(
+ sprintf(
+ 'Trait "%s" does not exist',
+ $traitName
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTypeException.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTypeException.php
new file mode 100644
index 000000000..b1a70edd6
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Exception/UnknownTypeException.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function sprintf;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class UnknownTypeException extends \PHPUnit\Framework\Exception implements Exception
+{
+ public function __construct(string $type)
+ {
+ parent::__construct(
+ sprintf(
+ 'Class or interface "%s" does not exist',
+ $type
+ )
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php
new file mode 100644
index 000000000..cb8531cd3
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator.php
@@ -0,0 +1,1004 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use const DIRECTORY_SEPARATOR;
+use const PHP_EOL;
+use const PHP_MAJOR_VERSION;
+use const PREG_OFFSET_CAPTURE;
+use const WSDL_CACHE_NONE;
+use function array_merge;
+use function array_pop;
+use function array_unique;
+use function class_exists;
+use function count;
+use function explode;
+use function extension_loaded;
+use function implode;
+use function in_array;
+use function interface_exists;
+use function is_array;
+use function is_object;
+use function md5;
+use function mt_rand;
+use function preg_match;
+use function preg_match_all;
+use function range;
+use function serialize;
+use function sort;
+use function sprintf;
+use function str_replace;
+use function strlen;
+use function strpos;
+use function strtolower;
+use function substr;
+use function trait_exists;
+use Doctrine\Instantiator\Exception\ExceptionInterface as InstantiatorException;
+use Doctrine\Instantiator\Instantiator;
+use Exception;
+use Iterator;
+use IteratorAggregate;
+use PHPUnit\Framework\InvalidArgumentException;
+use ReflectionClass;
+use ReflectionMethod;
+use SebastianBergmann\Template\Exception as TemplateException;
+use SebastianBergmann\Template\Template;
+use SoapClient;
+use SoapFault;
+use Throwable;
+use Traversable;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class Generator
+{
+ /**
+ * @var array
+ */
+ private const EXCLUDED_METHOD_NAMES = [
+ '__CLASS__' => true,
+ '__DIR__' => true,
+ '__FILE__' => true,
+ '__FUNCTION__' => true,
+ '__LINE__' => true,
+ '__METHOD__' => true,
+ '__NAMESPACE__' => true,
+ '__TRAIT__' => true,
+ '__clone' => true,
+ '__halt_compiler' => true,
+ ];
+
+ /**
+ * @var array
+ */
+ private static $cache = [];
+
+ /**
+ * @var Template[]
+ */
+ private static $templates = [];
+
+ /**
+ * Returns a mock object for the specified class.
+ *
+ * @param null|array $methods
+ *
+ * @throws \PHPUnit\Framework\InvalidArgumentException
+ * @throws ClassAlreadyExistsException
+ * @throws ClassIsFinalException
+ * @throws DuplicateMethodException
+ * @throws InvalidMethodNameException
+ * @throws OriginalConstructorInvocationRequiredException
+ * @throws ReflectionException
+ * @throws RuntimeException
+ * @throws UnknownTypeException
+ */
+ public function getMock(string $type, $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false, object $proxyTarget = null, bool $allowMockingUnknownTypes = true, bool $returnValueGeneration = true): MockObject
+ {
+ if (!is_array($methods) && null !== $methods) {
+ throw InvalidArgumentException::create(2, 'array');
+ }
+
+ if ($type === 'Traversable' || $type === '\\Traversable') {
+ $type = 'Iterator';
+ }
+
+ if (!$allowMockingUnknownTypes && !class_exists($type, $callAutoload) && !interface_exists($type, $callAutoload)) {
+ throw new UnknownTypeException($type);
+ }
+
+ if (null !== $methods) {
+ foreach ($methods as $method) {
+ if (!preg_match('~[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*~', (string) $method)) {
+ throw new InvalidMethodNameException((string) $method);
+ }
+ }
+
+ if ($methods !== array_unique($methods)) {
+ throw new DuplicateMethodException($methods);
+ }
+ }
+
+ if ($mockClassName !== '' && class_exists($mockClassName, false)) {
+ try {
+ $reflector = new ReflectionClass($mockClassName);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ if (!$reflector->implementsInterface(MockObject::class)) {
+ throw new ClassAlreadyExistsException($mockClassName);
+ }
+ }
+
+ if (!$callOriginalConstructor && $callOriginalMethods) {
+ throw new OriginalConstructorInvocationRequiredException;
+ }
+
+ $mock = $this->generate(
+ $type,
+ $methods,
+ $mockClassName,
+ $callOriginalClone,
+ $callAutoload,
+ $cloneArguments,
+ $callOriginalMethods
+ );
+
+ return $this->getObject(
+ $mock,
+ $type,
+ $callOriginalConstructor,
+ $callAutoload,
+ $arguments,
+ $callOriginalMethods,
+ $proxyTarget,
+ $returnValueGeneration
+ );
+ }
+
+ /**
+ * Returns a mock object for the specified abstract class with all abstract
+ * methods of the class mocked.
+ *
+ * Concrete methods to mock can be specified with the $mockedMethods parameter.
+ *
+ * @psalm-template RealInstanceType of object
+ * @psalm-param class-string<RealInstanceType> $originalClassName
+ * @psalm-return MockObject&RealInstanceType
+ *
+ * @throws \PHPUnit\Framework\InvalidArgumentException
+ * @throws ClassAlreadyExistsException
+ * @throws ClassIsFinalException
+ * @throws DuplicateMethodException
+ * @throws InvalidMethodNameException
+ * @throws OriginalConstructorInvocationRequiredException
+ * @throws ReflectionException
+ * @throws RuntimeException
+ * @throws UnknownClassException
+ * @throws UnknownTypeException
+ */
+ public function getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = null, bool $cloneArguments = true): MockObject
+ {
+ if (class_exists($originalClassName, $callAutoload) ||
+ interface_exists($originalClassName, $callAutoload)) {
+ try {
+ $reflector = new ReflectionClass($originalClassName);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ $methods = $mockedMethods;
+
+ foreach ($reflector->getMethods() as $method) {
+ if ($method->isAbstract() && !in_array($method->getName(), $methods ?? [], true)) {
+ $methods[] = $method->getName();
+ }
+ }
+
+ if (empty($methods)) {
+ $methods = null;
+ }
+
+ return $this->getMock(
+ $originalClassName,
+ $methods,
+ $arguments,
+ $mockClassName,
+ $callOriginalConstructor,
+ $callOriginalClone,
+ $callAutoload,
+ $cloneArguments
+ );
+ }
+
+ throw new UnknownClassException($originalClassName);
+ }
+
+ /**
+ * Returns a mock object for the specified trait with all abstract methods
+ * of the trait mocked. Concrete methods to mock can be specified with the
+ * `$mockedMethods` parameter.
+ *
+ * @psalm-param trait-string $traitName
+ *
+ * @throws \PHPUnit\Framework\InvalidArgumentException
+ * @throws ClassAlreadyExistsException
+ * @throws ClassIsFinalException
+ * @throws DuplicateMethodException
+ * @throws InvalidMethodNameException
+ * @throws OriginalConstructorInvocationRequiredException
+ * @throws ReflectionException
+ * @throws RuntimeException
+ * @throws UnknownClassException
+ * @throws UnknownTraitException
+ * @throws UnknownTypeException
+ */
+ public function getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = null, bool $cloneArguments = true): MockObject
+ {
+ if (!trait_exists($traitName, $callAutoload)) {
+ throw new UnknownTraitException($traitName);
+ }
+
+ $className = $this->generateClassName(
+ $traitName,
+ '',
+ 'Trait_'
+ );
+
+ $classTemplate = $this->getTemplate('trait_class.tpl');
+
+ $classTemplate->setVar(
+ [
+ 'prologue' => 'abstract ',
+ 'class_name' => $className['className'],
+ 'trait_name' => $traitName,
+ ]
+ );
+
+ $mockTrait = new MockTrait($classTemplate->render(), $className['className']);
+ $mockTrait->generate();
+
+ return $this->getMockForAbstractClass($className['className'], $arguments, $mockClassName, $callOriginalConstructor, $callOriginalClone, $callAutoload, $mockedMethods, $cloneArguments);
+ }
+
+ /**
+ * Returns an object for the specified trait.
+ *
+ * @psalm-param trait-string $traitName
+ *
+ * @throws ReflectionException
+ * @throws RuntimeException
+ * @throws UnknownTraitException
+ */
+ public function getObjectForTrait(string $traitName, string $traitClassName = '', bool $callAutoload = true, bool $callOriginalConstructor = false, array $arguments = []): object
+ {
+ if (!trait_exists($traitName, $callAutoload)) {
+ throw new UnknownTraitException($traitName);
+ }
+
+ $className = $this->generateClassName(
+ $traitName,
+ $traitClassName,
+ 'Trait_'
+ );
+
+ $classTemplate = $this->getTemplate('trait_class.tpl');
+
+ $classTemplate->setVar(
+ [
+ 'prologue' => '',
+ 'class_name' => $className['className'],
+ 'trait_name' => $traitName,
+ ]
+ );
+
+ return $this->getObject(
+ new MockTrait(
+ $classTemplate->render(),
+ $className['className']
+ ),
+ '',
+ $callOriginalConstructor,
+ $callAutoload,
+ $arguments
+ );
+ }
+
+ /**
+ * @throws ClassIsFinalException
+ * @throws ReflectionException
+ * @throws RuntimeException
+ */
+ public function generate(string $type, array $methods = null, string $mockClassName = '', bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = true, bool $callOriginalMethods = false): MockClass
+ {
+ if ($mockClassName !== '') {
+ return $this->generateMock(
+ $type,
+ $methods,
+ $mockClassName,
+ $callOriginalClone,
+ $callAutoload,
+ $cloneArguments,
+ $callOriginalMethods
+ );
+ }
+
+ $key = md5(
+ $type .
+ serialize($methods) .
+ serialize($callOriginalClone) .
+ serialize($cloneArguments) .
+ serialize($callOriginalMethods)
+ );
+
+ if (!isset(self::$cache[$key])) {
+ self::$cache[$key] = $this->generateMock(
+ $type,
+ $methods,
+ $mockClassName,
+ $callOriginalClone,
+ $callAutoload,
+ $cloneArguments,
+ $callOriginalMethods
+ );
+ }
+
+ return self::$cache[$key];
+ }
+
+ /**
+ * @throws RuntimeException
+ * @throws SoapExtensionNotAvailableException
+ */
+ public function generateClassFromWsdl(string $wsdlFile, string $className, array $methods = [], array $options = []): string
+ {
+ if (!extension_loaded('soap')) {
+ throw new SoapExtensionNotAvailableException;
+ }
+
+ $options = array_merge($options, ['cache_wsdl' => WSDL_CACHE_NONE]);
+
+ try {
+ $client = new SoapClient($wsdlFile, $options);
+ $_methods = array_unique($client->__getFunctions());
+ unset($client);
+ } catch (SoapFault $e) {
+ throw new RuntimeException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+
+ sort($_methods);
+
+ $methodTemplate = $this->getTemplate('wsdl_method.tpl');
+ $methodsBuffer = '';
+
+ foreach ($_methods as $method) {
+ preg_match_all('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\(/', $method, $matches, PREG_OFFSET_CAPTURE);
+ $lastFunction = array_pop($matches[0]);
+ $nameStart = $lastFunction[1];
+ $nameEnd = $nameStart + strlen($lastFunction[0]) - 1;
+ $name = str_replace('(', '', $lastFunction[0]);
+
+ if (empty($methods) || in_array($name, $methods, true)) {
+ $args = explode(
+ ',',
+ str_replace(')', '', substr($method, $nameEnd + 1))
+ );
+
+ foreach (range(0, count($args) - 1) as $i) {
+ $parameterStart = strpos($args[$i], '$');
+
+ if (!$parameterStart) {
+ continue;
+ }
+
+ $args[$i] = substr($args[$i], $parameterStart);
+ }
+
+ $methodTemplate->setVar(
+ [
+ 'method_name' => $name,
+ 'arguments' => implode(', ', $args),
+ ]
+ );
+
+ $methodsBuffer .= $methodTemplate->render();
+ }
+ }
+
+ $optionsBuffer = '[';
+
+ foreach ($options as $key => $value) {
+ $optionsBuffer .= $key . ' => ' . $value;
+ }
+
+ $optionsBuffer .= ']';
+
+ $classTemplate = $this->getTemplate('wsdl_class.tpl');
+ $namespace = '';
+
+ if (strpos($className, '\\') !== false) {
+ $parts = explode('\\', $className);
+ $className = array_pop($parts);
+ $namespace = 'namespace ' . implode('\\', $parts) . ';' . "\n\n";
+ }
+
+ $classTemplate->setVar(
+ [
+ 'namespace' => $namespace,
+ 'class_name' => $className,
+ 'wsdl' => $wsdlFile,
+ 'options' => $optionsBuffer,
+ 'methods' => $methodsBuffer,
+ ]
+ );
+
+ return $classTemplate->render();
+ }
+
+ /**
+ * @throws ReflectionException
+ *
+ * @return string[]
+ */
+ public function getClassMethods(string $className): array
+ {
+ try {
+ $class = new ReflectionClass($className);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ $methods = [];
+
+ foreach ($class->getMethods() as $method) {
+ if ($method->isPublic() || $method->isAbstract()) {
+ $methods[] = $method->getName();
+ }
+ }
+
+ return $methods;
+ }
+
+ /**
+ * @throws ReflectionException
+ *
+ * @return MockMethod[]
+ */
+ public function mockClassMethods(string $className, bool $callOriginalMethods, bool $cloneArguments): array
+ {
+ try {
+ $class = new ReflectionClass($className);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ $methods = [];
+
+ foreach ($class->getMethods() as $method) {
+ if (($method->isPublic() || $method->isAbstract()) && $this->canMockMethod($method)) {
+ $methods[] = MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments);
+ }
+ }
+
+ return $methods;
+ }
+
+ /**
+ * @throws ReflectionException
+ *
+ * @return MockMethod[]
+ */
+ public function mockInterfaceMethods(string $interfaceName, bool $cloneArguments): array
+ {
+ try {
+ $class = new ReflectionClass($interfaceName);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ $methods = [];
+
+ foreach ($class->getMethods() as $method) {
+ $methods[] = MockMethod::fromReflection($method, false, $cloneArguments);
+ }
+
+ return $methods;
+ }
+
+ /**
+ * @psalm-param class-string $interfaceName
+ *
+ * @throws ReflectionException
+ *
+ * @return ReflectionMethod[]
+ */
+ private function userDefinedInterfaceMethods(string $interfaceName): array
+ {
+ try {
+ // @codeCoverageIgnoreStart
+ $interface = new ReflectionClass($interfaceName);
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ $methods = [];
+
+ foreach ($interface->getMethods() as $method) {
+ if (!$method->isUserDefined()) {
+ continue;
+ }
+
+ $methods[] = $method;
+ }
+
+ return $methods;
+ }
+
+ /**
+ * @throws ReflectionException
+ * @throws RuntimeException
+ */
+ private function getObject(MockType $mockClass, $type = '', bool $callOriginalConstructor = false, bool $callAutoload = false, array $arguments = [], bool $callOriginalMethods = false, object $proxyTarget = null, bool $returnValueGeneration = true)
+ {
+ $className = $mockClass->generate();
+
+ if ($callOriginalConstructor) {
+ if (count($arguments) === 0) {
+ $object = new $className;
+ } else {
+ try {
+ $class = new ReflectionClass($className);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ $object = $class->newInstanceArgs($arguments);
+ }
+ } else {
+ try {
+ $object = (new Instantiator)->instantiate($className);
+ } catch (InstantiatorException $e) {
+ throw new RuntimeException($e->getMessage());
+ }
+ }
+
+ if ($callOriginalMethods) {
+ if (!is_object($proxyTarget)) {
+ if (count($arguments) === 0) {
+ $proxyTarget = new $type;
+ } else {
+ try {
+ $class = new ReflectionClass($type);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ $proxyTarget = $class->newInstanceArgs($arguments);
+ }
+ }
+
+ $object->__phpunit_setOriginalObject($proxyTarget);
+ }
+
+ if ($object instanceof MockObject) {
+ $object->__phpunit_setReturnValueGeneration($returnValueGeneration);
+ }
+
+ return $object;
+ }
+
+ /**
+ * @throws ClassIsFinalException
+ * @throws ReflectionException
+ * @throws RuntimeException
+ */
+ private function generateMock(string $type, ?array $explicitMethods, string $mockClassName, bool $callOriginalClone, bool $callAutoload, bool $cloneArguments, bool $callOriginalMethods): MockClass
+ {
+ $classTemplate = $this->getTemplate('mocked_class.tpl');
+ $additionalInterfaces = [];
+ $mockedCloneMethod = false;
+ $unmockedCloneMethod = false;
+ $isClass = false;
+ $isInterface = false;
+ $class = null;
+ $mockMethods = new MockMethodSet;
+
+ $_mockClassName = $this->generateClassName(
+ $type,
+ $mockClassName,
+ 'Mock_'
+ );
+
+ if (class_exists($_mockClassName['fullClassName'], $callAutoload)) {
+ $isClass = true;
+ } elseif (interface_exists($_mockClassName['fullClassName'], $callAutoload)) {
+ $isInterface = true;
+ }
+
+ if (!$isClass && !$isInterface) {
+ $prologue = 'class ' . $_mockClassName['originalClassName'] . "\n{\n}\n\n";
+
+ if (!empty($_mockClassName['namespaceName'])) {
+ $prologue = 'namespace ' . $_mockClassName['namespaceName'] .
+ " {\n\n" . $prologue . "}\n\n" .
+ "namespace {\n\n";
+
+ $epilogue = "\n\n}";
+ }
+
+ $mockedCloneMethod = true;
+ } else {
+ try {
+ $class = new ReflectionClass($_mockClassName['fullClassName']);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ if ($class->isFinal()) {
+ throw new ClassIsFinalException($_mockClassName['fullClassName']);
+ }
+
+ // @see https://github.com/sebastianbergmann/phpunit/issues/2995
+ if ($isInterface && $class->implementsInterface(Throwable::class)) {
+ $actualClassName = Exception::class;
+ $additionalInterfaces[] = $class->getName();
+ $isInterface = false;
+
+ try {
+ $class = new ReflectionClass($actualClassName);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ foreach ($this->userDefinedInterfaceMethods($_mockClassName['fullClassName']) as $method) {
+ $methodName = $method->getName();
+
+ if ($class->hasMethod($methodName)) {
+ try {
+ $classMethod = $class->getMethod($methodName);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ if (!$this->canMockMethod($classMethod)) {
+ continue;
+ }
+ }
+
+ $mockMethods->addMethods(
+ MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)
+ );
+ }
+
+ $_mockClassName = $this->generateClassName(
+ $actualClassName,
+ $_mockClassName['className'],
+ 'Mock_'
+ );
+ }
+
+ // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/103
+ if ($isInterface && $class->implementsInterface(Traversable::class) &&
+ !$class->implementsInterface(Iterator::class) &&
+ !$class->implementsInterface(IteratorAggregate::class)) {
+ $additionalInterfaces[] = Iterator::class;
+
+ $mockMethods->addMethods(
+ ...$this->mockClassMethods(Iterator::class, $callOriginalMethods, $cloneArguments)
+ );
+ }
+
+ if ($class->hasMethod('__clone')) {
+ try {
+ $cloneMethod = $class->getMethod('__clone');
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ if (!$cloneMethod->isFinal()) {
+ if ($callOriginalClone && !$isInterface) {
+ $unmockedCloneMethod = true;
+ } else {
+ $mockedCloneMethod = true;
+ }
+ }
+ } else {
+ $mockedCloneMethod = true;
+ }
+ }
+
+ if ($isClass && $explicitMethods === []) {
+ $mockMethods->addMethods(
+ ...$this->mockClassMethods($_mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments)
+ );
+ }
+
+ if ($isInterface && ($explicitMethods === [] || $explicitMethods === null)) {
+ $mockMethods->addMethods(
+ ...$this->mockInterfaceMethods($_mockClassName['fullClassName'], $cloneArguments)
+ );
+ }
+
+ if (is_array($explicitMethods)) {
+ foreach ($explicitMethods as $methodName) {
+ if ($class !== null && $class->hasMethod($methodName)) {
+ try {
+ $method = $class->getMethod($methodName);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ if ($this->canMockMethod($method)) {
+ $mockMethods->addMethods(
+ MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)
+ );
+ }
+ } else {
+ $mockMethods->addMethods(
+ MockMethod::fromName(
+ $_mockClassName['fullClassName'],
+ $methodName,
+ $cloneArguments
+ )
+ );
+ }
+ }
+ }
+
+ $mockedMethods = '';
+ $configurable = [];
+
+ foreach ($mockMethods->asArray() as $mockMethod) {
+ $mockedMethods .= $mockMethod->generateCode();
+ $configurable[] = new ConfigurableMethod($mockMethod->getName(), $mockMethod->getReturnType());
+ }
+
+ $method = '';
+
+ if (!$mockMethods->hasMethod('method') && (!isset($class) || !$class->hasMethod('method'))) {
+ $method = PHP_EOL . ' use \PHPUnit\Framework\MockObject\Method;';
+ }
+
+ $cloneTrait = '';
+
+ if ($mockedCloneMethod) {
+ $cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\MockedCloneMethod;';
+ }
+
+ if ($unmockedCloneMethod) {
+ $cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\UnmockedCloneMethod;';
+ }
+
+ $classTemplate->setVar(
+ [
+ 'prologue' => $prologue ?? '',
+ 'epilogue' => $epilogue ?? '',
+ 'class_declaration' => $this->generateMockClassDeclaration(
+ $_mockClassName,
+ $isInterface,
+ $additionalInterfaces
+ ),
+ 'clone' => $cloneTrait,
+ 'mock_class_name' => $_mockClassName['className'],
+ 'mocked_methods' => $mockedMethods,
+ 'method' => $method,
+ ]
+ );
+
+ return new MockClass(
+ $classTemplate->render(),
+ $_mockClassName['className'],
+ $configurable
+ );
+ }
+
+ private function generateClassName(string $type, string $className, string $prefix): array
+ {
+ if ($type[0] === '\\') {
+ $type = substr($type, 1);
+ }
+
+ $classNameParts = explode('\\', $type);
+
+ if (count($classNameParts) > 1) {
+ $type = array_pop($classNameParts);
+ $namespaceName = implode('\\', $classNameParts);
+ $fullClassName = $namespaceName . '\\' . $type;
+ } else {
+ $namespaceName = '';
+ $fullClassName = $type;
+ }
+
+ if ($className === '') {
+ do {
+ $className = $prefix . $type . '_' .
+ substr(md5((string) mt_rand()), 0, 8);
+ } while (class_exists($className, false));
+ }
+
+ return [
+ 'className' => $className,
+ 'originalClassName' => $type,
+ 'fullClassName' => $fullClassName,
+ 'namespaceName' => $namespaceName,
+ ];
+ }
+
+ private function generateMockClassDeclaration(array $mockClassName, bool $isInterface, array $additionalInterfaces = []): string
+ {
+ $buffer = 'class ';
+
+ $additionalInterfaces[] = MockObject::class;
+ $interfaces = implode(', ', $additionalInterfaces);
+
+ if ($isInterface) {
+ $buffer .= sprintf(
+ '%s implements %s',
+ $mockClassName['className'],
+ $interfaces
+ );
+
+ if (!in_array($mockClassName['originalClassName'], $additionalInterfaces, true)) {
+ $buffer .= ', ';
+
+ if (!empty($mockClassName['namespaceName'])) {
+ $buffer .= $mockClassName['namespaceName'] . '\\';
+ }
+
+ $buffer .= $mockClassName['originalClassName'];
+ }
+ } else {
+ $buffer .= sprintf(
+ '%s extends %s%s implements %s',
+ $mockClassName['className'],
+ !empty($mockClassName['namespaceName']) ? $mockClassName['namespaceName'] . '\\' : '',
+ $mockClassName['originalClassName'],
+ $interfaces
+ );
+ }
+
+ return $buffer;
+ }
+
+ private function canMockMethod(ReflectionMethod $method): bool
+ {
+ return !($this->isConstructor($method) || $method->isFinal() || $method->isPrivate() || $this->isMethodNameExcluded($method->getName()));
+ }
+
+ private function isMethodNameExcluded(string $name): bool
+ {
+ return isset(self::EXCLUDED_METHOD_NAMES[$name]);
+ }
+
+ /**
+ * @throws RuntimeException
+ */
+ private function getTemplate(string $template): Template
+ {
+ $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR . $template;
+
+ if (!isset(self::$templates[$filename])) {
+ try {
+ self::$templates[$filename] = new Template($filename);
+ } catch (TemplateException $e) {
+ throw new RuntimeException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ }
+
+ return self::$templates[$filename];
+ }
+
+ /**
+ * @see https://github.com/sebastianbergmann/phpunit/issues/4139#issuecomment-605409765
+ */
+ private function isConstructor(ReflectionMethod $method): bool
+ {
+ $methodName = strtolower($method->getName());
+
+ if ($methodName === '__construct') {
+ return true;
+ }
+
+ if (PHP_MAJOR_VERSION >= 8) {
+ return false;
+ }
+
+ $className = strtolower($method->getDeclaringClass()->getName());
+
+ return $methodName === $className;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl
new file mode 100644
index 000000000..5bf06f52d
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/deprecation.tpl
@@ -0,0 +1,2 @@
+
+ @trigger_error({deprecation}, E_USER_DEPRECATED);
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl
new file mode 100644
index 000000000..593119fb2
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_class.tpl
@@ -0,0 +1,6 @@
+declare(strict_types=1);
+
+{prologue}{class_declaration}
+{
+ use \PHPUnit\Framework\MockObject\Api;{method}{clone}
+{mocked_methods}}{epilogue}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl
new file mode 100644
index 000000000..114ff8d0d
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method.tpl
@@ -0,0 +1,22 @@
+
+ {modifier} function {reference}{method_name}({arguments_decl}){return_declaration}
+ {{deprecation}
+ $__phpunit_arguments = [{arguments_call}];
+ $__phpunit_count = func_num_args();
+
+ if ($__phpunit_count > {arguments_count}) {
+ $__phpunit_arguments_tmp = func_get_args();
+
+ for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
+ $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i];
+ }
+ }
+
+ $__phpunit_result = $this->__phpunit_getInvocationHandler()->invoke(
+ new \PHPUnit\Framework\MockObject\Invocation(
+ '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}
+ )
+ );
+
+ return $__phpunit_result;
+ }
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl
new file mode 100644
index 000000000..390202201
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_method_void.tpl
@@ -0,0 +1,20 @@
+
+ {modifier} function {reference}{method_name}({arguments_decl}){return_declaration}
+ {{deprecation}
+ $__phpunit_arguments = [{arguments_call}];
+ $__phpunit_count = func_num_args();
+
+ if ($__phpunit_count > {arguments_count}) {
+ $__phpunit_arguments_tmp = func_get_args();
+
+ for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
+ $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i];
+ }
+ }
+
+ $this->__phpunit_getInvocationHandler()->invoke(
+ new \PHPUnit\Framework\MockObject\Invocation(
+ '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}
+ )
+ );
+ }
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl
new file mode 100644
index 000000000..5e5cf23cd
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/mocked_static_method.tpl
@@ -0,0 +1,5 @@
+
+ {modifier} function {reference}{method_name}({arguments_decl}){return_declaration}
+ {
+ throw new \PHPUnit\Framework\MockObject\BadMethodCallException('Static method "{method_name}" cannot be invoked on mock object');
+ }
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl
new file mode 100644
index 000000000..91bef463d
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method.tpl
@@ -0,0 +1,22 @@
+
+ {modifier} function {reference}{method_name}({arguments_decl}){return_declaration}
+ {
+ $__phpunit_arguments = [{arguments_call}];
+ $__phpunit_count = func_num_args();
+
+ if ($__phpunit_count > {arguments_count}) {
+ $__phpunit_arguments_tmp = func_get_args();
+
+ for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
+ $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i];
+ }
+ }
+
+ $this->__phpunit_getInvocationHandler()->invoke(
+ new \PHPUnit\Framework\MockObject\Invocation(
+ '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}, true
+ )
+ );
+
+ return call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments);
+ }
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl
new file mode 100644
index 000000000..cce198826
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/proxied_method_void.tpl
@@ -0,0 +1,22 @@
+
+ {modifier} function {reference}{method_name}({arguments_decl}){return_declaration}
+ {
+ $__phpunit_arguments = [{arguments_call}];
+ $__phpunit_count = func_num_args();
+
+ if ($__phpunit_count > {arguments_count}) {
+ $__phpunit_arguments_tmp = func_get_args();
+
+ for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
+ $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i];
+ }
+ }
+
+ $this->__phpunit_getInvocationHandler()->invoke(
+ new \PHPUnit\Framework\MockObject\Invocation(
+ '{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}, true
+ )
+ );
+
+ call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments);
+ }
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl
new file mode 100644
index 000000000..a8fe470fd
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/trait_class.tpl
@@ -0,0 +1,6 @@
+declare(strict_types=1);
+
+{prologue}class {class_name}
+{
+ use {trait_name};
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl
new file mode 100644
index 000000000..b3100b414
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_class.tpl
@@ -0,0 +1,9 @@
+declare(strict_types=1);
+
+{namespace}class {class_name} extends \SoapClient
+{
+ public function __construct($wsdl, array $options)
+ {
+ parent::__construct('{wsdl}', $options);
+ }
+{methods}}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl
new file mode 100644
index 000000000..bb16e763e
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Generator/wsdl_method.tpl
@@ -0,0 +1,4 @@
+
+ public function {method_name}({arguments})
+ {
+ }
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php
new file mode 100644
index 000000000..392938347
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Invocation.php
@@ -0,0 +1,254 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function array_map;
+use function explode;
+use function get_class;
+use function implode;
+use function is_object;
+use function sprintf;
+use function strpos;
+use function strtolower;
+use function substr;
+use Doctrine\Instantiator\Instantiator;
+use PHPUnit\Framework\SelfDescribing;
+use PHPUnit\Util\Type;
+use SebastianBergmann\Exporter\Exporter;
+use stdClass;
+use Throwable;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class Invocation implements SelfDescribing
+{
+ /**
+ * @var string
+ */
+ private $className;
+
+ /**
+ * @var string
+ */
+ private $methodName;
+
+ /**
+ * @var array
+ */
+ private $parameters;
+
+ /**
+ * @var string
+ */
+ private $returnType;
+
+ /**
+ * @var bool
+ */
+ private $isReturnTypeNullable = false;
+
+ /**
+ * @var bool
+ */
+ private $proxiedCall;
+
+ /**
+ * @var object
+ */
+ private $object;
+
+ public function __construct(string $className, string $methodName, array $parameters, string $returnType, object $object, bool $cloneObjects = false, bool $proxiedCall = false)
+ {
+ $this->className = $className;
+ $this->methodName = $methodName;
+ $this->parameters = $parameters;
+ $this->object = $object;
+ $this->proxiedCall = $proxiedCall;
+
+ if (strtolower($methodName) === '__tostring') {
+ $returnType = 'string';
+ }
+
+ if (strpos($returnType, '?') === 0) {
+ $returnType = substr($returnType, 1);
+ $this->isReturnTypeNullable = true;
+ }
+
+ $this->returnType = $returnType;
+
+ if (!$cloneObjects) {
+ return;
+ }
+
+ foreach ($this->parameters as $key => $value) {
+ if (is_object($value)) {
+ $this->parameters[$key] = $this->cloneObject($value);
+ }
+ }
+ }
+
+ public function getClassName(): string
+ {
+ return $this->className;
+ }
+
+ public function getMethodName(): string
+ {
+ return $this->methodName;
+ }
+
+ public function getParameters(): array
+ {
+ return $this->parameters;
+ }
+
+ /**
+ * @throws RuntimeException
+ *
+ * @return mixed Mocked return value
+ */
+ public function generateReturnValue()
+ {
+ if ($this->isReturnTypeNullable || $this->proxiedCall) {
+ return null;
+ }
+
+ $union = false;
+
+ if (strpos($this->returnType, '|') !== false) {
+ $types = explode('|', $this->returnType);
+ $union = true;
+ } else {
+ $types = [$this->returnType];
+ }
+
+ $types = array_map('strtolower', $types);
+
+ if (in_array('', $types, true) ||
+ in_array('null', $types, true) ||
+ in_array('mixed', $types, true) ||
+ in_array('void', $types, true)) {
+ return null;
+ }
+
+ if (in_array('false', $types, true) ||
+ in_array('bool', $types, true)) {
+ return false;
+ }
+
+ if (in_array('float', $types, true)) {
+ return 0.0;
+ }
+
+ if (in_array('int', $types, true)) {
+ return 0;
+ }
+
+ if (in_array('string', $types, true)) {
+ return '';
+ }
+
+ if (in_array('array', $types, true)) {
+ return [];
+ }
+
+ if (in_array('static', $types, true)) {
+ try {
+ return (new Instantiator)->instantiate(get_class($this->object));
+ } catch (Throwable $t) {
+ throw new RuntimeException(
+ $t->getMessage(),
+ (int) $t->getCode(),
+ $t
+ );
+ }
+ }
+
+ if (in_array('object', $types, true)) {
+ return new stdClass;
+ }
+
+ if (in_array('callable', $types, true) ||
+ in_array('closure', $types, true)) {
+ return static function (): void
+ {
+ };
+ }
+
+ if (in_array('traversable', $types, true) ||
+ in_array('generator', $types, true) ||
+ in_array('iterable', $types, true)) {
+ $generator = static function (): \Generator
+ {
+ yield from [];
+ };
+
+ return $generator();
+ }
+
+ if (!$union) {
+ try {
+ return (new Generator)->getMock($this->returnType, [], [], '', false);
+ } catch (Throwable $t) {
+ throw new RuntimeException(
+ sprintf(
+ 'Return value for %s::%s() cannot be generated: %s',
+ $this->className,
+ $this->methodName,
+ $t->getMessage(),
+ ),
+ (int) $t->getCode(),
+ );
+ }
+ }
+
+ throw new RuntimeException(
+ sprintf(
+ 'Return value for %s::%s() cannot be generated because the declared return type is a union, please configure a return value for this method',
+ $this->className,
+ $this->methodName
+ )
+ );
+ }
+
+ public function toString(): string
+ {
+ $exporter = new Exporter;
+
+ return sprintf(
+ '%s::%s(%s)%s',
+ $this->className,
+ $this->methodName,
+ implode(
+ ', ',
+ array_map(
+ [$exporter, 'shortenedExport'],
+ $this->parameters
+ )
+ ),
+ $this->returnType ? sprintf(': %s', $this->returnType) : ''
+ );
+ }
+
+ public function getObject(): object
+ {
+ return $this->object;
+ }
+
+ private function cloneObject(object $original): object
+ {
+ if (Type::isCloneable($original)) {
+ return clone $original;
+ }
+
+ return $original;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/InvocationHandler.php b/vendor/phpunit/phpunit/src/Framework/MockObject/InvocationHandler.php
new file mode 100644
index 000000000..b9d62610a
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/InvocationHandler.php
@@ -0,0 +1,186 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function strtolower;
+use Exception;
+use PHPUnit\Framework\MockObject\Builder\InvocationMocker;
+use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
+use Throwable;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class InvocationHandler
+{
+ /**
+ * @var Matcher[]
+ */
+ private $matchers = [];
+
+ /**
+ * @var Matcher[]
+ */
+ private $matcherMap = [];
+
+ /**
+ * @var ConfigurableMethod[]
+ */
+ private $configurableMethods;
+
+ /**
+ * @var bool
+ */
+ private $returnValueGeneration;
+
+ /**
+ * @var Throwable
+ */
+ private $deferredError;
+
+ public function __construct(array $configurableMethods, bool $returnValueGeneration)
+ {
+ $this->configurableMethods = $configurableMethods;
+ $this->returnValueGeneration = $returnValueGeneration;
+ }
+
+ public function hasMatchers(): bool
+ {
+ foreach ($this->matchers as $matcher) {
+ if ($matcher->hasMatchers()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Looks up the match builder with identification $id and returns it.
+ *
+ * @param string $id The identification of the match builder
+ */
+ public function lookupMatcher(string $id): ?Matcher
+ {
+ if (isset($this->matcherMap[$id])) {
+ return $this->matcherMap[$id];
+ }
+
+ return null;
+ }
+
+ /**
+ * Registers a matcher with the identification $id. The matcher can later be
+ * looked up using lookupMatcher() to figure out if it has been invoked.
+ *
+ * @param string $id The identification of the matcher
+ * @param Matcher $matcher The builder which is being registered
+ *
+ * @throws MatcherAlreadyRegisteredException
+ */
+ public function registerMatcher(string $id, Matcher $matcher): void
+ {
+ if (isset($this->matcherMap[$id])) {
+ throw new MatcherAlreadyRegisteredException($id);
+ }
+
+ $this->matcherMap[$id] = $matcher;
+ }
+
+ public function expects(InvocationOrder $rule): InvocationMocker
+ {
+ $matcher = new Matcher($rule);
+ $this->addMatcher($matcher);
+
+ return new InvocationMocker(
+ $this,
+ $matcher,
+ ...$this->configurableMethods
+ );
+ }
+
+ /**
+ * @throws Exception
+ * @throws RuntimeException
+ */
+ public function invoke(Invocation $invocation)
+ {
+ $exception = null;
+ $hasReturnValue = false;
+ $returnValue = null;
+
+ foreach ($this->matchers as $match) {
+ try {
+ if ($match->matches($invocation)) {
+ $value = $match->invoked($invocation);
+
+ if (!$hasReturnValue) {
+ $returnValue = $value;
+ $hasReturnValue = true;
+ }
+ }
+ } catch (Exception $e) {
+ $exception = $e;
+ }
+ }
+
+ if ($exception !== null) {
+ throw $exception;
+ }
+
+ if ($hasReturnValue) {
+ return $returnValue;
+ }
+
+ if (!$this->returnValueGeneration) {
+ $exception = new ReturnValueNotConfiguredException($invocation);
+
+ if (strtolower($invocation->getMethodName()) === '__tostring') {
+ $this->deferredError = $exception;
+
+ return '';
+ }
+
+ throw $exception;
+ }
+
+ return $invocation->generateReturnValue();
+ }
+
+ public function matches(Invocation $invocation): bool
+ {
+ foreach ($this->matchers as $matcher) {
+ if (!$matcher->matches($invocation)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @throws Throwable
+ */
+ public function verify(): void
+ {
+ foreach ($this->matchers as $matcher) {
+ $matcher->verify();
+ }
+
+ if ($this->deferredError) {
+ throw $this->deferredError;
+ }
+ }
+
+ private function addMatcher(Matcher $matcher): void
+ {
+ $this->matchers[] = $matcher;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php
new file mode 100644
index 000000000..a0f8817bd
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Matcher.php
@@ -0,0 +1,272 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function assert;
+use function implode;
+use function sprintf;
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount;
+use PHPUnit\Framework\MockObject\Rule\AnyParameters;
+use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
+use PHPUnit\Framework\MockObject\Rule\InvokedCount;
+use PHPUnit\Framework\MockObject\Rule\MethodName;
+use PHPUnit\Framework\MockObject\Rule\ParametersRule;
+use PHPUnit\Framework\MockObject\Stub\Stub;
+use PHPUnit\Framework\TestFailure;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class Matcher
+{
+ /**
+ * @var InvocationOrder
+ */
+ private $invocationRule;
+
+ /**
+ * @var mixed
+ */
+ private $afterMatchBuilderId;
+
+ /**
+ * @var bool
+ */
+ private $afterMatchBuilderIsInvoked = false;
+
+ /**
+ * @var MethodName
+ */
+ private $methodNameRule;
+
+ /**
+ * @var ParametersRule
+ */
+ private $parametersRule;
+
+ /**
+ * @var Stub
+ */
+ private $stub;
+
+ public function __construct(InvocationOrder $rule)
+ {
+ $this->invocationRule = $rule;
+ }
+
+ public function hasMatchers(): bool
+ {
+ return !$this->invocationRule instanceof AnyInvokedCount;
+ }
+
+ public function hasMethodNameRule(): bool
+ {
+ return $this->methodNameRule !== null;
+ }
+
+ public function getMethodNameRule(): MethodName
+ {
+ return $this->methodNameRule;
+ }
+
+ public function setMethodNameRule(MethodName $rule): void
+ {
+ $this->methodNameRule = $rule;
+ }
+
+ public function hasParametersRule(): bool
+ {
+ return $this->parametersRule !== null;
+ }
+
+ public function setParametersRule(ParametersRule $rule): void
+ {
+ $this->parametersRule = $rule;
+ }
+
+ public function setStub(Stub $stub): void
+ {
+ $this->stub = $stub;
+ }
+
+ public function setAfterMatchBuilderId(string $id): void
+ {
+ $this->afterMatchBuilderId = $id;
+ }
+
+ /**
+ * @throws ExpectationFailedException
+ * @throws MatchBuilderNotFoundException
+ * @throws MethodNameNotConfiguredException
+ * @throws RuntimeException
+ */
+ public function invoked(Invocation $invocation)
+ {
+ if ($this->methodNameRule === null) {
+ throw new MethodNameNotConfiguredException;
+ }
+
+ if ($this->afterMatchBuilderId !== null) {
+ $matcher = $invocation->getObject()
+ ->__phpunit_getInvocationHandler()
+ ->lookupMatcher($this->afterMatchBuilderId);
+
+ if (!$matcher) {
+ throw new MatchBuilderNotFoundException($this->afterMatchBuilderId);
+ }
+
+ assert($matcher instanceof self);
+
+ if ($matcher->invocationRule->hasBeenInvoked()) {
+ $this->afterMatchBuilderIsInvoked = true;
+ }
+ }
+
+ $this->invocationRule->invoked($invocation);
+
+ try {
+ if ($this->parametersRule !== null) {
+ $this->parametersRule->apply($invocation);
+ }
+ } catch (ExpectationFailedException $e) {
+ throw new ExpectationFailedException(
+ sprintf(
+ "Expectation failed for %s when %s\n%s",
+ $this->methodNameRule->toString(),
+ $this->invocationRule->toString(),
+ $e->getMessage()
+ ),
+ $e->getComparisonFailure()
+ );
+ }
+
+ if ($this->stub) {
+ return $this->stub->invoke($invocation);
+ }
+
+ return $invocation->generateReturnValue();
+ }
+
+ /**
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ * @throws ExpectationFailedException
+ * @throws MatchBuilderNotFoundException
+ * @throws MethodNameNotConfiguredException
+ * @throws RuntimeException
+ */
+ public function matches(Invocation $invocation): bool
+ {
+ if ($this->afterMatchBuilderId !== null) {
+ $matcher = $invocation->getObject()
+ ->__phpunit_getInvocationHandler()
+ ->lookupMatcher($this->afterMatchBuilderId);
+
+ if (!$matcher) {
+ throw new MatchBuilderNotFoundException($this->afterMatchBuilderId);
+ }
+
+ assert($matcher instanceof self);
+
+ if (!$matcher->invocationRule->hasBeenInvoked()) {
+ return false;
+ }
+ }
+
+ if ($this->methodNameRule === null) {
+ throw new MethodNameNotConfiguredException;
+ }
+
+ if (!$this->invocationRule->matches($invocation)) {
+ return false;
+ }
+
+ try {
+ if (!$this->methodNameRule->matches($invocation)) {
+ return false;
+ }
+ } catch (ExpectationFailedException $e) {
+ throw new ExpectationFailedException(
+ sprintf(
+ "Expectation failed for %s when %s\n%s",
+ $this->methodNameRule->toString(),
+ $this->invocationRule->toString(),
+ $e->getMessage()
+ ),
+ $e->getComparisonFailure()
+ );
+ }
+
+ return true;
+ }
+
+ /**
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ * @throws ExpectationFailedException
+ * @throws MethodNameNotConfiguredException
+ */
+ public function verify(): void
+ {
+ if ($this->methodNameRule === null) {
+ throw new MethodNameNotConfiguredException;
+ }
+
+ try {
+ $this->invocationRule->verify();
+
+ if ($this->parametersRule === null) {
+ $this->parametersRule = new AnyParameters;
+ }
+
+ $invocationIsAny = $this->invocationRule instanceof AnyInvokedCount;
+ $invocationIsNever = $this->invocationRule instanceof InvokedCount && $this->invocationRule->isNever();
+
+ if (!$invocationIsAny && !$invocationIsNever) {
+ $this->parametersRule->verify();
+ }
+ } catch (ExpectationFailedException $e) {
+ throw new ExpectationFailedException(
+ sprintf(
+ "Expectation failed for %s when %s.\n%s",
+ $this->methodNameRule->toString(),
+ $this->invocationRule->toString(),
+ TestFailure::exceptionToString($e)
+ )
+ );
+ }
+ }
+
+ public function toString(): string
+ {
+ $list = [];
+
+ if ($this->invocationRule !== null) {
+ $list[] = $this->invocationRule->toString();
+ }
+
+ if ($this->methodNameRule !== null) {
+ $list[] = 'where ' . $this->methodNameRule->toString();
+ }
+
+ if ($this->parametersRule !== null) {
+ $list[] = 'and ' . $this->parametersRule->toString();
+ }
+
+ if ($this->afterMatchBuilderId !== null) {
+ $list[] = 'after ' . $this->afterMatchBuilderId;
+ }
+
+ if ($this->stub !== null) {
+ $list[] = 'will ' . $this->stub->toString();
+ }
+
+ return implode(' ', $list);
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MethodNameConstraint.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MethodNameConstraint.php
new file mode 100644
index 000000000..3082ab384
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MethodNameConstraint.php
@@ -0,0 +1,48 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function is_string;
+use function sprintf;
+use function strtolower;
+use PHPUnit\Framework\Constraint\Constraint;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MethodNameConstraint extends Constraint
+{
+ /**
+ * @var string
+ */
+ private $methodName;
+
+ public function __construct(string $methodName)
+ {
+ $this->methodName = $methodName;
+ }
+
+ public function toString(): string
+ {
+ return sprintf(
+ 'is "%s"',
+ $this->methodName
+ );
+ }
+
+ protected function matches($other): bool
+ {
+ if (!is_string($other)) {
+ return false;
+ }
+
+ return strtolower($this->methodName) === strtolower($other);
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php
new file mode 100644
index 000000000..aec32a2d4
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockBuilder.php
@@ -0,0 +1,516 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function array_diff;
+use function array_merge;
+use PHPUnit\Framework\TestCase;
+use ReflectionClass;
+
+/**
+ * @psalm-template MockedType
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ */
+final class MockBuilder
+{
+ /**
+ * @var TestCase
+ */
+ private $testCase;
+
+ /**
+ * @var string
+ */
+ private $type;
+
+ /**
+ * @var null|string[]
+ */
+ private $methods = [];
+
+ /**
+ * @var bool
+ */
+ private $emptyMethodsArray = false;
+
+ /**
+ * @var string
+ */
+ private $mockClassName = '';
+
+ /**
+ * @var array
+ */
+ private $constructorArgs = [];
+
+ /**
+ * @var bool
+ */
+ private $originalConstructor = true;
+
+ /**
+ * @var bool
+ */
+ private $originalClone = true;
+
+ /**
+ * @var bool
+ */
+ private $autoload = true;
+
+ /**
+ * @var bool
+ */
+ private $cloneArguments = false;
+
+ /**
+ * @var bool
+ */
+ private $callOriginalMethods = false;
+
+ /**
+ * @var ?object
+ */
+ private $proxyTarget;
+
+ /**
+ * @var bool
+ */
+ private $allowMockingUnknownTypes = true;
+
+ /**
+ * @var bool
+ */
+ private $returnValueGeneration = true;
+
+ /**
+ * @var Generator
+ */
+ private $generator;
+
+ /**
+ * @param string|string[] $type
+ *
+ * @psalm-param class-string<MockedType>|string|string[] $type
+ */
+ public function __construct(TestCase $testCase, $type)
+ {
+ $this->testCase = $testCase;
+ $this->type = $type;
+ $this->generator = new Generator;
+ }
+
+ /**
+ * Creates a mock object using a fluent interface.
+ *
+ * @throws \PHPUnit\Framework\InvalidArgumentException
+ * @throws ClassAlreadyExistsException
+ * @throws ClassIsFinalException
+ * @throws DuplicateMethodException
+ * @throws InvalidMethodNameException
+ * @throws OriginalConstructorInvocationRequiredException
+ * @throws ReflectionException
+ * @throws RuntimeException
+ * @throws UnknownTypeException
+ *
+ * @psalm-return MockObject&MockedType
+ */
+ public function getMock(): MockObject
+ {
+ $object = $this->generator->getMock(
+ $this->type,
+ !$this->emptyMethodsArray ? $this->methods : null,
+ $this->constructorArgs,
+ $this->mockClassName,
+ $this->originalConstructor,
+ $this->originalClone,
+ $this->autoload,
+ $this->cloneArguments,
+ $this->callOriginalMethods,
+ $this->proxyTarget,
+ $this->allowMockingUnknownTypes,
+ $this->returnValueGeneration
+ );
+
+ $this->testCase->registerMockObject($object);
+
+ return $object;
+ }
+
+ /**
+ * Creates a mock object for an abstract class using a fluent interface.
+ *
+ * @psalm-return MockObject&MockedType
+ *
+ * @throws \PHPUnit\Framework\Exception
+ * @throws ReflectionException
+ * @throws RuntimeException
+ */
+ public function getMockForAbstractClass(): MockObject
+ {
+ $object = $this->generator->getMockForAbstractClass(
+ $this->type,
+ $this->constructorArgs,
+ $this->mockClassName,
+ $this->originalConstructor,
+ $this->originalClone,
+ $this->autoload,
+ $this->methods,
+ $this->cloneArguments
+ );
+
+ $this->testCase->registerMockObject($object);
+
+ return $object;
+ }
+
+ /**
+ * Creates a mock object for a trait using a fluent interface.
+ *
+ * @psalm-return MockObject&MockedType
+ *
+ * @throws \PHPUnit\Framework\Exception
+ * @throws ReflectionException
+ * @throws RuntimeException
+ */
+ public function getMockForTrait(): MockObject
+ {
+ $object = $this->generator->getMockForTrait(
+ $this->type,
+ $this->constructorArgs,
+ $this->mockClassName,
+ $this->originalConstructor,
+ $this->originalClone,
+ $this->autoload,
+ $this->methods,
+ $this->cloneArguments
+ );
+
+ $this->testCase->registerMockObject($object);
+
+ return $object;
+ }
+
+ /**
+ * Specifies the subset of methods to mock. Default is to mock none of them.
+ *
+ * @deprecated https://github.com/sebastianbergmann/phpunit/pull/3687
+ *
+ * @return $this
+ */
+ public function setMethods(?array $methods = null): self
+ {
+ if ($methods === null) {
+ $this->methods = $methods;
+ } else {
+ $this->methods = array_merge($this->methods ?? [], $methods);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Specifies the subset of methods to mock, requiring each to exist in the class.
+ *
+ * @param string[] $methods
+ *
+ * @throws CannotUseOnlyMethodsException
+ * @throws ReflectionException
+ *
+ * @return $this
+ */
+ public function onlyMethods(array $methods): self
+ {
+ if (empty($methods)) {
+ $this->emptyMethodsArray = true;
+
+ return $this;
+ }
+
+ try {
+ $reflector = new ReflectionClass($this->type);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ foreach ($methods as $method) {
+ if (!$reflector->hasMethod($method)) {
+ throw new CannotUseOnlyMethodsException($this->type, $method);
+ }
+ }
+
+ $this->methods = array_merge($this->methods ?? [], $methods);
+
+ return $this;
+ }
+
+ /**
+ * Specifies methods that don't exist in the class which you want to mock.
+ *
+ * @param string[] $methods
+ *
+ * @throws CannotUseAddMethodsException
+ * @throws ReflectionException
+ * @throws RuntimeException
+ *
+ * @return $this
+ */
+ public function addMethods(array $methods): self
+ {
+ if (empty($methods)) {
+ $this->emptyMethodsArray = true;
+
+ return $this;
+ }
+
+ try {
+ $reflector = new ReflectionClass($this->type);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+
+ foreach ($methods as $method) {
+ if ($reflector->hasMethod($method)) {
+ throw new CannotUseAddMethodsException($this->type, $method);
+ }
+ }
+
+ $this->methods = array_merge($this->methods ?? [], $methods);
+
+ return $this;
+ }
+
+ /**
+ * Specifies the subset of methods to not mock. Default is to mock all of them.
+ *
+ * @deprecated https://github.com/sebastianbergmann/phpunit/pull/3687
+ *
+ * @throws ReflectionException
+ */
+ public function setMethodsExcept(array $methods = []): self
+ {
+ return $this->setMethods(
+ array_diff(
+ $this->generator->getClassMethods($this->type),
+ $methods
+ )
+ );
+ }
+
+ /**
+ * Specifies the arguments for the constructor.
+ *
+ * @return $this
+ */
+ public function setConstructorArgs(array $args): self
+ {
+ $this->constructorArgs = $args;
+
+ return $this;
+ }
+
+ /**
+ * Specifies the name for the mock class.
+ *
+ * @return $this
+ */
+ public function setMockClassName(string $name): self
+ {
+ $this->mockClassName = $name;
+
+ return $this;
+ }
+
+ /**
+ * Disables the invocation of the original constructor.
+ *
+ * @return $this
+ */
+ public function disableOriginalConstructor(): self
+ {
+ $this->originalConstructor = false;
+
+ return $this;
+ }
+
+ /**
+ * Enables the invocation of the original constructor.
+ *
+ * @return $this
+ */
+ public function enableOriginalConstructor(): self
+ {
+ $this->originalConstructor = true;
+
+ return $this;
+ }
+
+ /**
+ * Disables the invocation of the original clone constructor.
+ *
+ * @return $this
+ */
+ public function disableOriginalClone(): self
+ {
+ $this->originalClone = false;
+
+ return $this;
+ }
+
+ /**
+ * Enables the invocation of the original clone constructor.
+ *
+ * @return $this
+ */
+ public function enableOriginalClone(): self
+ {
+ $this->originalClone = true;
+
+ return $this;
+ }
+
+ /**
+ * Disables the use of class autoloading while creating the mock object.
+ *
+ * @return $this
+ */
+ public function disableAutoload(): self
+ {
+ $this->autoload = false;
+
+ return $this;
+ }
+
+ /**
+ * Enables the use of class autoloading while creating the mock object.
+ *
+ * @return $this
+ */
+ public function enableAutoload(): self
+ {
+ $this->autoload = true;
+
+ return $this;
+ }
+
+ /**
+ * Disables the cloning of arguments passed to mocked methods.
+ *
+ * @return $this
+ */
+ public function disableArgumentCloning(): self
+ {
+ $this->cloneArguments = false;
+
+ return $this;
+ }
+
+ /**
+ * Enables the cloning of arguments passed to mocked methods.
+ *
+ * @return $this
+ */
+ public function enableArgumentCloning(): self
+ {
+ $this->cloneArguments = true;
+
+ return $this;
+ }
+
+ /**
+ * Enables the invocation of the original methods.
+ *
+ * @return $this
+ */
+ public function enableProxyingToOriginalMethods(): self
+ {
+ $this->callOriginalMethods = true;
+
+ return $this;
+ }
+
+ /**
+ * Disables the invocation of the original methods.
+ *
+ * @return $this
+ */
+ public function disableProxyingToOriginalMethods(): self
+ {
+ $this->callOriginalMethods = false;
+ $this->proxyTarget = null;
+
+ return $this;
+ }
+
+ /**
+ * Sets the proxy target.
+ *
+ * @return $this
+ */
+ public function setProxyTarget(object $object): self
+ {
+ $this->proxyTarget = $object;
+
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function allowMockingUnknownTypes(): self
+ {
+ $this->allowMockingUnknownTypes = true;
+
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function disallowMockingUnknownTypes(): self
+ {
+ $this->allowMockingUnknownTypes = false;
+
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function enableAutoReturnValueGeneration(): self
+ {
+ $this->returnValueGeneration = true;
+
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function disableAutoReturnValueGeneration(): self
+ {
+ $this->returnValueGeneration = false;
+
+ return $this;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockClass.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockClass.php
new file mode 100644
index 000000000..253d78460
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockClass.php
@@ -0,0 +1,69 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function call_user_func;
+use function class_exists;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MockClass implements MockType
+{
+ /**
+ * @var string
+ */
+ private $classCode;
+
+ /**
+ * @var class-string
+ */
+ private $mockName;
+
+ /**
+ * @var ConfigurableMethod[]
+ */
+ private $configurableMethods;
+
+ /**
+ * @psalm-param class-string $mockName
+ */
+ public function __construct(string $classCode, string $mockName, array $configurableMethods)
+ {
+ $this->classCode = $classCode;
+ $this->mockName = $mockName;
+ $this->configurableMethods = $configurableMethods;
+ }
+
+ /**
+ * @psalm-return class-string
+ */
+ public function generate(): string
+ {
+ if (!class_exists($this->mockName, false)) {
+ eval($this->classCode);
+
+ call_user_func(
+ [
+ $this->mockName,
+ '__phpunit_initConfigurableMethods',
+ ],
+ ...$this->configurableMethods
+ );
+ }
+
+ return $this->mockName;
+ }
+
+ public function getClassCode(): string
+ {
+ return $this->classCode;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php
new file mode 100644
index 000000000..5e02cae5f
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php
@@ -0,0 +1,398 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use const DIRECTORY_SEPARATOR;
+use function implode;
+use function is_string;
+use function preg_match;
+use function preg_replace;
+use function sprintf;
+use function substr_count;
+use function trim;
+use function var_export;
+use ReflectionMethod;
+use ReflectionNamedType;
+use ReflectionParameter;
+use ReflectionUnionType;
+use SebastianBergmann\Template\Exception as TemplateException;
+use SebastianBergmann\Template\Template;
+use SebastianBergmann\Type\ReflectionMapper;
+use SebastianBergmann\Type\Type;
+use SebastianBergmann\Type\UnknownType;
+use SebastianBergmann\Type\VoidType;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MockMethod
+{
+ /**
+ * @var Template[]
+ */
+ private static $templates = [];
+
+ /**
+ * @var string
+ */
+ private $className;
+
+ /**
+ * @var string
+ */
+ private $methodName;
+
+ /**
+ * @var bool
+ */
+ private $cloneArguments;
+
+ /**
+ * @var string string
+ */
+ private $modifier;
+
+ /**
+ * @var string
+ */
+ private $argumentsForDeclaration;
+
+ /**
+ * @var string
+ */
+ private $argumentsForCall;
+
+ /**
+ * @var Type
+ */
+ private $returnType;
+
+ /**
+ * @var string
+ */
+ private $reference;
+
+ /**
+ * @var bool
+ */
+ private $callOriginalMethod;
+
+ /**
+ * @var bool
+ */
+ private $static;
+
+ /**
+ * @var ?string
+ */
+ private $deprecation;
+
+ /**
+ * @throws ReflectionException
+ * @throws RuntimeException
+ */
+ public static function fromReflection(ReflectionMethod $method, bool $callOriginalMethod, bool $cloneArguments): self
+ {
+ if ($method->isPrivate()) {
+ $modifier = 'private';
+ } elseif ($method->isProtected()) {
+ $modifier = 'protected';
+ } else {
+ $modifier = 'public';
+ }
+
+ if ($method->isStatic()) {
+ $modifier .= ' static';
+ }
+
+ if ($method->returnsReference()) {
+ $reference = '&';
+ } else {
+ $reference = '';
+ }
+
+ $docComment = $method->getDocComment();
+
+ if (is_string($docComment) &&
+ preg_match('#\*[ \t]*+@deprecated[ \t]*+(.*?)\r?+\n[ \t]*+\*(?:[ \t]*+@|/$)#s', $docComment, $deprecation)) {
+ $deprecation = trim(preg_replace('#[ \t]*\r?\n[ \t]*+\*[ \t]*+#', ' ', $deprecation[1]));
+ } else {
+ $deprecation = null;
+ }
+
+ return new self(
+ $method->getDeclaringClass()->getName(),
+ $method->getName(),
+ $cloneArguments,
+ $modifier,
+ self::getMethodParametersForDeclaration($method),
+ self::getMethodParametersForCall($method),
+ (new ReflectionMapper)->fromMethodReturnType($method),
+ $reference,
+ $callOriginalMethod,
+ $method->isStatic(),
+ $deprecation
+ );
+ }
+
+ public static function fromName(string $fullClassName, string $methodName, bool $cloneArguments): self
+ {
+ return new self(
+ $fullClassName,
+ $methodName,
+ $cloneArguments,
+ 'public',
+ '',
+ '',
+ new UnknownType,
+ '',
+ false,
+ false,
+ null
+ );
+ }
+
+ public function __construct(string $className, string $methodName, bool $cloneArguments, string $modifier, string $argumentsForDeclaration, string $argumentsForCall, Type $returnType, string $reference, bool $callOriginalMethod, bool $static, ?string $deprecation)
+ {
+ $this->className = $className;
+ $this->methodName = $methodName;
+ $this->cloneArguments = $cloneArguments;
+ $this->modifier = $modifier;
+ $this->argumentsForDeclaration = $argumentsForDeclaration;
+ $this->argumentsForCall = $argumentsForCall;
+ $this->returnType = $returnType;
+ $this->reference = $reference;
+ $this->callOriginalMethod = $callOriginalMethod;
+ $this->static = $static;
+ $this->deprecation = $deprecation;
+ }
+
+ public function getName(): string
+ {
+ return $this->methodName;
+ }
+
+ /**
+ * @throws RuntimeException
+ */
+ public function generateCode(): string
+ {
+ if ($this->static) {
+ $templateFile = 'mocked_static_method.tpl';
+ } elseif ($this->returnType instanceof VoidType) {
+ $templateFile = sprintf(
+ '%s_method_void.tpl',
+ $this->callOriginalMethod ? 'proxied' : 'mocked'
+ );
+ } else {
+ $templateFile = sprintf(
+ '%s_method.tpl',
+ $this->callOriginalMethod ? 'proxied' : 'mocked'
+ );
+ }
+
+ $deprecation = $this->deprecation;
+
+ if (null !== $this->deprecation) {
+ $deprecation = "The {$this->className}::{$this->methodName} method is deprecated ({$this->deprecation}).";
+ $deprecationTemplate = $this->getTemplate('deprecation.tpl');
+
+ $deprecationTemplate->setVar(
+ [
+ 'deprecation' => var_export($deprecation, true),
+ ]
+ );
+
+ $deprecation = $deprecationTemplate->render();
+ }
+
+ $template = $this->getTemplate($templateFile);
+
+ $template->setVar(
+ [
+ 'arguments_decl' => $this->argumentsForDeclaration,
+ 'arguments_call' => $this->argumentsForCall,
+ 'return_declaration' => !empty($this->returnType->asString()) ? (': ' . $this->returnType->asString()) : '',
+ 'return_type' => $this->returnType->asString(),
+ 'arguments_count' => !empty($this->argumentsForCall) ? substr_count($this->argumentsForCall, ',') + 1 : 0,
+ 'class_name' => $this->className,
+ 'method_name' => $this->methodName,
+ 'modifier' => $this->modifier,
+ 'reference' => $this->reference,
+ 'clone_arguments' => $this->cloneArguments ? 'true' : 'false',
+ 'deprecation' => $deprecation,
+ ]
+ );
+
+ return $template->render();
+ }
+
+ public function getReturnType(): Type
+ {
+ return $this->returnType;
+ }
+
+ /**
+ * @throws RuntimeException
+ */
+ private function getTemplate(string $template): Template
+ {
+ $filename = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR . $template;
+
+ if (!isset(self::$templates[$filename])) {
+ try {
+ self::$templates[$filename] = new Template($filename);
+ } catch (TemplateException $e) {
+ throw new RuntimeException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ }
+
+ return self::$templates[$filename];
+ }
+
+ /**
+ * Returns the parameters of a function or method.
+ *
+ * @throws RuntimeException
+ */
+ private static function getMethodParametersForDeclaration(ReflectionMethod $method): string
+ {
+ $parameters = [];
+
+ foreach ($method->getParameters() as $i => $parameter) {
+ $name = '$' . $parameter->getName();
+
+ /* Note: PHP extensions may use empty names for reference arguments
+ * or "..." for methods taking a variable number of arguments.
+ */
+ if ($name === '$' || $name === '$...') {
+ $name = '$arg' . $i;
+ }
+
+ $nullable = '';
+ $default = '';
+ $reference = '';
+ $typeDeclaration = '';
+ $type = null;
+ $typeName = null;
+
+ if ($parameter->hasType()) {
+ $type = $parameter->getType();
+
+ if ($type instanceof ReflectionNamedType) {
+ $typeName = $type->getName();
+ }
+ }
+
+ if ($parameter->isVariadic()) {
+ $name = '...' . $name;
+ } elseif ($parameter->isDefaultValueAvailable()) {
+ $default = ' = ' . self::exportDefaultValue($parameter);
+ } elseif ($parameter->isOptional()) {
+ $default = ' = null';
+ }
+
+ if ($type !== null) {
+ if ($typeName !== 'mixed' && $parameter->allowsNull() && !$type instanceof ReflectionUnionType) {
+ $nullable = '?';
+ }
+
+ if ($typeName === 'self') {
+ $typeDeclaration = $method->getDeclaringClass()->getName() . ' ';
+ } elseif ($typeName !== null) {
+ $typeDeclaration = $typeName . ' ';
+ } elseif ($type instanceof ReflectionUnionType) {
+ $typeDeclaration = self::unionTypeAsString(
+ $type,
+ $method->getDeclaringClass()->getName()
+ );
+ }
+ }
+
+ if ($parameter->isPassedByReference()) {
+ $reference = '&';
+ }
+
+ $parameters[] = $nullable . $typeDeclaration . $reference . $name . $default;
+ }
+
+ return implode(', ', $parameters);
+ }
+
+ /**
+ * Returns the parameters of a function or method.
+ *
+ * @throws ReflectionException
+ */
+ private static function getMethodParametersForCall(ReflectionMethod $method): string
+ {
+ $parameters = [];
+
+ foreach ($method->getParameters() as $i => $parameter) {
+ $name = '$' . $parameter->getName();
+
+ /* Note: PHP extensions may use empty names for reference arguments
+ * or "..." for methods taking a variable number of arguments.
+ */
+ if ($name === '$' || $name === '$...') {
+ $name = '$arg' . $i;
+ }
+
+ if ($parameter->isVariadic()) {
+ continue;
+ }
+
+ if ($parameter->isPassedByReference()) {
+ $parameters[] = '&' . $name;
+ } else {
+ $parameters[] = $name;
+ }
+ }
+
+ return implode(', ', $parameters);
+ }
+
+ /**
+ * @throws ReflectionException
+ */
+ private static function exportDefaultValue(ReflectionParameter $parameter): string
+ {
+ try {
+ return (string) var_export($parameter->getDefaultValue(), true);
+ // @codeCoverageIgnoreStart
+ } catch (\ReflectionException $e) {
+ throw new ReflectionException(
+ $e->getMessage(),
+ (int) $e->getCode(),
+ $e
+ );
+ }
+ // @codeCoverageIgnoreEnd
+ }
+
+ private static function unionTypeAsString(ReflectionUnionType $union, string $self): string
+ {
+ $types = [];
+
+ foreach ($union->getTypes() as $type) {
+ if ((string) $type === 'self') {
+ $types[] = $self;
+ } else {
+ $types[] = $type;
+ }
+ }
+
+ return implode('|', $types) . ' ';
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php
new file mode 100644
index 000000000..1c78963c0
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockMethodSet.php
@@ -0,0 +1,45 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function array_key_exists;
+use function array_values;
+use function strtolower;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MockMethodSet
+{
+ /**
+ * @var MockMethod[]
+ */
+ private $methods = [];
+
+ public function addMethods(MockMethod ...$methods): void
+ {
+ foreach ($methods as $method) {
+ $this->methods[strtolower($method->getName())] = $method;
+ }
+ }
+
+ /**
+ * @return MockMethod[]
+ */
+ public function asArray(): array
+ {
+ return array_values($this->methods);
+ }
+
+ public function hasMethod(string $methodName): bool
+ {
+ return array_key_exists(strtolower($methodName), $this->methods);
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php
new file mode 100644
index 000000000..094decf43
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockObject.php
@@ -0,0 +1,27 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use PHPUnit\Framework\MockObject\Builder\InvocationMocker as BuilderInvocationMocker;
+use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
+
+/**
+ * @method BuilderInvocationMocker method($constraint)
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ */
+interface MockObject extends Stub
+{
+ public function __phpunit_setOriginalObject($originalObject): void;
+
+ public function __phpunit_verify(bool $unsetInvocationMocker = true): void;
+
+ public function expects(InvocationOrder $invocationRule): BuilderInvocationMocker;
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockTrait.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockTrait.php
new file mode 100644
index 000000000..7c326988f
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockTrait.php
@@ -0,0 +1,54 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use function class_exists;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MockTrait implements MockType
+{
+ /**
+ * @var string
+ */
+ private $classCode;
+
+ /**
+ * @var class-string
+ */
+ private $mockName;
+
+ /**
+ * @psalm-param class-string $mockName
+ */
+ public function __construct(string $classCode, string $mockName)
+ {
+ $this->classCode = $classCode;
+ $this->mockName = $mockName;
+ }
+
+ /**
+ * @psalm-return class-string
+ */
+ public function generate(): string
+ {
+ if (!class_exists($this->mockName, false)) {
+ eval($this->classCode);
+ }
+
+ return $this->mockName;
+ }
+
+ public function getClassCode(): string
+ {
+ return $this->classCode;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/MockType.php b/vendor/phpunit/phpunit/src/Framework/MockObject/MockType.php
new file mode 100644
index 000000000..6a03fb51a
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/MockType.php
@@ -0,0 +1,21 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface MockType
+{
+ /**
+ * @psalm-return class-string
+ */
+ public function generate(): string;
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyInvokedCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyInvokedCount.php
new file mode 100644
index 000000000..f93e5686b
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyInvokedCount.php
@@ -0,0 +1,36 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class AnyInvokedCount extends InvocationOrder
+{
+ public function toString(): string
+ {
+ return 'invoked zero or more times';
+ }
+
+ public function verify(): void
+ {
+ }
+
+ public function matches(BaseInvocation $invocation): bool
+ {
+ return true;
+ }
+
+ protected function invokedDo(BaseInvocation $invocation): void
+ {
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyParameters.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyParameters.php
new file mode 100644
index 000000000..61de78878
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/AnyParameters.php
@@ -0,0 +1,31 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class AnyParameters implements ParametersRule
+{
+ public function toString(): string
+ {
+ return 'with any parameters';
+ }
+
+ public function apply(BaseInvocation $invocation): void
+ {
+ }
+
+ public function verify(): void
+ {
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ConsecutiveParameters.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ConsecutiveParameters.php
new file mode 100644
index 000000000..6025c0a16
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ConsecutiveParameters.php
@@ -0,0 +1,130 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use function count;
+use function gettype;
+use function is_iterable;
+use function sprintf;
+use PHPUnit\Framework\Constraint\Constraint;
+use PHPUnit\Framework\Constraint\IsEqual;
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\InvalidParameterGroupException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ConsecutiveParameters implements ParametersRule
+{
+ /**
+ * @var array
+ */
+ private $parameterGroups = [];
+
+ /**
+ * @var array
+ */
+ private $invocations = [];
+
+ /**
+ * @throws \PHPUnit\Framework\Exception
+ */
+ public function __construct(array $parameterGroups)
+ {
+ foreach ($parameterGroups as $index => $parameters) {
+ if (!is_iterable($parameters)) {
+ throw new InvalidParameterGroupException(
+ sprintf(
+ 'Parameter group #%d must be an array or Traversable, got %s',
+ $index,
+ gettype($parameters)
+ )
+ );
+ }
+
+ foreach ($parameters as $parameter) {
+ if (!$parameter instanceof Constraint) {
+ $parameter = new IsEqual($parameter);
+ }
+
+ $this->parameterGroups[$index][] = $parameter;
+ }
+ }
+ }
+
+ public function toString(): string
+ {
+ return 'with consecutive parameters';
+ }
+
+ /**
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ * @throws ExpectationFailedException
+ */
+ public function apply(BaseInvocation $invocation): void
+ {
+ $this->invocations[] = $invocation;
+ $callIndex = count($this->invocations) - 1;
+
+ $this->verifyInvocation($invocation, $callIndex);
+ }
+
+ /**
+ * @throws \PHPUnit\Framework\ExpectationFailedException
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ */
+ public function verify(): void
+ {
+ foreach ($this->invocations as $callIndex => $invocation) {
+ $this->verifyInvocation($invocation, $callIndex);
+ }
+ }
+
+ /**
+ * Verify a single invocation.
+ *
+ * @param int $callIndex
+ *
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ * @throws ExpectationFailedException
+ */
+ private function verifyInvocation(BaseInvocation $invocation, $callIndex): void
+ {
+ if (!isset($this->parameterGroups[$callIndex])) {
+ // no parameter assertion for this call index
+ return;
+ }
+
+ $parameters = $this->parameterGroups[$callIndex];
+
+ if (count($invocation->getParameters()) < count($parameters)) {
+ throw new ExpectationFailedException(
+ sprintf(
+ 'Parameter count for invocation %s is too low.',
+ $invocation->toString()
+ )
+ );
+ }
+
+ foreach ($parameters as $i => $parameter) {
+ $parameter->evaluate(
+ $invocation->getParameters()[$i],
+ sprintf(
+ 'Parameter %s for invocation #%d %s does not match expected ' .
+ 'value.',
+ $i,
+ $callIndex,
+ $invocation->toString()
+ )
+ );
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvocationOrder.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvocationOrder.php
new file mode 100644
index 000000000..90aa49350
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvocationOrder.php
@@ -0,0 +1,47 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use function count;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+use PHPUnit\Framework\MockObject\Verifiable;
+use PHPUnit\Framework\SelfDescribing;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+abstract class InvocationOrder implements SelfDescribing, Verifiable
+{
+ /**
+ * @var BaseInvocation[]
+ */
+ private $invocations = [];
+
+ public function getInvocationCount(): int
+ {
+ return count($this->invocations);
+ }
+
+ public function hasBeenInvoked(): bool
+ {
+ return count($this->invocations) > 0;
+ }
+
+ final public function invoked(BaseInvocation $invocation)
+ {
+ $this->invocations[] = $invocation;
+
+ return $this->invokedDo($invocation);
+ }
+
+ abstract public function matches(BaseInvocation $invocation): bool;
+
+ abstract protected function invokedDo(BaseInvocation $invocation);
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtIndex.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtIndex.php
new file mode 100644
index 000000000..2a6625e2f
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtIndex.php
@@ -0,0 +1,75 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use function sprintf;
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ *
+ * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4297
+ * @codeCoverageIgnore
+ */
+final class InvokedAtIndex extends InvocationOrder
+{
+ /**
+ * @var int
+ */
+ private $sequenceIndex;
+
+ /**
+ * @var int
+ */
+ private $currentIndex = -1;
+
+ /**
+ * @param int $sequenceIndex
+ */
+ public function __construct($sequenceIndex)
+ {
+ $this->sequenceIndex = $sequenceIndex;
+ }
+
+ public function toString(): string
+ {
+ return 'invoked at sequence index ' . $this->sequenceIndex;
+ }
+
+ public function matches(BaseInvocation $invocation): bool
+ {
+ $this->currentIndex++;
+
+ return $this->currentIndex == $this->sequenceIndex;
+ }
+
+ /**
+ * Verifies that the current expectation is valid. If everything is OK the
+ * code should just return, if not it must throw an exception.
+ *
+ * @throws ExpectationFailedException
+ */
+ public function verify(): void
+ {
+ if ($this->currentIndex < $this->sequenceIndex) {
+ throw new ExpectationFailedException(
+ sprintf(
+ 'The expected invocation at index %s was never reached.',
+ $this->sequenceIndex
+ )
+ );
+ }
+ }
+
+ protected function invokedDo(BaseInvocation $invocation): void
+ {
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastCount.php
new file mode 100644
index 000000000..a84aa6559
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastCount.php
@@ -0,0 +1,64 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class InvokedAtLeastCount extends InvocationOrder
+{
+ /**
+ * @var int
+ */
+ private $requiredInvocations;
+
+ /**
+ * @param int $requiredInvocations
+ */
+ public function __construct($requiredInvocations)
+ {
+ $this->requiredInvocations = $requiredInvocations;
+ }
+
+ public function toString(): string
+ {
+ return 'invoked at least ' . $this->requiredInvocations . ' times';
+ }
+
+ /**
+ * Verifies that the current expectation is valid. If everything is OK the
+ * code should just return, if not it must throw an exception.
+ *
+ * @throws ExpectationFailedException
+ */
+ public function verify(): void
+ {
+ $count = $this->getInvocationCount();
+
+ if ($count < $this->requiredInvocations) {
+ throw new ExpectationFailedException(
+ 'Expected invocation at least ' . $this->requiredInvocations .
+ ' times but it occurred ' . $count . ' time(s).'
+ );
+ }
+ }
+
+ public function matches(BaseInvocation $invocation): bool
+ {
+ return true;
+ }
+
+ protected function invokedDo(BaseInvocation $invocation): void
+ {
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastOnce.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastOnce.php
new file mode 100644
index 000000000..d0ad1f801
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtLeastOnce.php
@@ -0,0 +1,50 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class InvokedAtLeastOnce extends InvocationOrder
+{
+ public function toString(): string
+ {
+ return 'invoked at least once';
+ }
+
+ /**
+ * Verifies that the current expectation is valid. If everything is OK the
+ * code should just return, if not it must throw an exception.
+ *
+ * @throws ExpectationFailedException
+ */
+ public function verify(): void
+ {
+ $count = $this->getInvocationCount();
+
+ if ($count < 1) {
+ throw new ExpectationFailedException(
+ 'Expected invocation at least once but it never occurred.'
+ );
+ }
+ }
+
+ public function matches(BaseInvocation $invocation): bool
+ {
+ return true;
+ }
+
+ protected function invokedDo(BaseInvocation $invocation): void
+ {
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtMostCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtMostCount.php
new file mode 100644
index 000000000..c3b815aa4
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedAtMostCount.php
@@ -0,0 +1,64 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class InvokedAtMostCount extends InvocationOrder
+{
+ /**
+ * @var int
+ */
+ private $allowedInvocations;
+
+ /**
+ * @param int $allowedInvocations
+ */
+ public function __construct($allowedInvocations)
+ {
+ $this->allowedInvocations = $allowedInvocations;
+ }
+
+ public function toString(): string
+ {
+ return 'invoked at most ' . $this->allowedInvocations . ' times';
+ }
+
+ /**
+ * Verifies that the current expectation is valid. If everything is OK the
+ * code should just return, if not it must throw an exception.
+ *
+ * @throws ExpectationFailedException
+ */
+ public function verify(): void
+ {
+ $count = $this->getInvocationCount();
+
+ if ($count > $this->allowedInvocations) {
+ throw new ExpectationFailedException(
+ 'Expected invocation at most ' . $this->allowedInvocations .
+ ' times but it occurred ' . $count . ' time(s).'
+ );
+ }
+ }
+
+ public function matches(BaseInvocation $invocation): bool
+ {
+ return true;
+ }
+
+ protected function invokedDo(BaseInvocation $invocation): void
+ {
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedCount.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedCount.php
new file mode 100644
index 000000000..188326c91
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/InvokedCount.php
@@ -0,0 +1,102 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use function sprintf;
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class InvokedCount extends InvocationOrder
+{
+ /**
+ * @var int
+ */
+ private $expectedCount;
+
+ /**
+ * @param int $expectedCount
+ */
+ public function __construct($expectedCount)
+ {
+ $this->expectedCount = $expectedCount;
+ }
+
+ public function isNever(): bool
+ {
+ return $this->expectedCount === 0;
+ }
+
+ public function toString(): string
+ {
+ return 'invoked ' . $this->expectedCount . ' time(s)';
+ }
+
+ public function matches(BaseInvocation $invocation): bool
+ {
+ return true;
+ }
+
+ /**
+ * Verifies that the current expectation is valid. If everything is OK the
+ * code should just return, if not it must throw an exception.
+ *
+ * @throws ExpectationFailedException
+ */
+ public function verify(): void
+ {
+ $count = $this->getInvocationCount();
+
+ if ($count !== $this->expectedCount) {
+ throw new ExpectationFailedException(
+ sprintf(
+ 'Method was expected to be called %d times, ' .
+ 'actually called %d times.',
+ $this->expectedCount,
+ $count
+ )
+ );
+ }
+ }
+
+ /**
+ * @throws ExpectationFailedException
+ */
+ protected function invokedDo(BaseInvocation $invocation): void
+ {
+ $count = $this->getInvocationCount();
+
+ if ($count > $this->expectedCount) {
+ $message = $invocation->toString() . ' ';
+
+ switch ($this->expectedCount) {
+ case 0:
+ $message .= 'was not expected to be called.';
+
+ break;
+
+ case 1:
+ $message .= 'was not expected to be called more than once.';
+
+ break;
+
+ default:
+ $message .= sprintf(
+ 'was not expected to be called more than %d times.',
+ $this->expectedCount
+ );
+ }
+
+ throw new ExpectationFailedException($message);
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/MethodName.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/MethodName.php
new file mode 100644
index 000000000..83ba3b8da
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/MethodName.php
@@ -0,0 +1,68 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use function is_string;
+use PHPUnit\Framework\Constraint\Constraint;
+use PHPUnit\Framework\InvalidArgumentException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+use PHPUnit\Framework\MockObject\MethodNameConstraint;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class MethodName
+{
+ /**
+ * @var Constraint
+ */
+ private $constraint;
+
+ /**
+ * @param Constraint|string $constraint
+ *
+ * @throws InvalidArgumentException
+ */
+ public function __construct($constraint)
+ {
+ if (is_string($constraint)) {
+ $constraint = new MethodNameConstraint($constraint);
+ }
+
+ if (!$constraint instanceof Constraint) {
+ throw InvalidArgumentException::create(1, 'PHPUnit\Framework\Constraint\Constraint object or string');
+ }
+
+ $this->constraint = $constraint;
+ }
+
+ public function toString(): string
+ {
+ return 'method name ' . $this->constraint->toString();
+ }
+
+ /**
+ * @throws \PHPUnit\Framework\ExpectationFailedException
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ */
+ public function matches(BaseInvocation $invocation): bool
+ {
+ return $this->matchesName($invocation->getMethodName());
+ }
+
+ /**
+ * @throws \PHPUnit\Framework\ExpectationFailedException
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ */
+ public function matchesName(string $methodName): bool
+ {
+ return (bool) $this->constraint->evaluate($methodName, '', true);
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/Parameters.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/Parameters.php
new file mode 100644
index 000000000..3f1cc53ae
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/Parameters.php
@@ -0,0 +1,160 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use function count;
+use function get_class;
+use function sprintf;
+use Exception;
+use PHPUnit\Framework\Constraint\Constraint;
+use PHPUnit\Framework\Constraint\IsAnything;
+use PHPUnit\Framework\Constraint\IsEqual;
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class Parameters implements ParametersRule
+{
+ /**
+ * @var Constraint[]
+ */
+ private $parameters = [];
+
+ /**
+ * @var BaseInvocation
+ */
+ private $invocation;
+
+ /**
+ * @var bool|ExpectationFailedException
+ */
+ private $parameterVerificationResult;
+
+ /**
+ * @throws \PHPUnit\Framework\Exception
+ */
+ public function __construct(array $parameters)
+ {
+ foreach ($parameters as $parameter) {
+ if (!($parameter instanceof Constraint)) {
+ $parameter = new IsEqual(
+ $parameter
+ );
+ }
+
+ $this->parameters[] = $parameter;
+ }
+ }
+
+ public function toString(): string
+ {
+ $text = 'with parameter';
+
+ foreach ($this->parameters as $index => $parameter) {
+ if ($index > 0) {
+ $text .= ' and';
+ }
+
+ $text .= ' ' . $index . ' ' . $parameter->toString();
+ }
+
+ return $text;
+ }
+
+ /**
+ * @throws Exception
+ */
+ public function apply(BaseInvocation $invocation): void
+ {
+ $this->invocation = $invocation;
+ $this->parameterVerificationResult = null;
+
+ try {
+ $this->parameterVerificationResult = $this->doVerify();
+ } catch (ExpectationFailedException $e) {
+ $this->parameterVerificationResult = $e;
+
+ throw $this->parameterVerificationResult;
+ }
+ }
+
+ /**
+ * Checks if the invocation $invocation matches the current rules. If it
+ * does the rule will get the invoked() method called which should check
+ * if an expectation is met.
+ *
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ * @throws ExpectationFailedException
+ */
+ public function verify(): void
+ {
+ $this->doVerify();
+ }
+
+ /**
+ * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
+ * @throws ExpectationFailedException
+ */
+ private function doVerify(): bool
+ {
+ if (isset($this->parameterVerificationResult)) {
+ return $this->guardAgainstDuplicateEvaluationOfParameterConstraints();
+ }
+
+ if ($this->invocation === null) {
+ throw new ExpectationFailedException('Mocked method does not exist.');
+ }
+
+ if (count($this->invocation->getParameters()) < count($this->parameters)) {
+ $message = 'Parameter count for invocation %s is too low.';
+
+ // The user called `->with($this->anything())`, but may have meant
+ // `->withAnyParameters()`.
+ //
+ // @see https://github.com/sebastianbergmann/phpunit-mock-objects/issues/199
+ if (count($this->parameters) === 1 &&
+ get_class($this->parameters[0]) === IsAnything::class) {
+ $message .= "\nTo allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead.";
+ }
+
+ throw new ExpectationFailedException(
+ sprintf($message, $this->invocation->toString())
+ );
+ }
+
+ foreach ($this->parameters as $i => $parameter) {
+ $parameter->evaluate(
+ $this->invocation->getParameters()[$i],
+ sprintf(
+ 'Parameter %s for invocation %s does not match expected ' .
+ 'value.',
+ $i,
+ $this->invocation->toString()
+ )
+ );
+ }
+
+ return true;
+ }
+
+ /**
+ * @throws ExpectationFailedException
+ */
+ private function guardAgainstDuplicateEvaluationOfParameterConstraints(): bool
+ {
+ if ($this->parameterVerificationResult instanceof ExpectationFailedException) {
+ throw $this->parameterVerificationResult;
+ }
+
+ return (bool) $this->parameterVerificationResult;
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ParametersRule.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ParametersRule.php
new file mode 100644
index 000000000..70c47fe32
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Rule/ParametersRule.php
@@ -0,0 +1,28 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Rule;
+
+use PHPUnit\Framework\ExpectationFailedException;
+use PHPUnit\Framework\MockObject\Invocation as BaseInvocation;
+use PHPUnit\Framework\MockObject\Verifiable;
+use PHPUnit\Framework\SelfDescribing;
+
+/**
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ */
+interface ParametersRule extends SelfDescribing, Verifiable
+{
+ /**
+ * @throws ExpectationFailedException if the invocation violates the rule
+ */
+ public function apply(BaseInvocation $invocation): void;
+
+ public function verify(): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php
new file mode 100644
index 000000000..2b032e2dc
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub.php
@@ -0,0 +1,26 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use PHPUnit\Framework\MockObject\Builder\InvocationStubber;
+
+/**
+ * @method InvocationStubber method($constraint)
+ *
+ * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
+ */
+interface Stub
+{
+ public function __phpunit_getInvocationHandler(): InvocationHandler;
+
+ public function __phpunit_hasMatchers(): bool;
+
+ public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration): void;
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php
new file mode 100644
index 000000000..0dcf386b3
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ConsecutiveCalls.php
@@ -0,0 +1,57 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use function array_shift;
+use function sprintf;
+use PHPUnit\Framework\MockObject\Invocation;
+use SebastianBergmann\Exporter\Exporter;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ConsecutiveCalls implements Stub
+{
+ /**
+ * @var array
+ */
+ private $stack;
+
+ /**
+ * @var mixed
+ */
+ private $value;
+
+ public function __construct(array $stack)
+ {
+ $this->stack = $stack;
+ }
+
+ public function invoke(Invocation $invocation)
+ {
+ $this->value = array_shift($this->stack);
+
+ if ($this->value instanceof Stub) {
+ $this->value = $this->value->invoke($invocation);
+ }
+
+ return $this->value;
+ }
+
+ public function toString(): string
+ {
+ $exporter = new Exporter;
+
+ return sprintf(
+ 'return user-specified value %s',
+ $exporter->export($this->value)
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php
new file mode 100644
index 000000000..5d64c96a5
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Exception.php
@@ -0,0 +1,46 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use function sprintf;
+use PHPUnit\Framework\MockObject\Invocation;
+use SebastianBergmann\Exporter\Exporter;
+use Throwable;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class Exception implements Stub
+{
+ private $exception;
+
+ public function __construct(Throwable $exception)
+ {
+ $this->exception = $exception;
+ }
+
+ /**
+ * @throws Throwable
+ */
+ public function invoke(Invocation $invocation): void
+ {
+ throw $this->exception;
+ }
+
+ public function toString(): string
+ {
+ $exporter = new Exporter;
+
+ return sprintf(
+ 'raise user-specified exception %s',
+ $exporter->export($this->exception)
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php
new file mode 100644
index 000000000..c7b3f8f41
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnArgument.php
@@ -0,0 +1,41 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use function sprintf;
+use PHPUnit\Framework\MockObject\Invocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReturnArgument implements Stub
+{
+ /**
+ * @var int
+ */
+ private $argumentIndex;
+
+ public function __construct($argumentIndex)
+ {
+ $this->argumentIndex = $argumentIndex;
+ }
+
+ public function invoke(Invocation $invocation)
+ {
+ if (isset($invocation->getParameters()[$this->argumentIndex])) {
+ return $invocation->getParameters()[$this->argumentIndex];
+ }
+ }
+
+ public function toString(): string
+ {
+ return sprintf('return argument #%d', $this->argumentIndex);
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php
new file mode 100644
index 000000000..e02181e90
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnCallback.php
@@ -0,0 +1,59 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use function call_user_func_array;
+use function get_class;
+use function is_array;
+use function is_object;
+use function sprintf;
+use PHPUnit\Framework\MockObject\Invocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReturnCallback implements Stub
+{
+ private $callback;
+
+ public function __construct($callback)
+ {
+ $this->callback = $callback;
+ }
+
+ public function invoke(Invocation $invocation)
+ {
+ return call_user_func_array($this->callback, $invocation->getParameters());
+ }
+
+ public function toString(): string
+ {
+ if (is_array($this->callback)) {
+ if (is_object($this->callback[0])) {
+ $class = get_class($this->callback[0]);
+ $type = '->';
+ } else {
+ $class = $this->callback[0];
+ $type = '::';
+ }
+
+ return sprintf(
+ 'return result of user defined callback %s%s%s() with the ' .
+ 'passed arguments',
+ $class,
+ $type,
+ $this->callback[1]
+ );
+ }
+
+ return 'return result of user defined callback ' . $this->callback .
+ ' with the passed arguments';
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php
new file mode 100644
index 000000000..0d288cebe
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnReference.php
@@ -0,0 +1,45 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use function sprintf;
+use PHPUnit\Framework\MockObject\Invocation;
+use SebastianBergmann\Exporter\Exporter;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReturnReference implements Stub
+{
+ /**
+ * @var mixed
+ */
+ private $reference;
+
+ public function __construct(&$reference)
+ {
+ $this->reference = &$reference;
+ }
+
+ public function invoke(Invocation $invocation)
+ {
+ return $this->reference;
+ }
+
+ public function toString(): string
+ {
+ $exporter = new Exporter;
+
+ return sprintf(
+ 'return user-specified reference %s',
+ $exporter->export($this->reference)
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php
new file mode 100644
index 000000000..6d2137bfb
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnSelf.php
@@ -0,0 +1,32 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use PHPUnit\Framework\MockObject\Invocation;
+use PHPUnit\Framework\MockObject\RuntimeException;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReturnSelf implements Stub
+{
+ /**
+ * @throws RuntimeException
+ */
+ public function invoke(Invocation $invocation)
+ {
+ return $invocation->getObject();
+ }
+
+ public function toString(): string
+ {
+ return 'return the current object';
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php
new file mode 100644
index 000000000..fbcd0a07a
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnStub.php
@@ -0,0 +1,45 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use function sprintf;
+use PHPUnit\Framework\MockObject\Invocation;
+use SebastianBergmann\Exporter\Exporter;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReturnStub implements Stub
+{
+ /**
+ * @var mixed
+ */
+ private $value;
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+
+ public function invoke(Invocation $invocation)
+ {
+ return $this->value;
+ }
+
+ public function toString(): string
+ {
+ $exporter = new Exporter;
+
+ return sprintf(
+ 'return user-specified value %s',
+ $exporter->export($this->value)
+ );
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php
new file mode 100644
index 000000000..5fcd3a09a
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/ReturnValueMap.php
@@ -0,0 +1,53 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use function array_pop;
+use function count;
+use function is_array;
+use PHPUnit\Framework\MockObject\Invocation;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+final class ReturnValueMap implements Stub
+{
+ /**
+ * @var array
+ */
+ private $valueMap;
+
+ public function __construct(array $valueMap)
+ {
+ $this->valueMap = $valueMap;
+ }
+
+ public function invoke(Invocation $invocation)
+ {
+ $parameterCount = count($invocation->getParameters());
+
+ foreach ($this->valueMap as $map) {
+ if (!is_array($map) || $parameterCount !== (count($map) - 1)) {
+ continue;
+ }
+
+ $return = array_pop($map);
+
+ if ($invocation->getParameters() === $map) {
+ return $return;
+ }
+ }
+ }
+
+ public function toString(): string
+ {
+ return 'return value from a map';
+ }
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Stub.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Stub.php
new file mode 100644
index 000000000..15cfce5c3
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Stub/Stub.php
@@ -0,0 +1,27 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject\Stub;
+
+use PHPUnit\Framework\MockObject\Invocation;
+use PHPUnit\Framework\SelfDescribing;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface Stub extends SelfDescribing
+{
+ /**
+ * Fakes the processing of the invocation $invocation by returning a
+ * specific value.
+ *
+ * @param Invocation $invocation The invocation which was mocked and matched by the current method and argument matchers
+ */
+ public function invoke(Invocation $invocation);
+}
diff --git a/vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php b/vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php
new file mode 100644
index 000000000..8c9a82c5a
--- /dev/null
+++ b/vendor/phpunit/phpunit/src/Framework/MockObject/Verifiable.php
@@ -0,0 +1,26 @@
+<?php declare(strict_types=1);
+/*
+ * This file is part of PHPUnit.
+ *
+ * (c) Sebastian Bergmann <[email protected]>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+namespace PHPUnit\Framework\MockObject;
+
+use PHPUnit\Framework\ExpectationFailedException;
+
+/**
+ * @internal This class is not covered by the backward compatibility promise for PHPUnit
+ */
+interface Verifiable
+{
+ /**
+ * Verifies that the current expectation is valid. If everything is OK the
+ * code should just return, if not it must throw an exception.
+ *
+ * @throws ExpectationFailedException
+ */
+ public function verify(): void;
+}