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

Add PHP types to private methods and functions #49348

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
Feb 13, 2023
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
120 changes: 49 additions & 71 deletions 120 .github/expected-missing-return-types.diff
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ index 18f7ba0fb0..7f37cb6d9b 100644
+ protected function start(string $name): TraceableAdapterEvent
{
$this->calls[] = $event = new TraceableAdapterEvent();
diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
index 2ee96e9b37..f49ed24f68 100644
--- a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
+++ b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
@@ -81,5 +81,5 @@ trait FilesystemCommonTrait
* @return bool
*/
- protected function doUnlink(string $file)
+ protected function doUnlink(string $file): bool
{
return @unlink($file);
diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php
index 7cda0bc7d8..b2311826f4 100644
--- a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php
Expand Down Expand Up @@ -350,7 +361,7 @@ index e3ca1d49c4..526d350484 100644
+ public function locate(string $name, string $currentPath = null, bool $first = true): string|array;
}
diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php
index 30034e55a5..d6a57be190 100644
index 3f06f0c38c..ce0fd1d76d 100644
--- a/src/Symfony/Component/Config/Loader/FileLoader.php
+++ b/src/Symfony/Component/Config/Loader/FileLoader.php
@@ -67,5 +67,5 @@ abstract class FileLoader extends Loader
Expand Down Expand Up @@ -552,7 +563,7 @@ index 2762cdf05c..737334268a 100644
+ public function getName(): string;
}
diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php
index 893b3192e9..94822ed191 100644
index 7d31794be3..1c311aded2 100644
--- a/src/Symfony/Component/Console/Helper/Table.php
+++ b/src/Symfony/Component/Console/Helper/Table.php
@@ -193,5 +193,5 @@ class Table
Expand Down Expand Up @@ -609,6 +620,17 @@ index 74d885d131..3de806a60e 100644
+ protected function getErrorOutput(): OutputInterface
{
if (!$this->output instanceof ConsoleOutputInterface) {
diff --git a/src/Symfony/Component/CssSelector/Parser/Reader.php b/src/Symfony/Component/CssSelector/Parser/Reader.php
index 7f6ae7a600..d79db02567 100644
--- a/src/Symfony/Component/CssSelector/Parser/Reader.php
+++ b/src/Symfony/Component/CssSelector/Parser/Reader.php
@@ -57,5 +57,5 @@ class Reader
* @return int|false
*/
- public function getOffset(string $string): int|bool
+ public function getOffset(string $string): int|false
{
$position = strpos($this->source, $string, $this->position);
diff --git a/src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php b/src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php
index b4e982c457..521a9531f8 100644
--- a/src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php
Expand Down Expand Up @@ -853,30 +875,8 @@ index 479aeef880..272954c082 100644
- public function getFunctions();
+ public function getFunctions(): array;
}
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php
index e1a3169b00..e5dc5bfe21 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php
@@ -45,5 +45,5 @@ class ArrayNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
$result = [];
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php b/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php
index 0b31c66ded..e798ef8f2f 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/BinaryNode.php
@@ -93,5 +93,5 @@ class BinaryNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
$operator = $this->attributes['operator'];
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php b/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php
index ba78a2848e..f805b5655e 100644
index fec02abaae..7d02544275 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/ConditionalNode.php
@@ -41,5 +41,5 @@ class ConditionalNode extends Node
Expand All @@ -886,17 +886,6 @@ index ba78a2848e..f805b5655e 100644
+ public function evaluate(array $functions, array $values): mixed
{
if ($this->nodes['expr1']->evaluate($functions, $values)) {
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/ConstantNode.php b/src/Symfony/Component/ExpressionLanguage/Node/ConstantNode.php
index 869e350dc9..f1c1ad5bd3 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/ConstantNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/ConstantNode.php
@@ -39,5 +39,5 @@ class ConstantNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
return $this->attributes['value'];
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/FunctionNode.php b/src/Symfony/Component/ExpressionLanguage/Node/FunctionNode.php
index 06078da305..cc11697293 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/FunctionNode.php
Expand All @@ -915,28 +904,6 @@ index 06078da305..cc11697293 100644
+ public function toArray(): array
{
$array = [];
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php b/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php
index e9b10c3295..7aefd9bb84 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/GetAttrNode.php
@@ -66,5 +66,5 @@ class GetAttrNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
switch ($this->attributes['type']) {
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/NameNode.php b/src/Symfony/Component/ExpressionLanguage/Node/NameNode.php
index e017e967a1..8ea5bcf28c 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/NameNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/NameNode.php
@@ -34,5 +34,5 @@ class NameNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
return $values[$this->attributes['name']];
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/Node.php b/src/Symfony/Component/ExpressionLanguage/Node/Node.php
index eb5046c9bf..ef142d3787 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/Node.php
Expand Down Expand Up @@ -969,17 +936,6 @@ index eb5046c9bf..ef142d3787 100644
+ protected function isHash(array $value): bool
{
$expectedKey = 0;
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/NullCoalesceNode.php b/src/Symfony/Component/ExpressionLanguage/Node/NullCoalesceNode.php
index 3e59ef8676..b6371df241 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/NullCoalesceNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/NullCoalesceNode.php
@@ -37,5 +37,5 @@ class NullCoalesceNode extends Node
}

- public function evaluate(array $functions, array $values)
+ public function evaluate(array $functions, array $values): mixed
{
if ($this->nodes['expr1'] instanceof GetAttrNode) {
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/UnaryNode.php b/src/Symfony/Component/ExpressionLanguage/Node/UnaryNode.php
index 9e30d848eb..ee82938d8a 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/UnaryNode.php
Expand Down Expand Up @@ -1392,6 +1348,17 @@ index d894b7e74c..f0d6d32f0a 100644
+ protected function guessRoute(Request $request, string|object|array $controller): string
{
return 'n/a';
diff --git a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
index fcb100859f..8bf3ef09d5 100644
--- a/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
+++ b/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php
@@ -53,5 +53,5 @@ class FileLinkFormatter
* @return string|false
*/
- public function format(string $file, int $line): string|bool
+ public function format(string $file, int $line): string|false
{
if ($fmt = $this->getFileLinkFormat()) {
diff --git a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php
index 3650d1700d..055b57fc77 100644
--- a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php
Expand Down Expand Up @@ -1978,6 +1945,17 @@ index 69ac3d6ec4..d96c7d038d 100644
+ public function getMessageKey(): string
{
return 'An authentication exception occurred.';
diff --git a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
index b4ffa1dcd4..dd3c58a6d0 100644
--- a/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
+++ b/src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php
@@ -98,5 +98,5 @@ class InMemoryUserProvider implements UserProviderInterface
* @return InMemoryUser change return type on 7.0
*/
- private function getUser(string $username): UserInterface
+ private function getUser(string $username): InMemoryUser
{
if (!isset($this->users[strtolower($username)])) {
diff --git a/src/Symfony/Component/Security/Core/User/UserProviderInterface.php b/src/Symfony/Component/Security/Core/User/UserProviderInterface.php
index ec90d413fa..9f1401aa91 100644
--- a/src/Symfony/Component/Security/Core/User/UserProviderInterface.php
Expand Down Expand Up @@ -2286,7 +2264,7 @@ index 1749dd78d2..250b46bdd3 100644
{
return $this->class;
diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
index edac8395df..f3998dc4dd 100644
index 1b2457707f..5811aa8106 100644
--- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
@@ -295,5 +295,5 @@ abstract class ConstraintValidatorTestCase extends TestCase
Expand Down Expand Up @@ -3192,7 +3170,7 @@ index dba7c3dcfb..dce66ea6b9 100644
{
return $this->places;
diff --git a/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php b/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php
index cfe1c09b6e..de62f635f9 100644
index 06340a61bb..2654d15b9a 100644
--- a/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php
+++ b/src/Symfony/Contracts/Tests/Service/ServiceSubscriberTraitTest.php
@@ -80,5 +80,5 @@ class ParentTestService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private function addTaggedServices(ContainerBuilder $container): array
return $listenerRefs;
}

private function getEventManagerDef(ContainerBuilder $container, string $name)
private function getEventManagerDef(ContainerBuilder $container, string $name): Definition
{
if (!isset($this->eventManagers[$name])) {
$this->eventManagers[$name] = $container->getDefinition(sprintf($this->managerTemplate, $name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function validate(mixed $entity, Constraint $constraint)
->addViolation();
}

private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, mixed $value)
private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, mixed $value): string
{
if (!\is_object($value) || $value instanceof \DateTimeInterface) {
return $this->formatValue($value, self::PRETTY_DATE);
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private function displayDeprecations($groups, $configuration)
}
}

private static function getPhpUnitErrorHandler()
private static function getPhpUnitErrorHandler(): callable
{
if (!$eh = self::$errorHandler) {
if (class_exists(Handler::class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,15 @@ private function __construct(array $thresholds = [], $regex = '', $verboseOutput
$this->logFile = $logFile;
}

/**
* @return bool
*/
public function isEnabled()
public function isEnabled(): bool
{
return $this->enabled;
}

/**
* @param DeprecationGroup[] $deprecationGroups
*
* @return bool
*/
public function tolerates(array $deprecationGroups)
public function tolerates(array $deprecationGroups): bool
{
$grandTotal = 0;

Expand Down Expand Up @@ -229,10 +224,7 @@ public function toleratesForGroup(string $groupName, array $deprecationGroups):
return true;
}

/**
* @return bool
*/
public function isBaselineDeprecation(Deprecation $deprecation)
public function isBaselineDeprecation(Deprecation $deprecation): bool
{
if ($deprecation->isLegacy()) {
return false;
Expand Down Expand Up @@ -260,20 +252,17 @@ public function isBaselineDeprecation(Deprecation $deprecation)
return $result;
}

/**
* @return bool
*/
public function isGeneratingBaseline()
public function isGeneratingBaseline(): bool
{
return $this->generateBaseline;
}

public function getBaselineFile()
public function getBaselineFile(): string
{
return $this->baselineFile;
}

public function writeBaseline()
public function writeBaseline(): void
{
$map = [];
foreach ($this->baselineDeprecations as $location => $messages) {
Expand All @@ -290,47 +279,37 @@ public function writeBaseline()

/**
* @param string $message
*
* @return bool
*/
public function shouldDisplayStackTrace($message)
public function shouldDisplayStackTrace($message): bool
{
return '' !== $this->regex && preg_match($this->regex, $message);
}

/**
* @return bool
*/
public function isInRegexMode()
public function isInRegexMode(): bool
{
return '' !== $this->regex;
}

/**
* @return bool
*/
public function verboseOutput($group)
public function verboseOutput($group): bool
{
return $this->verboseOutput[$group];
}

public function shouldWriteToLogFile()
public function shouldWriteToLogFile(): bool
{
return null !== $this->logFile;
}

public function getLogFile()
public function getLogFile(): ?string
{
return $this->logFile;
}

/**
* @param string $serializedConfiguration an encoded string, for instance
* max[total]=1234&max[indirect]=42
*
* @return self
*/
public static function fromUrlEncodedString($serializedConfiguration)
public static function fromUrlEncodedString($serializedConfiguration): self
{
parse_str($serializedConfiguration, $normalizedConfiguration);
foreach (array_keys($normalizedConfiguration) as $key) {
Expand Down Expand Up @@ -376,29 +355,20 @@ public static function fromUrlEncodedString($serializedConfiguration)
);
}

/**
* @return self
*/
public static function inDisabledMode()
public static function inDisabledMode(): self
{
$configuration = new self();
$configuration->enabled = false;

return $configuration;
}

/**
* @return self
*/
public static function inStrictMode()
public static function inStrictMode(): self
{
return new self(['total' => 0]);
}

/**
* @return self
*/
public static function inWeakMode()
public static function inWeakMode(): self
{
$verboseOutput = [];
foreach (['unsilenced', 'direct', 'indirect', 'self', 'other'] as $group) {
Expand All @@ -408,18 +378,12 @@ public static function inWeakMode()
return new self([], '', $verboseOutput);
}

/**
* @return self
*/
public static function fromNumber($upperBound)
public static function fromNumber($upperBound): self
{
return new self(['total' => $upperBound]);
}

/**
* @return self
*/
public static function fromRegex($regex)
public static function fromRegex($regex): self
{
return new self([], $regex);
}
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.