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

[console] Apply PSR-2 code style. #3064

Merged
merged 1 commit into from
Jan 2, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions bin/drupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

set_time_limit(0);

if(file_exists(__DIR__ . '/../autoload.local.php')) {
require_once __DIR__ . '/../autoload.local.php';
}
else {
$autoloaders = [
if (file_exists(__DIR__ . '/../autoload.local.php')) {
include_once __DIR__ . '/../autoload.local.php';
} else {
$autoloaders = [
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../vendor/autoload.php'
];
Expand All @@ -25,9 +24,8 @@
}

if (isset($autoloader)) {
$autoload = require_once $autoloader;
}
else {
$autoload = include_once $autoloader;
} else {
echo ' You must set up the project dependencies using `composer install`' . PHP_EOL;
exit(1);
}
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"gabordemooij/redbean": "~4.3",
"doctrine/annotations": "1.2.*",
"symfony/expression-language": ">=2.7 <3.2",
"symfony/cache": ">=2.7 <3.2"
"symfony/cache": ">=2.7 <3.2",
"psy/psysh": "0.6|0.8"
},
"bin": ["bin/drupal"],
"config": {
Expand Down
11 changes: 5 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions phpqa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ application:
php-cs-fixer:
enabled: true
exception: false
# file:
# config-file: .php_cs
# single-execution: false
options:
level: psr2
arguments:
Expand Down
3 changes: 2 additions & 1 deletion src/Command/Database/DropCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$databaseConnection['database']
),
true
)) {
)
) {
return 1;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/Command/Generate/ProfileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ function ($machine_name) use ($validators) {
if ($io->confirm(
$this->trans('commands.generate.profile.questions.dependencies'),
true
)) {
)
) {
$dependencies = $io->ask(
$this->trans('commands.generate.profile.options.dependencies'),
''
Expand All @@ -307,7 +308,8 @@ function ($machine_name) use ($validators) {
if ($io->confirm(
$this->trans('commands.generate.profile.questions.distribution'),
false
)) {
)
) {
$distribution = $io->ask(
$this->trans('commands.generate.profile.options.distribution'),
'My Kick-ass Distribution'
Expand Down
6 changes: 4 additions & 2 deletions src/Command/Generate/ThemeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ function ($theme_path) use ($drupalRoot, $machine_name) {
if ($io->confirm(
$this->trans('commands.generate.theme.questions.regions'),
true
)) {
)
) {
// @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion
$regions = $this->regionQuestion($io);
$input->setOption('regions', $regions);
Expand All @@ -345,7 +346,8 @@ function ($theme_path) use ($drupalRoot, $machine_name) {
if ($io->confirm(
$this->trans('commands.generate.theme.questions.breakpoints'),
true
)) {
)
) {
// @see \Drupal\Console\Command\Shared\ThemeRegionTrait::regionQuestion
$breakpoints = $this->breakpointQuestion($io);
$input->setOption('breakpoints', $breakpoints);
Expand Down
3 changes: 2 additions & 1 deletion src/Command/Shared/FormTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function formQuestion(DrupalStyle $io)
if ($io->confirm(
$this->trans('commands.common.questions.inputs.confirm'),
true
)) {
)
) {
$input_types = [
'fieldset',
'text_format'
Expand Down
3 changes: 2 additions & 1 deletion src/Command/Shared/MenuTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function menuQuestion(DrupalStyle $io, $className)
if ($io->confirm(
$this->trans('commands.generate.form.questions.menu_link_gen'),
true
)) {
)
) {
// now we need to ask them where to gen the form
// get the route
$menu_options = [
Expand Down
3 changes: 2 additions & 1 deletion src/Command/Shared/PermissionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function permissionQuestion(DrupalStyle $output)
if (!$output->confirm(
$this->trans('commands.generate.permission.questions.add'),
true
)) {
)
) {
break;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Command/Shared/ServicesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public function servicesQuestion(DrupalStyle $io)
if ($io->confirm(
$this->trans('commands.common.questions.services.confirm'),
false
)) {
)
) {
$service_collection = [];
$io->writeln($this->trans('commands.common.questions.services.message'));
$services = $this->container->getServiceIds();
Expand Down
3 changes: 2 additions & 1 deletion src/Command/Shared/ThemeBreakpointTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ function ($breakPointLabel) use ($validators) {
if (!$io->confirm(
$this->trans('commands.generate.theme.questions.breakpoint-add'),
true
)) {
)
) {
break;
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Command/Shared/ThemeRegionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ function ($regionMachineName) use ($validators) {
if (!$io->confirm(
$this->trans('commands.generate.theme.questions.region-add'),
true
)) {
)
) {
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Command/ShellCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/**
* Class ShellCommand
*
* @package Drupal\Console\Command
*/
class ShellCommand extends Command
Expand Down
10 changes: 5 additions & 5 deletions src/Generator/CommandGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Drupal\Console\Generator;

use Drupal\Console\Extension\Manager;
use Drupal\Console\Core\Utils\TranslatorManager;
use Drupal\Console\Core\Utils\TranslatorManagerInterface;
use Drupal\Console\Core\Generator\Generator;

/**
Expand All @@ -24,19 +24,19 @@ class CommandGenerator extends Generator
protected $extensionManager;

/**
* @var TranslatorManager
* @var TranslatorManagerInterface
*/
protected $translatorManager;

/**
* CommandGenerator constructor.
*
* @param Manager $extensionManager
* @param TranslatorManager $translatorManager
* @param Manager $extensionManager
* @param TranslatorManagerInterface $translatorManager
*/
public function __construct(
Manager $extensionManager,
TranslatorManager $translatorManager
TranslatorManagerInterface $translatorManager
) {
$this->extensionManager = $extensionManager;
$this->translatorManager = $translatorManager;
Expand Down
28 changes: 28 additions & 0 deletions src/Plugin/ScriptHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* @file
* Contains Drupal\Console\Plugin\ScriptHandler.
*/

namespace Drupal\Console\Plugin;

use Composer\Script\Event;
use Composer\Util\ProcessExecutor;

class ScriptHandler
{
/**
* Register
*
* @param \Composer\Script\Event $event
* The script event.
*/
public static function dump(Event $event)
{
$packages = array_keys($event->getComposer()->getPackage()->getRequires());
if (!$packages) {
return;
}
}
}
15 changes: 15 additions & 0 deletions src/Utils/TranslatorManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Created by PhpStorm.
* User: jmolivas
* Date: 1/2/17
* Time: 2:27 PM
*/

namespace Drupal\Console\Utils;

use Drupal\Console\Core\Utils\TranslatorManager as TranslatorManagerBase;

class TranslatorManager extends TranslatorManagerBase
{
}
6 changes: 3 additions & 3 deletions templates/module/src/Command/command.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
{% if container_aware %}
use Drupal\Console\Command\Shared\ContainerAwareCommandTrait;
use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
{% else %}
use Drupal\Console\Command\Shared\CommandTrait;
use Drupal\Console\Core\Command\Shared\CommandTrait;
{% endif %}
use Drupal\Console\Style\DrupalStyle;
use Drupal\Console\Core\Style\DrupalStyle;
{% endblock %}

{% block class_declaration %}
Expand Down