Make WordPress Core

Changeset 56467

Timestamp:
08/25/2023 03:24:00 AM (12 months ago)
Author:
DrewAPicture
Message:

Introduce a _deprecated_class() function.

Similar to other function in the _deprecated_* series, _deprecated_class() comes with two new hooks: deprecated_class_run and deprecated_class_trigger_error.

Support has also been added for setting class deprecation expectations in tests.

Props jrf, wvega, ohryan.
See #41125.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r56414 r56467  
    55975597
    55985598/**
     5599
     5600
     5601
     5602
     5603
     5604
     5605
     5606
     5607
     5608
     5609
     5610
     5611
     5612
     5613
     5614
     5615
     5616
     5617
     5618
     5619
     5620
     5621
     5622
     5623
     5624
     5625
     5626
     5627
     5628
     5629
     5630
     5631
     5632
     5633
     5634
     5635
     5636
     5637
     5638
     5639
     5640
     5641
     5642
     5643
     5644
     5645
     5646
     5647
     5648
     5649
     5650
     5651
     5652
     5653
     5654
     5655
     5656
    55995657 * Marks a file as deprecated and inform when it has been used.
    56005658 *
  • trunk/tests/phpunit/includes/abstract-testcase.php

    r56421 r56467  
    569569        add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ), 10, 3 );
    570570        add_action( 'deprecated_argument_run', array( $this, 'deprecated_function_run' ), 10, 3 );
     571
    571572        add_action( 'deprecated_file_included', array( $this, 'deprecated_function_run' ), 10, 4 );
    572573        add_action( 'deprecated_hook_run', array( $this, 'deprecated_function_run' ), 10, 4 );
     
    575576        add_action( 'deprecated_function_trigger_error', '__return_false' );
    576577        add_action( 'deprecated_argument_trigger_error', '__return_false' );
     578
    577579        add_action( 'deprecated_file_trigger_error', '__return_false' );
    578580        add_action( 'deprecated_hook_trigger_error', '__return_false' );
     
    741743                        $message = sprintf(
    742744                            'Function %1$s was called with an argument that is deprecated since version %2$s with no alternative available.',
     745
     746
     747
     748
     749
     750
     751
     752
     753
     754
     755
     756
     757
     758
     759
     760
     761
    743762                            $function_name,
    744763                            $version
Note: See TracChangeset for help on using the changeset viewer.