I'm not sure this will work as expected. Comparing issues should be done using...
if ($issueA->getId() == $issueB->getId()) { ...