From d0e26bee77bc92c08063830f61c152f10cd3a158 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Thu, 18 Jul 2024 14:15:57 -0400 Subject: [PATCH] Adding DOMDocument property names to the ruleset --- Alley-Interactive/ruleset.xml | 20 ++++++++++++++++++++ CHANGELOG.md | 1 + tests/fixtures/pass/dom.php | 28 ++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/fixtures/pass/dom.php diff --git a/Alley-Interactive/ruleset.xml b/Alley-Interactive/ruleset.xml index db37ae4..ada847d 100644 --- a/Alley-Interactive/ruleset.xml +++ b/Alley-Interactive/ruleset.xml @@ -95,4 +95,24 @@ tests/*Test.php + + + + + + + + + + + + + + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index cce5d4b..523ac77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This project adheres to [Keep a CHANGELOG](https://keepachangelog.com/en/1.0.0/) ### Unreleased - Allow PSR-4 style `ClassName.php` file names to support our migration to PSR-4 for test files. +- Allow camelCase'd DOMDocument/DOMElement/etc. property names to not be flagged by `WordPress.NamingConventions.ValidVariableName`. ### 2.0.2 diff --git a/tests/fixtures/pass/dom.php b/tests/fixtures/pass/dom.php new file mode 100644 index 0000000..e4269e2 --- /dev/null +++ b/tests/fixtures/pass/dom.php @@ -0,0 +1,28 @@ +preserveWhiteSpace = false; +$ai_document->formatOutput = true; + +$ai_document->loadHTML( + file_get_contents( 'https://www.alley.com' ) // phpcs:ignore +); + +// Interact with the DOM document. +$ai_element = $ai_document->getElementById( 'element-id' ); + +// Ensure that DOMElement properties are allowed. +$ai_element->textContent = 'Hello, world!'; +$ai_element->className = 'element-class'; + +$ai_tag = $ai_element->tagName;