Debugging php cli-scripts from a docker container in NetBeans

Hello. Recently I made a script to replace my real php interpreter in NetBeans settings.

As you probably know NB can’t run dockerized php cli scripts. here I will show you how I solved this problem. Now instead of using terminal I just press Run or Debug button in NB GUI to start my session. AFAICS this solution is pretty good.

I started from something really simple:

#!/bin/bash
docker exec test-php php \
    -dxdebug.mode=debug \
    -dxdebug.start_with_request=1 \
    `basename ${BASH_ARGV[0]}` \
    "${@:1:$#-1}"

But this is not universal and does not take into account all the parameters I can set in ‘Project Properties’ > ‘Run Configurations’: