Skip to content

Commit

Permalink
minor symfony#33709 Add types to constructors and private/final/inter…
Browse files Browse the repository at this point in the history
…nal methods (Batch II) (derrabus)

This PR was squashed before being merged into the 4.4 branch (closes symfony#33709).

Discussion
----------

Add types to constructors and private/final/internal methods (Batch II)

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | symfony#32179, symfony#33228
| License       | MIT
| Doc PR        | N/A

Followup to symfony#33519, this time with:
* Form
* HttpClient
* HttpKernel
* intl
* Ldap
* Ldap
* Lock
* Messenger
* Processor
* PropertyInfo
* Routing
* Security
* Serializer
* Stopwatch
* Translation

Commits
-------

9378eb4 Add types to constructors and private/final/internal methods (Batch II)
  • Loading branch information
Tobion committed Oct 3, 2019
2 parents 4245a8c + 2725aae commit 14c0ace
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Mapping/Loader/YamlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function getMappedClasses()
return array_keys($this->classes);
}

private function getClassesFromYaml()
private function getClassesFromYaml(): array
{
if (!stream_is_local($this->file)) {
throw new MappingException(sprintf('This is not a local file "%s".', $this->file));
Expand Down
8 changes: 4 additions & 4 deletions NameConverter/MetadataAwareNameConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function denormalize($propertyName, string $class = null, string $format
return self::$denormalizeCache[$class][$propertyName] ?? $this->denormalizeFallback($propertyName, $class, $format, $context);
}

private function getCacheValueForNormalization(string $propertyName, string $class)
private function getCacheValueForNormalization(string $propertyName, string $class): ?string
{
if (!$this->metadataFactory->hasMetadataFor($class)) {
return null;
Expand All @@ -83,12 +83,12 @@ private function getCacheValueForNormalization(string $propertyName, string $cla
return $attributesMetadata[$propertyName]->getSerializedName() ?? null;
}

private function normalizeFallback(string $propertyName, string $class = null, string $format = null, array $context = [])
private function normalizeFallback(string $propertyName, string $class = null, string $format = null, array $context = []): string
{
return $this->fallbackNameConverter ? $this->fallbackNameConverter->normalize($propertyName, $class, $format, $context) : $propertyName;
}

private function getCacheValueForDenormalization(string $propertyName, string $class)
private function getCacheValueForDenormalization(string $propertyName, string $class): ?string
{
if (!isset(self::$attributesMetadataCache[$class])) {
self::$attributesMetadataCache[$class] = $this->getCacheValueForAttributesMetadata($class);
Expand All @@ -97,7 +97,7 @@ private function getCacheValueForDenormalization(string $propertyName, string $c
return self::$attributesMetadataCache[$class][$propertyName] ?? null;
}

private function denormalizeFallback(string $propertyName, string $class = null, string $format = null, array $context = [])
private function denormalizeFallback(string $propertyName, string $class = null, string $format = null, array $context = []): string
{
return $this->fallbackNameConverter ? $this->fallbackNameConverter->denormalize($propertyName, $class, $format, $context) : $propertyName;
}
Expand Down
2 changes: 1 addition & 1 deletion Normalizer/DateIntervalNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function supportsDenormalization($data, $type, $format = null)
return \DateInterval::class === $type;
}

private function isISO8601(string $string)
private function isISO8601(string $string): bool
{
return preg_match('/^[\-+]?P(?=\w*(?:\d|%\w))(?:\d+Y|%[yY]Y)?(?:\d+M|%[mM]M)?(?:(?:\d+D|%[dD]D)|(?:\d+W|%[wW]W))?(?:T(?:\d+H|[hH]H)?(?:\d+M|[iI]M)?(?:\d+S|[sS]S)?)?$/', $string);
}
Expand Down
2 changes: 1 addition & 1 deletion Normalizer/DateTimeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private function formatDateTimeErrors(array $errors): array
return $formattedErrors;
}

private function getTimezone(array $context)
private function getTimezone(array $context): ?\DateTimeZone
{
$dateTimeZone = $context[self::TIMEZONE_KEY] ?? $this->defaultContext[self::TIMEZONE_KEY];

Expand Down

0 comments on commit 14c0ace

Please sign in to comment.