Search code examples
composer-phpcontao

Avoid function duplication of dump function by psysh


I am developer of imi-conrun and have a problem: We use the psySh package we would like not to drop and defines the global scope function "dump" and have to initialize the Contao core which defines the global scope function "dump" as well without checking if the function is registered and then crashes.

Is there any possibility to only remove the dump function from psySh without making a fork?


Solution

  • I think there is no real solution for this.

    In the end it turn's out I do not need PsySH - so I removed it - problem solved.

    • Might make the suggestion to Contao to not blindly defined the dump function without a function_exists() call
    • On the other hand I could ensure that Contao is loaded first, then PsySH and thus would not define the dump() function again which would mean to run the composer autoload before the Contao init.

    TL;DR: global name space functions are bad.