Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[4.4] Add return types on internal|final|private methods (bis) #33264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function attach(string $file, string $name = null, string $contentType =
/**
* @return $this
*/
public function setSubject(string $subject)
public function setSubject(string $subject): self
{
$this->message->subject($subject);

Expand All @@ -78,7 +78,7 @@ public function getSubject(): ?string
/**
* @return $this
*/
public function setReturnPath(string $address)
public function setReturnPath(string $address): self
{
$this->message->returnPath($address);

Expand All @@ -93,7 +93,7 @@ public function getReturnPath(): string
/**
* @return $this
*/
public function addFrom(string $address, string $name = null)
public function addFrom(string $address, string $name = null): self
{
$this->message->addFrom($name ? new NamedAddress($address, $name) : new Address($address));

Expand All @@ -111,7 +111,7 @@ public function getFrom(): array
/**
* @return $this
*/
public function addReplyTo(string $address)
public function addReplyTo(string $address): self
{
$this->message->addReplyTo($address);

Expand All @@ -129,7 +129,7 @@ public function getReplyTo(): array
/**
* @return $this
*/
public function addTo(string $address, string $name = null)
public function addTo(string $address, string $name = null): self
{
$this->message->addTo($name ? new NamedAddress($address, $name) : new Address($address));

Expand All @@ -147,7 +147,7 @@ public function getTo(): array
/**
* @return $this
*/
public function addCc(string $address, string $name = null)
public function addCc(string $address, string $name = null): self
{
$this->message->addCc($name ? new NamedAddress($address, $name) : new Address($address));

Expand All @@ -165,7 +165,7 @@ public function getCc(): array
/**
* @return $this
*/
public function addBcc(string $address, string $name = null)
public function addBcc(string $address, string $name = null): self
{
$this->message->addBcc($name ? new NamedAddress($address, $name) : new Address($address));

Expand All @@ -183,7 +183,7 @@ public function getBcc(): array
/**
* @return $this
*/
public function setPriority(int $priority)
public function setPriority(int $priority): self
{
$this->message->setPriority($priority);

Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Cache/CacheItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function isHit()
*
* @return $this
*/
public function set($value)
public function set($value): self
{
$this->value = $value;

Expand All @@ -79,7 +79,7 @@ public function set($value)
*
* @return $this
*/
public function expiresAt($expiration)
public function expiresAt($expiration): self
{
if (null === $expiration) {
$this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null;
Expand All @@ -97,7 +97,7 @@ public function expiresAt($expiration)
*
* @return $this
*/
public function expiresAfter($time)
public function expiresAfter($time): self
{
if (null === $time) {
$this->expiry = $this->defaultLifetime > 0 ? microtime(true) + $this->defaultLifetime : null;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/CssSelector/Parser/TokenStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TokenStream
*
* @return $this
*/
public function push(Token $token)
public function push(Token $token): self
{
$this->tokens[] = $token;

Expand All @@ -68,7 +68,7 @@ public function push(Token $token)
*
* @return $this
*/
public function freeze()
public function freeze(): self
{
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,38 @@ interface ExtensionInterface
*
* @return callable[]
*/
public function getNodeTranslators();
public function getNodeTranslators(): array;

/**
* Returns combination translators.
*
* @return callable[]
*/
public function getCombinationTranslators();
public function getCombinationTranslators(): array;

/**
* Returns function translators.
*
* @return callable[]
*/
public function getFunctionTranslators();
public function getFunctionTranslators(): array;

/**
* Returns pseudo-class translators.
*
* @return callable[]
*/
public function getPseudoClassTranslators();
public function getPseudoClassTranslators(): array;

/**
* Returns attribute operation translators.
*
* @return callable[]
*/
public function getAttributeMatchingTranslators();
public function getAttributeMatchingTranslators(): array;

/**
* Returns extension name.
*
* @return string
*/
public function getName();
public function getName(): string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(int $flags = 0)
/**
* @return $this
*/
public function setFlag(int $flag, bool $on)
public function setFlag(int $flag, bool $on): self
{
if ($on && !$this->hasFlag($flag)) {
$this->flags += $flag;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/DependencyInjection/ChildDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ public function replaceArgument($index, $value)
/**
* @internal
*/
public function setAutoconfigured($autoconfigured)
public function setAutoconfigured($autoconfigured): self
{
throw new BadMethodCallException('A ChildDefinition cannot be autoconfigured.');
}

/**
* @internal
*/
public function setInstanceofConditionals(array $instanceof)
public function setInstanceofConditionals(array $instanceof): self
{
throw new BadMethodCallException('A ChildDefinition cannot have instanceof conditionals set on it.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function freezeAfterProcessing(Extension $extension, ContainerBuilder $co
/**
* {@inheritdoc}
*/
public function getEnvPlaceholders()
public function getEnvPlaceholders(): array
{
return null !== $this->processedEnvPlaceholders ? $this->processedEnvPlaceholders : parent::getEnvPlaceholders();
}
Expand Down Expand Up @@ -167,7 +167,7 @@ public function __construct(ExtensionInterface $extension, ParameterBagInterface
/**
* {@inheritdoc}
*/
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0)
public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): self
{
throw new LogicException(sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', \get_class($pass), $this->extensionClass));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ final class ScalarFactory
/**
* @return string
*/
public static function getSomeValue()
public static function getSomeValue(): string
{
return 'some value';
}
Expand Down
27 changes: 21 additions & 6 deletions src/Symfony/Component/Form/Util/OptionsResolverWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class OptionsResolverWrapper extends OptionsResolver
{
private $undefined = [];

public function setNormalizer($option, \Closure $normalizer)
/**
* @return $this
*/
public function setNormalizer($option, \Closure $normalizer): self
{
try {
parent::setNormalizer($option, $normalizer);
Expand All @@ -35,7 +38,10 @@ public function setNormalizer($option, \Closure $normalizer)
return $this;
}

public function setAllowedValues($option, $allowedValues)
/**
* @return $this
*/
public function setAllowedValues($option, $allowedValues): self
{
try {
parent::setAllowedValues($option, $allowedValues);
Expand All @@ -46,7 +52,10 @@ public function setAllowedValues($option, $allowedValues)
return $this;
}

public function addAllowedValues($option, $allowedValues)
/**
* @return $this
*/
public function addAllowedValues($option, $allowedValues): self
{
try {
parent::addAllowedValues($option, $allowedValues);
Expand All @@ -57,7 +66,10 @@ public function addAllowedValues($option, $allowedValues)
return $this;
}

public function setAllowedTypes($option, $allowedTypes)
/**
* @return $this
*/
public function setAllowedTypes($option, $allowedTypes): self
{
try {
parent::setAllowedTypes($option, $allowedTypes);
Expand All @@ -68,7 +80,10 @@ public function setAllowedTypes($option, $allowedTypes)
return $this;
}

public function addAllowedTypes($option, $allowedTypes)
/**
* @return $this
*/
public function addAllowedTypes($option, $allowedTypes): self
{
try {
parent::addAllowedTypes($option, $allowedTypes);
Expand All @@ -84,7 +99,7 @@ public function resolve(array $options = []): array
throw new AccessException('Resolve options is not supported.');
}

public function getUndefinedOptions()
public function getUndefinedOptions(): array
{
return array_keys($this->undefined);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function supports(Request $request, ArgumentMetadata $argument)
/**
* {@inheritdoc}
*/
public function resolve(Request $request, ArgumentMetadata $argument)
public function resolve(Request $request, ArgumentMetadata $argument): iterable
{
if (\is_array($controller = $request->attributes->get('_controller'))) {
$controller = $controller[0].'::'.$controller[1];
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/HttpClientKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(HttpClientInterface $client = null)
$this->client = $client ?? HttpClient::create();
}

public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true): Response
{
$headers = $this->getHeaders($request);
$body = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(string $dsn)
/**
* {@inheritdoc}
*/
public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null)
public function find($ip, $url, $limit, $method, $start = null, $end = null, $statusCode = null): array
{
$file = $this->getIndexFilename();

Expand Down Expand Up @@ -113,7 +113,7 @@ public function purge()
/**
* {@inheritdoc}
*/
public function read($token)
public function read($token): ?Profile
{
if (!$token || !file_exists($file = $this->getFilename($token))) {
return null;
Expand All @@ -127,7 +127,7 @@ public function read($token)
*
* @throws \RuntimeException
*/
public function write(Profile $profile)
public function write(Profile $profile): bool
{
$file = $this->getFilename($profile->getToken());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface ProfilerStorageInterface
*
* @return array An array of tokens
*/
public function find($ip, $url, $limit, $method, $start = null, $end = null);
public function find($ip, $url, $limit, $method, $start = null, $end = null): array;

/**
* Reads data associated with the given token.
Expand All @@ -49,14 +49,14 @@ public function find($ip, $url, $limit, $method, $start = null, $end = null);
*
* @return Profile|null The profile associated with token
*/
public function read($token);
public function read($token): ?Profile;

/**
* Saves a Profile.
*
* @return bool Write operation successful
*/
public function write(Profile $profile);
public function write(Profile $profile): bool;

/**
* Purges all data from the database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ protected function generateDataForMeta(BundleEntryReaderInterface $reader, strin
];
}

/**
* @return array
*/
protected function generateRegionNames(ArrayAccessibleResourceBundle $localeBundle)
protected function generateRegionNames(ArrayAccessibleResourceBundle $localeBundle): array
{
$unfilteredRegionNames = iterator_to_array($localeBundle['Countries']);
$regionNames = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Ldap/Security/LdapUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getEntry(): Entry
/**
* {@inheritdoc}
*/
public function getRoles()
public function getRoles(): array
{
return $this->roles;
}
Expand Down
Loading