Performance: use FQN for global constants by jrfnl · Pull Request #783 · PHPCompatibility/PHPCompatibility

@jrfnl

Constants in PHP are namespaced as well, however, when PHP cannot find the constant in the namespace, it will fall through to the global namespace.

The step to first check within the namespace can be skipped by either using `use const ...` (PHP 5.6+) or by prefixing the constant with a `\`.

As PHPCompatibility uses a lot of global constants, some performance gain can be archived by using the FQN for constants.

This PR implements this throughout the codebase.

If we want to guard this for the future, we could add the SlevomatCodingStandard as a `dev` dependency and add the `SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalConstants` sniff to the PHPCompatibility native ruleset.