I’d like to overwrite the PHPExcel_Cell_DefaultValueBinder::dataTypeForValue() method WITHOUT touching the library PHPExcel, so that I would not have problems to upgrade the library later.
As a matter fact, I am doing this to solve a problem of convertion of numbers into strings and I just wanted to know how to overwrite a method so that I can continue using the library with no later problem.
You can make a new class which would inherit from
PHPExcel_Cell_DefaultValueBinder, and override the functiondataTypeForValue.After, just use
PHPExcel_Cell_MyValueBinderinstead ofPHPExcel_Cell_DefaultValueBinder, using at the top of your code :So
PHPExcelwill use your own ValueBinder for the rest of the execution 🙂