Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Narrow existing return types on private/internal/final/test methods #42213

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 10, 2021
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
5 changes: 1 addition & 4 deletions 5 src/Symfony/Bridge/Doctrine/IdGenerator/UuidGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ public function nameBased(string $entityGetter, Uuid|string $namespace = null):
return $clone;
}

/**
* @return static
*/
public function randomBased(): self
public function randomBased(): static
{
$clone = clone $this;
$clone->factory = $clone->protoFactory->randomBased();
Expand Down
40 changes: 8 additions & 32 deletions 40 src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ public function attach(string $file, string $name = null, string $contentType =
}
}

/**
* @return $this
*/
public function setSubject(string $subject): self
public function setSubject(string $subject): static
{
$this->message->subject($subject);

Expand All @@ -72,10 +69,7 @@ public function getSubject(): ?string
return $this->message->getSubject();
}

/**
* @return $this
*/
public function setReturnPath(string $address): self
public function setReturnPath(string $address): static
{
$this->message->returnPath($address);

Expand All @@ -87,10 +81,7 @@ public function getReturnPath(): string
return $this->message->getReturnPath();
}

/**
* @return $this
*/
public function addFrom(string $address, string $name = ''): self
public function addFrom(string $address, string $name = ''): static
{
$this->message->addFrom(new Address($address, $name));

Expand All @@ -105,10 +96,7 @@ public function getFrom(): array
return $this->message->getFrom();
}

/**
* @return $this
*/
public function addReplyTo(string $address): self
public function addReplyTo(string $address): static
{
$this->message->addReplyTo($address);

Expand All @@ -123,10 +111,7 @@ public function getReplyTo(): array
return $this->message->getReplyTo();
}

/**
* @return $this
*/
public function addTo(string $address, string $name = ''): self
public function addTo(string $address, string $name = ''): static
{
$this->message->addTo(new Address($address, $name));

Expand All @@ -141,10 +126,7 @@ public function getTo(): array
return $this->message->getTo();
}

/**
* @return $this
*/
public function addCc(string $address, string $name = ''): self
public function addCc(string $address, string $name = ''): static
{
$this->message->addCc(new Address($address, $name));

Expand All @@ -159,10 +141,7 @@ public function getCc(): array
return $this->message->getCc();
}

/**
* @return $this
*/
public function addBcc(string $address, string $name = ''): self
public function addBcc(string $address, string $name = ''): static
{
$this->message->addBcc(new Address($address, $name));

Expand All @@ -177,10 +156,7 @@ public function getBcc(): array
return $this->message->getBcc();
}

/**
* @return $this
*/
public function setPriority(int $priority): self
public function setPriority(int $priority): static
{
$this->message->priority($priority);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function getPassword(): ?string
/**
* {@inheritdoc}
*/
public function getSalt()
public function getSalt(): ?string
{
return null;
}
Expand Down
35 changes: 7 additions & 28 deletions 35 src/Symfony/Component/Console/Command/LazyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ public function run(InputInterface $input, OutputInterface $output): int
return $this->getCommand()->run($input, $output);
}

/**
* @return $this
*/
public function setCode(callable $code): self
public function setCode(callable $code): static
{
$this->getCommand()->setCode($code);

Expand All @@ -87,10 +84,7 @@ public function mergeApplicationDefinition(bool $mergeArgs = true): void
$this->getCommand()->mergeApplicationDefinition($mergeArgs);
}

/**
* @return $this
*/
public function setDefinition(array|InputDefinition $definition): self
public function setDefinition(array|InputDefinition $definition): static
{
$this->getCommand()->setDefinition($definition);

Expand All @@ -107,40 +101,28 @@ public function getNativeDefinition(): InputDefinition
return $this->getCommand()->getNativeDefinition();
}

/**
* @return $this
*/
public function addArgument(string $name, int $mode = null, string $description = '', mixed $default = null): self
public function addArgument(string $name, int $mode = null, string $description = '', mixed $default = null): static
{
$this->getCommand()->addArgument($name, $mode, $description, $default);

return $this;
}

/**
* @return $this
*/
public function addOption(string $name, string|array $shortcut = null, int $mode = null, string $description = '', mixed $default = null): self
public function addOption(string $name, string|array $shortcut = null, int $mode = null, string $description = '', mixed $default = null): static
{
$this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);

return $this;
}

/**
* @return $this
*/
public function setProcessTitle(string $title): self
public function setProcessTitle(string $title): static
{
$this->getCommand()->setProcessTitle($title);

return $this;
}

/**
* @return $this
*/
public function setHelp(string $help): self
public function setHelp(string $help): static
{
$this->getCommand()->setHelp($help);

Expand All @@ -162,10 +144,7 @@ public function getSynopsis(bool $short = false): string
return $this->getCommand()->getSynopsis($short);
}

/**
* @return $this
*/
public function addUsage(string $usage): self
public function addUsage(string $usage): static
{
$this->getCommand()->addUsage($usage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ final public function env(): ?string
return $this->env;
}

/**
* @return static
*/
final public function withPath(string $path): self
final public function withPath(string $path): static
{
$clone = clone $this;
$clone->path = $clone->file = $path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ public function __construct(ServicesConfigurator $parent, Definition $definition
/**
* Adds a tag for this definition.
*
* @return $this
*
* @throws InvalidArgumentException when an invalid tag name or attribute is provided
*/
final public function tag(string $name, array $attributes = []): self
final public function tag(string $name, array $attributes = []): static
{
if ('' === $name) {
throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,14 @@ public function __construct(ContainerBuilder $container)
$this->container = $container;
}

/**
* @return $this
*/
final public function set(string $name, mixed $value): self
final public function set(string $name, mixed $value): static
{
$this->container->setParameter($name, static::processValue($value, true));

return $this;
}

/**
* @return $this
*/
final public function __invoke(string $name, mixed $value): self
final public function __invoke(string $name, mixed $value): static
{
return $this->set($name, $value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ public function __destruct()
* Excludes files from registration using glob patterns.
*
* @param string[]|string $excludes
*
* @return $this
*/
final public function exclude(array|string $excludes): self
final public function exclude(array|string $excludes): static
{
$this->excludes = (array) $excludes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,21 @@ public function __construct(string $id)
$this->id = $id;
}

/**
* @return $this
*/
final public function ignoreOnInvalid(): self
final public function ignoreOnInvalid(): static
{
$this->invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;

return $this;
}

/**
* @return $this
*/
final public function nullOnInvalid(): self
final public function nullOnInvalid(): static
{
$this->invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;

return $this;
}

/**
* @return $this
*/
final public function ignoreOnUninitialized(): self
final public function ignoreOnUninitialized(): static
{
$this->invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ trait AbstractTrait
/**
* Whether this definition is abstract, that means it merely serves as a
* template for other definitions.
*
* @return $this
*/
final public function abstract(bool $abstract = true): self
final public function abstract(bool $abstract = true): static
{
$this->definition->setAbstract($abstract);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ trait ArgumentTrait
{
/**
* Sets the arguments to pass to the service constructor/factory method.
*
* @return $this
*/
final public function args(array $arguments): self
final public function args(array $arguments): static
{
$this->definition->setArguments(static::processValue($arguments, true));

Expand All @@ -27,10 +25,8 @@ final public function args(array $arguments): self

/**
* Sets one argument to pass to the service constructor/factory method.
*
* @return $this
*/
final public function arg(string|int $key, mixed $value): self
final public function arg(string|int $key, mixed $value): static
{
$this->definition->setArgument($key, static::processValue($value, true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ trait AutoconfigureTrait
/**
* Sets whether or not instanceof conditionals should be prepended with a global set.
*
* @return $this
*
* @throws InvalidArgumentException when a parent is already set
*/
final public function autoconfigure(bool $autoconfigured = true): self
final public function autoconfigure(bool $autoconfigured = true): static
{
$this->definition->setAutoconfigured($autoconfigured);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ trait AutowireTrait
{
/**
* Enables/disables autowiring.
*
* @return $this
*/
final public function autowire(bool $autowired = true): self
final public function autowire(bool $autowired = true): static
{
$this->definition->setAutowired($autowired);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ trait BindTrait
*
* @param string $nameOrFqcn A parameter name with its "$" prefix, or an FQCN
* @param mixed $valueOrRef The value or reference to bind
*
* @return $this
*/
final public function bind(string $nameOrFqcn, mixed $valueOrRef): self
final public function bind(string $nameOrFqcn, mixed $valueOrRef): static
{
$valueOrRef = static::processValue($valueOrRef, true);
if (!preg_match('/^(?:(?:array|bool|float|int|string|iterable)[ \t]*+)?\$/', $nameOrFqcn) && !$valueOrRef instanceof Reference) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ trait CallTrait
* @param array $arguments An array of arguments to pass to the method call
* @param bool $returnsClone Whether the call returns the service instance or not
*
* @return $this
*
* @throws InvalidArgumentException on empty $method param
*/
final public function call(string $method, array $arguments = [], bool $returnsClone = false): self
final public function call(string $method, array $arguments = [], bool $returnsClone = false): static
{
$this->definition->addMethodCall($method, static::processValue($arguments, true), $returnsClone);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ trait ClassTrait
{
/**
* Sets the service class.
*
* @return $this
*/
final public function class(?string $class): self
final public function class(?string $class): static
{
$this->definition->setClass($class);

Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.