8000 [5.0] set return type declartion to `self` instead of `object` when the type is `$this` by azjezz · Pull Request #33100 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[5.0] set return type declartion to self instead of object when the type is $this #33100

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

Closed
wants to merge 1 commit into from
Closed
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.
8000 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): object
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): object
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): object
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): object
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): object
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): object
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): object
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): object
public function setPriority(int $priority): self
{
$this->message->setPriority($priority);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(ServicesConfigurator $parent, Definition $definition
*
* @throws InvalidArgumentException when an invalid tag name or attribute is provided
*/
final public function tag(string $name, array $attributes = []): object
final public function tag(string $name, array $attributes = []): self
{
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 @@ -32,7 +32,7 @@ public function __construct(ContainerBuilder $container)
*
* @return $this
*/
final public function set(string $name, $value): object
final public function set(string $name, $value): self
{
$this->container->setParameter($name, static::processValue($value, true));

Expand All @@ -44,7 +44,7 @@ final public function set(string $name, $value): object
*
* @return $this
*/
final public function __invoke(string $name, $value): object
final public function __invoke(string $name, $value): self
{
return $this->set($name, $value);
}
Expand Down
< A3E2 tr data-hunk="a8607d2c3f1f6e798546cbe83010a9c2f029b4156ae94c9c8debd8bdbf1bfb8f" class="show-top-border">
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __destruct()
*
* @return $this
*/
final public function exclude($excludes): object
final public function exclude($excludes): self
{
$this->excludes = (array) $excludes;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(string $id)
/**
* @return $this
*/
final public function ignoreOnInvalid(): object
final public function ignoreOnInvalid(): self
{
$this->invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;

Expand All @@ -42,7 +42,7 @@ final public function ignoreOnInvalid(): object
/**
* @return $this
*/
final public function nullOnInvalid(): object
final public function nullOnInvalid(): self
{
$this->invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;

Expand All @@ -52,7 +52,7 @@ final public function nullOnInvalid(): object
/**
* @return $this
*/
final public function ignoreOnUninitialized(): object
final public function ignoreOnUninitialized(): self
{
$this->invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait AbstractTrait
*
* @return $this
*/
final public function abstract(bool $abstract = true): object
final public function abstract(bool $abstract = true): self
{
$this->definition->setAbstract($abstract);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait ArgumentTrait
*
* @return $this
*/
final public function args(array $arguments): object
final public function args(array $arguments): self
{
$this->definition->setArguments(static::processValue($arguments, true));

Expand All @@ -35,7 +35,7 @@ final public function args(array $arguments): object
*
* @return $this
*/
final public function arg($key, $value): object
final public function arg($key, $value): self
{
$this->definition->setArgument($key, static::processValue($value, true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait AutoconfigureTrait
*
* @throws InvalidArgumentException when a parent is already set
*/
final public function autoconfigure(bool $autoconfigured = true): object
final public function autoconfigure(bool $autoconfigured = true): self
{
if ($autoconfigured && $this->definition instanceof ChildDefinition) {
throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait AutowireTrait
*
* @return $this
*/
final public function autowire(bool $autowired = true): object
final public function autowire(bool $autowired = true): self
{
$this->definition->setAutowired($autowired);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait BindTrait
*
* @return $this
*/
final public function bind(string $nameOrFqcn, $valueOrRef): object
final public function bind(string $nameOrFqcn, $valueOrRef): self
{
$valueOrRef = static::processValue($valueOrRef, true);
if (!preg_match('/^(?:(?:array|bool|float|int|string)[ \t]*+)?\$/', $nameOrFqcn) && !$valueOrRef instanceof Reference) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ trait CallTrait
*
* @throws InvalidArgumentException on empty $method param
*/
final public function call(string $method, array $arguments = []): object
final public function call(string $method, array $arguments = []): self
{
$this->definition->addMethodCall($method, static::processValue($arguments, true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait ClassTrait
*
* @return $this
*/
final public function class(?string $class): object
final public function class(?string $class): self
{
$this->definition->setClass($class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait ConfiguratorTrait
*
* @return $this
*/
final public function configurator($configurator): object
final public function configurator($configurator): self
{
$this->definition->setConfigurator(static::processValue($configurator, true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trait DecorateTrait
*
* @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals
*/
final public function decorate(?string $id, ?string $renamedId = null, int $priority = 0): object
final public function decorate(?string $id, ?string $renamedId = null, int $priority = 0): self
{
$this->definition->setDecoratedService($id, $renamedId, $priority);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait DeprecateTrait
*
* @throws InvalidArgumentException when the message template is invalid
*/
final public function deprecate(string $template = null): object
final public function deprecate(string $template = null): self
{
$this->definition->setDeprecated(true, $template);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait FactoryTrait
*
* @return $this
*/
final public function factory($factory): object
final public function factory($factory): self
{
if (\is_string($factory) && 1 === substr_count($factory, ':')) {
$factoryParts = explode(':', $factory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait FileTrait
*
* @return $this
*/
final public function file(string $file): object
final public function file(string $file): self
{
$this->definition->setFile($file);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait LazyTrait
*
* @return $this
*/
final public function lazy($lazy = true): object
final public function lazy($lazy = true): self
{
$this->definition->setLazy((bool) $lazy);
if (\is_string($lazy)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait ParentTrait
*
* @throws InvalidArgumentException when parent cannot be set
*/
final public function parent(string $parent): object
final public function parent(string $parent): self
{
if (!$this->allowParent) {
throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait PublicTrait
/**
* @return $this
*/
final public function public(): object
final public function public(): self
{
$this->definition->setPublic(true);

Expand All @@ -26,7 +26,7 @@ final public function public(): object
/**
* @return $this
*/
final public function private(): object
final public function private(): self
{
$this->definition->setPublic(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait ShareTrait
*
* @return $this
*/
final public function share(bool $shared = true): object
final public function share(bool $shared = true): self
{
$this->definition->setShared($shared);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait SyntheticTrait
*
* @return $this
*/
final public function synthetic(bool $synthetic = true): object
final public function synthetic(bool $synthetic = true): self
{
$this->definition->setSynthetic($synthetic);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait TagTrait
*
* @return $this
*/
final public function tag(string $name, array $attributes = []): object
final public function tag(string $name, array $attributes = []): self
{
if (!\is_string($name) || '' === $name) {
throw new InvalidArgumentException(sprintf('The tag name for service "%s" must be a non-empty string.', $this->id));
Expand Down
Loading
0