Eloquent\Phony\Reflection\FeatureDetector::checkToken PHP Method

checkToken() public method

Check that a keyword is interpreted as a particular token type.
public checkToken ( string $keyword, string $constantName ) : boolean
$keyword string The keyword.
$constantName string The name of the token type constant.
return boolean True if the keyword is interpreted as expected.
    public function checkToken($keyword, $constantName)
    {
        if (!defined($constantName)) {
            return false;
        }
        $tokens = token_get_all('<?php ' . $keyword);
        return is_array($tokens[1]) && constant($constantName) === $tokens[1][0];
    }