Skip to content

Commit e37a049

Browse files
committed
running php-cs-fixer
1 parent 76fbe3b commit e37a049

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+564
-166
lines changed

src/Application.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder;
411

512
use Symfony\Component\Console\Application as BaseApplication;
613
use Symfony\Component\Console\Input\InputInterface;
714
use Symfony\Component\Console\Input\InputOption;
815
use SymfonyDocsBuilder\Command\BuildDocsCommand;
9-
use SymfonyDocsBuilder\Command\CheckUrlsCommand;
1016
use SymfonyDocsBuilder\Command\GithubReleaseCommand;
1117

1218
class Application
@@ -18,10 +24,10 @@ public function __construct(string $symfonyVersion)
1824
{
1925
$this->application = new BaseApplication();
2026

21-
$configuration = [
22-
'symfony_api_url' => "https://api.symfony.com/%s",
23-
'php_doc_url' => "https://secure.php.net/manual/en",
24-
'symfony_doc_url' => "https://symfony.com/doc/%s",
27+
$configuration = [
28+
'symfony_api_url' => 'https://api.symfony.com/%s',
29+
'php_doc_url' => 'https://secure.php.net/manual/en',
30+
'symfony_doc_url' => 'https://symfony.com/doc/%s',
2531
];
2632
$this->buildContext = new BuildContext(
2733
$symfonyVersion,

src/BuildContext.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder;
411

512
use Doctrine\RST\Configuration;
@@ -26,9 +33,9 @@ public function __construct(
2633
string $symfonyDocUrl
2734
) {
2835
$this->symfonyVersion = $symfonyVersion;
29-
$this->symfonyApiUrl = $symfonyApiUrl;
30-
$this->phpDocUrl = $phpDocUrl;
31-
$this->symfonyDocUrl = $symfonyDocUrl;
36+
$this->symfonyApiUrl = $symfonyApiUrl;
37+
$this->phpDocUrl = $phpDocUrl;
38+
$this->symfonyDocUrl = $symfonyDocUrl;
3239
}
3340

3441
public function initializeRuntimeConfig(string $sourceDir, string $outputDir, ?string $parseSubPath = null, bool $disableCache = false, string $theme = Configuration::THEME_DEFAULT)
@@ -41,11 +48,11 @@ public function initializeRuntimeConfig(string $sourceDir, string $outputDir, ?s
4148
throw new \Exception(sprintf('Output directory "%s" does not exist', $outputDir));
4249
}
4350

44-
$this->sourceDir = realpath($sourceDir);
45-
$this->outputDir = realpath($outputDir);
46-
$this->parseSubPath = $parseSubPath;
47-
$this->disableCache = $disableCache;
48-
$this->theme = $theme;
51+
$this->sourceDir = realpath($sourceDir);
52+
$this->outputDir = realpath($outputDir);
53+
$this->parseSubPath = $parseSubPath;
54+
$this->disableCache = $disableCache;
55+
$this->theme = $theme;
4956
$this->runtimeInitialized = true;
5057
}
5158

src/CI/MissingFilesChecker.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Docs Builder package.
7+
* (c) Ryan Weaver <ryan@symfonycasts.com>
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
211

312
namespace SymfonyDocsBuilder\CI;
413

5-
use Symfony\Component\Console\Style\SymfonyStyle;
614
use Symfony\Component\Filesystem\Filesystem;
715
use Symfony\Component\Finder\Finder;
816
use SymfonyDocsBuilder\BuildContext;
@@ -15,8 +23,8 @@ class MissingFilesChecker
1523

1624
public function __construct(BuildContext $buildContext)
1725
{
18-
$this->finder = new Finder();
19-
$this->filesystem = new Filesystem();
26+
$this->finder = new Finder();
27+
$this->filesystem = new Filesystem();
2028
$this->buildContext = $buildContext;
2129
}
2230

@@ -31,12 +39,12 @@ public function getMissingFiles(): array
3139
$orphanedFiles = [];
3240

3341
foreach ($this->finder as $file) {
34-
$sourcePath = ltrim(substr($file->getPathname(), strlen($this->buildContext->getSourceDir())), '/');
42+
$sourcePath = ltrim(substr($file->getPathname(), \strlen($this->buildContext->getSourceDir())), '/');
3543

3644
$htmlFile = sprintf(
3745
'%s/%s.html',
3846
$this->buildContext->getOutputDir(),
39-
substr($sourcePath, 0, strlen($sourcePath) - 4)
47+
substr($sourcePath, 0, \strlen($sourcePath) - 4)
4048
);
4149

4250
$firstLine = fgets(fopen($file->getRealPath(), 'r'));

src/CI/UrlChecker.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Docs Builder package.
7+
* (c) Ryan Weaver <ryan@symfonycasts.com>
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
211

312
namespace SymfonyDocsBuilder\CI;
413

@@ -14,15 +23,15 @@ public function checkUrl(string $url)
1423
$httpClient = new Client(['timeout' => 10]);
1524

1625
try {
17-
$response = $httpClient->get($url, ['http_errors' => false]);
26+
$response = $httpClient->get($url, ['http_errors' => false]);
1827
$statusCode = $response->getStatusCode();
1928
} catch (GuzzleException $exception) {
2029
$statusCode = 0;
2130
}
2231

2332
if ($statusCode < 200 || $statusCode >= 300) {
2433
$this->invalidUrls[] = [
25-
'url' => $url,
34+
'url' => $url,
2635
'statusCode' => $statusCode,
2736
];
2837
}

src/Command/BuildDocsCommand.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Docs Builder package.
7+
* (c) Ryan Weaver <ryan@symfonycasts.com>
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
211

312
namespace SymfonyDocsBuilder\Command;
413

514
use Doctrine\Common\EventManager;
615
use Doctrine\RST\Builder;
716
use Doctrine\RST\Configuration;
8-
use Doctrine\RST\ErrorManager;
9-
use Doctrine\RST\Event\PostBuildRenderEvent;
10-
use Doctrine\RST\Event\PreNodeRenderEvent;
1117
use Doctrine\RST\Meta\Metas;
1218
use Symfony\Component\Console\Command\Command;
1319
use Symfony\Component\Console\Input\InputArgument;
@@ -21,9 +27,7 @@
2127
use SymfonyDocsBuilder\Generator\HtmlForPdfGenerator;
2228
use SymfonyDocsBuilder\Generator\JsonGenerator;
2329
use SymfonyDocsBuilder\KernelFactory;
24-
use SymfonyDocsBuilder\Listener\AssetsCopyListener;
2530
use SymfonyDocsBuilder\Listener\BuildProgressListener;
26-
use SymfonyDocsBuilder\Listener\CopyImagesListener;
2731

2832
class BuildDocsCommand extends Command
2933
{
@@ -141,7 +145,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
141145
}
142146

143147
if ($logPath = $input->getOption('save-errors')) {
144-
if (count($buildErrors) > 0) {
148+
if (\count($buildErrors) > 0) {
145149
array_unshift($buildErrors, sprintf('Build errors from "%s"', date('Y-m-d h:i:s')));
146150
}
147151

src/Command/CommandInitializerTrait.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/*
6+
* This file is part of the Docs Builder package.
7+
* (c) Ryan Weaver <ryan@symfonycasts.com>
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
211

312
namespace SymfonyDocsBuilder\Command;
413

514
use Doctrine\Common\EventManager;
615
use Doctrine\RST\Builder;
7-
use Doctrine\RST\Event\PostNodeRenderEvent;
816
use Doctrine\RST\Event\PostParseDocumentEvent;
917
use Doctrine\RST\Event\PreBuildParseEvent;
1018
use Doctrine\RST\Event\PreBuildRenderEvent;
1119
use Symfony\Component\Console\Helper\ProgressBar;
1220
use Symfony\Component\Console\Input\InputInterface;
1321
use Symfony\Component\Console\Output\OutputInterface;
14-
use Symfony\Component\Console\Style\SymfonyStyle;
1522
use Symfony\Component\Filesystem\Filesystem;
1623
use Symfony\Component\Finder\Finder;
1724
use SymfonyDocsBuilder\BuildContext;
18-
use SymfonyDocsBuilder\KernelFactory;
1925

2026
trait CommandInitializerTrait
2127
{
@@ -43,8 +49,6 @@ private function doInitialize(InputInterface $input, OutputInterface $output, st
4349

4450
private function initializeProgressBarEventListeners(): void
4551
{
46-
47-
4852
// tries to handle progress bar for "rendering"
4953
$this->eventManager->addEventListener(
5054
[PreBuildRenderEvent::PRE_BUILD_RENDER],
@@ -69,7 +73,7 @@ private function startBuild()
6973

7074
/**
7175
* Removes all existing html files in the output dir that should not exist
72-
* because previous build in the same output directory has been executed on another version
76+
* because previous build in the same output directory has been executed on another version.
7377
*/
7478
private function sanitizeOutputDirs(Finder $finder)
7579
{
@@ -121,7 +125,7 @@ function ($file) use ($outputDir, $format) {
121125
public function preBuildParse(PreBuildParseEvent $event)
122126
{
123127
$parseQueue = $event->getParseQueue();
124-
$parseCount = count($parseQueue->getAllFilesThatRequireParsing());
128+
$parseCount = \count($parseQueue->getAllFilesThatRequireParsing());
125129
$this->io->note(sprintf('Start parsing %d out-of-date rst files', $parseCount));
126130
$this->progressBar = new ProgressBar($this->output, $parseCount);
127131
}

src/Directive/AbstractAdmonitionDirective.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
use Doctrine\RST\Directives\SubDirective;

src/Directive/AdmonitionDirective.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
use Doctrine\RST\Directives\SubDirective;

src/Directive/BestPracticeDirective.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
class BestPracticeDirective extends AbstractAdmonitionDirective

src/Directive/CautionDirective.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
class CautionDirective extends AbstractAdmonitionDirective

src/Directive/CodeBlockDirective.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
use Doctrine\RST\Directives\Directive;

src/Directive/ConfigurationBlockDirective.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
use Doctrine\RST\Directives\SubDirective;
@@ -27,7 +34,7 @@ public function processSub(Parser $parser, ?Node $document, string $variable, st
2734

2835
$blocks[] = [
2936
'language' => $this->formatLanguageTab($language),
30-
'code' => $node->render(),
37+
'code' => $node->render(),
3138
];
3239
}
3340

@@ -42,7 +49,7 @@ public function processSub(Parser $parser, ?Node $document, string $variable, st
4249
}
4350

4451
/**
45-
* A hack to print exactly what we want in the tab of a configuration block
52+
* A hack to print exactly what we want in the tab of a configuration block.
4653
*/
4754
private function formatLanguageTab(string $language): string
4855
{

src/Directive/DeprecatedDirective.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
use Doctrine\RST\Directives\SubDirective;

src/Directive/GlossaryDirective.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<?php
22

3+
/*
4+
* This file is part of the Docs Builder package.
5+
* (c) Ryan Weaver <ryan@symfonycasts.com>
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
310
namespace SymfonyDocsBuilder\Directive;
411

512
use Doctrine\RST\Directives\SubDirective;
@@ -9,7 +16,7 @@
916
*/
1017
class GlossaryDirective extends SubDirective
1118
{
12-
public function getName() : string
19+
public function getName(): string
1320
{
1421
return 'glossary';
1522
}

0 commit comments

Comments
 (0)