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

Not using return value of array_map in ClassGenerator->setImplementedInterfaces #165

Description

@TysonAndre

https://github.com/zendframework/zend-code/blob/master/src/Generator/ClassGenerator.php#L476-L482 has the following snippet

array_map(function ($implementedInterface) {
return (string) TypeGenerator::fromTypeString($implementedInterface);
}, $implementedInterfaces);
$this->implementedInterfaces = $implementedInterfaces;

That's a no-op, since the return value of the array_map isn't used. I think that the array_map should be removed, replaced with array_walk (probably pointless unless it would throw), or (probably) be changed to:

$this->implementedInterfaces = array_map(function ($implementedInterface) {
return (string) TypeGenerator::fromTypeString($implementedInterface);
}, $implementedInterfaces);

The latter seems likely given the rest of the changes in ec09875

This was detected via static analysis, I'm not sure of the impact of fixing this.

http://php.net/array_map

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions