src/ReflectionFile.php
public function isStrictMode()
    {
        // declare statement for the strict_types can be only top-level node
        $topLevelNode = reset($this->topLevelNodes);
        if (!$topLevelNode instanceof Node\Stmt\Declare_) {
            return false;
        }

        $declareStatement = reset($topLevelNode->declares);
        $isStrictTypeKey  = $declareStatement->key->toString() === 'strict_types';
        $isScalarValue    = $declareStatement->value instanceof Node\Scalar\LNumber;
        $isStrictMode     = $isStrictTypeKey && $isScalarValue && $declareStatement->value->value === 1;

        return $isStrictMode;
    }
public function isStrictMode()
    {
        // declare statement for the strict_types can be only top-level node
        $topLevelNode = reset($this->topLevelNodes);
        if (!$topLevelNode instanceof Node\Stmt\Declare_) {
            return false;
        }

        $declareStatement = reset($topLevelNode->declares);
        $isStrictTypeKey  = $declareStatement->key->toString() === 'strict_types';
        $isScalarValue    = $declareStatement->value instanceof Node\Scalar\LNumber;
        $isStrictMode     = $isStrictTypeKey && $isScalarValue && $declareStatement->value->value === 1;

        return $isStrictMode;
    }
public function isStrictMode ( ) { // declare statement for the strict_types can be only top-level node $ topLevelNode = reset ( $ this -> topLevelNodes ) ; if ( ! $ topLevelNode instanceof Node \ Stmt \ Declare_ ) { return false ; } $ declareStatement = reset ( $ topLevelNode -> declares ) ; $ isStrictTypeKey = $ declareStatement -> key -> toString ( ) === 'strict_types' ; $ isScalarValue = $ declareStatement -> value instanceof Node \ Scalar \ LNumber ; $ isStrictMode = $ isStrictTypeKey && $ isScalarValue && $ declareStatement -> value -> value === 1 ; return $ isStrictMode ; }
Checks if the current file is in strict mode

@return bool
Checks if the current file is in strict mode