diff --git a/PhpUnit/DefinitionHasArgumentConstraint.php b/PhpUnit/DefinitionHasArgumentConstraint.php index 5e58d68..8f8bbf4 100644 --- a/PhpUnit/DefinitionHasArgumentConstraint.php +++ b/PhpUnit/DefinitionHasArgumentConstraint.php @@ -16,7 +16,6 @@ final class DefinitionHasArgumentConstraint extends Constraint private string|int $argumentIndex; private mixed $expectedValue; private bool $checkExpectedValue; - private Exporter $exporter; public function __construct($argumentIndex, $expectedValue, bool $checkExpectedValue = true) { @@ -39,7 +38,6 @@ public function __construct($argumentIndex, $expectedValue, bool $checkExpectedV $this->argumentIndex = $argumentIndex; $this->expectedValue = $expectedValue; $this->checkExpectedValue = $checkExpectedValue; - $this->exporter = new Exporter(); } public function toString(): string @@ -107,8 +105,8 @@ private function evaluateArgumentValue(Definition $definition, bool $returnResul sprintf( 'The value of argument named "%s" (%s) is not equal to the expected value (%s)', $this->argumentIndex, - $this->exporter->export($actualValue), - $this->exporter->export($this->expectedValue) + $this->exporter()->export($actualValue), + $this->exporter()->export($this->expectedValue) ) ); } @@ -124,15 +122,15 @@ private function evaluateArgumentValue(Definition $definition, bool $returnResul $message = sprintf( 'The value of argument named "%s" (%s) is not equal to the expected value (%s)', $this->argumentIndex, - $this->exporter->export($actualValue), - $this->exporter->export($this->expectedValue) + $this->exporter()->export($actualValue), + $this->exporter()->export($this->expectedValue) ); } else { $message = sprintf( 'The value of argument with index %d (%s) is not equal to the expected value (%s)', $this->argumentIndex, - $this->exporter->export($actualValue), - $this->exporter->export($this->expectedValue) + $this->exporter()->export($actualValue), + $this->exporter()->export($this->expectedValue) ); }