Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove E_USER_DEPRECATED deprecated methods #136

Merged
merged 3 commits into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1447,9 +1447,6 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="src/Helper/Placeholder/Registry.php">
<DocblockTypeContradiction occurrences="1">
<code>null === static::$instance</code>
</DocblockTypeContradiction>
<InvalidStringClass occurrences="1">
<code>new $this-&gt;containerClass($value)</code>
</InvalidStringClass>
Expand All @@ -1472,9 +1469,6 @@
<code>(string) $key</code>
<code>(string) $key</code>
</RedundantCastGivenDocblockType>
<UnsafeInstantiation occurrences="1">
<code>new static()</code>
</UnsafeInstantiation>
</file>
<file src="src/Helper/RenderChildModel.php">
<MissingConstructor occurrences="2">
Expand Down Expand Up @@ -2361,10 +2355,6 @@
</UndefinedMethod>
</file>
<file src="test/Helper/GravatarTest.php">
<DeprecatedMethod occurrences="2">
<code>getAttribs</code>
<code>setAttribs</code>
</DeprecatedMethod>
<InvalidScalarArgument occurrences="3">
<code>$value</code>
<code>$value</code>
Expand Down
46 changes: 0 additions & 46 deletions src/Helper/Gravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@
use function sprintf;
use function str_replace;
use function strtolower;
use function trigger_error;
use function trim;
use function ucwords;
use function urlencode;

use const E_USER_DEPRECATED;

/**
* Helper for retrieving avatars from gravatar.com
*/
Expand Down Expand Up @@ -196,26 +193,6 @@ public function setAttributes(array $attributes)
return $this;
}

/**
* Set attribs for image tag
*
* @deprecated Please use Laminas\View\Helper\Gravatar::setAttributes
*
* @param array $attribs
* @return Gravatar
*/
public function setAttribs(array $attribs)
{
trigger_error(sprintf(
'%s is deprecated; please use %s::setAttributes',
__METHOD__,
self::class
), E_USER_DEPRECATED);

$this->setAttributes($attribs);
return $this;
}

/**
* Get attributes of image
*
Expand All @@ -231,29 +208,6 @@ public function getAttributes()
return $this->attributes;
}

/**
* Get attribs of image
*
* Warning!
* If you set src attrib, you get it, but this value will be overwritten in
* protected method setSrcAttribForImg(). And finally your get other src
* value!
*
* @deprecated Please use Laminas\View\Helper\Gravatar::getAttributes
*
* @return array
*/
public function getAttribs()
{
trigger_error(sprintf(
'%s is deprecated; please use %s::getAttributes',
__METHOD__,
self::class
), E_USER_DEPRECATED);

return $this->getAttributes();
}

/**
* Set default img
*
Expand Down
31 changes: 0 additions & 31 deletions src/Helper/Placeholder/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
use function class_parents;
use function in_array;
use function sprintf;
use function trigger_error;

use const E_USER_DEPRECATED;

/**
* Registry for placeholder containers
Expand Down Expand Up @@ -42,34 +39,6 @@ class Registry
*/
protected $items = [];

/**
* Retrieve or create registry instance
*
* @return Registry
*/
public static function getRegistry()
{
trigger_error('Placeholder view helpers should no longer use a singleton registry', E_USER_DEPRECATED);
if (null === static::$instance) {
static::$instance = new static();
}

return static::$instance;
}

/**
* Unset the singleton
*
* Primarily useful for testing purposes; sets {@link $instance} to null.
*
* @return void
*/
public static function unsetRegistry()
{
trigger_error('Placeholder view helpers should no longer use a singleton registry', E_USER_DEPRECATED);
static::$instance = null;
}

/**
* Set the container for an item in the registry
*
Expand Down
31 changes: 0 additions & 31 deletions test/Helper/GravatarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Laminas\View\Helper\Gravatar;
use Laminas\View\Renderer\PhpRenderer as View;
use PHPUnit\Framework\TestCase;
use ReflectionMethod;

use function method_exists;
use function strtoupper;
Expand Down Expand Up @@ -274,34 +273,4 @@ public function testEmailIsProperlyNormalized(): void
$this->helper->__invoke('[email protected] ')->getEmail()
);
}

public function testSetAttribsIsDeprecated(): void
{
$this->expectDeprecation();

$this->helper->setAttribs([]);
}

public function testSetAttribsDocCommentHasDeprecated(): void
{
$method = new ReflectionMethod($this->helper, 'setAttribs');
$comment = $method->getDocComment();

$this->assertStringContainsString('@deprecated', $comment);
}

public function testGetAttribsIsDeprecated(): void
{
$this->expectDeprecation();

$this->helper->getAttribs();
}

public function testGetAttribsDocCommentHasDeprecated(): void
{
$method = new ReflectionMethod($this->helper, 'getAttribs');
$comment = $method->getDocComment();

$this->assertStringContainsString('@deprecated', $comment);
}
}