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

Move from PSR2 to PSR12 #4994

Merged
merged 2 commits into from Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/Commands/ArtCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

use Consolidation\AnnotatedCommand\AnnotationData;
Expand All @@ -9,7 +10,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

use Drush\Style\DrushStyle;
use Drush\Utils\StringUtils;

Expand Down
2 changes: 1 addition & 1 deletion examples/Commands/PolicyCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

use Consolidation\AnnotatedCommand\CommandData;
Expand All @@ -13,7 +14,6 @@

class PolicyCommands extends DrushCommands
{

/**
* Prevent catastrophic braino. Note that this file has to be local to the
* machine that initiates the sql:sync command.
Expand Down
2 changes: 1 addition & 1 deletion examples/Commands/SiteAliasAlterCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

use Consolidation\AnnotatedCommand\AnnotationData;
Expand All @@ -11,7 +12,6 @@
*/
class SiteAliasAlterCommands extends DrushCommands implements SiteAliasManagerAwareInterface
{

use SiteAliasManagerAwareTrait;

/**
Expand Down
2 changes: 1 addition & 1 deletion examples/Commands/SyncViaHttpCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

use Consolidation\AnnotatedCommand\CommandData;
Expand All @@ -13,7 +14,6 @@

class SyncViaHttpCommands extends DrushCommands
{

/**
* When a hook extends a command with additional options, it must
* implement declare those option(s) in a @hook option like this one. Doing so will add
Expand Down
2 changes: 1 addition & 1 deletion examples/Commands/XkcdCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

use Drush\Attributes\Command;
Expand All @@ -17,7 +18,6 @@

class XkcdCommands extends DrushCommands
{

use ExecTrait;

/**
Expand Down
3 changes: 2 additions & 1 deletion phpcs.xml
Expand Up @@ -4,10 +4,11 @@
<file>src</file>
<file>examples</file>
<file>tests</file>
<rule ref="PSR2"/>
<rule ref="PSR12"/>

<!-- Keep us sane-->
<rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed"><severity>0</severity></rule>
<rule ref="PSR2.Methods.MethodDeclaration.Underscore"><severity>0</severity></rule>

<arg name="warning-severity" value="0"/>
<arg value="s" />
Expand Down
4 changes: 2 additions & 2 deletions src/.editorconfig
@@ -1,8 +1,8 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# PHP PSR-2 Coding Standards
# http://www.php-fig.org/psr/psr-2/
# PHP PSR-12 Coding Standards
# http://www.php-fig.org/psr/psr-12/

[*.php]
charset = utf-8
Expand Down
1 change: 1 addition & 0 deletions src/Application.php
@@ -1,4 +1,5 @@
<?php

namespace Drush;

use Composer\Autoload\ClassLoader;
Expand Down
1 change: 1 addition & 0 deletions src/Backend/BackendPathEvaluator.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Backend;

use Consolidation\SiteAlias\SiteAlias;
Expand Down
1 change: 1 addition & 0 deletions src/Boot/AutoloaderAwareInterface.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Boot;

interface AutoloaderAwareInterface
Expand Down
1 change: 1 addition & 0 deletions src/Boot/AutoloaderAwareTrait.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Boot;

trait AutoloaderAwareTrait
Expand Down
1 change: 0 additions & 1 deletion src/Boot/EmptyBoot.php
Expand Up @@ -14,7 +14,6 @@
*/
class EmptyBoot extends BaseBoot
{

public function validRoot($path): bool
{
return false;
Expand Down
1 change: 0 additions & 1 deletion src/Boot/Kernels.php
Expand Up @@ -11,7 +11,6 @@
*/
final class Kernels
{

/**
* The default kernel that is used on standard requests.
*
Expand Down
1 change: 1 addition & 0 deletions src/Command/DrushCommandInfoAlterer.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Command;

use Consolidation\AnnotatedCommand\CommandInfoAltererInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/GlobalOptionsEventListener.php
@@ -1,10 +1,10 @@
<?php

namespace Drush\Command;

use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

use Drush\Preflight\LegacyPreflight;

class GlobalOptionsEventListener implements EventSubscriberInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Command/RemoteCommandProxy.php
@@ -1,12 +1,12 @@
<?php

namespace Drush\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drush\Symfony\IndiscriminateInputDefinition;

use Drush\Runtime\RedispatchHook;

/**
Expand Down
1 change: 1 addition & 0 deletions src/Command/ServiceCommandlist.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Command;

/**
Expand Down
16 changes: 8 additions & 8 deletions src/Commands/DrushCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

use Symfony\Component\Console\Style\SymfonyStyle;
Expand All @@ -25,23 +26,22 @@ abstract class DrushCommands implements IOAwareInterface, LoggerAwareInterface,
{
use ProcessManagerAwareTrait;
use ExecTrait;
use ConfigAwareTrait;
use LoggerAwareTrait;
use IO {
io as roboIo;
}

// This is more readable.
const REQ=InputOption::VALUE_REQUIRED;
const OPT=InputOption::VALUE_OPTIONAL;
const REQ = InputOption::VALUE_REQUIRED;
const OPT = InputOption::VALUE_OPTIONAL;

// Common exit codes.
const EXIT_SUCCESS = 0;
const EXIT_FAILURE = 1;
// Used to signal that the command completed successfully, but we still want to indicate a failure to the caller.
const EXIT_FAILURE_WITH_CLARITY = 3;

use LoggerAwareTrait;
use ConfigAwareTrait;
use IO {
io as roboIo;
}

/**
* @var CommandData
*/
Expand Down
7 changes: 1 addition & 6 deletions src/Commands/ExampleCommands.php
@@ -1,14 +1,9 @@
<?php
namespace Drush\Commands;

/**
* @file
* Set up local Drush configuration.
*/
namespace Drush\Commands;

use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Consolidation\OutputFormatters\Options\FormatterOptions;

use Consolidation\AnnotatedCommand\CommandData;

class ExampleCommands extends DrushCommands
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/LegacyCommands.php
@@ -1,9 +1,9 @@
<?php

namespace Drush\Commands;

class LegacyCommands extends DrushCommands
{

/**
* Drupal 8 does not support disabling modules. See pm:uninstall command.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/OptionsCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

/*
Expand All @@ -8,8 +9,7 @@

class OptionsCommands
{

const REQ=InputOption::VALUE_REQUIRED;
const REQ = InputOption::VALUE_REQUIRED;

/**
* @hook option @optionset_proc_build
Expand Down
1 change: 1 addition & 0 deletions src/Commands/ValidatorsCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands;

use Consolidation\AnnotatedCommand\AnnotationData;
Expand Down
1 change: 1 addition & 0 deletions src/Commands/config/ConfigPullCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\config;

use Consolidation\AnnotatedCommand\CommandData;
Expand Down
1 change: 1 addition & 0 deletions src/Commands/core/BrowseCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Drupal\Core\Url;
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/core/CacheCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Drupal\Core\Routing\RouteBuilderInterface;
Expand All @@ -23,7 +24,6 @@
*/
class CacheCommands extends DrushCommands implements CustomEventAwareInterface, AutoloaderAwareInterface, StdinAwareInterface
{

use CustomEventAwareTrait;
use AutoloaderAwareTrait;
use StdinAwareTrait;
Expand Down Expand Up @@ -353,7 +353,7 @@ public function loadDrupalAutoloader($drupal_root)
{
static $autoloader = false;

$autoloadFilePath = $drupal_root .'/autoload.php';
$autoloadFilePath = $drupal_root . '/autoload.php';
if (!$autoloader && file_exists($autoloadFilePath)) {
$autoloader = require $autoloadFilePath;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/core/CoreCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Consolidation\OutputFormatters\StructuredData\PropertyList;
Expand All @@ -10,7 +11,6 @@

class CoreCommands extends DrushCommands implements SiteAliasManagerAwareInterface
{

use SiteAliasManagerAwareTrait;

/**
Expand All @@ -33,7 +33,7 @@ public function globalOptions($options = ['format' => 'table']): RowsOfFields
$application = Drush::getApplication();
$def = $application->getDefinition();
foreach ($def->getOptions() as $key => $value) {
$name = '--'. $key;
$name = '--' . $key;
if ($value->getShortcut()) {
$name = '-' . $value->getShortcut() . ', ' . $name;
}
Expand Down
1 change: 1 addition & 0 deletions src/Commands/core/DeployCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Consolidation\SiteAlias\SiteAlias;
Expand Down
1 change: 1 addition & 0 deletions src/Commands/core/DocsCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Consolidation\AnnotatedCommand\CommandData;
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/core/DrupalDirectoryCommands.php
@@ -1,16 +1,15 @@
<?php

namespace Drush\Commands\core;

use Drush\Commands\DrushCommands;
use Consolidation\SiteAlias\HostPath;
use Consolidation\SiteAlias\SiteAliasManagerAwareInterface;
use Consolidation\SiteAlias\SiteAliasManagerAwareTrait;

use Drush\Backend\BackendPathEvaluator;

class DrupalDirectoryCommands extends DrushCommands implements SiteAliasManagerAwareInterface
{

use SiteAliasManagerAwareTrait;

/** @var BackendPathEvaluator */
Expand Down
1 change: 1 addition & 0 deletions src/Commands/core/DrupliconCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Consolidation\AnnotatedCommand\CommandData;
Expand Down
1 change: 1 addition & 0 deletions src/Commands/core/EditCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Consolidation\SiteProcess\Util\Escape;
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/core/LoginCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Drupal\user\Entity\User;
Expand All @@ -11,7 +12,6 @@

class LoginCommands extends DrushCommands implements SiteAliasManagerAwareInterface
{

use SiteAliasManagerAwareTrait;
use ExecTrait;

Expand Down
1 change: 1 addition & 0 deletions src/Commands/core/NotifyCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Consolidation\AnnotatedCommand\CommandData;
Expand Down
1 change: 1 addition & 0 deletions src/Commands/core/PhpCommands.php
@@ -1,4 +1,5 @@
<?php

namespace Drush\Commands\core;

use Consolidation\AnnotatedCommand\Input\StdinAwareInterface;
Expand Down