Skip to content

Commit 5d4d9be

Browse files
committed
Fix code style
1 parent 6bbd075 commit 5d4d9be

File tree

12 files changed

+122
-45
lines changed

12 files changed

+122
-45
lines changed

packages/guides-cli/resources/config/services.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use phpDocumentor\Guides\Cli\Command\ProgressBarSubscriber;
88
use phpDocumentor\Guides\Cli\Command\Run;
99
use phpDocumentor\Guides\Cli\Command\Serve;
10-
use phpDocumentor\Guides\Cli\Command\WorkingDirectorySwitcher;
1110
use phpDocumentor\Guides\Cli\Command\SettingsBuilder;
11+
use phpDocumentor\Guides\Cli\Command\WorkingDirectorySwitcher;
1212
use phpDocumentor\Guides\Cli\Internal\RunCommand;
1313
use phpDocumentor\Guides\Cli\Internal\RunCommandHandler;
1414
use phpDocumentor\Guides\Cli\Internal\ServerFactory;
@@ -57,6 +57,5 @@
5757
->set(SettingsBuilder::class)
5858
->set(RunCommandHandler::class)
5959
->tag('phpdoc.guides.command', ['command' => RunCommand::class])
60-
->set(ServerFactory::class)
61-
;
60+
->set(ServerFactory::class);
6261
};

packages/guides-cli/src/Command/Run.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,27 @@
1414
namespace phpDocumentor\Guides\Cli\Command;
1515

1616
use Doctrine\Deprecations\Deprecation;
17-
use Flyfinder\Path;
18-
use Flyfinder\Specification\InPath;
19-
use Flyfinder\Specification\NotSpecification;
20-
use Flyfinder\Specification\OrSpecification;
21-
use Flyfinder\Specification\SpecificationInterface;
2217
use League\Tactician\CommandBus;
2318
use Monolog\Handler\ErrorLogHandler;
2419
use Monolog\Handler\StreamHandler;
2520
use Monolog\Logger;
26-
use phpDocumentor\FileSystem\Finder\Exclude;
27-
use phpDocumentor\FileSystem\FlySystemAdapter;
2821
use phpDocumentor\Guides\Cli\Internal\RunCommand;
2922
use phpDocumentor\Guides\Cli\Logger\SpyProcessor;
30-
use phpDocumentor\Guides\Compiler\CompilerContext;
31-
use phpDocumentor\Guides\Event\PostProjectNodeCreated;
32-
use phpDocumentor\Guides\Handlers\CompileDocumentsCommand;
33-
use phpDocumentor\Guides\Handlers\ParseDirectoryCommand;
34-
use phpDocumentor\Guides\Handlers\ParseFileCommand;
35-
use phpDocumentor\Guides\Handlers\RenderCommand;
36-
use phpDocumentor\Guides\Nodes\ProjectNode;
37-
use phpDocumentor\Guides\Settings\ProjectSettings;
3823
use phpDocumentor\Guides\Settings\SettingsManager;
3924
use phpDocumentor\Guides\Twig\Theme\ThemeManager;
4025
use Psr\Clock\ClockInterface;
4126
use Psr\Log\LogLevel;
42-
use RuntimeException;
4327
use Symfony\Component\Console\Command\Command;
44-
use Symfony\Component\Console\Input\InputArgument;
4528
use Symfony\Component\Console\Input\InputInterface;
4629
use Symfony\Component\Console\Input\InputOption;
4730
use Symfony\Component\Console\Output\ConsoleOutputInterface;
4831
use Symfony\Component\Console\Output\OutputInterface;
4932
use Symfony\Component\EventDispatcher\EventDispatcher;
5033

51-
use function array_map;
5234
use function array_pop;
53-
use function array_reduce;
54-
use function array_shift;
55-
use function assert;
5635
use function count;
5736
use function implode;
5837
use function is_countable;
59-
use function is_dir;
60-
use function method_exists;
61-
use function pathinfo;
62-
use function sprintf;
6338
use function strtoupper;
6439

6540
final class Run extends Command

packages/guides-cli/src/Command/Serve.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Command;
615

716
use League\Tactician\CommandBus;
17+
use Monolog\Handler\ErrorLogHandler;
818
use phpDocumentor\FileSystem\FlySystemAdapter;
919
use phpDocumentor\Guides\Cli\Internal\RunCommand;
1020
use phpDocumentor\Guides\Cli\Internal\ServerFactory;
1121
use phpDocumentor\Guides\Cli\Internal\Watcher\FileModifiedEvent;
1222
use phpDocumentor\Guides\Cli\Internal\Watcher\INotifyWatcher;
1323
use phpDocumentor\Guides\Event\PostParseDocument;
1424
use Psr\EventDispatcher\EventDispatcherInterface;
25+
use Psr\Log\LoggerInterface;
1526
use React\EventLoop\Loop;
1627
use Symfony\Component\Console\Command\Command;
1728
use Symfony\Component\Console\Input\InputInterface;
@@ -23,6 +34,7 @@
2334
final class Serve extends Command
2435
{
2536
public function __construct(
37+
private LoggerInterface $logger,
2638
private EventDispatcherInterface $dispatcher,
2739
private SettingsBuilder $settingsBuilder,
2840
private CommandBus $commandBus,
@@ -41,6 +53,7 @@ protected function configure(): void
4153

4254
protected function execute(InputInterface $input, OutputInterface $output): int
4355
{
56+
$this->logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM));
4457
// Enable tick processing for signal handling
4558
declare(ticks=1);
4659

packages/guides-cli/src/Command/SettingsBuilder.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Command;
615

716
use phpDocumentor\Guides\Event\PostProjectNodeCreated;
@@ -175,6 +184,5 @@ public function configureCommand(Command $command): void
175184
InputOption::VALUE_REQUIRED,
176185
'The theme used for rendering',
177186
);
178-
179187
}
180188
}

packages/guides-cli/src/Internal/HttpHandler.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Internal;
615

716
use GuzzleHttp\Psr7\Message;
@@ -77,6 +86,7 @@ public function onOpen(ConnectionInterface $conn, RequestInterface|null $request
7786

7887
$conn->send(Message::toString(new Response(200, $headers, $content)));
7988
$conn->close();
89+
8090
return;
8191
}
8292

@@ -118,8 +128,7 @@ public function onError(ConnectionInterface $conn, Throwable $e): void
118128
$this->close($conn, 500);
119129
}
120130

121-
/** @param string $msg */
122-
public function onMessage(ConnectionInterface $from, $msg): void
131+
public function onMessage(ConnectionInterface $from, string $msg): void
123132
{
124133
// TODO: Implement onMessage() method.
125134
}

packages/guides-cli/src/Internal/RunCommand.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Internal;
615

716
use phpDocumentor\Guides\Nodes\ProjectNode;
@@ -14,7 +23,6 @@ public function __construct(
1423
public readonly ProjectSettings $settings,
1524
public readonly ProjectNode $projectNode,
1625
public readonly InputInterface|null $input,
17-
)
18-
{
26+
) {
1927
}
2028
}

packages/guides-cli/src/Internal/RunCommandHandler.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Internal;
615

716
use Flyfinder\Path;
@@ -17,19 +26,26 @@
1726
use phpDocumentor\Guides\Handlers\ParseDirectoryCommand;
1827
use phpDocumentor\Guides\Handlers\ParseFileCommand;
1928
use phpDocumentor\Guides\Handlers\RenderCommand;
29+
use phpDocumentor\Guides\Nodes\DocumentNode;
2030
use phpDocumentor\Guides\Settings\ProjectSettings;
2131
use phpDocumentor\Guides\Twig\Theme\ThemeManager;
2232
use Symfony\Component\Console\Input\InputInterface;
2333

34+
use function array_map;
35+
use function array_reduce;
36+
use function array_shift;
37+
use function assert;
38+
use function method_exists;
39+
2440
class RunCommandHandler
2541
{
2642
public function __construct(
2743
private CommandBus $commandBus,
2844
private ThemeManager $themeManager,
29-
)
30-
{
45+
) {
3146
}
3247

48+
/** @return DocumentNode[] */
3349
public function handle(RunCommand $command): array
3450
{
3551
$settings = $command->settings;

packages/guides-cli/src/Internal/Server.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Internal;
615

716
use Ratchet\App;

packages/guides-cli/src/Internal/ServerFactory.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Internal;
615

716
use phpDocumentor\FileSystem\FlySystemAdapter;
@@ -19,7 +28,7 @@ public function __construct(private LoggerInterface $logger)
1928
public function createWebserver(FlySystemAdapter $files, LoopInterface|null $loop, string $host, string $listen, int $port): Server
2029
{
2130
$httpHandler = new HttpHandler($this->logger, $files);
22-
$wsServer = new WebSocketHandler();
31+
$wsServer = new WebSocketHandler($this->logger);
2332
$host = 'localhost';
2433

2534

packages/guides-cli/src/Internal/Watcher/FileModifiedEvent.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace phpDocumentor\Guides\Cli\Internal\Watcher;
615

716
final class FileModifiedEvent

0 commit comments

Comments
 (0)