Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API code optimizations #7682

Commits on Oct 31, 2024

  1. Simplify ternary operators and remove redundant type casting.

    anton-vlasenko authored and Anton Vlasenko committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    95a6a54 View commit details
    Browse the repository at this point in the history
  2. Use strict comparisons to verify empty arrays.

    anton-vlasenko authored and Anton Vlasenko committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    ace4072 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e4efe7d View commit details
    Browse the repository at this point in the history
  4. 1. Replace simple if/else statements with ternary operators.

    2. Refactor complex `if/continue` statements into two simpler `continue` statements.
    3. Refactor return values in certain methods, such as creating arrays all at once instead of adding values to an array one by one.
    anton-vlasenko authored and Anton Vlasenko committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    128605f View commit details
    Browse the repository at this point in the history
  5. 1. Remove unncessary variables.

    2. Reorders order of expressions in if conditions to optimize performance.
    3. Fixes issues with callling stating methods dynamically and non-static method statically.
    4. Merges isset() and unset() statements.
    5. Explicitly return null in WP_REST_Posts_Controller::handle_terms().
    anton-vlasenko authored and Anton Vlasenko committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    f0ae81d View commit details
    Browse the repository at this point in the history