Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule "ordered_imports" does not use "imports_order" #88

Open
1 task done
dkd-kaehm opened this issue Jan 19, 2023 · 1 comment
Open
1 task done

Rule "ordered_imports" does not use "imports_order" #88

dkd-kaehm opened this issue Jan 19, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@dkd-kaehm
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Operating System

ne matter

Composer version

no matter

PHP version

8.1

TYPO3 Coding Standards Package version

Latest stable release

Additional version information

0.7.1

Current Behavior

The import statemnt is not ordered by import type see "use function " block example in core:

https://github.com/TYPO3/typo3/blob/60bcbf2cdf4a7d262d77127becfd72ec92a1a993/typo3/sysext/install/Classes/SystemEnvironment/ServerResponse/ServerResponseCheck.php#L20-L36

<?php

declare(strict_types=1);

/*
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

namespace TYPO3\CMS\Install\SystemEnvironment\ServerResponse;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\TransferException;

use function GuzzleHttp\Promise\settle;

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Crypto\Random;
use TYPO3\CMS\Core\Http\Uri;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Controller\ServerResponseCheckController;
use TYPO3\CMS\Install\SystemEnvironment\CheckInterface;
use TYPO3\CMS\Reports\Status;

/**
 * Checks how use web server is interpreting static files concerning
 * their `content-type` and evaluated content in HTTP responses.
 *
 * @internal should only be used from within TYPO3 Core
 */
class ServerResponseCheck implements CheckInterface
{
...

Expected Behavior

The import statements are ordered by type like follows:

<?php

declare(strict_types=1);
....

use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\TransferException;
use Psr\Http\Message\ResponseInterface;
// ...

use function GuzzleHttp\Promise\settle;

/**
 * Checks how use web server is interpreting static files concerning
 * their `content-type` and evaluated content in HTTP responses.
 *
 * @internal should only be used from within TYPO3 Core
 */
class ServerResponseCheck implements CheckInterface
{
...

Steps To Reproduce

No response

Anything else?

See:
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.13.2/doc/rules/import/ordered_imports.rst

Would propose to replace the defined rule
from
'ordered_imports' => true
to

'ordered_imports' => [
    'imports_order' => ['class', 'function', 'const'],
    'sort_algorithm' => 'alpha'
]

I did the same on EXT:solr 12 LTS preparations.

@gilbertsoft
Copy link
Collaborator

Hi @dkd-kaehm , the change is currently prepared in the core see https://review.typo3.org/c/Packages/TYPO3.CMS/+/79149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants