jenkins-bot has submitted this change and it was merged.

Change subject: Deprecate internal ORMTable::unprefixFieldName(s)
......................................................................


Deprecate internal ORMTable::unprefixFieldName(s)

unprefixFieldNames is not used anywhere outside of the class. Why
should it?

unprefixFieldName became unused in I19194f1, but I did not removed
it because it is public.

The fact that both methods are public is a mistake as far as I can
tell. I can't think of a good reason to do that.

Change-Id: Iafc527b5d534648a962a8c2015d21403362bb573
---
M includes/db/IORMTable.php
M includes/db/ORMTable.php
2 files changed, 24 insertions(+), 5 deletions(-)

Approvals:
  Aude: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/db/IORMTable.php b/includes/db/IORMTable.php
index 4dc693a..6e262e8 100644
--- a/includes/db/IORMTable.php
+++ b/includes/db/IORMTable.php
@@ -442,10 +442,11 @@
         * Takes an array of field names with prefix and returns the unprefixed 
equivalent.
         *
         * @since 1.20
+        * @deprecated since 1.25, will be removed
         *
-        * @param array $fieldNames
+        * @param string[] $fieldNames
         *
-        * @return array
+        * @return string[]
         */
        public function unprefixFieldNames( array $fieldNames );
 
@@ -453,6 +454,7 @@
         * Takes a field name with prefix and returns the unprefixed equivalent.
         *
         * @since 1.20
+        * @deprecated since 1.25, will be removed
         *
         * @param string $fieldName
         *
diff --git a/includes/db/ORMTable.php b/includes/db/ORMTable.php
index 31f32e5..1868073 100644
--- a/includes/db/ORMTable.php
+++ b/includes/db/ORMTable.php
@@ -778,12 +778,26 @@
         * Takes an array of field names with prefix and returns the unprefixed 
equivalent.
         *
         * @since 1.20
+        * @deprecated since 1.25, will be removed
         *
-        * @param array $fieldNames
+        * @param string[] $fieldNames
         *
-        * @return array
+        * @return string[]
         */
        public function unprefixFieldNames( array $fieldNames ) {
+               wfDeprecated( __METHOD__, '1.25' );
+
+               return $this->stripFieldPrefix( $fieldNames );
+       }
+
+       /**
+        * Takes an array of field names with prefix and returns the unprefixed 
equivalent.
+        *
+        * @param string[] $fieldNames
+        *
+        * @return string[]
+        */
+       private function stripFieldPrefix( array $fieldNames ) {
                $start = strlen( $this->fieldPrefix );
 
                return array_map( function( $fieldName ) use ( $start ) {
@@ -795,12 +809,15 @@
         * Takes a field name with prefix and returns the unprefixed equivalent.
         *
         * @since 1.20
+        * @deprecated since 1.25, will be removed
         *
         * @param string $fieldName
         *
         * @return string
         */
        public function unprefixFieldName( $fieldName ) {
+               wfDeprecated( __METHOD__, '1.25' );
+
                return substr( $fieldName, strlen( $this->fieldPrefix ) );
        }
 
@@ -837,7 +854,7 @@
                $result = (array)$result;
 
                $rawFields = array_combine(
-                       $this->unprefixFieldNames( array_keys( $result ) ),
+                       $this->stripFieldPrefix( array_keys( $result ) ),
                        array_values( $result )
                );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/166568
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iafc527b5d534648a962a8c2015d21403362bb573
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to