Page MenuHomePhabricator

Detect the use of undefined magic constants
Closed, ResolvedPublic

Description

PHP has a bunch of magic constants (such as __FILE__ and __DIR__). The use of these constants can possibly cause issues if the magic constant does not exist in the targeted PHP version. For example, __DIR__ wasn't introduced until PHP 5.3.0 but there is no linter step which checks whether __DIR__ is used in rP, rARC or rPHU (all of which target PHP 5.2.3).

It should be reasonably straight-forward to add these magic constants to resources/php_compat_info.json (which lives in rPHU) so that we can detect this stuff during linting.

Revisions and Commits