Skip to content

Instantly share code, notes, and snippets.

@webevt
Created March 22, 2017 17:35
Show Gist options
  • Save webevt/b1f79d5c3b1a6f1a7d7fa34f2c960ecf to your computer and use it in GitHub Desktop.
Save webevt/b1f79d5c3b1a6f1a7d7fa34f2c960ecf to your computer and use it in GitHub Desktop.
Find non-existent services in Symfony app
app/console debug:container | tail -n +8 | head -n-5 | grep -v "alias for" | while read -r LINE; do CLASS=$(echo $LINE | awk '{print $2}'); SERVICE=$(echo $LINE | awk '{print $1}'); if [ -z $CLASS ]; then continue; fi; php -r "require_once 'app/autoload.php'; class_exists('$CLASS') || interface_exists('$CLASS') ?: print('Service $SERVICE ($CLASS) does not exist'.PHP_EOL);"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment