Summary: I don't offer a replacement because `f() ?: 1` converted to `f() ? f() : 1` can cause side effects and whitespace issues.
Test Plan: New test.
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3489
}
}
+ $ternaries = $root->selectDescendantsOfType('n_TERNARY_EXPRESSION');
+ foreach ($ternaries as $ternary) {
+ $yes = $ternary->getChildByIndex(1);
+ if ($yes->getTypeName() == 'n_EMPTY') {
+ $this->raiseLintAtNode(
+ $ternary,
+ self::LINT_PHP_53_FEATURES,
+ 'This codebase targets PHP 5.2, but short ternary was not '.
+ 'introduced until PHP 5.3.');
+ }
+ }
+
$this->lintPHP53Functions($root);
}
g(function() use ($c) {});
h(function /* ! */ () use ($c) {});
static::m();
+1 ? 1 : 2;
+1 ?: 2;
~~~~~~~~~~
disabled:3:1
disabled:4:5
disabled:5:3
disabled:6:3
disabled:7:3
-disabled:8:1
\ No newline at end of file
+disabled:8:1
+disabled:10:1
\ No newline at end of file