Skip to content

Commit 7125b46

Browse files
committed
style(*): apply auto fixes
1 parent de006ea commit 7125b46

23 files changed

+150
-147
lines changed

src/php/bootstrap.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
// @codingStandardsIgnoreFile
34
/**
45
* This file is part of the Sclable Xml Lint Package.
@@ -11,19 +12,20 @@
1112

1213
/**
1314
* @param string $file
15+
*
1416
* @return bool|string
1517
*/
1618
function includeIfExists($file)
1719
{
18-
/** @noinspection PhpIncludeInspection */
20+
/* @noinspection PhpIncludeInspection */
1921
return file_exists($file) ? include $file : false;
2022
}
2123

22-
if ((!$loader = includeIfExists(__DIR__.'/../../vendor/autoload.php'))
23-
&& (!$loader = includeIfExists(__DIR__.'/../../../../autoload.php'))) {
24+
if ((!$loader = includeIfExists(__DIR__ . '/../../vendor/autoload.php'))
25+
&& (!$loader = includeIfExists(__DIR__ . '/../../../../autoload.php'))) {
2426
echo 'You must set up the project dependencies, run the following commands:' . PHP_EOL .
2527
'curl -sS https://getcomposer.org/installer | php' . PHP_EOL .
26-
'php composer.phar install'.PHP_EOL;
28+
'php composer.phar install' . PHP_EOL;
2729
exit(1);
2830
}
2931

src/php/console/application/Application.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,30 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10+
1011
namespace sclable\xmlLint\console\application;
1112

12-
use sclable\xmlLint\console\command\LintCommand;
1313
use Symfony\Component\Console\Command\Command;
14-
use Symfony\Component\Console\Command\HelpCommand;
1514
use Symfony\Component\Console\Input\ArgvInput;
15+
use sclable\xmlLint\console\command\LintCommand;
16+
use Symfony\Component\Console\Command\HelpCommand;
1617
use Symfony\Component\Console\Input\InputInterface;
1718
use Symfony\Component\Console\Output\OutputInterface;
1819

1920
/**
20-
* Class Application
21+
* Class Application.
2122
*
2223
* customized console application for Xml Lint
2324
*
24-
* @package sclable\xmlLint\console
2525
* @author Michael Rutz <[email protected]>
26-
*
2726
*/
2827
class Application extends \Symfony\Component\Console\Application
2928
{
3029
const VERSION = 'dev';
3130
const NAME = 'Sclable Xml Lint';
3231

3332
/**
34-
* @inheritdoc
33+
* {@inheritdoc}
3534
*/
3635
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
3736
{
@@ -41,26 +40,27 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
4140
$this->setDefaultCommand(LintCommand::COMMAND_NAME);
4241
}
4342

44-
4543
/**
46-
* @inheritdoc
44+
* {@inheritdoc}
4745
*/
4846
protected function getDefaultCommands()
4947
{
5048
parent::getDefaultCommands();
49+
5150
return [
5251
new HelpCommand(),
53-
new LintCommand()
52+
new LintCommand(),
5453
];
5554
}
5655

5756
/**
58-
* @inheritdoc
57+
* {@inheritdoc}
58+
*
5959
* @SuppressWarnings(PHPMD.Superglobals)
6060
*/
6161
public function run(InputInterface $input = null, OutputInterface $output = null)
6262
{
63-
if ($input === null) {
63+
if (null === $input) {
6464
// rewrite the input for single command usage
6565
$argv = $_SERVER['argv'];
6666
$scriptName = array_shift($argv);
@@ -73,11 +73,11 @@ public function run(InputInterface $input = null, OutputInterface $output = null
7373
}
7474

7575
/**
76-
* @inheritdoc
76+
* {@inheritdoc}
7777
*/
7878
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
7979
{
80-
if ($command->getName() <> 'version') {
80+
if ('version' != $command->getName()) {
8181
$output->writeln($this->getLongVersion());
8282
}
8383

src/php/console/command/Command.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10+
1011
namespace sclable\xmlLint\console\command;
1112

12-
use \Symfony\Component\Console\Command\Command as BaseCommand;
13+
use Symfony\Component\Console\Command\Command as BaseCommand;
1314

1415
/**
15-
* Class Command
16+
* Class Command.
1617
*
1718
*
18-
* @package php\console\command
1919
* @author Michael Rutz <[email protected]>
20-
*
2120
*/
2221
class Command extends BaseCommand
2322
{
2423
/** @var array local synopsis runtime cache */
2524
private $synopsis = [];
2625

2726
/**
28-
* @inheritdoc
27+
* {@inheritdoc}
28+
*
2929
* @SuppressWarnings(PHPMD.Superglobals)
3030
*/
3131
public function getSynopsis($short = false)

src/php/console/command/HelpCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10+
1011
namespace sclable\xmlLint\console\command;
1112

12-
use Symfony\Component\Console\Input\InputInterface;
1313
use Symfony\Component\Console\Input\InputOption;
14+
use Symfony\Component\Console\Input\InputInterface;
1415
use Symfony\Component\Console\Output\OutputInterface;
1516

1617
/**
17-
* Class HelpCommand
18+
* Class HelpCommand.
1819
*
1920
* customized help command to render the help without sub_command.
2021
*
2122
* default: `xmllint <sub_command> [--option|-o] <argument>`
2223
* customized: `xmllint [--option|-o] <argument>`
2324
*
2425
* @see \Symfony\Component\Console\Command\HelpCommand
25-
* @package sclable\xmlLint\console\command
26-
* @author Michael Rutz <[email protected]>
2726
*
27+
* @author Michael Rutz <[email protected]>
2828
*/
2929
class HelpCommand extends \Symfony\Component\Console\Command\HelpCommand
3030
{
@@ -37,7 +37,7 @@ protected function configure()
3737

3838
$this
3939
->setName('help')
40-
->setDefinition(array(
40+
->setDefinition([
4141
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
4242
new InputOption(
4343
'format',
@@ -47,7 +47,7 @@ protected function configure()
4747
'txt'
4848
),
4949
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
50-
))
50+
])
5151
->setDescription('Display help')
5252
->setHelp(<<<EOF
5353
The <info>%command.name%</info> command displays the help.
@@ -59,7 +59,7 @@ protected function configure()
5959
}
6060

6161
/**
62-
* @inheritdoc
62+
* {@inheritdoc}
6363
*/
6464
protected function execute(InputInterface $input, OutputInterface $output)
6565
{

src/php/console/command/LintCommand.php

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10+
1011
namespace sclable\xmlLint\console\command;
1112

1213
use sclable\xmlLint\data\FileReport;
14+
use Symfony\Component\Finder\Finder;
15+
use Symfony\Component\Finder\SplFileInfo;
1316
use sclable\xmlLint\validator\ValidationFactory;
17+
use Symfony\Component\Console\Input\InputOption;
1418
use sclable\xmlLint\validator\ValidationInterface;
1519
use Symfony\Component\Console\Input\InputArgument;
1620
use Symfony\Component\Console\Input\InputInterface;
17-
use Symfony\Component\Console\Input\InputOption;
1821
use Symfony\Component\Console\Output\OutputInterface;
19-
use Symfony\Component\Finder\Finder;
20-
use Symfony\Component\Finder\SplFileInfo;
2122

2223
/**
23-
* Class LintCommand
24+
* Class LintCommand.
2425
*
2526
*
26-
* @package sclable\xmlLint\console\command
2727
* @author Michael Rutz <[email protected]>
2828
*
2929
* @const string COMMAND_NAME the name of the command
@@ -35,9 +35,9 @@ class LintCommand extends Command
3535
const COMMAND_NAME = 'lint';
3636
const ARGUMENT_FILE = 'file';
3737
const OPTION_RECURSIVE = 'recursive';
38-
const OPTION_EXCLUDE = 'exclude';
39-
const OPTION_PATTERN = 'pattern';
40-
const OPTION_NO_XSD = 'skip-xsd';
38+
const OPTION_EXCLUDE = 'exclude';
39+
const OPTION_PATTERN = 'pattern';
40+
const OPTION_NO_XSD = 'skip-xsd';
4141

4242
/** @var OutputInterface */
4343
protected $output;
@@ -55,7 +55,7 @@ class LintCommand extends Command
5555
private $start;
5656

5757
/**
58-
* @inheritdoc
58+
* {@inheritdoc}
5959
*/
6060
protected function configure()
6161
{
@@ -97,7 +97,7 @@ protected function configure()
9797
}
9898

9999
/**
100-
* @inheritdoc
100+
* {@inheritdoc}
101101
*/
102102
protected function execute(InputInterface $input, OutputInterface $output)
103103
{
@@ -122,7 +122,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
122122

123123
$output->writeln('');
124124

125-
if ($status === false) {
125+
if (false === $status) {
126126
$this->printReportsOfFilesWithProblems();
127127
}
128128

@@ -136,8 +136,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
136136
}
137137

138138
/**
139-
* lint the content of a directory, recursive if defined
139+
* lint the content of a directory, recursive if defined.
140+
*
140141
* @param string $dir path/to/dir
142+
*
141143
* @return bool
142144
*/
143145
private function lintDir($dir)
@@ -173,7 +175,7 @@ private function lintDir($dir)
173175
/** @var SplFileInfo $file */
174176
foreach ($finder as $file) {
175177
$ret = $this->lintFile($file) && $ret;
176-
if (++$counter % 30 == 0) {
178+
if (0 == ++$counter % 30) {
177179
$this->output->writeln(sprintf(
178180
' %8d/%d %6.2f%%',
179181
$counter,
@@ -187,14 +189,14 @@ private function lintDir($dir)
187189
}
188190

189191
/**
190-
* format and print the errors from the queue to the output
192+
* format and print the errors from the queue to the output.
191193
*/
192194
private function printReportsOfFilesWithProblems()
193195
{
194196
$this->output->writeln(PHP_EOL . '<error>errors:</error>');
195197

196198
foreach ($this->reports as $report) {
197-
if ($report->hasProblems() === false) {
199+
if (false === $report->hasProblems()) {
198200
continue;
199201
}
200202

@@ -212,13 +214,14 @@ private function printReportsOfFilesWithProblems()
212214
}
213215

214216
/**
215-
* lint a file, pass errors to the queue
217+
* lint a file, pass errors to the queue.
218+
*
216219
* @param \SplFileInfo $file
220+
*
217221
* @return bool
218222
*/
219223
private function lintFile(\SplFileInfo $file)
220224
{
221-
222225
if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
223226
$this->output->write('lint file ' . $file . ' ... ');
224227
}
@@ -228,13 +231,13 @@ private function lintFile(\SplFileInfo $file)
228231
$status = $this->validator->validateFile($report);
229232

230233
if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
231-
if ($status === false) {
234+
if (false === $status) {
232235
$this->output->writeln('<error>errors</error>');
233236
} else {
234237
$this->output->writeln('<info>passed.</info>');
235238
}
236239
} else {
237-
if ($status === false) {
240+
if (false === $status) {
238241
$this->output->write('<error>F</error>');
239242
} else {
240243
$this->output->write('.');

0 commit comments

Comments
 (0)