My suggestion is to remove the if statement

```php
foreach($this->serviceName as $serviceName){
     $definition->addArgument(new Reference($serviceName));
}
```
and put in the constructor
```php
$this->serviceName = is_array($serviceName) ? $serviceName : array($serviceName);
```