diff --git a/externals/jsonlint/src/Seld/JsonLint/JsonParser.php b/externals/jsonlint/src/Seld/JsonLint/JsonParser.php --- a/externals/jsonlint/src/Seld/JsonLint/JsonParser.php +++ b/externals/jsonlint/src/Seld/JsonLint/JsonParser.php @@ -229,7 +229,7 @@ // just recovered from another error if ($recovering == 3) { if ($symbol == $EOF) { - throw new JsonLintParsingException($errStr ? $errStr : 'Parsing halted.'); + throw new JsonLintParsingException($errStr ?: 'Parsing halted.'); } // discard current lookahead and grab another @@ -247,7 +247,7 @@ break; } if ($state == 0) { - throw new JsonLintParsingException($errStr ? $errStr : 'Parsing halted.'); + throw new JsonLintParsingException($errStr ?: 'Parsing halted.'); } $this->popStack(1); $state = $this->stack[count($this->stack)-1]; @@ -293,9 +293,9 @@ $yyval->token = $this->vstack[count($this->vstack) - $len]; // default to $$ = $1 // default location, uses first token for firsts, last for lasts $yyval->store = array( // _$ = store - 'first_line' => $this->lstack[count($this->lstack) - ($len ? $len : 1)]['first_line'], + 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'], 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'], - 'first_column' => $this->lstack[count($this->lstack) - ($len ? $len : 1)]['first_column'], + 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'], 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'], ); $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack); diff --git a/scripts/__init_script__.php b/scripts/__init_script__.php --- a/scripts/__init_script__.php +++ b/scripts/__init_script__.php @@ -1,3 +1,3 @@ setConduitCredentials($credentials); - $engine = id(new ArcanistConduitEngine()) + $engine = (new ArcanistConduitEngine()) ->setConduitURI($conduit_uri) ->setConduitToken($conduit_token); @@ -373,7 +373,7 @@ $arc .= csprintf(' --conduit-uri=%s', $conduit_uri); } - $conduit_domain = id(new PhutilURI($conduit_uri))->getDomain(); + $conduit_domain = (new PhutilURI($conduit_uri))->getDomain(); throw new ArcanistUsageException( phutil_console_format( @@ -404,7 +404,7 @@ "%s\n", pht("Registering event listener '%s'.", $listener)); try { - id(new $listener())->register(); + (new $listener())->register(); } catch (PhutilMissingSymbolException $ex) { // Continue anyway, since you may otherwise be unable to run commands // like `arc set-config events.listeners` in order to repair the damage @@ -687,7 +687,7 @@ // especially bizarre, but it allows `arc` to be used in automation // workflows more easily. For some context, see PHI13. - $executing_directory = dirname(dirname(__FILE__)); + $executing_directory = dirname(__DIR__); $working_directory = dirname($location); fwrite( diff --git a/scripts/hgdaemon/hgdaemon_client.php b/scripts/hgdaemon/hgdaemon_client.php --- a/scripts/hgdaemon/hgdaemon_client.php +++ b/scripts/hgdaemon/hgdaemon_client.php @@ -1,7 +1,7 @@ #!/usr/bin/env php parseStandardArguments(); diff --git a/scripts/hgdaemon/hgdaemon_server.php b/scripts/hgdaemon/hgdaemon_server.php --- a/scripts/hgdaemon/hgdaemon_server.php +++ b/scripts/hgdaemon/hgdaemon_server.php @@ -1,7 +1,7 @@ #!/usr/bin/env php parseStandardArguments(); diff --git a/src/__phutil_library_init__.php b/src/__phutil_library_init__.php --- a/src/__phutil_library_init__.php +++ b/src/__phutil_library_init__.php @@ -1,3 +1,3 @@ $ref_keys) { foreach ($ref_keys as $key) { - $commit_ref = id(new ArcanistCommitRef()) + $commit_ref = (new ArcanistCommitRef()) ->setCommitHash($commit_identifier); $results[$key][] = $commit_ref; } diff --git a/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php b/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php --- a/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php +++ b/src/browse/query/ArcanistBrowseRevisionURIHardpointQuery.php @@ -22,7 +22,7 @@ foreach ($refs as $key => $ref) { foreach ($ref->getCommitRefs() as $commit_ref) { $hash = $commit_ref->getCommitHash(); - $states[$hash] = id(new ArcanistWorkingCopyStateRef()) + $states[$hash] = (new ArcanistWorkingCopyStateRef()) ->setCommitRef($commit_ref); $map[$hash][] = $key; } diff --git a/src/browse/query/ArcanistBrowseURIHardpointQuery.php b/src/browse/query/ArcanistBrowseURIHardpointQuery.php --- a/src/browse/query/ArcanistBrowseURIHardpointQuery.php +++ b/src/browse/query/ArcanistBrowseURIHardpointQuery.php @@ -36,13 +36,13 @@ } public static function getAllBrowseQueries() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->execute(); } final protected function newBrowseURIRef() { - return id(new ArcanistBrowseURIRef()) + return (new ArcanistBrowseURIRef()) ->setType($this->getSupportedBrowseType()); } diff --git a/src/browse/workflow/ArcanistBrowseWorkflow.php b/src/browse/workflow/ArcanistBrowseWorkflow.php --- a/src/browse/workflow/ArcanistBrowseWorkflow.php +++ b/src/browse/workflow/ArcanistBrowseWorkflow.php @@ -69,7 +69,7 @@ } else { $refs = array(); foreach ($targets as $target) { - $refs[] = id(new ArcanistBrowseRef()) + $refs[] = (new ArcanistBrowseRef()) ->setToken($target); } } @@ -153,7 +153,7 @@ $is_single_ref = (count($refs) == 1); - $table = id(new PhutilConsoleTable()); + $table = (new PhutilConsoleTable()); if ($is_single_ref) { $table->addColumn('pick', array('title' => pht('Pick'))); diff --git a/src/channel/PhutilChannel.php b/src/channel/PhutilChannel.php --- a/src/channel/PhutilChannel.php +++ b/src/channel/PhutilChannel.php @@ -130,8 +130,8 @@ array $writes, array $options = array()) { - assert_instances_of($reads, __CLASS__); - assert_instances_of($writes, __CLASS__); + assert_instances_of($reads, self::class); + assert_instances_of($writes, self::class); $read = idx($options, 'read', array()); $write = idx($options, 'write', array()); diff --git a/src/channel/PhutilChannelChannel.php b/src/channel/PhutilChannelChannel.php --- a/src/channel/PhutilChannelChannel.php +++ b/src/channel/PhutilChannelChannel.php @@ -104,7 +104,7 @@ 'Do not call %s or %s directly on a %s. Instead, call %s or %s.', 'readBytes()', 'writeBytes()', - __CLASS__, + self::class, 'read()', 'write()')); } diff --git a/src/conduit/ArcanistConduitCallFuture.php b/src/conduit/ArcanistConduitCallFuture.php --- a/src/conduit/ArcanistConduitCallFuture.php +++ b/src/conduit/ArcanistConduitCallFuture.php @@ -111,7 +111,7 @@ } private function raiseException($summary, $title, $body) { - throw id(new ArcanistConduitAuthenticationException($summary)) + throw (new ArcanistConduitAuthenticationException($summary)) ->setTitle($title) ->setBody($body); } diff --git a/src/conduit/ArcanistConduitEngine.php b/src/conduit/ArcanistConduitEngine.php --- a/src/conduit/ArcanistConduitEngine.php +++ b/src/conduit/ArcanistConduitEngine.php @@ -46,7 +46,7 @@ $future = $this->getClient()->callMethod($method, $parameters); - $call_future = id(new ArcanistConduitCallFuture($future)) + $call_future = (new ArcanistConduitCallFuture($future)) ->setEngine($this); return $call_future; @@ -75,7 +75,7 @@ } private function raiseURIException() { - $list = id(new PhutilConsoleList()) + $list = (new PhutilConsoleList()) ->addItem( pht( 'Run in a working copy with "phabricator.uri" set in ".arcconfig".')) @@ -86,7 +86,7 @@ pht( 'Specify a URI explicitly with `--config phabricator.uri=`.')); - $block = id(new PhutilConsoleBlock()) + $block = (new PhutilConsoleBlock()) ->addParagraph( pht( 'This command needs to communicate with a server, but no '. diff --git a/src/conduit/ConduitClient.php b/src/conduit/ConduitClient.php --- a/src/conduit/ConduitClient.php +++ b/src/conduit/ConduitClient.php @@ -135,7 +135,7 @@ $params['__conduit__'] = $meta; } - $uri = id(clone $this->uri)->setPath('/api/'.$method); + $uri = (clone $this->uri)->setPath('/api/'.$method); $data = array( 'params' => json_encode($params), @@ -177,7 +177,7 @@ $this->password); } - return id(new ConduitFuture($core_future)) + return (new ConduitFuture($core_future)) ->setClient($this, $method); } diff --git a/src/config/ArcanistConfigurationEngine.php b/src/config/ArcanistConfigurationEngine.php --- a/src/config/ArcanistConfigurationEngine.php +++ b/src/config/ArcanistConfigurationEngine.php @@ -221,7 +221,7 @@ } private function newEngineExtensions() { - return id(new PhutilClassMapQuery()) + return (new PhutilClassMapQuery()) ->setAncestorClass('ArcanistConfigurationEngineExtension') ->setUniqueMethod('getExtensionKey') ->setContinueOnFailure(true) diff --git a/src/config/arc/ArcanistArcConfigurationEngineExtension.php b/src/config/arc/ArcanistArcConfigurationEngineExtension.php --- a/src/config/arc/ArcanistArcConfigurationEngineExtension.php +++ b/src/config/arc/ArcanistArcConfigurationEngineExtension.php @@ -50,7 +50,7 @@ return array( - id(new ArcanistStringConfigOption()) + (new ArcanistStringConfigOption()) ->setKey('base') ->setSummary(pht('Ruleset for selecting commit ranges.')) ->setHelp( @@ -62,7 +62,7 @@ array( 'arc:amended, arc:prompt', )), - id(new ArcanistStringConfigOption()) + (new ArcanistStringConfigOption()) ->setKey('repository') ->setAliases( array( @@ -82,7 +82,7 @@ 'R123', '123', )), - id(new ArcanistStringConfigOption()) + (new ArcanistStringConfigOption()) ->setKey('phabricator.uri') ->setAliases( array( @@ -99,7 +99,7 @@ array( 'https://devtools.example.com/', )), - id(new ArcanistAliasesConfigOption()) + (new ArcanistAliasesConfigOption()) ->setKey(self::KEY_ALIASES) ->setDefaultValue(array()) ->setSummary(pht('List of command aliases.')) @@ -107,7 +107,7 @@ pht( 'Configured command aliases. Use the "alias" workflow to define '. 'aliases.')), - id(new ArcanistPromptsConfigOption()) + (new ArcanistPromptsConfigOption()) ->setKey(self::KEY_PROMPTS) ->setDefaultValue(array()) ->setSummary(pht('List of prompt responses.')) @@ -115,7 +115,7 @@ pht( 'Configured prompt aliases. Use the "prompts" workflow to '. 'show prompts and responses.')), - id(new ArcanistStringListConfigOption()) + (new ArcanistStringListConfigOption()) ->setKey('arc.land.onto') ->setDefaultValue(array()) ->setSummary(pht('Default list of "onto" refs for "arc land".')) @@ -127,7 +127,7 @@ array( '["master"]', )), - id(new ArcanistStringListConfigOption()) + (new ArcanistStringListConfigOption()) ->setKey('pager') ->setDefaultValue(array()) ->setSummary(pht('Default pager command.')) @@ -139,7 +139,7 @@ array( '["less", "-R", "--"]', )), - id(new ArcanistStringConfigOption()) + (new ArcanistStringConfigOption()) ->setKey('arc.land.onto-remote') ->setSummary(pht('Default list of "onto" remote for "arc land".')) ->setHelp( @@ -150,7 +150,7 @@ array( 'origin', )), - id(new ArcanistStringConfigOption()) + (new ArcanistStringConfigOption()) ->setKey('arc.land.strategy') ->setSummary( pht( diff --git a/src/config/source/ArcanistDefaultsConfigurationSource.php b/src/config/source/ArcanistDefaultsConfigurationSource.php --- a/src/config/source/ArcanistDefaultsConfigurationSource.php +++ b/src/config/source/ArcanistDefaultsConfigurationSource.php @@ -8,7 +8,7 @@ } public function __construct() { - $values = id(new ArcanistConfigurationEngine()) + $values = (new ArcanistConfigurationEngine()) ->newDefaults(); parent::__construct($values); diff --git a/src/config/source/ArcanistFilesystemConfigurationSource.php b/src/config/source/ArcanistFilesystemConfigurationSource.php --- a/src/config/source/ArcanistFilesystemConfigurationSource.php +++ b/src/config/source/ArcanistFilesystemConfigurationSource.php @@ -36,7 +36,7 @@ } protected function writeToStorage($values) { - $content = id(new PhutilJSON()) + $content = (new PhutilJSON()) ->encodeFormatted($values); $path = $this->path; diff --git a/src/configuration/ArcanistConfiguration.php b/src/configuration/ArcanistConfiguration.php --- a/src/configuration/ArcanistConfiguration.php +++ b/src/configuration/ArcanistConfiguration.php @@ -38,7 +38,7 @@ } public function buildAllWorkflows() { - return id(new PhutilClassMapQuery()) + return (new PhutilClassMapQuery()) ->setAncestorClass('ArcanistWorkflow') ->setUniqueMethod('getWorkflowName') ->execute(); diff --git a/src/configuration/ArcanistSetting.php b/src/configuration/ArcanistSetting.php --- a/src/configuration/ArcanistSetting.php +++ b/src/configuration/ArcanistSetting.php @@ -38,8 +38,8 @@ } final public static function getAllSettings() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->setUniqueMethod('getSettingKey') ->setSortMethod('getSettingKey') ->execute(); diff --git a/src/console/PhutilConsole.php b/src/console/PhutilConsole.php --- a/src/console/PhutilConsole.php +++ b/src/console/PhutilConsole.php @@ -104,7 +104,7 @@ public function confirm($prompt, $default = false) { - $message = id(new PhutilConsoleMessage()) + $message = (new PhutilConsoleMessage()) ->setType(PhutilConsoleMessage::TYPE_CONFIRM) ->setData( array( @@ -119,7 +119,7 @@ } public function prompt($prompt, $history = '') { - $message = id(new PhutilConsoleMessage()) + $message = (new PhutilConsoleMessage()) ->setType(PhutilConsoleMessage::TYPE_PROMPT) ->setData( array( @@ -134,7 +134,7 @@ } public function sendMessage($data) { - $message = id(new PhutilConsoleMessage())->setData($data); + $message = (new PhutilConsoleMessage())->setData($data); return $this->writeMessage($message); } @@ -180,7 +180,7 @@ private function writeTextMessage($type, array $argv) { - $message = id(new PhutilConsoleMessage()) + $message = (new PhutilConsoleMessage()) ->setType($type) ->setData($argv); @@ -250,7 +250,7 @@ } public function isLogEnabled() { - $message = id(new PhutilConsoleMessage()) + $message = (new PhutilConsoleMessage()) ->setType(PhutilConsoleMessage::TYPE_ENABLED) ->setData( array( @@ -264,7 +264,7 @@ } public function isErrATTY() { - $message = id(new PhutilConsoleMessage()) + $message = (new PhutilConsoleMessage()) ->setType(PhutilConsoleMessage::TYPE_TTY) ->setData( array( @@ -278,7 +278,7 @@ } public function getErrCols() { - $message = id(new PhutilConsoleMessage()) + $message = (new PhutilConsoleMessage()) ->setType(PhutilConsoleMessage::TYPE_COLS) ->setData( array( diff --git a/src/console/PhutilConsoleFormatter.php b/src/console/PhutilConsoleFormatter.php --- a/src/console/PhutilConsoleFormatter.php +++ b/src/console/PhutilConsoleFormatter.php @@ -102,7 +102,7 @@ $format = preg_replace($invert_re, $invert, $format); $format = preg_replace_callback( '@<(fg|bg):('.$colors.')>(.*)@sU', - array(__CLASS__, 'replaceColorCode'), + array(self::class, 'replaceColorCode'), $format); } diff --git a/src/console/PhutilConsoleMetrics.php b/src/console/PhutilConsoleMetrics.php --- a/src/console/PhutilConsoleMetrics.php +++ b/src/console/PhutilConsoleMetrics.php @@ -46,7 +46,7 @@ // NOTE: We can't just execute this because it won't be connected to a TTY // if we do. - $err = id(new PhutilExecPassthru('tput cols > %s', $tmp)) + $err = (new PhutilExecPassthru('tput cols > %s', $tmp)) ->resolve(); $stdout = Filesystem::readFile($tmp); unset($tmp); diff --git a/src/console/PhutilConsoleProgressBar.php b/src/console/PhutilConsoleProgressBar.php --- a/src/console/PhutilConsoleProgressBar.php +++ b/src/console/PhutilConsoleProgressBar.php @@ -5,7 +5,7 @@ * * // Create a progress bar, and configure the total amount of work that * // needs to be done. - * $bar = id(new PhutilConsoleProgressBar()) + * $bar = (new PhutilConsoleProgressBar()) * ->setTotal(count($stuff)); * * // As you complete the work, update the progress bar. diff --git a/src/console/PhutilConsoleServerChannel.php b/src/console/PhutilConsoleServerChannel.php --- a/src/console/PhutilConsoleServerChannel.php +++ b/src/console/PhutilConsoleServerChannel.php @@ -3,7 +3,7 @@ final class PhutilConsoleServerChannel extends PhutilChannelChannel { public function didReceiveStderr(PhutilExecChannel $channel, $stderr) { - $message = id(new PhutilConsoleMessage()) + $message = (new PhutilConsoleMessage()) ->setType(PhutilConsoleMessage::TYPE_ERR) ->setData(array('%s', $stderr)); $this->getUnderlyingChannel()->addMessage($message); diff --git a/src/console/PhutilInteractiveEditor.php b/src/console/PhutilInteractiveEditor.php --- a/src/console/PhutilInteractiveEditor.php +++ b/src/console/PhutilInteractiveEditor.php @@ -3,7 +3,7 @@ /** * Edit a document interactively, by launching $EDITOR (like vi or nano). * - * $result = id(new InteractiveEditor($document)) + * $result = (new InteractiveEditor($document)) * ->setName('shopping_list') * ->setLineOffset(15) * ->editInteractively(); diff --git a/src/console/grid/ArcanistGridRow.php b/src/console/grid/ArcanistGridRow.php --- a/src/console/grid/ArcanistGridRow.php +++ b/src/console/grid/ArcanistGridRow.php @@ -6,7 +6,7 @@ private $cells; public function setCells(array $cells) { - $cells = id(new PhutilArrayCheck()) + $cells = (new PhutilArrayCheck()) ->setInstancesOf('ArcanistGridCell') ->setUniqueMethod('getKey') ->setContext($this, 'setCells') diff --git a/src/console/grid/ArcanistGridView.php b/src/console/grid/ArcanistGridView.php --- a/src/console/grid/ArcanistGridView.php +++ b/src/console/grid/ArcanistGridView.php @@ -19,7 +19,7 @@ } public function newColumn($key) { - $column = id(new ArcanistGridColumn()) + $column = (new ArcanistGridColumn()) ->setKey($key); $this->columns[$key] = $column; @@ -30,7 +30,7 @@ public function newRow(array $cells) { assert_instances_of($cells, 'ArcanistGridCell'); - $row = id(new ArcanistGridRow()) + $row = (new ArcanistGridRow()) ->setCells($cells); $this->rows[] = $row; @@ -287,7 +287,7 @@ $line = phutil_string_cast($line); - return id(new PhutilUTF8StringTruncator()) + return (new PhutilUTF8StringTruncator()) ->setMaximumGlyphs($dst_width) ->truncateString($line); } diff --git a/src/console/view/PhutilConsoleTable.php b/src/console/view/PhutilConsoleTable.php --- a/src/console/view/PhutilConsoleTable.php +++ b/src/console/view/PhutilConsoleTable.php @@ -3,7 +3,7 @@ /** * Show a table in the console. Usage: * - * $table = id(new PhutilConsoleTable()) + * $table = (new PhutilConsoleTable()) * ->addColumn('id', array('title' => 'ID', 'align' => 'right')) * ->addColumn('name', array('title' => 'Username', 'align' => 'center')) * ->addColumn('email', array('title' => 'Email Address')) diff --git a/src/difference/ArcanistDiffUtils.php b/src/difference/ArcanistDiffUtils.php --- a/src/difference/ArcanistDiffUtils.php +++ b/src/difference/ArcanistDiffUtils.php @@ -94,7 +94,7 @@ } public static function generateEditString(array $ov, array $nv, $max = 80) { - return id(new PhutilEditDistanceMatrix()) + return (new PhutilEditDistanceMatrix()) ->setComputeString(true) ->setAlterCost(1 / ($max * 2)) ->setReplaceCost(2) diff --git a/src/difference/ArcanistDiffVectorNode.php b/src/difference/ArcanistDiffVectorNode.php --- a/src/difference/ArcanistDiffVectorNode.php +++ b/src/difference/ArcanistDiffVectorNode.php @@ -39,7 +39,7 @@ $element = $vector[$idx]; if (!isset($this->children[$element])) { - $this->children[$element] = id(new self()) + $this->children[$element] = (new self()) ->setParentNode($this) ->setVector(array_slice($vector, 0, $idx + 1)); } diff --git a/src/error/PhutilErrorHandler.php b/src/error/PhutilErrorHandler.php --- a/src/error/PhutilErrorHandler.php +++ b/src/error/PhutilErrorHandler.php @@ -53,8 +53,8 @@ */ public static function initialize() { self::$initialized = true; - set_error_handler(array(__CLASS__, 'handleError')); - set_exception_handler(array(__CLASS__, 'handleException')); + set_error_handler(array(self::class, 'handleError')); + set_exception_handler(array(self::class, 'handleException')); } /** diff --git a/src/filesystem/FileFinder.php b/src/filesystem/FileFinder.php --- a/src/filesystem/FileFinder.php +++ b/src/filesystem/FileFinder.php @@ -5,7 +5,7 @@ * this class is straightforward: * * // Find PHP files in /tmp - * $files = id(new FileFinder('/tmp')) + * $files = (new FileFinder('/tmp')) * ->withType('f') * ->withSuffix('php') * ->find(); @@ -238,7 +238,7 @@ "Invalid %s root directory specified ('%s'). Root directory ". "must be a directory, be readable, and be specified with an ". "absolute path.", - __CLASS__, + self::class, $this->root)); } diff --git a/src/filesystem/PhutilLock.php b/src/filesystem/PhutilLock.php --- a/src/filesystem/PhutilLock.php +++ b/src/filesystem/PhutilLock.php @@ -104,7 +104,7 @@ */ protected static function registerLock(PhutilLock $lock) { if (!self::$registeredShutdownFunction) { - register_shutdown_function(array(__CLASS__, 'unlockAll')); + register_shutdown_function(array(self::class, 'unlockAll')); self::$registeredShutdownFunction = true; } diff --git a/src/filesystem/PhutilProcessQuery.php b/src/filesystem/PhutilProcessQuery.php --- a/src/filesystem/PhutilProcessQuery.php +++ b/src/filesystem/PhutilProcessQuery.php @@ -35,7 +35,7 @@ $parts = preg_split('/\s+/', trim($process), 2); list($pid, $command) = $parts; - $ref = id(new PhutilProcessRef()) + $ref = (new PhutilProcessRef()) ->setPID((int)$pid); $argv = $this->getArgv($pid, $command); diff --git a/src/filesystem/binary/PhutilBinaryAnalyzer.php b/src/filesystem/binary/PhutilBinaryAnalyzer.php --- a/src/filesystem/binary/PhutilBinaryAnalyzer.php +++ b/src/filesystem/binary/PhutilBinaryAnalyzer.php @@ -43,8 +43,8 @@ } final public static function getAllBinaries() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->setUniqueMethod('getBinaryKey') ->setSortMethod('getBinaryName') ->execute(); diff --git a/src/filesystem/binary/PhutilMercurialBinaryAnalyzer.php b/src/filesystem/binary/PhutilMercurialBinaryAnalyzer.php --- a/src/filesystem/binary/PhutilMercurialBinaryAnalyzer.php +++ b/src/filesystem/binary/PhutilMercurialBinaryAnalyzer.php @@ -11,7 +11,7 @@ const CAPABILTIY_ANNOTATE_TEMPLATES = 'annotate_templates'; protected function newBinaryVersion() { - $future = id(new ExecFuture('hg --version --quiet')) + $future = (new ExecFuture('hg --version --quiet')) ->setEnv( array( 'HGPLAIN' => 1, diff --git a/src/filesystem/linesofalarge/LinesOfALargeExecFuture.php b/src/filesystem/linesofalarge/LinesOfALargeExecFuture.php --- a/src/filesystem/linesofalarge/LinesOfALargeExecFuture.php +++ b/src/filesystem/linesofalarge/LinesOfALargeExecFuture.php @@ -73,7 +73,7 @@ "You can not reiterate over a %s object. The entire goal of the ". "construct is to avoid keeping output in memory. What you are ". "attempting to do is silly and doesn't make any sense.", - __CLASS__)); + self::class)); } $this->didRewind = true; } diff --git a/src/future/FutureIterator.php b/src/future/FutureIterator.php --- a/src/future/FutureIterator.php +++ b/src/future/FutureIterator.php @@ -120,7 +120,7 @@ * null for key and value. Among other potential uses, you can use this to * show some busy indicator: * - * $futures = id(new FutureIterator($futures)) + * $futures = (new FutureIterator($futures)) * ->setUpdateInterval(1); * foreach ($futures as $future) { * if ($future === null) { @@ -148,7 +148,7 @@ /** * Limit the number of simultaneously executing futures. * - * $futures = id(new FutureIterator($futures)) + * $futures = (new FutureIterator($futures)) * ->limit(4); * foreach ($futures as $future) { * // Run no more than 4 futures simultaneously. @@ -436,7 +436,7 @@ // anything because the SIGCHLD will interrupt the stream_select(), as // long as we have a handler registered. if (function_exists('pcntl_signal')) { - if (!pcntl_signal(SIGCHLD, array(__CLASS__, 'handleSIGCHLD'))) { + if (!pcntl_signal(SIGCHLD, array(self::class, 'handleSIGCHLD'))) { throw new Exception(pht('Failed to install signal handler!')); } } diff --git a/src/future/aws/PhutilAWSFuture.php b/src/future/aws/PhutilAWSFuture.php --- a/src/future/aws/PhutilAWSFuture.php +++ b/src/future/aws/PhutilAWSFuture.php @@ -98,10 +98,10 @@ $path = $this->getPath(); $data = $this->getData(); - $uri = id(new PhutilURI("https://{$host}/", $params)) + $uri = (new PhutilURI("https://{$host}/", $params)) ->setPath($path); - $future = id(new HTTPSFuture($uri, $data)) + $future = (new HTTPSFuture($uri, $data)) ->setMethod($method); foreach ($this->headers as $header) { @@ -123,7 +123,7 @@ $region = $this->getRegion(); - id(new PhutilAWSv4Signature()) + (new PhutilAWSv4Signature()) ->setRegion($region) ->setService($this->getServiceName()) ->setAccessKey($access_key) diff --git a/src/future/github/PhutilGitHubFuture.php b/src/future/github/PhutilGitHubFuture.php --- a/src/future/github/PhutilGitHubFuture.php +++ b/src/future/github/PhutilGitHubFuture.php @@ -59,7 +59,7 @@ $future->setData($this->params); $future->addHeader('Authorization', 'token '.$this->accessToken); // NOTE: GitHub requires a 'User-Agent' header. - $future->addHeader('User-Agent', __CLASS__); + $future->addHeader('User-Agent', self::class); $future->setMethod($this->method); foreach ($this->headers as $header) { @@ -100,7 +100,7 @@ $ex); } - return id(new PhutilGitHubResponse()) + return (new PhutilGitHubResponse()) ->setStatus($status) ->setHeaders($headers) ->setBody($data); diff --git a/src/future/http/HTTPFuture.php b/src/future/http/HTTPFuture.php --- a/src/future/http/HTTPFuture.php +++ b/src/future/http/HTTPFuture.php @@ -67,7 +67,7 @@ if (isset($parts['user']) || isset($parts['pass'])) { throw new Exception( - pht('HTTP Basic Auth is not supported by %s.', __CLASS__)); + pht('HTTP Basic Auth is not supported by %s.', self::class)); } if (isset($parts['path'])) { @@ -109,7 +109,7 @@ } private function getDefaultUserAgent() { - return __CLASS__.'/1.0'; + return self::class.'/1.0'; } public function isReady() { diff --git a/src/future/http/HTTPSFuture.php b/src/future/http/HTTPSFuture.php --- a/src/future/http/HTTPSFuture.php +++ b/src/future/http/HTTPSFuture.php @@ -199,7 +199,7 @@ '%s currently supports only one file attachment for each '. 'parameter name. You are trying to attach two different files with '. 'the same parameter, "%s".', - __CLASS__, + self::class, $key)); } @@ -218,7 +218,7 @@ } $uri = $this->getURI(); - $domain = id(new PhutilURI($uri))->getDomain(); + $domain = (new PhutilURI($uri))->getDomain(); $is_download = $this->isDownload(); @@ -457,7 +457,7 @@ } if ($use_streaming_parser) { - $streaming_parser = id(new PhutilHTTPResponseParser()) + $streaming_parser = (new PhutilHTTPResponseParser()) ->setFollowLocationHeaders($this->getFollowLocation()); if ($this->downloadHandle) { diff --git a/src/future/http/PhutilHTTPEngineExtension.php b/src/future/http/PhutilHTTPEngineExtension.php --- a/src/future/http/PhutilHTTPEngineExtension.php +++ b/src/future/http/PhutilHTTPEngineExtension.php @@ -71,8 +71,8 @@ } final public static function getAllExtensions() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->setUniqueMethod('getExtensionKey') ->execute(); } diff --git a/src/future/paypal/PhutilPayPalAPIFuture.php b/src/future/paypal/PhutilPayPalAPIFuture.php --- a/src/future/paypal/PhutilPayPalAPIFuture.php +++ b/src/future/paypal/PhutilPayPalAPIFuture.php @@ -60,7 +60,7 @@ $params['PWD'] = $this->apiPassword; $params['SIGNATURE'] = $this->apiSignature; - $this->future = id(new HTTPSFuture($this->getHost(), $params)) + $this->future = (new HTTPSFuture($this->getHost(), $params)) ->setMethod('POST'); } diff --git a/src/future/postmark/PhutilPostmarkFuture.php b/src/future/postmark/PhutilPostmarkFuture.php --- a/src/future/postmark/PhutilPostmarkFuture.php +++ b/src/future/postmark/PhutilPostmarkFuture.php @@ -47,12 +47,12 @@ throw new PhutilInvalidStateException('setMethod'); } - $uri = id(new PhutilURI('https://api.postmarkapp.com/')) + $uri = (new PhutilURI('https://api.postmarkapp.com/')) ->setPath('/'.$this->method); $request_body = phutil_json_encode($this->parameters); - $future = id(new HTTPSFuture($uri)) + $future = (new HTTPSFuture($uri)) ->setData($request_body) ->setMethod('POST') ->addHeader('X-Postmark-Server-Token', $this->accessToken) diff --git a/src/hardpoint/ArcanistHardpointEngine.php b/src/hardpoint/ArcanistHardpointEngine.php --- a/src/hardpoint/ArcanistHardpointEngine.php +++ b/src/hardpoint/ArcanistHardpointEngine.php @@ -126,7 +126,7 @@ $request->setHardpointDefinition($definition); foreach ($load as $query_key => $object_map) { - $query = id(clone $queries[$query_key]); + $query = (clone $queries[$query_key]); $task = $request->newTask() ->setQuery($query) @@ -192,7 +192,7 @@ $wait_futures = $this->waitFutures; if ($wait_futures) { if (!$this->futureIterator) { - $iterator = id(new FutureIterator(array())) + $iterator = (new FutureIterator(array())) ->limit(32); foreach ($wait_futures as $wait_future) { $iterator->addFuture($wait_future); diff --git a/src/hardpoint/ArcanistHardpointObject.php b/src/hardpoint/ArcanistHardpointObject.php --- a/src/hardpoint/ArcanistHardpointObject.php +++ b/src/hardpoint/ArcanistHardpointObject.php @@ -61,12 +61,12 @@ } final protected function newHardpoint($hardpoint_key) { - return id(new ArcanistScalarHardpoint()) + return (new ArcanistScalarHardpoint()) ->setHardpointKey($hardpoint_key); } final protected function newVectorHardpoint($hardpoint_key) { - return id(new ArcanistVectorHardpoint()) + return (new ArcanistVectorHardpoint()) ->setHardpointKey($hardpoint_key); } @@ -74,7 +74,7 @@ $hardpoint_key, ArcanistHardpoint $template) { - return id(clone $template) + return (clone $template) ->setHardpointKey($hardpoint_key); } diff --git a/src/hardpoint/ArcanistHardpointRequest.php b/src/hardpoint/ArcanistHardpointRequest.php --- a/src/hardpoint/ArcanistHardpointRequest.php +++ b/src/hardpoint/ArcanistHardpointRequest.php @@ -16,7 +16,7 @@ } if (is_string($spec)) { - return id(new self())->setHardpoint($spec); + return (new self())->setHardpoint($spec); } throw new Exception( @@ -53,7 +53,7 @@ } public function newTask() { - $task = id(new ArcanistHardpointTask()) + $task = (new ArcanistHardpointTask()) ->setRequest($this); $this->tasks[] = $task; diff --git a/src/init/init-library.php b/src/init/init-library.php --- a/src/init/init-library.php +++ b/src/init/init-library.php @@ -1,6 +1,6 @@ withSuffix('php') ->withType('f') ->withFollowSymlinks(true) diff --git a/src/inspector/ArcanistBrowseRefInspector.php b/src/inspector/ArcanistBrowseRefInspector.php --- a/src/inspector/ArcanistBrowseRefInspector.php +++ b/src/inspector/ArcanistBrowseRefInspector.php @@ -15,7 +15,7 @@ 'token.')); } - return id(new ArcanistBrowseRef()) + return (new ArcanistBrowseRef()) ->setToken($argv[0]); } diff --git a/src/inspector/ArcanistRefInspector.php b/src/inspector/ArcanistRefInspector.php --- a/src/inspector/ArcanistRefInspector.php +++ b/src/inspector/ArcanistRefInspector.php @@ -22,8 +22,8 @@ } final public static function getAllInspectors() { - $base_inspectors = id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + $base_inspectors = (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->execute(); $results = array(); diff --git a/src/inspector/ArcanistWorkingCopyStateRefInspector.php b/src/inspector/ArcanistWorkingCopyStateRefInspector.php --- a/src/inspector/ArcanistWorkingCopyStateRefInspector.php +++ b/src/inspector/ArcanistWorkingCopyStateRefInspector.php @@ -16,10 +16,10 @@ } $commit_hash = $argv[0]; - $commit_ref = id(new ArcanistCommitRef()) + $commit_ref = (new ArcanistCommitRef()) ->setCommitHash($commit_hash); - return id(new ArcanistWorkingCopyStateRef()) + return (new ArcanistWorkingCopyStateRef()) ->setCommitRef($commit_ref); } diff --git a/src/internationalization/PhutilLocale.php b/src/internationalization/PhutilLocale.php --- a/src/internationalization/PhutilLocale.php +++ b/src/internationalization/PhutilLocale.php @@ -142,8 +142,8 @@ static $locales; if ($locales === null) { - $objects = id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + $objects = (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->execute(); $locale_map = array(); @@ -157,7 +157,7 @@ 'Two subclasses of "%s" ("%s" and "%s") define '. 'locales with the same locale code ("%s"). Each locale must '. 'have a unique locale code.', - __CLASS__, + self::class, get_class($object), get_class($locale_map[$locale_code]), $locale_code)); diff --git a/src/internationalization/PhutilTranslation.php b/src/internationalization/PhutilTranslation.php --- a/src/internationalization/PhutilTranslation.php +++ b/src/internationalization/PhutilTranslation.php @@ -47,8 +47,8 @@ * @return list List of available translation sources. */ public static function loadAllTranslations() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->execute(); } diff --git a/src/land/ArcanistLandCommit.php b/src/land/ArcanistLandCommit.php --- a/src/land/ArcanistLandCommit.php +++ b/src/land/ArcanistLandCommit.php @@ -37,7 +37,7 @@ public function getDisplaySummary() { if ($this->displaySummary === null) { - $this->displaySummary = id(new PhutilUTF8StringTruncator()) + $this->displaySummary = (new PhutilUTF8StringTruncator()) ->setMaximumGlyphs(64) ->truncateString($this->getSummary()); } diff --git a/src/land/engine/ArcanistGitLandEngine.php b/src/land/engine/ArcanistGitLandEngine.php --- a/src/land/engine/ArcanistGitLandEngine.php +++ b/src/land/engine/ArcanistGitLandEngine.php @@ -990,7 +990,7 @@ continue; } - $new_markers[] = id(new ArcanistMarkerRef()) + $new_markers[] = (new ArcanistMarkerRef()) ->setMarkerType(ArcanistMarkerRef::TYPE_BRANCH) ->setName($onto_ref); } @@ -1418,7 +1418,7 @@ return $into_commit; } - $target = id(new ArcanistLandTarget()) + $target = (new ArcanistLandTarget()) ->setRemote($this->getIntoRemote()) ->setRef($this->getIntoRef()); @@ -1587,7 +1587,7 @@ $summary = $parts[2]; - $commit_map[$hash] = id(new ArcanistLandCommit()) + $commit_map[$hash] = (new ArcanistLandCommit()) ->setHash($hash) ->setParents($parents) ->setSummary($summary); diff --git a/src/land/engine/ArcanistLandEngine.php b/src/land/engine/ArcanistLandEngine.php --- a/src/land/engine/ArcanistLandEngine.php +++ b/src/land/engine/ArcanistLandEngine.php @@ -804,10 +804,10 @@ foreach ($commit_map as $commit) { $hash = $commit->getHash(); - $commit_ref = id(new ArcanistCommitRef()) + $commit_ref = (new ArcanistCommitRef()) ->setCommitHash($hash); - $state_ref = id(new ArcanistWorkingCopyStateRef()) + $state_ref = (new ArcanistWorkingCopyStateRef()) ->setCommitRef($commit_ref); $state_refs[$hash] = $state_ref; @@ -1111,7 +1111,7 @@ $symbols = array(); foreach ($raw_symbols as $raw_symbol) { - $symbols[] = id(new ArcanistLandSymbol()) + $symbols[] = (new ArcanistLandSymbol()) ->setSymbol($raw_symbol); } @@ -1183,7 +1183,7 @@ foreach ($revision_groups as $revision_phid => $group) { $revision_ref = head($group)->getRevisionRef(); - $set = id(new ArcanistLandCommitSet()) + $set = (new ArcanistLandCommitSet()) ->setRevisionRef($revision_ref) ->setCommits($group); @@ -1381,7 +1381,7 @@ // need it, since loading it requires a relatively expensive Conduit call. $revision_symbol = $this->getRevisionSymbol(); if ($revision_symbol) { - $symbol_ref = id(new ArcanistRevisionSymbolRef()) + $symbol_ref = (new ArcanistRevisionSymbolRef()) ->setSymbol($revision_symbol); $this->setRevisionSymbolRef($symbol_ref); } @@ -1612,7 +1612,7 @@ } final protected function getOntoRemoteRef() { - return id(new ArcanistRemoteRef()) + return (new ArcanistRemoteRef()) ->setRemoteName($this->getOntoRemote()); } diff --git a/src/land/engine/ArcanistMercurialLandEngine.php b/src/land/engine/ArcanistMercurialLandEngine.php --- a/src/land/engine/ArcanistMercurialLandEngine.php +++ b/src/land/engine/ArcanistMercurialLandEngine.php @@ -294,7 +294,7 @@ pht( 'TODO: Ambiguous ref.')); } else if (!$match_count) { - $new_bookmark = id(new ArcanistMarkerRef()) + $new_bookmark = (new ArcanistMarkerRef()) ->setMarkerType(ArcanistMarkerRef::TYPE_BOOKMARK) ->setName($onto_ref) ->attachRemoteRef($remote_ref); @@ -528,7 +528,7 @@ return $into_commit; } - $target = id(new ArcanistLandTarget()) + $target = (new ArcanistLandTarget()) ->setRemote($this->getIntoRemote()) ->setRef($this->getIntoRef()); @@ -577,7 +577,7 @@ $target_name = $target->getRef(); - $remote_ref = id(new ArcanistRemoteRef()) + $remote_ref = (new ArcanistRemoteRef()) ->setRemoteName($target->getRemote()); $markers = $api->newMarkerRefQuery() @@ -750,7 +750,7 @@ $summary = $parts[2]; - $commit_map[$hash] = id(new ArcanistLandCommit()) + $commit_map[$hash] = (new ArcanistLandCommit()) ->setHash($hash) ->setParents($parents) ->setSummary($summary); diff --git a/src/lint/ArcanistLintMessage.php b/src/lint/ArcanistLintMessage.php --- a/src/lint/ArcanistLintMessage.php +++ b/src/lint/ArcanistLintMessage.php @@ -251,7 +251,7 @@ } public function setDependentMessages(array $messages) { - assert_instances_of($messages, __CLASS__); + assert_instances_of($messages, self::class); $this->dependentMessages = $messages; return $this; } @@ -368,7 +368,7 @@ } } - return id(clone $this) + return (clone $this) ->setOriginalText($original) ->setReplacementText($replacement) ->setLine($line) diff --git a/src/lint/engine/ArcanistComprehensiveLintEngine.php b/src/lint/engine/ArcanistComprehensiveLintEngine.php --- a/src/lint/engine/ArcanistComprehensiveLintEngine.php +++ b/src/lint/engine/ArcanistComprehensiveLintEngine.php @@ -19,25 +19,25 @@ } $text_paths = preg_grep('/\.(php|css|hpp|cpp|l|y|py|pl)$/', $paths); - $linters[] = id(new ArcanistGeneratedLinter())->setPaths($text_paths); - $linters[] = id(new ArcanistNoLintLinter())->setPaths($text_paths); - $linters[] = id(new ArcanistTextLinter())->setPaths($text_paths); + $linters[] = (new ArcanistGeneratedLinter())->setPaths($text_paths); + $linters[] = (new ArcanistNoLintLinter())->setPaths($text_paths); + $linters[] = (new ArcanistTextLinter())->setPaths($text_paths); - $linters[] = id(new ArcanistFilenameLinter())->setPaths($paths); + $linters[] = (new ArcanistFilenameLinter())->setPaths($paths); - $linters[] = id(new ArcanistXHPASTLinter()) + $linters[] = (new ArcanistXHPASTLinter()) ->setPaths(preg_grep('/\.php$/', $paths)); $py_paths = preg_grep('/\.py$/', $paths); - $linters[] = id(new ArcanistPyFlakesLinter())->setPaths($py_paths); - $linters[] = id(new ArcanistPEP8Linter()) + $linters[] = (new ArcanistPyFlakesLinter())->setPaths($py_paths); + $linters[] = (new ArcanistPEP8Linter()) ->setFlags($this->getPEP8WithTextOptions()) ->setPaths($py_paths); - $linters[] = id(new ArcanistRubyLinter()) + $linters[] = (new ArcanistRubyLinter()) ->setPaths(preg_grep('/\.rb$/', $paths)); - $linters[] = id(new ArcanistJSHintLinter()) + $linters[] = (new ArcanistJSHintLinter()) ->setPaths(preg_grep('/\.js$/', $paths)); return $linters; diff --git a/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php b/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php --- a/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php +++ b/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php @@ -137,7 +137,7 @@ } private function loadAvailableLinters() { - return id(new PhutilClassMapQuery()) + return (new PhutilClassMapQuery()) ->setAncestorClass('ArcanistLinter') ->setUniqueMethod('getLinterConfigurationName', true) ->execute(); diff --git a/src/lint/engine/ArcanistLintEngine.php b/src/lint/engine/ArcanistLintEngine.php --- a/src/lint/engine/ArcanistLintEngine.php +++ b/src/lint/engine/ArcanistLintEngine.php @@ -184,7 +184,7 @@ foreach ($linters as $linter) { $version = get_class($linter).':'.$linter->getCacheVersion(); - $symbols = id(new PhutilSymbolLoader()) + $symbols = (new PhutilSymbolLoader()) ->setType('class') ->setName(get_class($linter)) ->selectSymbolsWithoutLoading(); diff --git a/src/lint/engine/ArcanistSingleLintEngine.php b/src/lint/engine/ArcanistSingleLintEngine.php --- a/src/lint/engine/ArcanistSingleLintEngine.php +++ b/src/lint/engine/ArcanistSingleLintEngine.php @@ -22,7 +22,7 @@ "You must configure '%s' with the name of a linter ". "in order to use %s.", $key, - __CLASS__)); + self::class)); } if (!class_exists($linter_name)) { diff --git a/src/lint/linter/ArcanistBaseXHPASTLinter.php b/src/lint/linter/ArcanistBaseXHPASTLinter.php --- a/src/lint/linter/ArcanistBaseXHPASTLinter.php +++ b/src/lint/linter/ArcanistBaseXHPASTLinter.php @@ -86,7 +86,7 @@ $engine->setLinterResource($resource_key, $linter); } - $base_class = __CLASS__; + $base_class = self::class; if (!($linter instanceof $base_class)) { throw new Exception( pht( diff --git a/src/lint/linter/ArcanistCSSLintLinter.php b/src/lint/linter/ArcanistCSSLintLinter.php --- a/src/lint/linter/ArcanistCSSLintLinter.php +++ b/src/lint/linter/ArcanistCSSLintLinter.php @@ -81,7 +81,7 @@ $original_text = substr($original_text, $char - 1); } - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setLine($line) ->setChar($char) diff --git a/src/lint/linter/ArcanistCSharpLinter.php b/src/lint/linter/ArcanistCSharpLinter.php --- a/src/lint/linter/ArcanistCSharpLinter.php +++ b/src/lint/linter/ArcanistCSharpLinter.php @@ -196,7 +196,7 @@ public function didLintPaths(array $paths) { if ($this->futures) { - $futures = id(new FutureIterator($this->futures)) + $futures = (new FutureIterator($this->futures)) ->limit(8); foreach ($futures as $future) { $this->resolveFuture($future); diff --git a/src/lint/linter/ArcanistClosureLinter.php b/src/lint/linter/ArcanistClosureLinter.php --- a/src/lint/linter/ArcanistClosureLinter.php +++ b/src/lint/linter/ArcanistClosureLinter.php @@ -46,7 +46,7 @@ continue; } - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setLine($matches[1]) ->setName('GJSLINT'.$matches[2]) diff --git a/src/lint/linter/ArcanistCoffeeLintLinter.php b/src/lint/linter/ArcanistCoffeeLintLinter.php --- a/src/lint/linter/ArcanistCoffeeLintLinter.php +++ b/src/lint/linter/ArcanistCoffeeLintLinter.php @@ -94,7 +94,7 @@ // Column number is not provided in the output. // See https://github.com/clutchski/coffeelint/issues/87 - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setLine($report['lineNumber']) ->setCode($this->getLinterName()) diff --git a/src/lint/linter/ArcanistFutureLinter.php b/src/lint/linter/ArcanistFutureLinter.php --- a/src/lint/linter/ArcanistFutureLinter.php +++ b/src/lint/linter/ArcanistFutureLinter.php @@ -13,7 +13,7 @@ public function willLintPaths(array $paths) { $limit = $this->getFuturesLimit(); - $this->futures = id(new FutureIterator(array()))->limit($limit); + $this->futures = (new FutureIterator(array()))->limit($limit); foreach ($this->buildFutures($paths) as $path => $future) { $future->setFutureKey($path); $this->futures->addFuture($future); diff --git a/src/lint/linter/ArcanistJSONLinter.php b/src/lint/linter/ArcanistJSONLinter.php --- a/src/lint/linter/ArcanistJSONLinter.php +++ b/src/lint/linter/ArcanistJSONLinter.php @@ -37,7 +37,7 @@ $data = $this->getData($path); try { - id(new PhutilJSONParser())->parse($data); + (new PhutilJSONParser())->parse($data); } catch (PhutilJSONParserException $ex) { $this->raiseLintAtLine( $ex->getSourceLine(), diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php --- a/src/lint/linter/ArcanistLinter.php +++ b/src/lint/linter/ArcanistLinter.php @@ -405,7 +405,7 @@ $original = null, $replacement = null) { - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($this->getActivePath()) ->setLine($line) ->setChar($char) diff --git a/src/lint/linter/ArcanistPhpLinter.php b/src/lint/linter/ArcanistPhpLinter.php --- a/src/lint/linter/ArcanistPhpLinter.php +++ b/src/lint/linter/ArcanistPhpLinter.php @@ -70,7 +70,7 @@ if (preg_match($regex, $stdout, $matches)) { $code = $this->getLintCodeFromLinterConfigurationKey($matches['type']); - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setLine($matches['line']) ->setCode($this->getLinterName().$code) diff --git a/src/lint/linter/ArcanistPhpcsLinter.php b/src/lint/linter/ArcanistPhpcsLinter.php --- a/src/lint/linter/ArcanistPhpcsLinter.php +++ b/src/lint/linter/ArcanistPhpcsLinter.php @@ -112,7 +112,7 @@ $source = $child->getAttribute('source'); $code = 'PHPCS.'.$prefix.'.'.$source; - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setName($source) ->setLine($child->getAttribute('line')) diff --git a/src/lint/linter/ArcanistPhutilLibraryLinter.php b/src/lint/linter/ArcanistPhutilLibraryLinter.php --- a/src/lint/linter/ArcanistPhutilLibraryLinter.php +++ b/src/lint/linter/ArcanistPhutilLibraryLinter.php @@ -99,7 +99,7 @@ $root = phutil_get_library_root($library); try { - $symbols[$library] = id(new PhutilLibraryMapBuilder($root)) + $symbols[$library] = (new PhutilLibraryMapBuilder($root)) ->buildFileSymbolMap(); } catch (XHPASTSyntaxErrorException $ex) { // If the library contains a syntax error then there isn't much that we diff --git a/src/lint/linter/ArcanistPuppetLintLinter.php b/src/lint/linter/ArcanistPuppetLintLinter.php --- a/src/lint/linter/ArcanistPuppetLintLinter.php +++ b/src/lint/linter/ArcanistPuppetLintLinter.php @@ -108,7 +108,7 @@ continue; } - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setLine($matches[0]) ->setChar($matches[1]) diff --git a/src/lint/linter/ArcanistPyLintLinter.php b/src/lint/linter/ArcanistPyLintLinter.php --- a/src/lint/linter/ArcanistPyLintLinter.php +++ b/src/lint/linter/ArcanistPyLintLinter.php @@ -105,7 +105,7 @@ pht( '%s is not compatible with the installed version of pylint. '. 'Minimum version: %s; installed version: %s.', - __CLASS__, + self::class, $minimum_version, $installed_version)); } @@ -135,7 +135,7 @@ $char = (int)$matches[1]; $char = max(0, $char); - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setLine($matches[0]) ->setChar($char) diff --git a/src/lint/linter/ArcanistRuboCopLinter.php b/src/lint/linter/ArcanistRuboCopLinter.php --- a/src/lint/linter/ArcanistRuboCopLinter.php +++ b/src/lint/linter/ArcanistRuboCopLinter.php @@ -84,7 +84,7 @@ foreach ($results['files'] as $file) { foreach ($file['offenses'] as $offense) { - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($file['path']) ->setDescription($offense['message']) ->setLine($offense['location']['line']) diff --git a/src/lint/linter/ArcanistScriptAndRegexLinter.php b/src/lint/linter/ArcanistScriptAndRegexLinter.php --- a/src/lint/linter/ArcanistScriptAndRegexLinter.php +++ b/src/lint/linter/ArcanistScriptAndRegexLinter.php @@ -189,7 +189,7 @@ $futures[$path] = $future; } - $futures = id(new FutureIterator($futures)) + $futures = (new FutureIterator($futures)) ->limit(4); foreach ($futures as $path => $future) { list($stdout) = $future->resolvex(); @@ -226,7 +226,7 @@ pht( "%s: configuration captured a '%s' named capturing group, ". "'%s'. Script output:\n%s", - __CLASS__, + self::class, 'throw', $throw, $output)); diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -47,7 +47,7 @@ } public function getAdditionalInformation() { - $table = id(new PhutilConsoleTable()) + $table = (new PhutilConsoleTable()) ->setBorders(true) ->addColumn('id', array('title' => pht('ID'))) ->addColumn('class', array('title' => pht('Class'))) diff --git a/src/lint/linter/ArcanistXMLLinter.php b/src/lint/linter/ArcanistXMLLinter.php --- a/src/lint/linter/ArcanistXMLLinter.php +++ b/src/lint/linter/ArcanistXMLLinter.php @@ -44,10 +44,10 @@ } foreach (libxml_get_errors() as $error) { - $message = id(new ArcanistLintMessage()) + $message = (new ArcanistLintMessage()) ->setPath($path) ->setLine($error->line) - ->setChar($error->column ? $error->column : null) + ->setChar($error->column ?: null) ->setCode($this->getLintMessageFullCode($error->code)) ->setName(pht('LibXML Error')) ->setDescription(trim($error->message)); diff --git a/src/lint/linter/standards/ArcanistLinterStandard.php b/src/lint/linter/standards/ArcanistLinterStandard.php --- a/src/lint/linter/standards/ArcanistLinterStandard.php +++ b/src/lint/linter/standards/ArcanistLinterStandard.php @@ -91,8 +91,8 @@ * @return list */ final public static function loadAllStandards() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->setUniqueMethod('getKey') ->execute(); } diff --git a/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php b/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php --- a/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php +++ b/src/lint/linter/xhpast/ArcanistXHPASTLinterRule.php @@ -9,8 +9,8 @@ protected $windowsVersion; final public static function loadAllRules() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->setUniqueMethod('getLintID') ->execute(); } @@ -24,7 +24,7 @@ throw new Exception( pht( '`%s` class `%s` must define an ID constant.', - __CLASS__, + self::class, get_class($this))); } @@ -33,7 +33,7 @@ pht( '`%s` class `%s` has an invalid ID constant. '. 'ID must be an integer.', - __CLASS__, + self::class, get_class($this))); } diff --git a/src/lint/linter/xhpast/rules/ArcanistFormattedStringXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistFormattedStringXHPASTLinterRule.php --- a/src/lint/linter/xhpast/rules/ArcanistFormattedStringXHPASTLinterRule.php +++ b/src/lint/linter/xhpast/rules/ArcanistFormattedStringXHPASTLinterRule.php @@ -94,7 +94,7 @@ $argv = array($format->evalStatic()) + array_fill(0, $argc, null); try { - xsprintf(array(__CLASS__, 'processXsprintfCallback'), null, $argv); + xsprintf(array(self::class, 'processXsprintfCallback'), null, $argv); } catch (BadFunctionCallException $ex) { $this->raiseLintAtNode( $call, diff --git a/src/lint/linter/xhpast/rules/ArcanistKeywordCasingXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistKeywordCasingXHPASTLinterRule.php --- a/src/lint/linter/xhpast/rules/ArcanistKeywordCasingXHPASTLinterRule.php +++ b/src/lint/linter/xhpast/rules/ArcanistKeywordCasingXHPASTLinterRule.php @@ -99,7 +99,7 @@ throw new Exception( pht( 'Unexpected tokens whilst processing `%s`.', - __CLASS__)); + self::class)); } $keywords[] = head($tokens); diff --git a/src/lint/renderer/ArcanistLintRenderer.php b/src/lint/renderer/ArcanistLintRenderer.php --- a/src/lint/renderer/ArcanistLintRenderer.php +++ b/src/lint/renderer/ArcanistLintRenderer.php @@ -9,8 +9,8 @@ } final public static function getAllRenderers() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->setUniqueMethod('getRendererKey') ->execute(); } diff --git a/src/moduleutils/PhutilLibraryMapBuilder.php b/src/moduleutils/PhutilLibraryMapBuilder.php --- a/src/moduleutils/PhutilLibraryMapBuilder.php +++ b/src/moduleutils/PhutilLibraryMapBuilder.php @@ -237,7 +237,7 @@ } private static function newExtractSymbolsFuture(array $flags, array $paths) { - $bin = dirname(__FILE__).'/../../support/lib/extract-symbols.php'; + $bin = __DIR__.'/../../support/lib/extract-symbols.php'; return new ExecFuture( 'php -f %R -- --ugly %Ls -- %Ls', @@ -283,7 +283,7 @@ 'phutil')); } - $files = id(new FileFinder($root)) + $files = (new FileFinder($root)) ->withType('f') ->withSuffix('php') ->excludePath('*/.*') @@ -450,7 +450,7 @@ $progress = new PhutilConsoleProgressBar(); $progress->setTotal(count($futures)); - $futures = id(new FutureIterator($futures)) + $futures = (new FutureIterator($futures)) ->limit($limit); foreach ($futures as $file => $future) { $result = $future->resolveJSON(); diff --git a/src/object/Phobject.php b/src/object/Phobject.php --- a/src/object/Phobject.php +++ b/src/object/Phobject.php @@ -85,7 +85,7 @@ throw new Exception( pht( '"%s" class "%s" must define a "%s" constant.', - __CLASS__, + self::class, get_class($this), $key)); } @@ -96,7 +96,7 @@ pht( '"%s" class "%s" has an invalid "%s" property. Field constants '. 'must be strings and no more than %s bytes in length.', - __CLASS__, + self::class, get_class($this), $key, new PhutilNumber($byte_limit))); diff --git a/src/parser/PhutilBugtraqParser.php b/src/parser/PhutilBugtraqParser.php --- a/src/parser/PhutilBugtraqParser.php +++ b/src/parser/PhutilBugtraqParser.php @@ -12,7 +12,7 @@ * * ...you can use: * - * $message = id(new PhutilBugtraqParser()) + * $message = (new PhutilBugtraqParser()) * ->setBugtraqPattern('http://bugs.com/%BUGID%') * ->setBugtraqCaptureExpression('/[Ii]ssues?:?(\s*,?\s*#\d+)+/') * ->setBugtraqSelectExpression('/(\d+)/') diff --git a/src/parser/PhutilParserGenerator.php b/src/parser/PhutilParserGenerator.php --- a/src/parser/PhutilParserGenerator.php +++ b/src/parser/PhutilParserGenerator.php @@ -5,7 +5,7 @@ * and rules, then calling @{method:processGrammar}. For example, here is a * simple grammar which accepts one or more "a" followed by exactly one "b": * - * $parser = id(new PhutilParserGenerator()) + * $parser = (new PhutilParserGenerator()) * ->setTerminals(array('a', 'b')) * ->setStartRule('S') * ->setRules( @@ -792,7 +792,7 @@ public function generateParserFunction($name) { $out = array(); $out[] = 'function '.$name.'(array $tokens, $callback) {'; - $out[] = ' return '.__CLASS__.'::parseTokensWithTables('; + $out[] = ' return '.self::class.'::parseTokensWithTables('; $out[] = ' '.$this->formatAndIndent($this->actionTable, 4).','; $out[] = ' '.$this->formatAndIndent($this->gotoTable, 4).','; $out[] = ' '.$this->formatAndIndent($this->getEOFSymbol(), 4).','; diff --git a/src/parser/PhutilTypeSpec.php b/src/parser/PhutilTypeSpec.php --- a/src/parser/PhutilTypeSpec.php +++ b/src/parser/PhutilTypeSpec.php @@ -294,7 +294,7 @@ } $tokens = array_values($tokens); - $callback = array(__CLASS__, 'didReduceTokens'); + $callback = array(self::class, 'didReduceTokens'); return self::parseTokens($tokens, $callback); } diff --git a/src/parser/PhutilURI.php b/src/parser/PhutilURI.php --- a/src/parser/PhutilURI.php +++ b/src/parser/PhutilURI.php @@ -126,7 +126,7 @@ $this->path = idx($parts, 'path', ''); $query = idx($parts, 'query'); if ($query) { - $pairs = id(new PhutilQueryStringParser()) + $pairs = (new PhutilQueryStringParser()) ->parseQueryStringToPairList($query); foreach ($pairs as $pair) { diff --git a/src/parser/argument/PhutilArgumentParser.php b/src/parser/argument/PhutilArgumentParser.php --- a/src/parser/argument/PhutilArgumentParser.php +++ b/src/parser/argument/PhutilArgumentParser.php @@ -1000,7 +1000,7 @@ if ($maybe) { sort($maybe); - $maybe_list = id(new PhutilConsoleList()) + $maybe_list = (new PhutilConsoleList()) ->setWrap(false) ->setBullet(null) ->addItems($maybe) diff --git a/src/parser/argument/PhutilArgumentSpellingCorrector.php b/src/parser/argument/PhutilArgumentSpellingCorrector.php --- a/src/parser/argument/PhutilArgumentSpellingCorrector.php +++ b/src/parser/argument/PhutilArgumentSpellingCorrector.php @@ -27,13 +27,13 @@ // These costs are somewhat made up, but the theory is that it is far more // likely you will mis-strike a key ("lans" for "land") or press two keys // out of order ("alnd" for "land") than omit keys or press extra keys. - $matrix = id(new PhutilEditDistanceMatrix()) + $matrix = (new PhutilEditDistanceMatrix()) ->setInsertCost(4) ->setDeleteCost(4) ->setReplaceCost(3) ->setTransposeCost(2); - return id(new self()) + return (new self()) ->setEditDistanceMatrix($matrix) ->setMode(self::MODE_COMMANDS) ->setMaximumDistance($max_distance); @@ -53,12 +53,12 @@ // "--nolint" or "--reviewer" versus "--reviewers". $max_distance = 1; - $matrix = id(new PhutilEditDistanceMatrix()) + $matrix = (new PhutilEditDistanceMatrix()) ->setInsertCost(1) ->setDeleteCost(1) ->setReplaceCost(10); - return id(new self()) + return (new self()) ->setEditDistanceMatrix($matrix) ->setMode(self::MODE_FLAGS) ->setMaximumDistance($max_distance); diff --git a/src/parser/argument/workflow/PhutilArgumentWorkflow.php b/src/parser/argument/workflow/PhutilArgumentWorkflow.php --- a/src/parser/argument/workflow/PhutilArgumentWorkflow.php +++ b/src/parser/argument/workflow/PhutilArgumentWorkflow.php @@ -14,7 +14,7 @@ * EOHELP * ); * - * $add_workflow = id(new PhutilArgumentWorkflow()) + * $add_workflow = (new PhutilArgumentWorkflow()) * ->setName('add') * ->setExamples('**add** __n__ ...') * ->setSynopsis('Compute the sum of a list of numbers.') @@ -26,7 +26,7 @@ * ), * )); * - * $mul_workflow = id(new PhutilArgumentWorkflow()) + * $mul_workflow = (new PhutilArgumentWorkflow()) * ->setName('mul') * ->setExamples('**mul** __n__ ...') * ->setSynopsis('Compute the product of a list of numbers.') diff --git a/src/parser/html/PhutilDOMNode.php b/src/parser/html/PhutilDOMNode.php --- a/src/parser/html/PhutilDOMNode.php +++ b/src/parser/html/PhutilDOMNode.php @@ -126,7 +126,7 @@ $raw_string = $child->newRawString(); - $nodes[] = id(new self()) + $nodes[] = (new self()) ->setContent($raw_string) ->setRawHead($raw_string); } @@ -197,7 +197,7 @@ continue; } - $results[] = id(new self()) + $results[] = (new self()) ->setContent($parts) ->setRawHead($parts); } diff --git a/src/parser/html/PhutilHTMLParser.php b/src/parser/html/PhutilHTMLParser.php --- a/src/parser/html/PhutilHTMLParser.php +++ b/src/parser/html/PhutilHTMLParser.php @@ -106,7 +106,7 @@ $content = '<'.$content.'>'; } - $node = id(new PhutilDOMNode()) + $node = (new PhutilDOMNode()) ->setContent($content) ->setRawHead($content); @@ -210,7 +210,7 @@ $attribute_map = array(); } - $node = id(new PhutilDOMNode()) + $node = (new PhutilDOMNode()) ->setTagName($tag_name) ->setAttributes($attribute_map) ->setRawHead('<'.$raw_content.'>'); diff --git a/src/parser/xhpast/bin/PhutilXHPASTBinary.php b/src/parser/xhpast/bin/PhutilXHPASTBinary.php --- a/src/parser/xhpast/bin/PhutilXHPASTBinary.php +++ b/src/parser/xhpast/bin/PhutilXHPASTBinary.php @@ -97,9 +97,9 @@ */ public static function getPath() { if (phutil_is_windows()) { - return dirname(__FILE__).'\\xhpast.exe'; + return __DIR__.'\\xhpast.exe'; } - return dirname(__FILE__).'/xhpast'; + return __DIR__.'/xhpast'; } /** diff --git a/src/phage/action/PhageLocalAction.php b/src/phage/action/PhageLocalAction.php --- a/src/phage/action/PhageLocalAction.php +++ b/src/phage/action/PhageLocalAction.php @@ -11,7 +11,7 @@ 'bin', )); - $future = id(new ExecFuture('%s exec -- %C', './phage', $command)) + $future = (new ExecFuture('%s exec -- %C', './phage', $command)) ->setCWD($bin_dir); return $future; diff --git a/src/phage/bootloader/PhagePHPAgentBootloader.php b/src/phage/bootloader/PhagePHPAgentBootloader.php --- a/src/phage/bootloader/PhagePHPAgentBootloader.php +++ b/src/phage/bootloader/PhagePHPAgentBootloader.php @@ -65,7 +65,7 @@ $main_sequence->addFile($root.'/'.$file); } - // NOTE: If we use id() here, we don't get a stack trace out of it when + // NOTE: If we use () here, we don't get a stack trace out of it when // we call a nonexistent method from inside "execute()"? Not exactly sure // what's going on here, but just sweep it under the rug for now. diff --git a/src/ref/ArcanistRef.php b/src/ref/ArcanistRef.php --- a/src/ref/ArcanistRef.php +++ b/src/ref/ArcanistRef.php @@ -6,7 +6,7 @@ abstract public function getRefDisplayName(); final public function newRefView() { - $ref_view = id(new ArcanistRefView()) + $ref_view = (new ArcanistRefView()) ->setRef($this); $this->buildRefView($ref_view); diff --git a/src/ref/ArcanistRefView.php b/src/ref/ArcanistRefView.php --- a/src/ref/ArcanistRefView.php +++ b/src/ref/ArcanistRefView.php @@ -98,7 +98,7 @@ // TODO: This should truncate based on console display width, not // glyphs, but there's currently no "setMaximumConsoleCharacterWidth()". - $title = id(new PhutilUTF8StringTruncator()) + $title = (new PhutilUTF8StringTruncator()) ->setMaximumGlyphs($usable_width) ->truncateString($title); diff --git a/src/ref/build/ArcanistBuildRef.php b/src/ref/build/ArcanistBuildRef.php --- a/src/ref/build/ArcanistBuildRef.php +++ b/src/ref/build/ArcanistBuildRef.php @@ -94,7 +94,7 @@ $status_class = 2; } - return id(new PhutilSortVector()) + return (new PhutilSortVector()) ->addInt($status_class) ->addString($status); } diff --git a/src/ref/commit/ArcanistCommitSymbolRefInspector.php b/src/ref/commit/ArcanistCommitSymbolRefInspector.php --- a/src/ref/commit/ArcanistCommitSymbolRefInspector.php +++ b/src/ref/commit/ArcanistCommitSymbolRefInspector.php @@ -15,7 +15,7 @@ 'commit symbol.')); } - return id(new ArcanistCommitSymbolRef()) + return (new ArcanistCommitSymbolRef()) ->setSymbol($argv[0]); } diff --git a/src/ref/commit/ArcanistGitCommitSymbolCommitHardpointQuery.php b/src/ref/commit/ArcanistGitCommitSymbolCommitHardpointQuery.php --- a/src/ref/commit/ArcanistGitCommitSymbolCommitHardpointQuery.php +++ b/src/ref/commit/ArcanistGitCommitSymbolCommitHardpointQuery.php @@ -81,7 +81,7 @@ continue; } - $ref = id(new ArcanistCommitRef()) + $ref = (new ArcanistCommitRef()) ->setCommitHash($result); $results[$key] = $ref; diff --git a/src/ref/commit/ArcanistMercurialCommitSymbolCommitHardpointQuery.php b/src/ref/commit/ArcanistMercurialCommitSymbolCommitHardpointQuery.php --- a/src/ref/commit/ArcanistMercurialCommitSymbolCommitHardpointQuery.php +++ b/src/ref/commit/ArcanistMercurialCommitSymbolCommitHardpointQuery.php @@ -182,7 +182,7 @@ continue; } - $ref = id(new ArcanistCommitRef()) + $ref = (new ArcanistCommitRef()) ->setCommitHash($result); $results[$key] = $ref; diff --git a/src/ref/revision/ArcanistRevisionAuthorHardpointQuery.php b/src/ref/revision/ArcanistRevisionAuthorHardpointQuery.php --- a/src/ref/revision/ArcanistRevisionAuthorHardpointQuery.php +++ b/src/ref/revision/ArcanistRevisionAuthorHardpointQuery.php @@ -17,7 +17,7 @@ $symbols = array(); foreach ($refs as $key => $ref) { - $symbols[$key] = id(new ArcanistUserSymbolRef()) + $symbols[$key] = (new ArcanistUserSymbolRef()) ->setSymbol($ref->getAuthorPHID()); } diff --git a/src/ref/revision/ArcanistRevisionParentRevisionsHardpointQuery.php b/src/ref/revision/ArcanistRevisionParentRevisionsHardpointQuery.php --- a/src/ref/revision/ArcanistRevisionParentRevisionsHardpointQuery.php +++ b/src/ref/revision/ArcanistRevisionParentRevisionsHardpointQuery.php @@ -50,7 +50,7 @@ $map[$src][$dst] = $dst; - $symbols[$dst] = id(new ArcanistRevisionSymbolRef()) + $symbols[$dst] = (new ArcanistRevisionSymbolRef()) ->setSymbol($dst); } diff --git a/src/ref/simple/ArcanistSimpleSymbolRefInspector.php b/src/ref/simple/ArcanistSimpleSymbolRefInspector.php --- a/src/ref/simple/ArcanistSimpleSymbolRefInspector.php +++ b/src/ref/simple/ArcanistSimpleSymbolRefInspector.php @@ -6,13 +6,13 @@ private $templateRef; protected function newInspectors() { - $refs = id(new PhutilClassMapQuery()) + $refs = (new PhutilClassMapQuery()) ->setAncestorClass('ArcanistSimpleSymbolRef') ->execute(); $inspectors = array(); foreach ($refs as $ref) { - $inspectors[] = id(new self()) + $inspectors[] = (new self()) ->setTemplateRef($ref); } @@ -40,7 +40,7 @@ $this->getInspectFunctionName())); } - return id(clone $this->getTemplateRef()) + return (clone $this->getTemplateRef()) ->setSymbol($argv[0]); } diff --git a/src/ref/symbol/ArcanistSymbolEngine.php b/src/ref/symbol/ArcanistSymbolEngine.php --- a/src/ref/symbol/ArcanistSymbolEngine.php +++ b/src/ref/symbol/ArcanistSymbolEngine.php @@ -77,7 +77,7 @@ $refs = array(); $load_refs = array(); foreach ($symbols as $symbol) { - $ref = id(clone $template) + $ref = (clone $template) ->setSymbol($symbol); $ref_key = $ref->getSymbolEngineCacheKey(); diff --git a/src/ref/user/ArcanistUserSymbolRefInspector.php b/src/ref/user/ArcanistUserSymbolRefInspector.php --- a/src/ref/user/ArcanistUserSymbolRefInspector.php +++ b/src/ref/user/ArcanistUserSymbolRefInspector.php @@ -15,7 +15,7 @@ 'user symbol.')); } - return id(new ArcanistUserSymbolRef()) + return (new ArcanistUserSymbolRef()) ->setSymbol($argv[0]); } diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -746,7 +746,7 @@ // After the other commands exit, we can start the `diff-files` command. ); - id(new FutureIterator($futures))->resolveAll(); + (new FutureIterator($futures))->resolveAll(); // We're clear to start the `git diff-files` now. $unstaged_future->start(); @@ -931,7 +931,7 @@ public function getAllFiles() { $future = $this->buildLocalFuture(array('ls-files -z')); - return id(new LinesOfALargeExecFuture($future)) + return (new LinesOfALargeExecFuture($future)) ->setDelimiter("\0"); } @@ -1683,7 +1683,7 @@ ':(attr:filter=lfs)', )); - $lfs_list = id(new LinesOfALargeExecFuture($future)) + $lfs_list = (new LinesOfALargeExecFuture($future)) ->setDelimiter("\0"); try { @@ -1733,7 +1733,7 @@ } public function newLocalState() { - return id(new ArcanistGitLocalState()) + return (new ArcanistGitLocalState()) ->setRepositoryAPI($this); } diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -246,7 +246,7 @@ $last_node = $node; } - $futures = id(new FutureIterator($futures)) + $futures = (new FutureIterator($futures)) ->limit(4); foreach ($futures as $node => $future) { list($parents) = $future->resolvex(); @@ -1034,7 +1034,7 @@ } public function newLocalState() { - return id(new ArcanistMercurialLocalState()) + return (new ArcanistMercurialLocalState()) ->setRepositoryAPI($this); } diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php --- a/src/repository/api/ArcanistRepositoryAPI.php +++ b/src/repository/api/ArcanistRepositoryAPI.php @@ -72,7 +72,7 @@ throw new Exception( pht( 'Trying to create a %s without a working copy!', - __CLASS__)); + self::class)); } $root = $working_copy->getProjectRoot(); @@ -710,7 +710,7 @@ return null; } - return id(new ArcanistWorkingCopyStateRef()) + return (new ArcanistWorkingCopyStateRef()) ->setCommitRef($commit_ref); } @@ -778,7 +778,7 @@ } final public function newMarkerRefQuery() { - return id($this->newMarkerRefQueryTemplate()) + return ($this->newMarkerRefQueryTemplate()) ->setRepositoryAPI($this); } @@ -787,7 +787,7 @@ } final public function newRemoteRefQuery() { - return id($this->newRemoteRefQueryTemplate()) + return ($this->newRemoteRefQueryTemplate()) ->setRepositoryAPI($this); } @@ -796,7 +796,7 @@ } final public function newCommitGraphQuery() { - return id($this->newCommitGraphQueryTemplate()); + return ($this->newCommitGraphQueryTemplate()); } protected function newCommitGraphQueryTemplate() { @@ -827,7 +827,7 @@ final public function getGraph() { if (!$this->graph) { - $this->graph = id(new ArcanistCommitGraph()) + $this->graph = (new ArcanistCommitGraph()) ->setRepositoryAPI($this); } diff --git a/src/repository/graph/ArcanistCommitGraph.php b/src/repository/graph/ArcanistCommitGraph.php --- a/src/repository/graph/ArcanistCommitGraph.php +++ b/src/repository/graph/ArcanistCommitGraph.php @@ -41,14 +41,14 @@ $hash)); } - $this->nodes[$hash] = id(new ArcanistCommitNode()) + $this->nodes[$hash] = (new ArcanistCommitNode()) ->setCommitHash($hash); return $this->nodes[$hash]; } public function newPartitionQuery() { - return id(new ArcanistCommitGraphPartitionQuery()) + return (new ArcanistCommitGraphPartitionQuery()) ->setGraph($this); } diff --git a/src/repository/graph/ArcanistCommitGraphPartition.php b/src/repository/graph/ArcanistCommitGraphPartition.php --- a/src/repository/graph/ArcanistCommitGraphPartition.php +++ b/src/repository/graph/ArcanistCommitGraphPartition.php @@ -55,7 +55,7 @@ } public function newSetQuery() { - return id(new ArcanistCommitGraphSetQuery()) + return (new ArcanistCommitGraphSetQuery()) ->setPartition($this); } diff --git a/src/repository/graph/ArcanistCommitGraphPartitionQuery.php b/src/repository/graph/ArcanistCommitGraphPartitionQuery.php --- a/src/repository/graph/ArcanistCommitGraphPartitionQuery.php +++ b/src/repository/graph/ArcanistCommitGraphPartitionQuery.php @@ -139,7 +139,7 @@ foreach ($partition_lists as $partition_id => $partition_list) { $partition_set = array_fuse($partition_list); - $results[] = id(new ArcanistCommitGraphPartition()) + $results[] = (new ArcanistCommitGraphPartition()) ->setGraph($graph) ->setHashes($partition_set) ->setHeads($partition_heads[$partition_id]) diff --git a/src/repository/graph/ArcanistCommitGraphSetQuery.php b/src/repository/graph/ArcanistCommitGraphSetQuery.php --- a/src/repository/graph/ArcanistCommitGraphSetQuery.php +++ b/src/repository/graph/ArcanistCommitGraphSetQuery.php @@ -175,7 +175,7 @@ } } - $set = id(new ArcanistCommitGraphSet()) + $set = (new ArcanistCommitGraphSet()) ->setSetID($set_n++) ->setColor($node_color) ->setHashes(array_keys($in_set)); diff --git a/src/repository/graph/ArcanistCommitNode.php b/src/repository/graph/ArcanistCommitNode.php --- a/src/repository/graph/ArcanistCommitNode.php +++ b/src/repository/graph/ArcanistCommitNode.php @@ -58,7 +58,7 @@ public function getCommitRef() { if ($this->commitRef === null) { - $this->commitRef = id(new ArcanistCommitRef()) + $this->commitRef = (new ArcanistCommitRef()) ->setCommitHash($this->getCommitHash()) ->attachMessage($this->getCommitMessage()); } diff --git a/src/repository/graph/query/ArcanistGitCommitGraphQuery.php b/src/repository/graph/query/ArcanistGitCommitGraphQuery.php --- a/src/repository/graph/query/ArcanistGitCommitGraphQuery.php +++ b/src/repository/graph/query/ArcanistGitCommitGraphQuery.php @@ -106,7 +106,7 @@ $future = array_pop($this->futures); $future->start(); - $iterator = id(new LinesOfALargeExecFuture($future)) + $iterator = (new LinesOfALargeExecFuture($future)) ->setDelimiter("\1"); $iterator->rewind(); diff --git a/src/repository/graph/query/ArcanistMercurialCommitGraphQuery.php b/src/repository/graph/query/ArcanistMercurialCommitGraphQuery.php --- a/src/repository/graph/query/ArcanistMercurialCommitGraphQuery.php +++ b/src/repository/graph/query/ArcanistMercurialCommitGraphQuery.php @@ -112,7 +112,7 @@ $future->setResolveOnError(true); $future->start(); - $lines = id(new LinesOfALargeExecFuture($future)) + $lines = (new LinesOfALargeExecFuture($future)) ->setDelimiter("\1"); $lines->rewind(); diff --git a/src/repository/graph/view/ArcanistCommitGraphSetTreeView.php b/src/repository/graph/view/ArcanistCommitGraphSetTreeView.php --- a/src/repository/graph/view/ArcanistCommitGraphSetTreeView.php +++ b/src/repository/graph/view/ArcanistCommitGraphSetTreeView.php @@ -96,7 +96,7 @@ } private function newSetView(ArcanistCommitGraphSet $set) { - return id(new ArcanistCommitGraphSetView()) + return (new ArcanistCommitGraphSetView()) ->setSet($set); } diff --git a/src/repository/graph/view/ArcanistCommitGraphSetView.php b/src/repository/graph/view/ArcanistCommitGraphSetView.php --- a/src/repository/graph/view/ArcanistCommitGraphSetView.php +++ b/src/repository/graph/view/ArcanistCommitGraphSetView.php @@ -70,7 +70,7 @@ } public function setChildViews(array $child_views) { - assert_instances_of($child_views, __CLASS__); + assert_instances_of($child_views, self::class); $this->childViews = $child_views; return $this; } @@ -233,19 +233,19 @@ $messages_view = $this->drawMessagesCell($items); return array( - id(new ArcanistGridCell()) + (new ArcanistGridCell()) ->setKey('marker') ->setContent($marker_view), - id(new ArcanistGridCell()) + (new ArcanistGridCell()) ->setKey('commits') ->setContent($commits_view), - id(new ArcanistGridCell()) + (new ArcanistGridCell()) ->setKey('status') ->setContent($status_view), - id(new ArcanistGridCell()) + (new ArcanistGridCell()) ->setKey('revisions') ->setContent($revisions_view), - id(new ArcanistGridCell()) + (new ArcanistGridCell()) ->setKey('messages') ->setContent($messages_view), ); @@ -329,7 +329,7 @@ $marker_width = $available_width; } - $marker_name = id(new PhutilUTF8StringTruncator()) + $marker_name = (new PhutilUTF8StringTruncator()) ->setMaximumGlyphs($marker_width) ->truncateString($marker_name); diff --git a/src/repository/marker/ArcanistGitRepositoryMarkerQuery.php b/src/repository/marker/ArcanistGitRepositoryMarkerQuery.php --- a/src/repository/marker/ArcanistGitRepositoryMarkerQuery.php +++ b/src/repository/marker/ArcanistGitRepositoryMarkerQuery.php @@ -72,7 +72,7 @@ continue; } - $marker = id(new ArcanistMarkerRef()) + $marker = (new ArcanistMarkerRef()) ->setName($name) ->setMarkerType($type) ->setEpoch((int)$epoch) @@ -175,7 +175,7 @@ continue; } - $marker = id(new ArcanistMarkerRef()) + $marker = (new ArcanistMarkerRef()) ->setName($name) ->setMarkerType($type) ->setMarkerHash($hash) diff --git a/src/repository/marker/ArcanistMercurialRepositoryMarkerQuery.php b/src/repository/marker/ArcanistMercurialRepositoryMarkerQuery.php --- a/src/repository/marker/ArcanistMercurialRepositoryMarkerQuery.php +++ b/src/repository/marker/ArcanistMercurialRepositoryMarkerQuery.php @@ -89,7 +89,7 @@ $commit_ref = $api->newCommitRef() ->setCommitHash($node); - $marker_ref = id(new ArcanistMarkerRef()) + $marker_ref = (new ArcanistMarkerRef()) ->setName($item['name']) ->setCommitHash($node) ->attachCommitRef($commit_ref); diff --git a/src/repository/marker/ArcanistRepositoryMarkerQuery.php b/src/repository/marker/ArcanistRepositoryMarkerQuery.php --- a/src/repository/marker/ArcanistRepositoryMarkerQuery.php +++ b/src/repository/marker/ArcanistRepositoryMarkerQuery.php @@ -58,7 +58,7 @@ $api = $this->getRepositoryAPI(); foreach ($markers as $marker) { - $state_ref = id(new ArcanistWorkingCopyStateRef()) + $state_ref = (new ArcanistWorkingCopyStateRef()) ->setCommitRef($marker->getCommitRef()); $marker->attachWorkingCopyStateRef($state_ref); diff --git a/src/repository/remote/ArcanistGitRepositoryRemoteQuery.php b/src/repository/remote/ArcanistGitRepositoryRemoteQuery.php --- a/src/repository/remote/ArcanistGitRepositoryRemoteQuery.php +++ b/src/repository/remote/ArcanistGitRepositoryRemoteQuery.php @@ -43,7 +43,7 @@ $fetch_uri = idx($uris, 'fetch'); $push_uri = idx($uris, 'push'); - $ref = id(new ArcanistRemoteRef()) + $ref = (new ArcanistRemoteRef()) ->setRemoteName($name); if ($fetch_uri !== null) { diff --git a/src/repository/remote/ArcanistMercurialRepositoryRemoteQuery.php b/src/repository/remote/ArcanistMercurialRepositoryRemoteQuery.php --- a/src/repository/remote/ArcanistMercurialRepositoryRemoteQuery.php +++ b/src/repository/remote/ArcanistMercurialRepositoryRemoteQuery.php @@ -31,7 +31,7 @@ // are fetchable and pushable, they just have rules around selection // as default targets for operations. - $ref = id(new ArcanistRemoteRef()) + $ref = (new ArcanistRemoteRef()) ->setRemoteName($name) ->setFetchURI($uri) ->setPushURI($uri); diff --git a/src/repository/state/ArcanistRepositoryLocalState.php b/src/repository/state/ArcanistRepositoryLocalState.php --- a/src/repository/state/ArcanistRepositoryLocalState.php +++ b/src/repository/state/ArcanistRepositoryLocalState.php @@ -65,11 +65,11 @@ 'Ignore the changes to these %s submodule(s) and continue?', new PhutilNumber(count($externals))); - $list = id(new PhutilConsoleList()) + $list = (new PhutilConsoleList()) ->setWrap(false) ->addItems($externals); - id(new PhutilConsoleBlock()) + (new PhutilConsoleBlock()) ->addParagraph($message) ->addList($list) ->draw(); diff --git a/src/runtime/ArcanistRuntime.php b/src/runtime/ArcanistRuntime.php --- a/src/runtime/ArcanistRuntime.php +++ b/src/runtime/ArcanistRuntime.php @@ -74,7 +74,7 @@ ), ); - $args = id(new PhutilArgumentParser($argv)) + $args = (new PhutilArgumentParser($argv)) ->parseStandardArguments(); // If we can test whether STDIN is a TTY, and it isn't, require that "--" @@ -145,7 +145,7 @@ throw new PhutilArgumentUsageException(pht('Choose a workflow!')); } - $alias_effects = id(new ArcanistAliasEngine()) + $alias_effects = (new ArcanistAliasEngine()) ->setRuntime($this) ->setToolset($toolset) ->setWorkflows($workflows) @@ -311,7 +311,7 @@ } private function loadConfiguration(PhutilArgumentParser $args) { - $engine = id(new ArcanistConfigurationEngine()) + $engine = (new ArcanistConfigurationEngine()) ->setArguments($args); $working_copy = ArcanistWorkingCopy::newFromWorkingDirectory(getcwd()); @@ -472,7 +472,7 @@ // especially bizarre, but it allows `arc` to be used in automation // workflows more easily. For some context, see PHI13. - $executing_directory = dirname(dirname(__FILE__)); + $executing_directory = dirname(__DIR__); $log->writeWarn( pht('VERY META'), @@ -531,7 +531,7 @@ } private function newWorkflows(ArcanistToolset $toolset) { - $workflows = id(new PhutilClassMapQuery()) + $workflows = (new PhutilClassMapQuery()) ->setAncestorClass('ArcanistWorkflow') ->setContinueOnFailure(true) ->execute(); @@ -557,7 +557,7 @@ get_class($toolset), $toolset->getToolsetKey())); } - $map[$key] = id(clone $workflow) + $map[$key] = (clone $workflow) ->setToolset($toolset); } @@ -797,7 +797,7 @@ } private function newSymbolEngine() { - return id(new ArcanistSymbolEngine()) + return (new ArcanistSymbolEngine()) ->setWorkflow($this); } @@ -814,7 +814,7 @@ $queries = ArcanistRuntimeHardpointQuery::getAllQueries(); foreach ($queries as $key => $query) { - $queries[$key] = id(clone $query) + $queries[$key] = (clone $query) ->setRuntime($this); } diff --git a/src/serviceprofiler/PhutilServiceProfiler.php b/src/serviceprofiler/PhutilServiceProfiler.php --- a/src/serviceprofiler/PhutilServiceProfiler.php +++ b/src/serviceprofiler/PhutilServiceProfiler.php @@ -78,7 +78,7 @@ public static function installEchoListener() { $instance = self::getInstance(); - $instance->addListener(array(__CLASS__, 'echoListener')); + $instance->addListener(array(self::class, 'echoListener')); } public static function echoListener($type, $id, $data) { diff --git a/src/symbols/PhutilClassMapQuery.php b/src/symbols/PhutilClassMapQuery.php --- a/src/symbols/PhutilClassMapQuery.php +++ b/src/symbols/PhutilClassMapQuery.php @@ -239,7 +239,7 @@ } } - $objects = id(new PhutilSymbolLoader()) + $objects = (new PhutilSymbolLoader()) ->setAncestorClass($ancestor) ->setContinueOnFailure($this->continueOnFailure) ->loadObjects(); diff --git a/src/symbols/PhutilSymbolLoader.php b/src/symbols/PhutilSymbolLoader.php --- a/src/symbols/PhutilSymbolLoader.php +++ b/src/symbols/PhutilSymbolLoader.php @@ -8,7 +8,7 @@ * classes in a library: * * ```lang=php - * $symbols = id(new PhutilSymbolLoader()) + * $symbols = (new PhutilSymbolLoader()) * ->setType('class') * ->setLibrary('example') * ->selectAndLoadSymbols(); diff --git a/src/toolset/ArcanistAliasEngine.php b/src/toolset/ArcanistAliasEngine.php --- a/src/toolset/ArcanistAliasEngine.php +++ b/src/toolset/ArcanistAliasEngine.php @@ -275,7 +275,7 @@ } protected function newEffect($effect_type) { - return id(new ArcanistAliasEffect()) + return (new ArcanistAliasEffect()) ->setType($effect_type); } diff --git a/src/toolset/ArcanistPrompt.php b/src/toolset/ArcanistPrompt.php --- a/src/toolset/ArcanistPrompt.php +++ b/src/toolset/ArcanistPrompt.php @@ -301,7 +301,7 @@ } if ($response_value !== null) { - $response_list[] = id(new ArcanistPromptResponse()) + $response_list[] = (new ArcanistPromptResponse()) ->setPrompt($this->getKey()) ->setResponse($response_value); } diff --git a/src/toolset/ArcanistPromptResponse.php b/src/toolset/ArcanistPromptResponse.php --- a/src/toolset/ArcanistPromptResponse.php +++ b/src/toolset/ArcanistPromptResponse.php @@ -16,7 +16,7 @@ 'response' => 'string', )); - return id(new self()) + return (new self()) ->setPrompt($map['prompt']) ->setResponse($map['response']); } diff --git a/src/toolset/ArcanistToolset.php b/src/toolset/ArcanistToolset.php --- a/src/toolset/ArcanistToolset.php +++ b/src/toolset/ArcanistToolset.php @@ -7,8 +7,8 @@ } final public static function newToolsetMap() { - $toolsets = id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + $toolsets = (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->setUniqueMethod('getToolsetKey') ->execute(); diff --git a/src/toolset/query/ArcanistRuntimeHardpointQuery.php b/src/toolset/query/ArcanistRuntimeHardpointQuery.php --- a/src/toolset/query/ArcanistRuntimeHardpointQuery.php +++ b/src/toolset/query/ArcanistRuntimeHardpointQuery.php @@ -24,8 +24,8 @@ } public static function getAllQueries() { - return id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + return (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->execute(); } @@ -59,7 +59,7 @@ $conduit_engine = $this->getRuntime() ->getConduitEngine(); - $conduit_future = id(new ConduitSearchFuture()) + $conduit_future = (new ConduitSearchFuture()) ->setConduitEngine($conduit_engine) ->setMethod($method) ->setConstraints($constraints) diff --git a/src/toolset/workflow/ArcanistAliasWorkflow.php b/src/toolset/workflow/ArcanistAliasWorkflow.php --- a/src/toolset/workflow/ArcanistAliasWorkflow.php +++ b/src/toolset/workflow/ArcanistAliasWorkflow.php @@ -135,7 +135,7 @@ $trigger = array_shift($argv); $this->validateAliasTrigger($trigger); - $alias = id(new ArcanistAlias()) + $alias = (new ArcanistAlias()) ->setToolset($this->getToolsetKey()) ->setTrigger($trigger) ->setCommand($argv); diff --git a/src/toolset/workflow/ArcanistHelpWorkflow.php b/src/toolset/workflow/ArcanistHelpWorkflow.php --- a/src/toolset/workflow/ArcanistHelpWorkflow.php +++ b/src/toolset/workflow/ArcanistHelpWorkflow.php @@ -8,7 +8,7 @@ } public function newPhutilWorkflow() { - return id(new PhutilHelpArgumentWorkflow()) + return (new PhutilHelpArgumentWorkflow()) ->setWorkflow($this); } diff --git a/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php b/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php --- a/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php +++ b/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php @@ -174,7 +174,7 @@ } private function loadAvailableTestEngines() { - return id(new PhutilClassMapQuery()) + return (new PhutilClassMapQuery()) ->setAncestorClass('ArcanistUnitTestEngine') ->setUniqueMethod('getEngineConfigurationName', true) ->execute(); diff --git a/src/unit/engine/NoseTestEngine.php b/src/unit/engine/NoseTestEngine.php --- a/src/unit/engine/NoseTestEngine.php +++ b/src/unit/engine/NoseTestEngine.php @@ -71,7 +71,7 @@ } $results = array(); - $futures = id(new FutureIterator($futures)) + $futures = (new FutureIterator($futures)) ->limit(4); foreach ($futures as $test_path => $future) { try { diff --git a/src/unit/engine/PhpunitTestEngine.php b/src/unit/engine/PhpunitTestEngine.php --- a/src/unit/engine/PhpunitTestEngine.php +++ b/src/unit/engine/PhpunitTestEngine.php @@ -73,7 +73,7 @@ } $results = array(); - $futures = id(new FutureIterator($futures)) + $futures = (new FutureIterator($futures)) ->limit(4); foreach ($futures as $test => $future) { @@ -101,7 +101,7 @@ */ private function parseTestResults($path, $json_tmp, $clover_tmp, $stderr) { $test_results = Filesystem::readFile($json_tmp); - return id(new ArcanistPhpunitTestResultParser()) + return (new ArcanistPhpunitTestResultParser()) ->setEnableCoverage($this->getEnableCoverage()) ->setProjectRoot($this->projectRoot) ->setCoverageFile($clover_tmp) diff --git a/src/unit/engine/PhutilUnitTestEngine.php b/src/unit/engine/PhutilUnitTestEngine.php --- a/src/unit/engine/PhutilUnitTestEngine.php +++ b/src/unit/engine/PhutilUnitTestEngine.php @@ -35,7 +35,7 @@ 'coverage can not be enabled for %s.', '--coverage', 'XDebug', - __CLASS__)); + self::class)); } } else { $enable_coverage = true; @@ -80,7 +80,7 @@ private function getAllTests() { $project_root = $this->getWorkingCopy()->getProjectRoot(); - $symbols = id(new PhutilSymbolLoader()) + $symbols = (new PhutilSymbolLoader()) ->setType('class') ->setAncestorClass('PhutilTestCase') ->setConcreteOnly(true) @@ -133,7 +133,7 @@ $library = $path_info['library']; $path = $path_info['path']; - $symbols = id(new PhutilSymbolLoader()) + $symbols = (new PhutilSymbolLoader()) ->setType('class') ->setLibrary($library) ->setPathPrefix($path) diff --git a/src/unit/engine/XUnitTestEngine.php b/src/unit/engine/XUnitTestEngine.php --- a/src/unit/engine/XUnitTestEngine.php +++ b/src/unit/engine/XUnitTestEngine.php @@ -104,7 +104,7 @@ $this->loadEnvironment(); if ($this->getRunAllTests()) { - $paths = id(new FileFinder($this->projectRoot))->find(); + $paths = (new FileFinder($this->projectRoot))->find(); } else { $paths = $this->getPaths(); } @@ -288,7 +288,7 @@ dirname($test_assembly['project']))); $build_futures[$test_assembly['project']] = $build_future; } - $iterator = id(new FutureIterator($build_futures))->limit(1); + $iterator = (new FutureIterator($build_futures))->limit(1); foreach ($iterator as $test_assembly => $future) { $result = new ArcanistUnitTestResult(); $result->setName('(build) '.$test_assembly); @@ -364,7 +364,7 @@ } // Run all of the tests. - $futures = id(new FutureIterator($futures)) + $futures = (new FutureIterator($futures)) ->limit(8); foreach ($futures as $test_assembly => $future) { list($err, $stdout, $stderr) = $future->resolve(); diff --git a/src/unit/engine/phutil/PhutilTestCase.php b/src/unit/engine/phutil/PhutilTestCase.php --- a/src/unit/engine/phutil/PhutilTestCase.php +++ b/src/unit/engine/phutil/PhutilTestCase.php @@ -797,7 +797,7 @@ ->getWorkingCopy() ->getProjectConfig('phabricator.uri'); - $uri = id(new PhutilURI($base_uri)) + $uri = (new PhutilURI($base_uri)) ->setPath("/diffusion/symbol/{$method}/") ->setQueryParam('context', get_class($this)) ->setQueryParam('jump', 'true') diff --git a/src/unit/parser/ArcanistPhpunitTestResultParser.php b/src/unit/parser/ArcanistPhpunitTestResultParser.php --- a/src/unit/parser/ArcanistPhpunitTestResultParser.php +++ b/src/unit/parser/ArcanistPhpunitTestResultParser.php @@ -18,7 +18,7 @@ */ public function parseTestResults($path, $test_results) { if (!$test_results) { - $result = id(new ArcanistUnitTestResult()) + $result = (new ArcanistUnitTestResult()) ->setName($path) ->setUserData($this->stderr) ->setResult(ArcanistUnitTestResult::RESULT_BROKEN); @@ -94,7 +94,7 @@ } if (!$last_test_finished) { - $results[] = id(new ArcanistUnitTestResult()) + $results[] = (new ArcanistUnitTestResult()) ->setName(idx($event, 'test')) // use last event ->setUserData($this->stderr) ->setResult(ArcanistUnitTestResult::RESULT_BROKEN); diff --git a/src/unit/parser/ArcanistXUnitTestResultParser.php b/src/unit/parser/ArcanistXUnitTestResultParser.php --- a/src/unit/parser/ArcanistXUnitTestResultParser.php +++ b/src/unit/parser/ArcanistXUnitTestResultParser.php @@ -27,7 +27,7 @@ $load_success = @$xunit_dom->loadXML($test_results); if (!$load_success) { - $input_start = id(new PhutilUTF8StringTruncator()) + $input_start = (new PhutilUTF8StringTruncator()) ->setMaximumGlyphs(150) ->truncateString($test_results); throw new Exception( diff --git a/src/upload/ArcanistFileUploader.php b/src/upload/ArcanistFileUploader.php --- a/src/upload/ArcanistFileUploader.php +++ b/src/upload/ArcanistFileUploader.php @@ -4,11 +4,11 @@ * Upload a list of @{class:ArcanistFileDataRef} objects over Conduit. * * // Create a new uploader. - * $uploader = id(new ArcanistFileUploader()) + * $uploader = (new ArcanistFileUploader()) * ->setConduitEngine($conduit); * * // Queue one or more files to be uploaded. - * $file = id(new ArcanistFileDataRef()) + * $file = (new ArcanistFileDataRef()) * ->setName('example.jpg') * ->setPath('/path/to/example.jpg'); * $uploader->addFile($file); @@ -121,7 +121,7 @@ $futures[$key] = $conduit->newFuture('file.allocate', $params); } - $iterator = id(new FutureIterator($futures))->limit(4); + $iterator = (new FutureIterator($futures))->limit(4); $chunks = array(); foreach ($iterator as $key => $future) { try { diff --git a/src/utils/PhutilDirectedScalarGraph.php b/src/utils/PhutilDirectedScalarGraph.php --- a/src/utils/PhutilDirectedScalarGraph.php +++ b/src/utils/PhutilDirectedScalarGraph.php @@ -10,7 +10,7 @@ throw new Exception( pht( '%s can not load additional nodes at runtime. Tried to load: %s', - __CLASS__, + self::class, implode(', ', $nodes))); } diff --git a/src/utils/PhutilEditDistanceMatrix.php b/src/utils/PhutilEditDistanceMatrix.php --- a/src/utils/PhutilEditDistanceMatrix.php +++ b/src/utils/PhutilEditDistanceMatrix.php @@ -6,7 +6,7 @@ * two inputs. The inputs are arrays containing any scalars (not just strings) * so it can be used with, e.g., utf8 sequences. * - * $matrix = id(new PhutilEditDistanceMatrix()) + * $matrix = (new PhutilEditDistanceMatrix()) * ->setSequences(str_split('ran'), str_split('rat')); * * $cost = $matrix->getEditDistance(); diff --git a/src/utils/PhutilUTF8StringTruncator.php b/src/utils/PhutilUTF8StringTruncator.php --- a/src/utils/PhutilUTF8StringTruncator.php +++ b/src/utils/PhutilUTF8StringTruncator.php @@ -7,7 +7,7 @@ * This class takes some UTF-8 string as input, and emits a valid UTF-8 string * which is no longer than given byte, codepoint, or glyph limits. * - * $short = id(new PhutilUTF8StringTruncator()) + * $short = (new PhutilUTF8StringTruncator()) * ->setMaximumGlyphs(80) * ->truncateString($long); * diff --git a/src/work/ArcanistWorkEngine.php b/src/work/ArcanistWorkEngine.php --- a/src/work/ArcanistWorkEngine.php +++ b/src/work/ArcanistWorkEngine.php @@ -102,7 +102,7 @@ $log = $this->getLogEngine(); try { - $revision_symbol = id(new ArcanistRevisionSymbolRef()) + $revision_symbol = (new ArcanistRevisionSymbolRef()) ->setSymbol($symbol); } catch (Exception $ex) { return; @@ -187,7 +187,7 @@ $workflow = $this->getWorkflow(); try { - $task_symbol = id(new ArcanistTaskSymbolRef()) + $task_symbol = (new ArcanistTaskSymbolRef()) ->setSymbol($symbol); } catch (Exception $ex) { return; diff --git a/src/workflow/ArcanistCallConduitWorkflow.php b/src/workflow/ArcanistCallConduitWorkflow.php --- a/src/workflow/ArcanistCallConduitWorkflow.php +++ b/src/workflow/ArcanistCallConduitWorkflow.php @@ -64,7 +64,7 @@ $result = null; } - echo id(new PhutilJSON())->encodeFormatted( + echo (new PhutilJSON())->encodeFormatted( array( 'error' => $error, 'errorMessage' => $error_message, diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -509,7 +509,7 @@ // TODO: This is hacky, but we don't currently receive a URI back // from "differential.revision.edit". - $result_uri = id(new PhutilURI($this->getConduitURI())) + $result_uri = (new PhutilURI($this->getConduitURI())) ->setPath('/D'.$result_id); } else { if ($is_draft) { @@ -1083,7 +1083,7 @@ $targets[] = array('command' => 'info', 'path' => $path); } - $futures = id(new FutureIterator($futures)) + $futures = (new FutureIterator($futures)) ->limit(8); foreach ($futures as $key => $future) { $target = $targets[$key]; @@ -1369,7 +1369,7 @@ $preview = explode("\n", $saved); $preview = array_shift($preview); $preview = trim($preview); - $preview = id(new PhutilUTF8StringTruncator()) + $preview = (new PhutilUTF8StringTruncator()) ->setMaximumGlyphs(64) ->truncateString($preview); @@ -1688,7 +1688,7 @@ "%s\n\n", $message); - $list = id(new PhutilConsoleList()); + $list = (new PhutilConsoleList()); foreach ($away as $spec) { $list->addItem( pht( @@ -2418,7 +2418,7 @@ * @task diffprop */ private function resolveDiffPropertyUpdates() { - id(new FutureIterator($this->diffPropertyFutures)) + (new FutureIterator($this->diffPropertyFutures)) ->resolveAll(); $this->diffPropertyFutures = array(); } @@ -2535,11 +2535,11 @@ $change->setMetadata("{$type}:file:mime-type", $mime); } - $uploader = id(new ArcanistFileUploader()) + $uploader = (new ArcanistFileUploader()) ->setConduitEngine($this->getConduitEngine()); foreach ($need_upload as $key => $spec) { - $ref = id(new ArcanistFileDataRef()) + $ref = (new ArcanistFileDataRef()) ->setName($spec['name']) ->setData($spec['data']); @@ -2862,7 +2862,7 @@ $api = $this->getRepositoryAPI(); $base_ref = $api->getBaseCommitRef(); - $state_ref = id(new ArcanistWorkingCopyStateRef()) + $state_ref = (new ArcanistWorkingCopyStateRef()) ->setCommitRef($base_ref); $this->loadHardpoints( diff --git a/src/workflow/ArcanistDownloadWorkflow.php b/src/workflow/ArcanistDownloadWorkflow.php --- a/src/workflow/ArcanistDownloadWorkflow.php +++ b/src/workflow/ArcanistDownloadWorkflow.php @@ -138,7 +138,7 @@ // For small files, don't bother drawing a progress bar. $minimum_bar_bytes = (1024 * 1024 * 4); if ($expected_bytes > $minimum_bar_bytes) { - $progress = id(new PhutilConsoleProgressSink()) + $progress = (new PhutilConsoleProgressSink()) ->setTotalWork($expected_bytes); $future->setProgressSink($progress); diff --git a/src/workflow/ArcanistLiberateWorkflow.php b/src/workflow/ArcanistLiberateWorkflow.php --- a/src/workflow/ArcanistLiberateWorkflow.php +++ b/src/workflow/ArcanistLiberateWorkflow.php @@ -58,7 +58,7 @@ pht('SCAN'), pht('Searching for libraries in the current working directory...')); - $init_files = id(new FileFinder(getcwd())) + $init_files = (new FileFinder(getcwd())) ->withPath('*/__phutil_library_init__.php') ->find(); diff --git a/src/workflow/ArcanistLintersWorkflow.php b/src/workflow/ArcanistLintersWorkflow.php --- a/src/workflow/ArcanistLintersWorkflow.php +++ b/src/workflow/ArcanistLintersWorkflow.php @@ -46,7 +46,7 @@ public function run() { $console = PhutilConsole::getConsole(); - $linters = id(new PhutilClassMapQuery()) + $linters = (new PhutilClassMapQuery()) ->setAncestorClass('ArcanistLinter') ->execute(); diff --git a/src/workflow/ArcanistListWorkflow.php b/src/workflow/ArcanistListWorkflow.php --- a/src/workflow/ArcanistListWorkflow.php +++ b/src/workflow/ArcanistListWorkflow.php @@ -80,7 +80,7 @@ $color_map, $revision['statusName'], 'default'); } - $table = id(new PhutilConsoleTable()) + $table = (new PhutilConsoleTable()) ->setShowHeader(false) ->addColumn('exists', array('title' => '')) ->addColumn('status', array('title' => pht('Status'))) diff --git a/src/workflow/ArcanistMarkersWorkflow.php b/src/workflow/ArcanistMarkersWorkflow.php --- a/src/workflow/ArcanistMarkersWorkflow.php +++ b/src/workflow/ArcanistMarkersWorkflow.php @@ -70,7 +70,7 @@ foreach ($nodes as $node) { $commit_ref = $node->getCommitRef(); - $state_ref = id(new ArcanistWorkingCopyStateRef()) + $state_ref = (new ArcanistWorkingCopyStateRef()) ->setCommitRef($commit_ref); $state_refs[$node->getCommitHash()] = $state_ref; @@ -128,7 +128,7 @@ $row_lists = array(); foreach ($roots as $set) { - $view = id(new ArcanistCommitGraphSetTreeView()) + $view = (new ArcanistCommitGraphSetTreeView()) ->setRepositoryAPI($api) ->setRootSet($set) ->setMarkers($markers) @@ -139,7 +139,7 @@ $partition_lists[] = $row_lists; } - $grid = id(new ArcanistGridView()); + $grid = (new ArcanistGridView()); $grid->newColumn('marker'); $grid->newColumn('commits'); $grid->newColumn('status'); @@ -244,7 +244,7 @@ } - $vector = id(new PhutilSortVector()) + $vector = (new PhutilSortVector()) ->addInt($has_active) ->addInt($max_epoch) ->addInt($has_markers) @@ -279,7 +279,7 @@ $partition_name = ''; } - $partition_vector = id(new PhutilSortVector()) + $partition_vector = (new PhutilSortVector()) ->addInt($any_active) ->addInt($partition_epoch) ->addInt($has_markers) diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -1130,7 +1130,7 @@ $phids = idx($rev_auxiliary, 'phabricator:depends-on', array()); if ($phids) { $revision_phid = $revision['phid']; - $graph = id(new ArcanistDifferentialDependencyGraph()) + $graph = (new ArcanistDifferentialDependencyGraph()) ->setConduit($this->getConduit()) ->setRepositoryAPI($this->getRepositoryAPI()) ->setStartPHID($revision_phid) diff --git a/src/workflow/ArcanistTasksWorkflow.php b/src/workflow/ArcanistTasksWorkflow.php --- a/src/workflow/ArcanistTasksWorkflow.php +++ b/src/workflow/ArcanistTasksWorkflow.php @@ -99,7 +99,7 @@ return 0; } - $table = id(new PhutilConsoleTable()) + $table = (new PhutilConsoleTable()) ->setShowHeader(false) ->addColumn('id', array('title' => pht('ID'))) ->addColumn('title', array('title' => pht('Title'))) diff --git a/src/workflow/ArcanistUpgradeWorkflow.php b/src/workflow/ArcanistUpgradeWorkflow.php --- a/src/workflow/ArcanistUpgradeWorkflow.php +++ b/src/workflow/ArcanistUpgradeWorkflow.php @@ -69,11 +69,11 @@ $root, $library); - $list = id(new PhutilConsoleList()) + $list = (new PhutilConsoleList()) ->setWrap(false) ->addItems(array_keys($uncommitted)); - id(new PhutilConsoleBlock()) + (new PhutilConsoleBlock()) ->addParagraph($message) ->addList($list) ->addParagraph( diff --git a/src/workflow/ArcanistUploadWorkflow.php b/src/workflow/ArcanistUploadWorkflow.php --- a/src/workflow/ArcanistUploadWorkflow.php +++ b/src/workflow/ArcanistUploadWorkflow.php @@ -52,11 +52,11 @@ $conduit = $this->getConduitEngine(); $results = array(); - $uploader = id(new ArcanistFileUploader()) + $uploader = (new ArcanistFileUploader()) ->setConduitEngine($conduit); foreach ($paths as $key => $path) { - $file = id(new ArcanistFileDataRef()) + $file = (new ArcanistFileDataRef()) ->setName(basename($path)) ->setPath($path); @@ -112,7 +112,7 @@ $json[] = $map; } - echo id(new PhutilJSON())->encodeAsList($json); + echo (new PhutilJSON())->encodeAsList($json); } else { foreach ($refs as $ref) { $uri = $ref->getURI(); diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -121,7 +121,7 @@ $specs = mpull($arguments, 'getPhutilSpecification'); - $phutil_workflow = id(new ArcanistPhutilWorkflow()) + $phutil_workflow = (new ArcanistPhutilWorkflow()) ->setName($this->getWorkflowName()) ->setWorkflow($this) ->setArguments($specs); @@ -166,7 +166,7 @@ } final public function newLegacyPhutilWorkflow() { - $phutil_workflow = id(new ArcanistPhutilWorkflow()) + $phutil_workflow = (new ArcanistPhutilWorkflow()) ->setName($this->getWorkflowName()); $arguments = $this->getArguments(); @@ -207,7 +207,7 @@ } final protected function newWorkflowArgument($key) { - return id(new ArcanistWorkflowArgument()) + return (new ArcanistWorkflowArgument()) ->setKey($key); } @@ -1088,11 +1088,11 @@ 'Ignore the changes to these %s submodule(s) and continue?', new PhutilNumber(count($externals))); - $list = id(new PhutilConsoleList()) + $list = (new PhutilConsoleList()) ->setWrap(false) ->addItems($externals); - id(new PhutilConsoleBlock()) + (new PhutilConsoleBlock()) ->addParagraph($message) ->addList($list) ->draw(); @@ -2287,7 +2287,7 @@ } if (!$this->repositoryRef) { - $ref = id(new ArcanistRepositoryRef()) + $ref = (new ArcanistRepositoryRef()) ->setPHID($this->getRepositoryPHID()) ->setBrowseURI($this->getRepositoryURI()); @@ -2314,7 +2314,7 @@ } final public function newCommand(PhutilExecutableFuture $future) { - return id(new ArcanistCommand()) + return (new ArcanistCommand()) ->setLogEngine($this->getLogEngine()) ->setExecutableFuture($future); } @@ -2330,7 +2330,7 @@ } protected function newPrompt($key) { - return id(new ArcanistPrompt()) + return (new ArcanistPrompt()) ->setWorkflow($this) ->setKey($key); } @@ -2430,7 +2430,7 @@ $base_uri = $this->getConduitEngine() ->getConduitURI(); - $raw_uri = id(new PhutilURI($base_uri)) + $raw_uri = (new PhutilURI($base_uri)) ->setPath($raw_uri->getPath()); } @@ -2452,7 +2452,7 @@ } // Try to show the content through a pager. - $err = id(new PhutilExecPassthru('%Ls', $pager)) + $err = (new PhutilExecPassthru('%Ls', $pager)) ->write($corpus) ->resolve(); diff --git a/src/workingcopy/ArcanistWorkingCopy.php b/src/workingcopy/ArcanistWorkingCopy.php --- a/src/workingcopy/ArcanistWorkingCopy.php +++ b/src/workingcopy/ArcanistWorkingCopy.php @@ -8,8 +8,8 @@ private $repositoryAPI; public static function newFromWorkingDirectory($path) { - $working_types = id(new PhutilClassMapQuery()) - ->setAncestorClass(__CLASS__) + $working_types = (new PhutilClassMapQuery()) + ->setAncestorClass(self::class) ->execute(); $paths = Filesystem::walkToRoot($path); diff --git a/support/init/init-arcanist.php b/support/init/init-arcanist.php --- a/support/init/init-arcanist.php +++ b/support/init/init-arcanist.php @@ -1,6 +1,6 @@ execute($argv); diff --git a/support/init/init-script.php b/support/init/init-script.php --- a/support/init/init-script.php +++ b/support/init/init-script.php @@ -98,7 +98,7 @@ // Adjust `include_path`. ini_set('include_path', implode(PATH_SEPARATOR, array( - dirname(dirname(__FILE__)).'/externals/includes', + dirname(__DIR__).'/externals/includes', ini_get('include_path'), ))); @@ -110,7 +110,7 @@ @libxml_disable_entity_loader(true); } - $root = dirname(dirname(dirname(__FILE__))); + $root = dirname(dirname(__DIR__)); require_once $root.'/src/init/init-library.php'; PhutilErrorHandler::initialize(); diff --git a/support/lib/extract-symbols.php b/support/lib/extract-symbols.php --- a/support/lib/extract-symbols.php +++ b/support/lib/extract-symbols.php @@ -5,7 +5,7 @@ // built-in symbol list through introspection. $builtins = phutil_symbols_get_builtins(); -$root = dirname(dirname(dirname(__FILE__))); +$root = dirname(dirname(__DIR__)); require_once $root.'/support/init/init-script.php'; $args = new PhutilArgumentParser($argv); @@ -561,7 +561,7 @@ $compat = json_decode( file_get_contents( - dirname(__FILE__).'/../../resources/php/symbol-information.json'), + __DIR__.'/../../resources/php/symbol-information.json'), true); foreach (array('functions', 'classes', 'interfaces') as $type) { diff --git a/support/lib/rebuild-map.php b/support/lib/rebuild-map.php --- a/support/lib/rebuild-map.php +++ b/support/lib/rebuild-map.php @@ -1,7 +1,7 @@ #!/usr/bin/env php getArg('ugly')) { echo json_encode($library_map); } else { - echo id(new PhutilJSON())->encodeFormatted($library_map); + echo (new PhutilJSON())->encodeFormatted($library_map); } } else { $builder->buildAndWriteMap(); diff --git a/support/unit/lock.php b/support/unit/lock.php --- a/support/unit/lock.php +++ b/support/unit/lock.php @@ -1,7 +1,7 @@ #!/usr/bin/env php