laminas / laminas-di

Automated dependency injection for PSR-11 containers
https://docs.laminas.dev/laminas-di/
BSD 3-Clause "New" or "Revised" License
36 stars 20 forks source link

INJECTOR: Remove redundant interface_exists check #44

Closed sjokkateer closed 2 years ago

sjokkateer commented 2 years ago

Signed-off-by: Remy Bos 27890746+sjokkateer@users.noreply.github.com

Q A
Documentation no
Bugfix no
BC Break no
New Feature no
RFC no
QA no

Description

Currently in Injector::canCreate() the result of the following check is returned class_exists($class) && ! interface_exists($class). In case class_exists($class) evaluates to true, ! interface_exists($class) will also always evaluate to true. In the other scenario where class_exists($class) evaluates to false, the statement short circuits as the entire statement is already determined to be false.

This pull request thus removes the right hand side of the logical conjunction: ! interface_exists($class) as it seems to be redundant.