.. _cannot-rebind-scope-of-closure-created-from-method: Cannot rebind scope of closure created from method -------------------------------------------------- .. meta:: :description: Cannot rebind scope of closure created from method: When a closure is build from a method and an existing object, it is not possible to rebind it to another object. :og:image: https://php-errors.readthedocs.io/en/latest/_static/logo.png :og:type: article :og:title: Cannot rebind scope of closure created from method :og:description: When a closure is build from a method and an existing object, it is not possible to rebind it to another object :og:url: https://php-errors.readthedocs.io/en/latest/messages/cannot-rebind-scope-of-closure-created-from-method.html :og:locale: en :twitter:card: summary_large_image :twitter:site: @exakat :twitter:title: Cannot rebind scope of closure created from method :twitter:description: Cannot rebind scope of closure created from method: When a closure is build from a method and an existing object, it is not possible to rebind it to another object :twitter:creator: @exakat :twitter:image:src: https://php-errors.readthedocs.io/en/latest/_static/logo.png .. raw:: html Description ___________ When a closure is build from a method and an existing object, it is not possible to rebind it to another object. Example _______ .. code-block:: php method(...); $ret = $fn->bindTo($x, Y::class); ?> Solutions _________ + To be rebound, the closure must be build from within the class.