From c7fa503e9be78c43ca2e492ce86183fce7a403d5 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Wed, 2 Oct 2019 13:35:38 +0200 Subject: [PATCH] Remove AFPData::dup The method, which simply duplicates an AFPData instance, is only used when casting types, to return a different instance when the object already has the desired type. However, nothing is assuming that, so we can just return the original instance and save some time. Bug: T234427 Change-Id: Id8067b418a00260ceead35f234e55268390699ab --- includes/parser/AFPData.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/includes/parser/AFPData.php b/includes/parser/AFPData.php index 5a344bbbc..db3ae3a57 100644 --- a/includes/parser/AFPData.php +++ b/includes/parser/AFPData.php @@ -98,13 +98,6 @@ class AFPData { } } - /** - * @return AFPData - */ - private function dup() { - return new AFPData( $this->type, $this->data ); - } - /** * @param AFPData $orig * @param string $target @@ -112,7 +105,7 @@ class AFPData { */ public static function castTypes( AFPData $orig, $target ) { if ( $orig->type === $target ) { - return $orig->dup(); + return $orig; } if ( $orig->type === self::DUNDEFINED ) { // This case should be handled at a higher level, to avoid implicitly relying on what