1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* IDE-Helper code documentation options.
|
4
|
|
|
*
|
5
|
|
|
* @see IdeHelperConfig
|
6
|
|
|
*/
|
7
|
|
|
|
8
|
|
|
use Spiral\IdeHelper\Locators;
|
9
|
|
|
use Spiral\IdeHelper\Renderer;
|
10
|
|
|
use Spiral\IdeHelper\Writers;
|
11
|
|
|
|
12
|
|
|
return [
|
13
|
|
|
// locators are responsible for searching classes and their members
|
14
|
|
|
'locators' => [
|
15
|
|
|
'containers' => bind(Locators\ContainersLocator::class, [
|
16
|
|
|
'targets' => [
|
17
|
|
|
\Interop\Container\ContainerInterface::class . '::get',
|
18
|
|
|
'spiral',
|
19
|
|
|
],
|
20
|
|
|
]),
|
21
|
|
|
'bindings' => Locators\BindingsLocator::class,
|
22
|
|
|
'requests' => Locators\RequestsLocator::class,
|
23
|
|
|
/* 'documents' => Locators\DocumentsLocator::class, */
|
|
|
|
|
24
|
|
|
'records' => Locators\RecordsLocator::class,
|
25
|
|
|
],
|
26
|
|
|
// writers are responsible for storing data collected by locators
|
27
|
|
|
'writers' => [
|
28
|
|
|
'phpProperty' => bind(Writers\FilePerClassWriter::class, [
|
29
|
|
|
'outputDirectory' => directory('application') . 'resources/ide-helper/',
|
30
|
|
|
'renderer' => bind(Renderer\ReactorBasedPropertyRenderer::class),
|
31
|
|
|
]),
|
32
|
|
|
'phpDoc' => bind(Writers\FilePerClassWriter::class, [
|
33
|
|
|
'outputDirectory' => directory('application') . 'resources/ide-helper/',
|
34
|
|
|
'renderer' => bind(Renderer\ReactorBasedDocRenderer::class),
|
35
|
|
|
]),
|
36
|
|
|
'meta' => bind(Writers\SingleFileWriter::class, [
|
37
|
|
|
'outputFile' => directory('root') . '.phpstorm.meta.php/virtual.meta.php',
|
38
|
|
|
'renderer' => bind(Renderer\PhpstormMetaRenderer::class),
|
39
|
|
|
]),
|
40
|
|
|
],
|
41
|
|
|
// each scope is a combination of locators and writers, first each locator is executed to
|
42
|
|
|
// collect data, then each writer is executed with all collected data
|
43
|
|
|
'scopes' => [
|
44
|
|
|
'container' => [
|
45
|
|
|
'locators' => ['bindings'],
|
46
|
|
|
'writers' => ['phpProperty'],
|
47
|
|
|
],
|
48
|
|
|
'entity' => [
|
49
|
|
|
'locators' => [
|
50
|
|
|
'requests',
|
51
|
|
|
/* 'documents', */
|
52
|
|
|
'records'
|
53
|
|
|
],
|
54
|
|
|
'writers' => ['phpDoc'],
|
55
|
|
|
],
|
56
|
|
|
'meta' => [
|
57
|
|
|
'locators' => ['containers'],
|
58
|
|
|
'writers' => ['meta'],
|
59
|
|
|
],
|
60
|
|
|
],
|
61
|
|
|
];
|
62
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.