src/Standards/BestIt/Sniffs/TypeHints/ReturnTypeDeclarationSniff.php
private function validateReturnType(?array $returnTypes): void
    {
        if (!$returnTypes) {
            $returnTypes = [];
        }

        $fixableTypes = $this->loadFixableTypes($returnTypes);

        if (count($returnTypes) === count($fixableTypes)) {
            // Make sure this var is only filled, if it really is fixable for us.
            $this->typesForFix = $fixableTypes;
        }

        $exception =
            (new CodeError(static::CODE_MISSING_RETURN_TYPE, self::MESSAGE_MISSING_RETURN_TYPE, $this->stackPos))
                ->setPayload([$this->getFunctionName()]);

        $exception->isFixable((bool) $this->typesForFix);

        throw $exception;
    }
private function validateReturnType(?array $returnTypes): void
    {
        if (!$returnTypes) {
            $returnTypes = [];
        }

        $fixableTypes = $this->loadFixableTypes($returnTypes);

        if (count($returnTypes) === count($fixableTypes)) {
            // Make sure this var is only filled, if it really is fixable for us.
            $this->typesForFix = $fixableTypes;
        }

        $exception =
            (new CodeError(static::CODE_MISSING_RETURN_TYPE, self::MESSAGE_MISSING_RETURN_TYPE, $this->stackPos))
                ->setPayload([$this->getFunctionName()]);

        $exception->isFixable((bool) $this->typesForFix);

        throw $exception;
    }
private function validateReturnType ( ? array $ returnTypes ) : void { if ( ! $ returnTypes ) { $ returnTypes = [ ] ; } $ fixableTypes = $ this -> loadFixableTypes ( $ returnTypes ) ; if ( count ( $ returnTypes ) === count ( $ fixableTypes ) ) { // Make sure this var is only filled, if it really is fixable for us. $ this -> typesForFix = $ fixableTypes ; } $ exception = ( new CodeError ( static :: CODE_MISSING_RETURN_TYPE , self :: MESSAGE_MISSING_RETURN_TYPE , $ this -> stackPos ) ) -> setPayload ( [ $ this -> getFunctionName ( ) ] ) ; $ exception -> isFixable ( ( bool ) $ this -> typesForFix ) ; throw $ exception ; }
Validates the return type and registers an error if there is one.

@param array|null $returnTypes
@throws CodeWarning

@return void
Validates the return type and registers an error if there is one .