Skip to content

Commit ff06ba4

Browse files
committed
rename get/setMicroseconds() to get/setMicrosecond()
1 parent 1246890 commit ff06ba4

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/Symfony/Component/Clock/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CHANGELOG
44
7.1
55
---
66

7-
* Add `DatePoint::get/setMicroseconds()`
7+
* Add `DatePoint::get/setMicrosecond()`
88

99
6.4
1010
---

src/Symfony/Component/Clock/DatePoint.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,23 @@ public function getTimezone(): \DateTimeZone
118118
return parent::getTimezone() ?: throw new \DateInvalidTimeZoneException('The DatePoint object has no timezone.');
119119
}
120120

121-
public function setMicroseconds(int $microseconds): static
121+
public function setMicrosecond(int $microsecond): static
122122
{
123-
if ($microseconds < 0 || $microseconds > 999999) {
124-
throw new \DateRangeError('DatePoint::setMicroseconds(): Argument #1 ($microseconds) must be between 0 and 999999, '.$microseconds.' given');
123+
if ($microsecond < 0 || $microsecond > 999999) {
124+
throw new \DateRangeError('DatePoint::setMicrosecond(): Argument #1 ($microsecond) must be between 0 and 999999, '.$microsecond.' given');
125125
}
126126

127127
if (\PHP_VERSION_ID < 80400) {
128-
return $this->setTime(...explode('.', $this->format('H.i.s.'.$microseconds)));
128+
return $this->setTime(...explode('.', $this->format('H.i.s.'.$microsecond)));
129129
}
130130

131-
return parent::setMicroseconds($microseconds);
131+
return parent::setMicrosecond($microsecond);
132132
}
133133

134-
public function getMicroseconds(): int
134+
public function getMicrosecond(): int
135135
{
136136
if (\PHP_VERSION_ID >= 80400) {
137-
return parent::getMicroseconds();
137+
return parent::getMicrosecond();
138138
}
139139

140140
return $this->format('u');

src/Symfony/Component/Clock/Tests/DatePointTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ public function testModify()
5858
$date->modify('Bad Date');
5959
}
6060

61-
public function testMicroseconds()
61+
public function testMicrosecond()
6262
{
6363
$date = new DatePoint('2010-01-28 15:00:00.123456');
6464

6565
$this->assertSame('2010-01-28 15:00:00.123456', $date->format('Y-m-d H:i:s.u'));
6666

67-
$date = $date->setMicroseconds(789);
67+
$date = $date->setMicrosecond(789);
6868

6969
$this->assertSame('2010-01-28 15:00:00.000789', $date->format('Y-m-d H:i:s.u'));
70-
$this->assertSame(789, $date->getMicroseconds());
70+
$this->assertSame(789, $date->getMicrosecond());
7171

7272
$this->expectException(\DateRangeError::class);
73-
$this->expectExceptionMessage('DatePoint::setMicroseconds(): Argument #1 ($microseconds) must be between 0 and 999999, 1000000 given');
74-
$date->setMicroseconds(1000000);
73+
$this->expectExceptionMessage('DatePoint::setMicrosecond(): Argument #1 ($microsecond) must be between 0 and 999999, 1000000 given');
74+
$date->setMicrosecond(1000000);
7575
}
7676
}

0 commit comments

Comments
 (0)