Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 9910c88

Browse files
committed
Trigger a deprecated error for getAttribs method
1 parent af4b9fc commit 9910c88

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/Helper/Gravatar.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,21 @@ public function setAttribs(array $attribs)
210210
return $this;
211211
}
212212

213+
/**
214+
* Get attributes of image
215+
*
216+
* Warning!
217+
* If you set src attribute, you get it, but this value will be overwritten in
218+
* protected method setSrcAttribForImg(). And finally your get other src
219+
* value!
220+
*
221+
* @return array
222+
*/
223+
public function getAttributes()
224+
{
225+
return $this->attribs;
226+
}
227+
213228
/**
214229
* Get attribs of image
215230
*
@@ -222,6 +237,12 @@ public function setAttribs(array $attribs)
222237
*/
223238
public function getAttribs()
224239
{
240+
trigger_error(sprintf(
241+
'%s is deprecated; please use %s::getAttributes',
242+
__METHOD__,
243+
__CLASS__
244+
), E_USER_DEPRECATED);
245+
225246
return $this->attribs;
226247
}
227248

test/Helper/GravatarTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,11 @@ public function testSetAttribsDocCommentHasDeprecated()
302302

303303
$this->assertContains('@deprecated', $comment);
304304
}
305+
306+
public function testGetAttribsIsDeprecated()
307+
{
308+
$this->expectException(DeprecatedError::class);
309+
310+
$this->helper->getAttribs();
311+
}
305312
}

0 commit comments

Comments
 (0)