antecedent / patchwork

Method redefinition (monkey-patching) functionality for PHP.
https://antecedent.github.io/patchwork/
MIT License
444 stars 40 forks source link

How to prevent PHP User Warning for a method that is not defined during its redefinition #23

Open tomolimo opened 9 years ago

tomolimo commented 9 years ago

Hello,

I'm doing a redefinition of a method that will be loaded later during execution. All is fine, but depending on functionnal reasons the file is not always included (only needed classes are loaded), then when execution is finished, I got a PHP User Warning saying:

PHP User Warning: 'my_patched_function' was never defined during the lifetime of its redefinition in .....\patchwork\src\Interceptor.php at line 43

How is it be possible to disable such warnings? Thank you, regards, Tomolimo

antecedent commented 9 years ago

Hello, I will implement this today as Patchwork\silence($handle), where $handle is the return value of replace.

antecedent commented 9 years ago

Implemented.