Skip to content

Commit 105acf6

Browse files
committed
minor #71 remove deprecated methods (xabbuh)
This PR was merged into the 3.0.x-dev branch. Discussion ---------- remove deprecated methods Commits ------- 19b7120 remove deprecated methods
2 parents ee41a76 + 19b7120 commit 105acf6

File tree

5 files changed

+8
-76
lines changed

5 files changed

+8
-76
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ CHANGELOG
44
3.0.0
55
-----
66

7+
* The `Statement::getTimestamp()` method has been removed. Use
8+
`Statement::getCreated()` instead.
9+
* The `Statement::withTimestamp()` method has been removed. Use
10+
`Statement::withCreated()` instead.
11+
* The `SubStatement::getTimestamp()` method has been removed. Use
12+
`SubStatement::getCreated()` instead.
13+
* The `SubStatement::withTimestamp()` method has been removed. Use
14+
`SubStatement::withCreated()` instead.
715
* Dropped support for PHP < 7.1 as well as HHVM.
816
* The `Object` class was renamed to `StatementObject` for compatibility with PHP
917
7.2.

spec/StatementSpec.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,6 @@ public function it_returns_a_new_instance_with_authority()
188188
$statement->getAuthority()->shouldReturn($authority);
189189
}
190190

191-
public function it_returns_a_new_instance_with_timestamp()
192-
{
193-
$timestamp = new \DateTime('2014-07-23T12:34:02-05:00');
194-
$statement = $this->withTimestamp($timestamp);
195-
196-
$statement->shouldNotBe($this);
197-
$statement->shouldBeAnInstanceOf('\Xabbuh\XApi\Model\Statement');
198-
$statement->getTimestamp()->shouldReturn($timestamp);
199-
}
200-
201191
public function it_returns_a_new_instance_with_stored()
202192
{
203193
$stored = new \DateTime('2014-07-23T12:34:02-05:00');

spec/SubStatementSpec.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,6 @@ public function it_returns_a_new_instance_with_result()
165165
$subStatement->getResult()->shouldReturn($result);
166166
}
167167

168-
public function it_returns_a_new_instance_with_timestamp()
169-
{
170-
$timestamp = new \DateTime('2014-07-23T12:34:02-05:00');
171-
$statement = $this->withTimestamp($timestamp);
172-
173-
$statement->shouldNotBe($this);
174-
$statement->shouldBeAnInstanceOf('\Xabbuh\XApi\Model\SubStatement');
175-
$statement->getTimestamp()->shouldReturn($timestamp);
176-
}
177-
178168
public function it_returns_a_new_instance_with_context()
179169
{
180170
$context = new Context();

src/Statement.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,6 @@ public function withAuthority(Actor $authority = null)
151151
return $statement;
152152
}
153153

154-
/**
155-
* @deprecated since 1.2, to be removed in 3.0
156-
*/
157-
public function withTimestamp(\DateTime $timestamp = null)
158-
{
159-
@trigger_error(sprintf('The "%s()" method is deprecated since 1.2 and will be removed in 3.0. Use "%s::withCreated()" instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
160-
161-
$statement = clone $this;
162-
$statement->created = $timestamp;
163-
164-
return $statement;
165-
}
166-
167154
public function withCreated(\DateTime $created = null)
168155
{
169156
$statement = clone $this;
@@ -274,21 +261,6 @@ public function getAuthority()
274261
return $this->authority;
275262
}
276263

277-
/**
278-
* Returns the timestamp of when the events described in this statement
279-
* occurred.
280-
*
281-
* @return \DateTime The timestamp
282-
*
283-
* @deprecated since 1.2, to be removed in 3.0
284-
*/
285-
public function getTimestamp()
286-
{
287-
@trigger_error(sprintf('The "%s()" method is deprecated since 1.2 and will be removed in 3.0. Use "%s::getCreated()" instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
288-
289-
return $this->created;
290-
}
291-
292264
/**
293265
* Returns the timestamp of when the events described in this statement
294266
* occurred.

src/SubStatement.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,6 @@ public function withResult(Result $result)
9797
return $subStatement;
9898
}
9999

100-
/**
101-
* @deprecated since 1.2, to be removed in 3.0
102-
*/
103-
public function withTimestamp(\DateTime $timestamp = null)
104-
{
105-
@trigger_error(sprintf('The "%s()" method is deprecated since 1.2 and will be removed in 3.0. Use "%s::withCreated()" instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
106-
107-
$statement = clone $this;
108-
$statement->created = $timestamp;
109-
110-
return $statement;
111-
}
112-
113100
public function withCreated(\DateTime $created = null)
114101
{
115102
$statement = clone $this;
@@ -179,21 +166,6 @@ public function getResult()
179166
return $this->result;
180167
}
181168

182-
/**
183-
* Returns the timestamp of when the events described in this statement
184-
* occurred.
185-
*
186-
* @return \DateTime The timestamp
187-
*
188-
* @deprecated since 1.2, to be removed in 3.0
189-
*/
190-
public function getTimestamp()
191-
{
192-
@trigger_error(sprintf('The "%s()" method is deprecated since 1.2 and will be removed in 3.0. Use "%s::getCreated()" instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
193-
194-
return $this->created;
195-
}
196-
197169
/**
198170
* Returns the timestamp of when the events described in this statement
199171
* occurred.

0 commit comments

Comments
 (0)