sonata-project / SonataClassificationBundle

@@ -18,28 +18,28 @@
Loading
18 18
19 19
abstract class Category implements CategoryInterface
20 20
{
21 -
    private ?string $name = null;
21 +
    protected ?string $name = null;
22 22
23 -
    private ?string $slug = null;
23 +
    protected ?string $slug = null;
24 24
25 -
    private bool $enabled = false;
25 +
    protected bool $enabled = false;
26 26
27 -
    private ?string $description = null;
27 +
    protected ?string $description = null;
28 28
29 -
    private ?\DateTimeInterface $createdAt = null;
29 +
    protected ?\DateTimeInterface $createdAt = null;
30 30
31 -
    private ?\DateTimeInterface $updatedAt = null;
31 +
    protected ?\DateTimeInterface $updatedAt = null;
32 32
33 -
    private ?int $position = null;
33 +
    protected ?int $position = null;
34 34
35 35
    /**
36 36
     * @var Collection<int, CategoryInterface>
37 37
     */
38 -
    private Collection $children;
38 +
    protected Collection $children;
39 39
40 -
    private ?CategoryInterface $parent = null;
40 +
    protected ?CategoryInterface $parent = null;
41 41
42 -
    private ?ContextInterface $context = null;
42 +
    protected ?ContextInterface $context = null;
43 43
44 44
    public function __construct()
45 45
    {

@@ -26,6 +26,21 @@
Loading
26 26
 * This is the class that validates and merges configuration from your app/config files.
27 27
 *
28 28
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
29 +
 *
30 +
 * @phpstan-type Config = array{
31 +
 *     class: array{
32 +
 *         category: class-string,
33 +
 *         collection: class-string,
34 +
 *         context: class-string,
35 +
 *         tag: class-string,
36 +
 *     },
37 +
 *     admin: array{
38 +
 *         category: array{class: class-string, controller: class-string, translation: string},
39 +
 *         collection: array{class: class-string, controller: class-string, translation: string},
40 +
 *         context: array{class: class-string, controller: class-string, translation: string},
41 +
 *         tag: array{class: class-string, controller: class-string, translation: string},
42 +
 *     },
43 +
 * }
29 44
 */
30 45
final class Configuration implements ConfigurationInterface
31 46
{

@@ -17,17 +17,17 @@
Loading
17 17
18 18
abstract class Tag implements TagInterface
19 19
{
20 -
    private ?string $name = null;
20 +
    protected ?string $name = null;
21 21
22 -
    private ?string $slug = null;
22 +
    protected ?string $slug = null;
23 23
24 -
    private ?\DateTimeInterface $createdAt = null;
24 +
    protected ?\DateTimeInterface $createdAt = null;
25 25
26 -
    private ?\DateTimeInterface $updatedAt = null;
26 +
    protected ?\DateTimeInterface $updatedAt = null;
27 27
28 -
    private bool $enabled = false;
28 +
    protected bool $enabled = false;
29 29
30 -
    private ?ContextInterface $context = null;
30 +
    protected ?ContextInterface $context = null;
31 31
32 32
    public function __toString(): string
33 33
    {

@@ -25,6 +25,8 @@
Loading
25 25
 * SonataClassificationBundleExtension.
26 26
 *
27 27
 * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
28 +
 *
29 +
 * @phpstan-import-type Config from Configuration
28 30
 */
29 31
final class SonataClassificationExtension extends Extension
30 32
{
@@ -35,6 +37,8 @@
Loading
35 37
    {
36 38
        $processor = new Processor();
37 39
        $configuration = new Configuration();
40 +
41 +
        /** @phpstan-var Config $config */
38 42
        $config = $processor->processConfiguration($configuration, $configs);
39 43
40 44
        /** @var array<string, mixed> $bundles */
@@ -61,7 +65,8 @@
Loading
61 65
    }
62 66
63 67
    /**
64 -
     * @param array<string, array<string, string>> $config
68 +
     * @param array<string, mixed> $config
69 +
     * @phpstan-param Config $config
65 70
     */
66 71
    private function configureClass(array $config, ContainerBuilder $container): void
67 72
    {
@@ -79,7 +84,8 @@
Loading
79 84
    }
80 85
81 86
    /**
82 -
     * @param array<string, array<string, array<string, string>>> $config
87 +
     * @param array<string, mixed> $config
88 +
     * @phpstan-param Config $config
83 89
     */
84 90
    private function configureAdmin(array $config, ContainerBuilder $container): void
85 91
    {
@@ -101,11 +107,12 @@
Loading
101 107
    }
102 108
103 109
    /**
104 -
     * @param array<string, array<string, string>> $config
110 +
     * @param array<string, mixed> $config
111 +
     * @phpstan-param Config $config
105 112
     */
106 113
    private function registerSonataDoctrineMapping(array $config): void
107 114
    {
108 -
        foreach ($config['class'] as $type => $class) {
115 +
        foreach ($config['class'] as $class) {
109 116
            if (!class_exists($class)) {
110 117
                return;
111 118
            }

@@ -15,15 +15,15 @@
Loading
15 15
16 16
abstract class Context implements ContextInterface
17 17
{
18 -
    private ?string $id = null;
18 +
    protected ?string $id = null;
19 19
20 -
    private ?string $name = null;
20 +
    protected ?string $name = null;
21 21
22 -
    private ?\DateTimeInterface $createdAt = null;
22 +
    protected ?\DateTimeInterface $createdAt = null;
23 23
24 -
    private ?\DateTimeInterface $updatedAt = null;
24 +
    protected ?\DateTimeInterface $updatedAt = null;
25 25
26 -
    private bool $enabled = false;
26 +
    protected bool $enabled = false;
27 27
28 28
    public function __toString(): string
29 29
    {

@@ -15,19 +15,19 @@
Loading
15 15
16 16
abstract class Collection implements CollectionInterface
17 17
{
18 -
    private ?string $name = null;
18 +
    protected ?string $name = null;
19 19
20 -
    private ?string $slug = null;
20 +
    protected ?string $slug = null;
21 21
22 -
    private bool $enabled = false;
22 +
    protected bool $enabled = false;
23 23
24 -
    private ?string $description = null;
24 +
    protected ?string $description = null;
25 25
26 -
    private ?\DateTimeInterface $createdAt = null;
26 +
    protected ?\DateTimeInterface $createdAt = null;
27 27
28 -
    private ?\DateTimeInterface $updatedAt = null;
28 +
    protected ?\DateTimeInterface $updatedAt = null;
29 29
30 -
    private ?ContextInterface $context = null;
30 +
    protected ?ContextInterface $context = null;
31 31
32 32
    public function __toString(): string
33 33
    {
Files Complexity Coverage
src 348 55.37%
Project Totals (36 files) 348 55.37%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading