Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Remove unused Arguments methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Apr 11, 2023
1 parent 6401ea3 commit 48f3f4c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 65 deletions.
28 changes: 0 additions & 28 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7245,8 +7245,6 @@ When [verifying that a spy was called with specific arguments], or
methods:

- [`$arguments->all()`](#arguments.all)
- [`$arguments->positional()`](#arguments.positional)
- [`$arguments->named()`](#arguments.named)
- [`count($arguments)`](#arguments.count)
- [`$arguments->count()`](#arguments.count)
- [`foreach ($arguments as $positionOrName => $argument)`](#arguments.implements.Traversable)
Expand Down Expand Up @@ -7278,32 +7276,6 @@ _Arguments passed by reference will be references in the returned array._
_See [Verifying that a spy was called with specific arguments],
[Verifying that a call was made with specific arguments]._

<a name="arguments.positional" />

---

> _array\<int,mixed>_ $arguments->[**positional**](#arguments.positional)()
Get the positional arguments as an array.

_Arguments passed by reference will be references in the returned array._

_See [Verifying that a spy was called with specific arguments],
[Verifying that a call was made with specific arguments]._

<a name="arguments.named" />

---

> _array\<string,mixed>_ $arguments->[**named**](#arguments.named)()
Get the named arguments as an array.

_Arguments passed by reference will be references in the returned array._

_See [Verifying that a spy was called with specific arguments],
[Verifying that a call was made with specific arguments]._

<a name="arguments.count" />

---
Expand Down
36 changes: 1 addition & 35 deletions src/Call/Arguments.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public static function create(...$arguments): self
*/
public function __construct(array $arguments)
{
$this->arguments = $arguments;
$this->count = count($arguments);
$this->positionalCount = 0;
$this->positional = [];
$this->named = [];

$firstPositionOrName = 0;
Expand All @@ -59,15 +59,10 @@ public function __construct(array $arguments)
$this->named[$positionOrName] = &$value;
} else {
++$this->positionalCount;
$this->positional[] = &$value;
}
}

$this->firstPositionOrName = $firstPositionOrName;

// do not move this above other assignments
// PHP does extremely weird things with references if you do
$this->arguments = $arguments;
}

/**
Expand Down Expand Up @@ -98,30 +93,6 @@ public function all(): array
return $this->arguments;
}

/**
* Get the positional arguments.
*
* This method supports reference parameters.
*
* @return array<int,mixed> The positional arguments.
*/
public function positional(): array
{
return $this->positional;
}

/**
* Get the named arguments.
*
* This method supports reference parameters.
*
* @return array<string,mixed> The named arguments.
*/
public function named(): array
{
return $this->named;
}

/**
* Set an argument by position or name.
*
Expand Down Expand Up @@ -268,11 +239,6 @@ public function getIterator(): Iterator
*/
private $arguments;

/**
* @var array<int,mixed>
*/
private $positional;

/**
* @var array<string,mixed>
*/
Expand Down
2 changes: 0 additions & 2 deletions test/suite/Call/ArgumentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ protected function setUp(): void
public function testConstructor()
{
$this->assertSame($this->arguments, $this->subject->all());
$this->assertSame([&$this->a, &$this->b], $this->subject->positional());
$this->assertSame(['c' => &$this->c], $this->subject->named());
$this->assertSame($this->arguments, iterator_to_array($this->subject));
$this->assertCount(3, $this->subject);
}
Expand Down

0 comments on commit 48f3f4c

Please sign in to comment.