Added variable declaration and removed dead code

As per
https://scrutinizer-ci.com/g/symphonycms/symphony-2/inspections/760abd97-0a8c-4b95-84ba-2cb4b5047ec4/issues/files/symphony/content/content.publish.php?status=existing&selectedSeverities%5B0%5D=10&orderField=issueCount&order=desc