src/Standards/BestIt/Sniffs/TypeHints/ReturnTypeDeclarationSniff.php
private function getUsableReturnTypes(Annotation $annotation): ?array
    {
        $return = null;

        $returnTypes = $this->getReturnsFromAnnotation($annotation);
        $returnTypeCount = count($returnTypes);
        $justOneReturn = $returnTypeCount === 1;

        if (!$justOneReturn || strtolower($returnTypes[0]) !== 'mixed') {
            $isNullableType = ($returnTypeCount === 2) &&
                version_compare(phpversion(), '7.1.0', '>=') &&
                (count(array_intersect($returnTypes, self::NULL_TYPES)) === 1);

            $return = ($justOneReturn || $isNullableType) ? $returnTypes : null;
        }

        return $return;
    }
private function getUsableReturnTypes(Annotation $annotation): ?array
    {
        $return = null;

        $returnTypes = $this->getReturnsFromAnnotation($annotation);
        $returnTypeCount = count($returnTypes);
        $justOneReturn = $returnTypeCount === 1;

        if (!$justOneReturn || strtolower($returnTypes[0]) !== 'mixed') {
            $isNullableType = ($returnTypeCount === 2) &&
                version_compare(phpversion(), '7.1.0', '>=') &&
                (count(array_intersect($returnTypes, self::NULL_TYPES)) === 1);

            $return = ($justOneReturn || $isNullableType) ? $returnTypes : null;
        }

        return $return;
    }
private function getUsableReturnTypes ( Annotation $ annotation ) : ? array { $ return = null ; $ returnTypes = $ this -> getReturnsFromAnnotation ( $ annotation ) ; $ returnTypeCount = count ( $ returnTypes ) ; $ justOneReturn = $ returnTypeCount === 1 ; if ( ! $ justOneReturn || strtolower ( $ returnTypes [ 0 ] ) !== 'mixed' ) { $ isNullableType = ( $ returnTypeCount === 2 ) && version_compare ( phpversion ( ) , '7.1.0' , '>=' ) && ( count ( array_intersect ( $ returnTypes , self :: NULL_TYPES ) ) === 1 ) ; $ return = ( $ justOneReturn || $ isNullableType ) ? $ returnTypes : null ; } return $ return ; }
Returns the types of the annotation, if the types are usable.

Usable means, that there should be one type != mixed in the return-annotation or a nullable type, which means
2 types like null|$ANYTYPE.

@param Annotation $annotation

@return array|null Null if there are no usable types or the usable types.
Returns the types of the annotation if the types are usable .