Skip to content

Commit ec4a37d

Browse files
committed
Fixed method, const and property visibilities
1 parent 8bf883e commit ec4a37d

File tree

8 files changed

+81
-81
lines changed

8 files changed

+81
-81
lines changed

src/Draft/AbstractDraft.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function registerKeyword(KeywordInterface $keyword, string $vocabulary):
150150
$this->keywords[$keyword->getName()] = $keyword;
151151
}
152152

153-
protected function unregisterKeywordByVocabulary(string $vocabulary): void
153+
protected function unregisterKeywordsByVocabulary(string $vocabulary): void
154154
{
155155
foreach ($this->keywordsByVocabulary[$vocabulary] as $keyword) {
156156
unset($this->keywords[$keyword->getName()]);
@@ -412,7 +412,7 @@ public function valuesAreEqual(mixed $value1, mixed $value2): bool
412412
/**
413413
* @return KeywordInterface[]
414414
*/
415-
protected function prioritizeSchemaKeywords(\stdClass $schema, StaticEvaluationContext $context): array
415+
private function prioritizeSchemaKeywords(\stdClass $schema, StaticEvaluationContext $context): array
416416
{
417417
$prioritizedKeywords = [];
418418

@@ -426,7 +426,7 @@ protected function prioritizeSchemaKeywords(\stdClass $schema, StaticEvaluationC
426426
return $prioritizedKeywords;
427427
}
428428

429-
protected function decodeJsonPointerToken(string $fragment): string
429+
private function decodeJsonPointerToken(string $fragment): string
430430
{
431431
return str_replace(['~1', '~0'], ['/', '~'], urldecode($fragment));
432432
}

src/Draft/Draft202012.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ protected function registerKeywords(): void
134134
$this->registerKeyword(new DynamicRefKeyword(8000), self::VOCABULARY_CORE);
135135
$this->registerKeyword(new CommentKeyword(9000), self::VOCABULARY_CORE);
136136
} else {
137-
$this->unregisterKeywordByVocabulary(self::VOCABULARY_CORE);
137+
$this->unregisterKeywordsByVocabulary(self::VOCABULARY_CORE);
138138
}
139139

140140
// Content
@@ -143,7 +143,7 @@ protected function registerKeywords(): void
143143
$this->registerKeyword(new ContentMediaTypeKeyword(11000), self::VOCABULARY_CONTENT);
144144
$this->registerKeyword(new ContentSchemaKeyword(12000), self::VOCABULARY_CONTENT);
145145
} else {
146-
$this->unregisterKeywordByVocabulary(self::VOCABULARY_CONTENT);
146+
$this->unregisterKeywordsByVocabulary(self::VOCABULARY_CONTENT);
147147
}
148148

149149
// Applicator
@@ -169,22 +169,22 @@ protected function registerKeywords(): void
169169
$this->registerKeyword(new ElseKeyword(26000), self::VOCABULARY_APPLICATOR);
170170
$this->registerKeyword(new DependentSchemasKeyword(27000), self::VOCABULARY_APPLICATOR);
171171
} else {
172-
$this->unregisterKeywordByVocabulary(self::VOCABULARY_APPLICATOR);
172+
$this->unregisterKeywordsByVocabulary(self::VOCABULARY_APPLICATOR);
173173
}
174174

175175
// Unevaluated (depends on in-place applicators)
176176
if ($this->vocabularyEnabled(self::VOCABULARY_UNEVALUATED)) {
177177
$this->registerKeyword(new UnevaluatedItemsKeyword(28000), self::VOCABULARY_UNEVALUATED);
178178
$this->registerKeyword(new UnevaluatedPropertiesKeyword(29000), self::VOCABULARY_UNEVALUATED);
179179
} else {
180-
$this->unregisterKeywordByVocabulary(self::VOCABULARY_UNEVALUATED);
180+
$this->unregisterKeywordsByVocabulary(self::VOCABULARY_UNEVALUATED);
181181
}
182182

183183
// Format annotation
184184
if ($this->vocabularyEnabled(self::VOCABULARY_FORMAT_ANNOTATION)) {
185185
$this->registerKeyword(new FormatKeyword(30000), self::VOCABULARY_FORMAT_ANNOTATION);
186186
} else {
187-
$this->unregisterKeywordByVocabulary(self::VOCABULARY_FORMAT_ANNOTATION);
187+
$this->unregisterKeywordsByVocabulary(self::VOCABULARY_FORMAT_ANNOTATION);
188188
}
189189

190190
// Validation
@@ -210,7 +210,7 @@ protected function registerKeywords(): void
210210
$this->registerKeyword(new RequiredKeyword(49000), self::VOCABULARY_VALIDATION);
211211
$this->registerKeyword(new DependentRequiredKeyword(50000), self::VOCABULARY_VALIDATION);
212212
} else {
213-
$this->unregisterKeywordByVocabulary(self::VOCABULARY_VALIDATION);
213+
$this->unregisterKeywordsByVocabulary(self::VOCABULARY_VALIDATION);
214214
}
215215

216216
// Meta data
@@ -223,7 +223,7 @@ protected function registerKeywords(): void
223223
$this->registerKeyword(new WriteOnlyKeyword(56000), self::VOCABULARY_META_DATA);
224224
$this->registerKeyword(new ExamplesKeyword(57000), self::VOCABULARY_META_DATA);
225225
} else {
226-
$this->unregisterKeywordByVocabulary(self::VOCABULARY_META_DATA);
226+
$this->unregisterKeywordsByVocabulary(self::VOCABULARY_META_DATA);
227227
}
228228
}
229229
}

src/Keyword/Identifier/AnchorKeyword.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class AnchorKeyword extends AbstractKeyword implements StaticKeywordInterface, RuntimeKeywordInterface
1616
{
17-
protected const PATTERN_XML_NC_NAME_US_ASCII = '/[A-Z_][A-Z_0-9\-.]*$/i';
17+
private const PATTERN_XML_NC_NAME_US_ASCII = '/[A-Z_][A-Z_0-9\-.]*$/i';
1818

1919
public function getName(): string
2020
{
@@ -35,7 +35,7 @@ public function evaluateStatic(mixed &$keywordValue, StaticEvaluationContext $co
3535
);
3636
}
3737

38-
if (preg_match(static::PATTERN_XML_NC_NAME_US_ASCII, $keywordValue) !== 1) {
38+
if (preg_match(self::PATTERN_XML_NC_NAME_US_ASCII, $keywordValue) !== 1) {
3939
throw new InvalidKeywordValueException(
4040
'The value of \'%s\' must start with a letter (a-z) or underscore (_), followed by any number of'
4141
. ' letters, digits (0-9), hyphens (-), underscores (_), and periods (.).',

src/Keyword/Validation/ContentMediaTypeKeyword.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
class ContentMediaTypeKeyword extends AbstractKeyword implements StaticKeywordInterface, RuntimeKeywordInterface
1616
{
17+
private const PATTERN_MIME_TYPE_FORMAT = <<<'REGEX'
18+
/[a-z0-9!#$%^&*_\-+{}|'.`~]+\/[a-z0-9!#$%^&*_\-+{}|'.`~]+/i
19+
REGEX;
20+
1721
public function getName(): string
1822
{
1923
return 'contentMediaType';
2024
}
2125

22-
protected const PATTERN_MIME_TYPE_FORMAT = <<<'REGEX'
23-
/[a-z0-9!#$%^&*_\-+{}|'.`~]+\/[a-z0-9!#$%^&*_\-+{}|'.`~]+/i
24-
REGEX;
25-
2626
/**
2727
* @throws StaticKeywordAnalysisException
2828
*/
@@ -36,7 +36,7 @@ public function evaluateStatic(mixed &$keywordValue, StaticEvaluationContext $co
3636
);
3737
}
3838

39-
if (preg_match(static::PATTERN_MIME_TYPE_FORMAT, $keywordValue) === 0) {
39+
if (preg_match(self::PATTERN_MIME_TYPE_FORMAT, $keywordValue) === 0) {
4040
throw new InvalidKeywordValueException(
4141
'The value of \'%s\' must be a media type, as defined by RFC 2046.',
4242
$this,
@@ -85,7 +85,7 @@ public function evaluate(mixed $keywordValue, RuntimeEvaluationContext $context)
8585
* @param resource $stream
8686
* @return string
8787
*/
88-
protected function detectMimeType($stream): string
88+
private function detectMimeType($stream): string
8989
{
9090
return mime_content_type($stream) ?: 'application/octet-stream';
9191
}

src/Keyword/Validation/ContentSchemaKeyword.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ public function evaluate(mixed $keywordValue, RuntimeEvaluationContext $context)
8686
return $result;
8787
}
8888

89-
protected function shouldParseInstance(string $contentMediaType): bool
89+
private function shouldParseInstance(string $contentMediaType): bool
9090
{
9191
return str_starts_with($contentMediaType, 'application/json');
9292
}
9393

9494
/**
9595
* @return \stdClass|array<scalar, mixed>|null
9696
*/
97-
protected function parseInstance(RuntimeEvaluationContext $context): \stdClass|array|null
97+
private function parseInstance(RuntimeEvaluationContext $context): \stdClass|array|null
9898
{
9999
/** @var string $instance */
100100
$instance = $context->getCurrentInstance();

0 commit comments

Comments
 (0)