You can simplify to `if ($definition->getFactoryClass()) {` (same for the other one below)