Skip to content

Commit 4fba549

Browse files
author
vrana
committed
Use PhabricatorEnv::newObjectFromConfig() wherever possible
Test Plan: /mail/send/ scripts/aphront/aphrontpath.php / Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1983
1 parent 74cc558 commit 4fba549

File tree

16 files changed

+23
-35
lines changed

16 files changed

+23
-35
lines changed

scripts/aphront/aphrontpath.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
$path = '/'.(isset($url['path']) ? ltrim($url['path'], '/') : '');
3131

3232
$config_key = 'aphront.default-application-configuration-class';
33-
$config_class = PhabricatorEnv::getEnvConfig($config_key);
34-
$application = newv($config_class, array());
33+
$application = PhabricatorEnv::newObjectFromConfig($config_key);
3534
$mapper = new AphrontURIMapper($application->getURIMap());
3635

3736
list($controller) = $mapper->mapPath($path);

src/applications/audit/editor/comment/PhabricatorAuditCommentEditor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,8 @@ public static function getMailThreading($phid) {
267267
}
268268

269269
public static function newReplyHandlerForCommit($commit) {
270-
$handler_class = PhabricatorEnv::getEnvConfig(
270+
$reply_handler = PhabricatorEnv::newObjectFromConfig(
271271
'metamta.diffusion.reply-handler');
272-
$reply_handler = newv($handler_class, array());
273272
$reply_handler->setMailReceiver($commit);
274273
return $reply_handler;
275274
}

src/applications/auth/controller/oauth/PhabricatorOAuthLoginController.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,8 @@ public function processRequest() {
206206
return id(new AphrontDialogResponse())->setDialog($dialog);
207207
}
208208

209-
$class = PhabricatorEnv::getEnvConfig('controller.oauth-registration');
210-
PhutilSymbolLoader::loadClass($class);
211-
$controller = newv($class, array($this->getRequest()));
209+
$key = 'controller.oauth-registration';
210+
$controller = PhabricatorEnv::newObjectFromConfig($key);
212211

213212
$controller->setOAuthProvider($provider);
214213
$controller->setOAuthInfo($oauth_info);

src/applications/auth/controller/oauth/__init__.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
phutil_require_module('phutil', 'markup');
2222
phutil_require_module('phutil', 'parser/uri');
23-
phutil_require_module('phutil', 'symbols');
2423
phutil_require_module('phutil', 'utils');
2524

2625

src/applications/differential/field/selector/base/DifferentialFieldSelector.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ final public function __construct() {
2323
}
2424

2525
final public static function newSelector() {
26-
$class = PhabricatorEnv::getEnvConfig('differential.field-selector');
27-
$selector = newv($class, array());
28-
return $selector;
26+
return PhabricatorEnv::newObjectFromConfig('differential.field-selector');
2927
}
3028

3129
abstract public function getFieldSpecifications();

src/applications/differential/field/selector/base/__init__.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@
88

99
phutil_require_module('phabricator', 'infrastructure/env');
1010

11-
phutil_require_module('phutil', 'utils');
12-
1311

1412
phutil_require_source('DifferentialFieldSelector.php');

src/applications/files/storage/file/PhabricatorFile.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public static function newFromPHPUpload($spec, array $params = array()) {
8484

8585
public static function newFromFileData($data, array $params = array()) {
8686

87-
$selector_class = PhabricatorEnv::getEnvConfig('storage.engine-selector');
88-
$selector = newv($selector_class, array());
87+
$selector = PhabricatorEnv::newObjectFromConfig('storage.engine-selector');
8988

9089
$engines = $selector->selectStorageEngines($data, $params);
9190
if (!$engines) {

src/applications/maniphest/editor/transaction/ManiphestTransactionEditor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,8 @@ private function sendEmail($task, $transactions, $email_to, $email_cc) {
284284
}
285285

286286
public function buildReplyHandler(ManiphestTask $task) {
287-
$handler_class = PhabricatorEnv::getEnvConfig(
287+
$handler_object = PhabricatorEnv::newObjectFromConfig(
288288
'metamta.maniphest.reply-handler');
289-
290-
$handler_object = newv($handler_class, array());
291289
$handler_object->setMailReceiver($task);
292290

293291
return $handler_object;

src/applications/maniphest/extensions/base/ManiphestTaskExtensions.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* Copyright 2011 Facebook, Inc.
4+
* Copyright 2012 Facebook, Inc.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -30,8 +30,7 @@ abstract public function getAuxiliaryFieldSpecifications();
3030

3131
final public static function newExtensions() {
3232
$key = 'maniphest.custom-task-extensions-class';
33-
$class = PhabricatorEnv::getEnvConfig($key);
34-
return newv($class, array());
33+
return PhabricatorEnv::newObjectFromConfig($key);
3534
}
3635

3736
}

src/applications/maniphest/extensions/base/__init__.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@
88

99
phutil_require_module('phabricator', 'infrastructure/env');
1010

11-
phutil_require_module('phutil', 'utils');
12-
1311

1412
phutil_require_source('ManiphestTaskExtensions.php');

0 commit comments

Comments
 (0)