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

String/UnicodeLanguageIdentifierFieldTrait.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\String;
4
5
use Doctrine\DBAL\Types\Type;
6
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
7
use Doctrine\ORM\Mapping\Builder\FieldBuilder;
8
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\String\UnicodeLanguageIdentifierFieldInterface;
9
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\ValidatedEntityInterface;
10
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper;
11
use Symfony\Component\Validator\Constraints\Language;
12
use Symfony\Component\Validator\Mapping\ClassMetadata as ValidatorClassMetaData;
13
14
trait UnicodeLanguageIdentifierFieldTrait
15
{
16
17
    /**
18
     * @var string|null
19
     */
20
    private $unicodeLanguageIdentifier;
21
22
    /**
23
     * @SuppressWarnings(PHPMD.StaticAccess)
24
     * @param ClassMetadataBuilder $builder
25
     */
26 1
    public static function metaForUnicodeLanguageIdentifier(ClassMetadataBuilder $builder): void
27
    {
28 1
        $fieldBuilder = new FieldBuilder(
29 1
            $builder,
30
            [
31 1
                'fieldName' => UnicodeLanguageIdentifierFieldInterface::PROP_UNICODE_LANGUAGE_IDENTIFIER,
32
                'type'      => Type::STRING,
33
                'default'   => null,
34
            ]
35
        );
36
        $fieldBuilder
37 1
            ->columnName(MappingHelper::getColumnNameForField(
38 1
                UnicodeLanguageIdentifierFieldInterface::PROP_UNICODE_LANGUAGE_IDENTIFIER
39
            ))
40 1
            ->nullable(true)
41 1
            ->unique(false)
42 1
            ->length(50)
43 1
            ->build();
44 1
    }
45
46
    /**
47
     * This method sets the validation for this field.
48
     *
49
     * You should add in as many relevant property constraints as you see fit.
50
     *
51
     * @see https://symfony.com/doc/current/validation.html#supported-constraints
52
     *
53
     * @param ValidatorClassMetaData $metadata
54
     *
55
     * @throws \Symfony\Component\Validator\Exception\MissingOptionsException
56
     * @throws \Symfony\Component\Validator\Exception\InvalidOptionsException
57
     * @throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException
58
     */
59 2
    protected static function validatorMetaForUnicodeLanguageIdentifier(ValidatorClassMetaData $metadata)
60
    {
61 2
        $metadata->addPropertyConstraint(
62 2
            UnicodeLanguageIdentifierFieldInterface::PROP_UNICODE_LANGUAGE_IDENTIFIER,
63 2
            new Language()
64
        );
65 2
    }
66
67
    /**
68
     * @return string|null
69
     */
70 2
    public function getUnicodeLanguageIdentifier(): ?string
71
    {
72 2
        if (null === $this->unicodeLanguageIdentifier) {
73 1
            return UnicodeLanguageIdentifierFieldInterface::DEFAULT_UNICODE_LANGUAGE_IDENTIFIER;
74
        }
75
76 2
        return $this->unicodeLanguageIdentifier;
77
    }
78
79
    /**
80
     * @param string|null $unicodeLanguageIdentifier
81
     *
82
     * @return self
83
     */
84 2
    public function setUnicodeLanguageIdentifier(?string $unicodeLanguageIdentifier): self
85
    {
86 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

86
        $this->/** @scrutinizer ignore-call */ 
87
               updatePropertyValueThenValidateAndNotify(
Loading history...
87 2
            UnicodeLanguageIdentifierFieldInterface::PROP_UNICODE_LANGUAGE_IDENTIFIER,
88 2
            $unicodeLanguageIdentifier
89
        );
90
91 2
        return $this;
92
    }
93
}
94