Skip to content

Commit 49e8706

Browse files
committed
minor #33709 Add types to constructors and private/final/internal methods (Batch II) (derrabus)
This PR was squashed before being merged into the 4.4 branch (closes #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 | #32179, #33228 | License | MIT | Doc PR | N/A Followup to #33519, this time with: * Form * HttpClient * HttpKernel * intl * Ldap * Ldap * Lock * Messenger * Processor * PropertyInfo * Routing * Security * Serializer * Stopwatch * Translation Commits ------- 9378eb4858 Add types to constructors and private/final/internal methods (Batch II)
2 parents 4f10fd1 + 91ce454 commit 49e8706

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Adapter/ExtLdap/Collection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function offsetUnset($offset)
118118
unset($this->entries[$offset]);
119119
}
120120

121-
private function getSingleEntry($con, $current)
121+
private function getSingleEntry($con, $current): Entry
122122
{
123123
$attributes = ldap_get_attributes($con, $current);
124124

@@ -137,7 +137,7 @@ private function getSingleEntry($con, $current)
137137
return new Entry($dn, $attributes);
138138
}
139139

140-
private function cleanupAttributes(array $entry)
140+
private function cleanupAttributes(array $entry): array
141141
{
142142
$attributes = array_diff_key($entry, array_flip(range(0, $entry['count'] - 1)) + [
143143
'count' => null,

Adapter/ExtLdap/ConnectionOptions.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ final class ConnectionOptions
6262
const X_KEEPALIVE_PROBES = 0x6301;
6363
const X_KEEPALIVE_INTERVAL = 0x6302;
6464

65-
public static function getOptionName($name)
65+
public static function getOptionName(string $name): string
6666
{
6767
return sprintf('%s::%s', self::class, strtoupper($name));
6868
}
@@ -71,11 +71,9 @@ public static function getOptionName($name)
7171
* Fetches an option's corresponding constant value from an option name.
7272
* The option name can either be in snake or camel case.
7373
*
74-
* @param string $name
75-
*
7674
* @throws LdapException
7775
*/
78-
public static function getOption($name): int
76+
public static function getOption(string $name): int
7977
{
8078
// Convert
8179
$constantName = self::getOptionName($name);
@@ -87,7 +85,7 @@ public static function getOption($name): int
8785
return \constant($constantName);
8886
}
8987

90-
public static function isOption($name)
88+
public static function isOption(string $name): bool
9189
{
9290
return \defined(self::getOptionName($name));
9391
}

Adapter/ExtLdap/EntryManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function applyOperations(string $dn, iterable $operations): void
156156
}
157157
}
158158

159-
private function parseRdnFromEntry(Entry $entry)
159+
private function parseRdnFromEntry(Entry $entry): string
160160
{
161161
if (!preg_match('/^([^,]+),/', $entry->getDn(), $matches)) {
162162
throw new LdapException(sprintf('Entry "%s" malformed, could not parse RDN.', $entry->getDn()));

0 commit comments

Comments
 (0)