Repository navigation
feat: let core's copy of a presence function or class win when it already exists - #805
Conversation
🛝 WordPress PlaygroundsBuilt from d34395c
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #805 +/- ##
============================================
+ Coverage 97.09% 97.12% +0.02%
Complexity 271 271
============================================
Files 30 30
Lines 4370 4375 +5
============================================
+ Hits 4243 4249 +6
+ Misses 127 126 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Dropped the |
…d leave the constants unguarded
b6b6f61 to
025b266
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Wrapping public functions and classes in \unction_exists()\ / \class_exists()\ is the clean canonical Gutenberg/feature-plugin approach for incremental Core adoption. Regarding Codecov's note (\Patch coverage is 99.74555% with 2 lines in your changes missing coverage): the uncovered lines are the fallback branches where a function/class already exists before inclusion. Adding a test in \ est-core-guards.php\ that declares a mock presence function/class before running the guard check will exercise those fallback branches and restore 100% patch coverage. |
|
#733 now has answers to Deepak's scope questions, which change this PR in two places:
Guarding every function in |
# Conflicts: # plugins/presence-api/includes/presence.php # plugins/presence-api/includes/rest-api/endpoints/class-wp-rest-presence-controller.php
|
Merged main to clear the conflicts with #815. I rebuilt both files from main's copy with the same wrapping rather than resolving each hunk, so |
Almost all of this diff is re-indentation, so it reads best with whitespace hidden (
?w=1), and the scope (all 57 functions inpresence.phpincluding private helpers, plus the two REST controllers and the CLI command) is the one I proposed on #733 before hearing back, so it may need narrowing.Related: #733
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Writing the script that wrapped each declaration and drafting the guard test; reviewed and run locally by me.