Add types to private and final methods.
This commit is contained in:
parent
ff63bb325d
commit
1b880677d4
@ -119,7 +119,7 @@ class DoctrineDataCollector extends DataCollector
|
|||||||
return 'db';
|
return 'db';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sanitizeQueries(string $connectionName, array $queries)
|
private function sanitizeQueries(string $connectionName, array $queries): array
|
||||||
{
|
{
|
||||||
foreach ($queries as $i => $query) {
|
foreach ($queries as $i => $query) {
|
||||||
$queries[$i] = $this->sanitizeQuery($connectionName, $query);
|
$queries[$i] = $this->sanitizeQuery($connectionName, $query);
|
||||||
@ -128,7 +128,7 @@ class DoctrineDataCollector extends DataCollector
|
|||||||
return $queries;
|
return $queries;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sanitizeQuery(string $connectionName, $query)
|
private function sanitizeQuery(string $connectionName, array $query): array
|
||||||
{
|
{
|
||||||
$query['explainable'] = true;
|
$query['explainable'] = true;
|
||||||
if (null === $query['params']) {
|
if (null === $query['params']) {
|
||||||
|
@ -180,7 +180,7 @@ class ConsoleFormatter implements FormatterInterface
|
|||||||
return $record;
|
return $record;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function dumpData($data, $colors = null)
|
private function dumpData($data, bool $colors = null): string
|
||||||
{
|
{
|
||||||
if (null === $this->dumper) {
|
if (null === $this->dumper) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -118,13 +118,13 @@ EOF
|
|||||||
throw new RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
|
throw new RuntimeException(sprintf('File or directory "%s" is not readable', $filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validate(string $template, $file)
|
private function validate(string $template, string $file): array
|
||||||
{
|
{
|
||||||
$realLoader = $this->twig->getLoader();
|
$realLoader = $this->twig->getLoader();
|
||||||
try {
|
try {
|
||||||
$temporaryLoader = new ArrayLoader([(string) $file => $template]);
|
$temporaryLoader = new ArrayLoader([$file => $template]);
|
||||||
$this->twig->setLoader($temporaryLoader);
|
$this->twig->setLoader($temporaryLoader);
|
||||||
$nodeTree = $this->twig->parse($this->twig->tokenize(new Source($template, (string) $file)));
|
$nodeTree = $this->twig->parse($this->twig->tokenize(new Source($template, $file)));
|
||||||
$this->twig->compile($nodeTree);
|
$this->twig->compile($nodeTree);
|
||||||
$this->twig->setLoader($realLoader);
|
$this->twig->setLoader($realLoader);
|
||||||
} catch (Error $e) {
|
} catch (Error $e) {
|
||||||
|
@ -72,7 +72,7 @@ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
final protected function ignoreAutoloadException($class, \Exception $exception)
|
final protected function ignoreAutoloadException(string $class, \Exception $exception): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
ClassExistenceResource::throwOnRequiredClass($class, $exception);
|
ClassExistenceResource::throwOnRequiredClass($class, $exception);
|
||||||
|
@ -1069,7 +1069,7 @@ class FrameworkExtension extends Extension
|
|||||||
/**
|
/**
|
||||||
* Returns a definition for an asset package.
|
* Returns a definition for an asset package.
|
||||||
*/
|
*/
|
||||||
private function createPackageDefinition(?string $basePath, array $baseUrls, Reference $version)
|
private function createPackageDefinition(?string $basePath, array $baseUrls, Reference $version): Definition
|
||||||
{
|
{
|
||||||
if ($basePath && $baseUrls) {
|
if ($basePath && $baseUrls) {
|
||||||
throw new \LogicException('An asset package cannot have base URLs and base paths.');
|
throw new \LogicException('An asset package cannot have base URLs and base paths.');
|
||||||
@ -1085,7 +1085,7 @@ class FrameworkExtension extends Extension
|
|||||||
return $package;
|
return $package;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createVersion(ContainerBuilder $container, ?string $version, ?string $format, ?string $jsonManifestPath, string $name)
|
private function createVersion(ContainerBuilder $container, ?string $version, ?string $format, ?string $jsonManifestPath, string $name): Reference
|
||||||
{
|
{
|
||||||
// Configuration prevents $version and $jsonManifestPath from being set
|
// Configuration prevents $version and $jsonManifestPath from being set
|
||||||
if (null !== $version) {
|
if (null !== $version) {
|
||||||
|
@ -199,7 +199,7 @@ class Cookie
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function parseDate($dateValue)
|
private static function parseDate(string $dateValue): ?string
|
||||||
{
|
{
|
||||||
// trim single quotes around date if present
|
// trim single quotes around date if present
|
||||||
if (($length = \strlen($dateValue)) > 1 && "'" === $dateValue[0] && "'" === $dateValue[$length - 1]) {
|
if (($length = \strlen($dateValue)) > 1 && "'" === $dateValue[0] && "'" === $dateValue[$length - 1]) {
|
||||||
@ -216,6 +216,8 @@ class Cookie
|
|||||||
if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
|
if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) {
|
||||||
return $date->format('U');
|
return $date->format('U');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -740,7 +740,10 @@ class Filesystem
|
|||||||
return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
|
return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function box($func)
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private static function box(callable $func)
|
||||||
{
|
{
|
||||||
self::$lastError = null;
|
self::$lastError = null;
|
||||||
set_error_handler(__CLASS__.'::handleError');
|
set_error_handler(__CLASS__.'::handleError');
|
||||||
|
@ -246,8 +246,8 @@ class FileType extends AbstractType
|
|||||||
/**
|
/**
|
||||||
* This method should be kept in sync with Symfony\Component\Validator\Constraints\FileValidator::moreDecimalsThan().
|
* This method should be kept in sync with Symfony\Component\Validator\Constraints\FileValidator::moreDecimalsThan().
|
||||||
*/
|
*/
|
||||||
private static function moreDecimalsThan($double, $numberOfDecimals)
|
private static function moreDecimalsThan(string $double, int $numberOfDecimals): bool
|
||||||
{
|
{
|
||||||
return \strlen((string) $double) > \strlen(round($double, $numberOfDecimals));
|
return \strlen($double) > \strlen(round($double, $numberOfDecimals));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,10 +47,7 @@ class FormFactoryBuilder implements FormFactoryBuilderInterface
|
|||||||
*/
|
*/
|
||||||
private $typeGuessers = [];
|
private $typeGuessers = [];
|
||||||
|
|
||||||
/**
|
public function __construct(bool $forceCoreExtension = false)
|
||||||
* @param bool $forceCoreExtension
|
|
||||||
*/
|
|
||||||
public function __construct($forceCoreExtension = false)
|
|
||||||
{
|
{
|
||||||
$this->forceCoreExtension = $forceCoreExtension;
|
$this->forceCoreExtension = $forceCoreExtension;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class MessageBus implements MessageBusInterface
|
|||||||
private $middlewareHandlers;
|
private $middlewareHandlers;
|
||||||
private $cachedIterator;
|
private $cachedIterator;
|
||||||
|
|
||||||
public function __construct($middlewareHandlers)
|
public function __construct(\Traversable $middlewareHandlers)
|
||||||
{
|
{
|
||||||
$this->middlewareHandlers = $middlewareHandlers;
|
$this->middlewareHandlers = $middlewareHandlers;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function throwInvalidArgumentException($message, $trace, $i, $propertyPath)
|
private static function throwInvalidArgumentException(string $message, array $trace, int $i, string $propertyPath): void
|
||||||
{
|
{
|
||||||
// the type mismatch is not caused by invalid arguments (but e.g. by an incompatible return type hint of the writer method)
|
// the type mismatch is not caused by invalid arguments (but e.g. by an incompatible return type hint of the writer method)
|
||||||
if (0 !== strpos($message, 'Argument ')) {
|
if (0 !== strpos($message, 'Argument ')) {
|
||||||
|
@ -66,7 +66,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
|||||||
* If all voters abstained from voting, the decision will be based on the
|
* If all voters abstained from voting, the decision will be based on the
|
||||||
* allowIfAllAbstainDecisions property value (defaults to false).
|
* allowIfAllAbstainDecisions property value (defaults to false).
|
||||||
*/
|
*/
|
||||||
private function decideAffirmative(TokenInterface $token, array $attributes, $object = null)
|
private function decideAffirmative(TokenInterface $token, array $attributes, $object = null): bool
|
||||||
{
|
{
|
||||||
$deny = 0;
|
$deny = 0;
|
||||||
foreach ($this->voters as $voter) {
|
foreach ($this->voters as $voter) {
|
||||||
@ -106,7 +106,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
|||||||
* If all voters abstained from voting, the decision will be based on the
|
* If all voters abstained from voting, the decision will be based on the
|
||||||
* allowIfAllAbstainDecisions property value (defaults to false).
|
* allowIfAllAbstainDecisions property value (defaults to false).
|
||||||
*/
|
*/
|
||||||
private function decideConsensus(TokenInterface $token, array $attributes, $object = null)
|
private function decideConsensus(TokenInterface $token, array $attributes, $object = null): bool
|
||||||
{
|
{
|
||||||
$grant = 0;
|
$grant = 0;
|
||||||
$deny = 0;
|
$deny = 0;
|
||||||
@ -147,7 +147,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
|
|||||||
* If all voters abstained from voting, the decision will be based on the
|
* If all voters abstained from voting, the decision will be based on the
|
||||||
* allowIfAllAbstainDecisions property value (defaults to false).
|
* allowIfAllAbstainDecisions property value (defaults to false).
|
||||||
*/
|
*/
|
||||||
private function decideUnanimous(TokenInterface $token, array $attributes, $object = null)
|
private function decideUnanimous(TokenInterface $token, array $attributes, $object = null): bool
|
||||||
{
|
{
|
||||||
$grant = 0;
|
$grant = 0;
|
||||||
foreach ($this->voters as $voter) {
|
foreach ($this->voters as $voter) {
|
||||||
|
@ -22,6 +22,7 @@ use Symfony\Component\Security\Core\Exception\CookieTheftException;
|
|||||||
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
|
||||||
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
|
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
|
||||||
use Symfony\Component\Security\Http\ParameterBagUtils;
|
use Symfony\Component\Security\Http\ParameterBagUtils;
|
||||||
|
|
||||||
@ -221,7 +222,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
|
|||||||
*/
|
*/
|
||||||
abstract protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token);
|
abstract protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token);
|
||||||
|
|
||||||
final protected function getUserProvider($class)
|
final protected function getUserProvider(string $class): UserProviderInterface
|
||||||
{
|
{
|
||||||
foreach ($this->userProviders as $provider) {
|
foreach ($this->userProviders as $provider) {
|
||||||
if ($provider->supportsClass($class)) {
|
if ($provider->supportsClass($class)) {
|
||||||
|
@ -106,7 +106,7 @@ EOF
|
|||||||
return $this->display($io, $filesInfo);
|
return $this->display($io, $filesInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validate(string $content, $file = null)
|
private function validate(string $content, string $file = null): array
|
||||||
{
|
{
|
||||||
$errors = [];
|
$errors = [];
|
||||||
|
|
||||||
|
@ -199,9 +199,9 @@ class FileValidator extends ConstraintValidator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function moreDecimalsThan($double, $numberOfDecimals)
|
private static function moreDecimalsThan(string $double, int $numberOfDecimals): bool
|
||||||
{
|
{
|
||||||
return \strlen((string) $double) > \strlen(round($double, $numberOfDecimals));
|
return \strlen($double) > \strlen(round($double, $numberOfDecimals));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,11 @@ class Registry
|
|||||||
return $matched;
|
return $matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function supports(WorkflowInterface $workflow, $supportStrategy, $subject, $workflowName): bool
|
/**
|
||||||
|
* @param WorkflowSupportStrategyInterface $supportStrategy
|
||||||
|
* @param object $subject
|
||||||
|
*/
|
||||||
|
private function supports(WorkflowInterface $workflow, $supportStrategy, $subject, ?string $workflowName): bool
|
||||||
{
|
{
|
||||||
if (null !== $workflowName && $workflowName !== $workflow->getName()) {
|
if (null !== $workflowName && $workflowName !== $workflow->getName()) {
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user