This works:
RewriteCond %{QUERY_STRING} ^.+$
RewriteRule ^/?([^/\.]+)$ /$1.php [L]
The idea is to make sure there's a query string (question mark plus stuff) and if so check if the stuff before the question mark has no extension and if so, append .php.