src/Standards/BestIt/Sniffs/Formatting/AlphabeticallySortedUsesSniff.php
private function getNewUseStatements(): string
    {
        $this->sortUseStatements();

        $file = $this->getFile()->getBaseFile();

        return implode(
            $file->eolChar,
            array_map(
                function (UseStatement $useStatement) use ($file): string {
                    $unqualifiedName = NamespaceHelper::getUnqualifiedNameFromFullyQualifiedName(
                        $useStatement->getFullyQualifiedTypeName()
                    );

                    $useTypeName = UseStatementHelper::getTypeName($file, $useStatement);
                    $useTypeFormatted = $useTypeName ? sprintf('%s ', $useTypeName) : '';

                    return ($unqualifiedName === $useStatement->getNameAsReferencedInFile())
                        ? sprintf(
                            'use %s%s;',
                            $useTypeFormatted,
                            $useStatement->getFullyQualifiedTypeName()
                        )
                        : sprintf(
                            'use %s%s as %s;',
                            $useTypeFormatted,
                            $useStatement->getFullyQualifiedTypeName(),
                            $useStatement->getNameAsReferencedInFile()
                        );
                },
                $this->useStatements
            )
        );
    }
private function getNewUseStatements(): string
    {
        $this->sortUseStatements();

        $file = $this->getFile()->getBaseFile();

        return implode(
            $file->eolChar,
            array_map(
                function (UseStatement $useStatement) use ($file): string {
                    $unqualifiedName = NamespaceHelper::getUnqualifiedNameFromFullyQualifiedName(
                        $useStatement->getFullyQualifiedTypeName()
                    );

                    $useTypeName = UseStatementHelper::getTypeName($file, $useStatement);
                    $useTypeFormatted = $useTypeName ? sprintf('%s ', $useTypeName) : '';

                    return ($unqualifiedName === $useStatement->getNameAsReferencedInFile())
                        ? sprintf(
                            'use %s%s;',
                            $useTypeFormatted,
                            $useStatement->getFullyQualifiedTypeName()
                        )
                        : sprintf(
                            'use %s%s as %s;',
                            $useTypeFormatted,
                            $useStatement->getFullyQualifiedTypeName(),
                            $useStatement->getNameAsReferencedInFile()
                        );
                },
                $this->useStatements
            )
        );
    }
private function getNewUseStatements ( ) : string { $ this -> sortUseStatements ( ) ; $ file = $ this -> getFile ( ) -> getBaseFile ( ) ; return implode ( $ file -> eolChar , array_map ( function ( UseStatement $ useStatement ) use ( $ file ) : string { $ unqualifiedName = NamespaceHelper :: getUnqualifiedNameFromFullyQualifiedName ( $ useStatement -> getFullyQualifiedTypeName ( ) ) ; $ useTypeName = UseStatementHelper :: getTypeName ( $ file , $ useStatement ) ; $ useTypeFormatted = $ useTypeName ? sprintf ( '%s ' , $ useTypeName ) : '' ; return ( $ unqualifiedName === $ useStatement -> getNameAsReferencedInFile ( ) ) ? sprintf ( 'use %s%s;' , $ useTypeFormatted , $ useStatement -> getFullyQualifiedTypeName ( ) ) : sprintf ( 'use %s%s as %s;' , $ useTypeFormatted , $ useStatement -> getFullyQualifiedTypeName ( ) , $ useStatement -> getNameAsReferencedInFile ( ) ) ; } , $ this -> useStatements ) ) ; }
Returns the new statements as a string for fixing.

@return string
Returns the new statements as a string for fixing .