@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

Remove some conditions which are always true/false

Summary:
Remove code around some conditions which are always true/false anyway.

Same game as rP1b9fafc7af72.

Test Plan: Read earlier code in each file; run static code analysis.

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D26760

+27 -35
+9 -13
src/applications/auth/provider/PhabricatorLDAPAuthProvider.php
··· 158 158 159 159 if ($request->isFormPost()) { 160 160 try { 161 - if (phutil_nonempty_string($username) && $has_password) { 162 - $adapter = $this->getAdapter(); 163 - $adapter->setLoginUsername($username); 164 - $adapter->setLoginPassword($password); 161 + $adapter = $this->getAdapter(); 162 + $adapter->setLoginUsername($username); 163 + $adapter->setLoginPassword($password); 165 164 166 - // TODO: This calls ldap_bind() eventually, which dumps cleartext 167 - // passwords to the error log. See note in PhutilLDAPAuthAdapter. 168 - // See T3351. 165 + // TODO: This calls ldap_bind() eventually, which dumps cleartext 166 + // passwords to the error log. See note in PhutilLDAPAuthAdapter. 167 + // See T3351. 169 168 170 - DarkConsoleErrorLogPluginAPI::enableDiscardMode(); 171 - $identifiers = $adapter->getAccountIdentifiers(); 172 - DarkConsoleErrorLogPluginAPI::disableDiscardMode(); 173 - } else { 174 - throw new Exception(pht('Username and password are required!')); 175 - } 169 + DarkConsoleErrorLogPluginAPI::enableDiscardMode(); 170 + $identifiers = $adapter->getAccountIdentifiers(); 171 + DarkConsoleErrorLogPluginAPI::disableDiscardMode(); 176 172 } catch (PhutilAuthCredentialException $ex) { 177 173 $response = $controller->buildProviderPageResponse( 178 174 $this,
+7 -9
src/applications/fact/controller/PhabricatorFactObjectController.php
··· 210 210 continue; 211 211 } 212 212 213 - if (!$has_any) { 214 - $rows[] = array( 215 - $icon_nodata, 216 - $fact->getName(), 217 - null, 218 - null, 219 - null, 220 - ); 221 - } 213 + $rows[] = array( 214 + $icon_nodata, 215 + $fact->getName(), 216 + null, 217 + null, 218 + null, 219 + ); 222 220 } 223 221 224 222 $table = id(new AphrontTableView($rows))
+1 -1
src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
··· 67 67 } else { 68 68 69 69 $comments = $request->getValue('comments'); 70 - if (!$is_new && $comments !== null) { 70 + if ($comments !== null) { 71 71 $changes[PhabricatorTransactions::TYPE_COMMENT] = null; 72 72 } 73 73
+1 -1
src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php
··· 118 118 // OK. 119 119 } else if ($importing) { 120 120 // OK. 121 - } else if (!$any_step && !$importing) { 121 + } else { 122 122 throw new PhutilArgumentUsageException( 123 123 pht( 124 124 'Specify which steps to reparse with "--message", "--change", '.
+1 -1
src/view/control/AphrontTableView.php
··· 188 188 if ($sort_value == $this->sortSelected) { 189 189 if ($this->sortReverse) { 190 190 $sort_glyph_class = 'aphront-table-up-sort'; 191 - } else if (!$this->sortReverse) { 191 + } else { 192 192 $sort_value = '-'.$sort_value; 193 193 } 194 194 $classes[] = 'aphront-table-view-sortable-selected';
+1 -1
src/view/phui/PHUITimelineEventView.php
··· 750 750 )); 751 751 752 752 if (!$is_admin && !$can_interact) { 753 - $remove_item->setDisabled(!$is_admin && !$can_interact); 753 + $remove_item->setDisabled(true); 754 754 } else { 755 755 $remove_item->setColor(PhabricatorActionView::RED); 756 756 }
+7 -9
support/startup/PhabricatorStartup.php
··· 174 174 } 175 175 176 176 $msg = ">>> UNRECOVERABLE FATAL ERROR <<<\n\n"; 177 - if ($event) { 178 - // Even though we should be emitting this as text-plain, escape things 179 - // just to be sure since we can't really be sure what the program state 180 - // is when we get here. 181 - $msg .= htmlspecialchars( 182 - $event['message']."\n\n".$event['file'].':'.$event['line'], 183 - ENT_QUOTES, 184 - 'UTF-8'); 185 - } 177 + // Even though we should be emitting this as text-plain, escape things 178 + // just to be sure since we can't really be sure what the program state 179 + // is when we get here. 180 + $msg .= htmlspecialchars( 181 + $event['message']."\n\n".$event['file'].':'.$event['line'], 182 + ENT_QUOTES, 183 + 'UTF-8'); 186 184 187 185 // flip dem tables 188 186 $msg .= "\n\n\n";