Add backtrace to deprecated message

This commit is contained in:
Mike Jolley 2017-04-12 17:37:59 +01:00
parent 307a42b37e
commit 3e9f74d038
5 changed files with 5 additions and 5 deletions

View File

@ -145,7 +145,7 @@ class WC_Order_Refund extends WC_Abstract_Order {
* @return mixed
*/
public function __get( $key ) {
wc_doing_it_wrong( $key, 'Refund properties should not be accessed directly.', '3.0' );
wc_doing_it_wrong( $key, 'Refund properties should not be accessed directly. Called by: ' . wp_debug_backtrace_summary( __CLASS__ ), '3.0' );
/**
* Maps legacy vars to new getters.
*/

View File

@ -404,7 +404,7 @@ abstract class WC_Abstract_Legacy_Order extends WC_Data {
* @return mixed
*/
public function __get( $key ) {
wc_doing_it_wrong( $key, 'Order properties should not be accessed directly.', '3.0' );
wc_doing_it_wrong( $key, 'Order properties should not be accessed directly. Called by: ' . wp_debug_backtrace_summary( __CLASS__ ), '3.0' );
if ( 'completed_date' === $key ) {
return $this->get_date_completed() ? gmdate( 'Y-m-d H:i:s', $this->get_date_completed()->getOffsetTimestamp() ) : '';

View File

@ -69,7 +69,7 @@ abstract class WC_Abstract_Legacy_Product extends WC_Data {
return $this->post_type;
}
wc_doing_it_wrong( $key, __( 'Product properties should not be accessed directly.', 'woocommerce' ), '3.0' );
wc_doing_it_wrong( $key, __( 'Product properties should not be accessed directly. Called by: ' . wp_debug_backtrace_summary( __CLASS__ ), 'woocommerce' ), '3.0' );
switch ( $key ) {
case 'id' :

View File

@ -58,7 +58,7 @@ abstract class WC_Legacy_Coupon extends WC_Data {
* @return mixed
*/
public function __get( $key ) {
wc_doing_it_wrong( $key, 'Coupon properties should not be accessed directly.', '3.0' );
wc_doing_it_wrong( $key, 'Coupon properties should not be accessed directly. Called by: ' . wp_debug_backtrace_summary( __CLASS__ ), '3.0' );
switch ( $key ) {
case 'id' :

View File

@ -48,7 +48,7 @@ abstract class WC_Legacy_Customer extends WC_Data {
* @return string
*/
public function __get( $key ) {
wc_doing_it_wrong( $key, 'Customer properties should not be accessed directly.', '3.0' );
wc_doing_it_wrong( $key, 'Customer properties should not be accessed directly. Called by: ' . wp_debug_backtrace_summary( __CLASS__ ), '3.0' );
$key = $this->filter_legacy_key( $key );
if ( in_array( $key, array( 'country', 'state', 'postcode', 'city', 'address_1', 'address', 'address_2' ) ) ) {
$key = 'billing_' . $key;