PostForm::getContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Blog\Post;
6
7
use Yiisoft\FormModel\FormModel;
0 ignored issues
show
Bug introduced by
The type Yiisoft\FormModel\FormModel was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Yiisoft\Validator\Rule\Required;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\Rule\Required was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
final class PostForm extends FormModel
11
{
12
    private ?string $title = null;
13
    private ?string $content = null;
14
    private array $tags = [];
15
16
    public function getTitle(): string
17
    {
18
        return $this->title;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->title could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
19
    }
20
21
    public function getContent(): ?string
22
    {
23
        return $this->content;
24
    }
25
26
    public function getFormName(): string
27
    {
28
        return '';
29
    }
30
31
    public function getTags(): array
32
    {
33
        return $this->tags;
34
    }
35
36
    public function getRules(): array
37
    {
38
        return [
39
            'title' => [new Required()],
40
            'content' => [new Required()],
41
        ];
42
    }
43
}
44