GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 810b23...1b23c8 )
by joseph
12s
created

Fields/Traits/String/NullableStringFieldTrait.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\String;
4
5
// phpcs:disable
6
7
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\String\NullableStringFieldInterface;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\ValidatedEntityInterface;
10
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
11
use Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetaData;
12
13
// phpcs:enable
14
trait NullableStringFieldTrait
15
{
16
17
    /**
18
     * @var string|null
19
     */
20
    private $nullableString;
21
22
    /**
23
     * @SuppressWarnings(PHPMD.StaticAccess)
24
     */
25 1
    public static function metaForNullableString(ClassMetadataBuilder $builder)
26
    {
27 1
        MappingHelper::setSimpleStringFields(
28 1
            [NullableStringFieldInterface::PROP_NULLABLE_STRING],
29 1
            $builder,
30 1
            NullableStringFieldInterface::DEFAULT_NULLABLE_STRING,
31 1
            false
32
        );
33 1
    }
34
35
    /**
36
     * This method sets the validation for this field.
37
     *
38
     * You should add in as many relevant property constraints as you see fit.
39
     *
40
     * Remove the PHPMD suppressed warning once you start setting constraints
41
     *
42
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
43
     * @see https://symfony.com/doc/current/validation.html#supported-constraints
44
     *
45
     * @param ValidatorClassMetaData $metadata
46
     *
47
     * @throws \Symfony\Component\Validator\Exception\MissingOptionsException
48
     * @throws \Symfony\Component\Validator\Exception\InvalidOptionsException
49
     * @throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException
50
     */
51
    protected static function validatorMetaForNullableString(ValidatorClassMetaData $metadata)
52
    {
53
        //        $metadata->addPropertyConstraint(
54
        //            NullableStringFieldInterface::PROP_NULLABLE_STRING,
55
        //            new NotBlank()
56
        //        );
57
    }
58
59
    /**
60
     * @return string|null
61
     */
62 2
    public function getNullableString(): ?string
63
    {
64 2
        if (null === $this->nullableString) {
65 2
            return NullableStringFieldInterface::DEFAULT_NULLABLE_STRING;
66
        }
67
68
        return $this->nullableString;
69
    }
70
71
    /**
72
     * @param string|null $nullableString
73
     *
74
     * @return self
75
     */
76 2
    public function setNullableString(?string $nullableString): self
77
    {
78 2
        $this->updatePropertyValueThenValidateAndNotify(
0 ignored issues
show
It seems like updatePropertyValueThenValidateAndNotify() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

78
        $this->/** @scrutinizer ignore-call */ 
79
               updatePropertyValueThenValidateAndNotify(
Loading history...
79 2
            NullableStringFieldInterface::PROP_NULLABLE_STRING,
80 2
            $nullableString
81
        );
82
83 2
        return $this;
84
    }
85
}
86