Skip to content
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
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/MongoDbOdm/Filter/OrderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ final class OrderFilter extends AbstractFilter implements OrderFilterInterface
public function __construct(ManagerRegistry $managerRegistry, string $orderParameterName = 'order', LoggerInterface $logger = null, array $properties = null, NameConverterInterface $nameConverter = null)
{
if (null !== $properties) {
$properties = array_map(function ($propertyOptions) {
$properties = array_map(static function ($propertyOptions) {
// shorthand for default direction
if (\is_string($propertyOptions)) {
$propertyOptions = [
Expand Down
4 changes: 2 additions & 2 deletions src/Bridge/Doctrine/MongoDbOdm/SubresourceDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ private function buildAggregation(array $identifiers, array $context, Builder $p
$aggregation = $this->buildAggregation($identifiers, $context, $aggregation, --$remainingIdentifiers, $topAggregationBuilder);

$results = $aggregation->execute()->toArray();
$in = array_reduce($results, function ($in, $result) use ($previousAssociationProperty) {
return $in + array_map(function ($result) {
$in = array_reduce($results, static function ($in, $result) use ($previousAssociationProperty) {
return $in + array_map(static function ($result) {
return $result['_id'];
}, $result[$previousAssociationProperty] ?? []);
}, []);
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Orm/Filter/OrderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OrderFilter extends AbstractContextAwareFilter implements OrderFilterInter
public function __construct(ManagerRegistry $managerRegistry, ?RequestStack $requestStack = null, string $orderParameterName = 'order', LoggerInterface $logger = null, array $properties = null, NameConverterInterface $nameConverter = null)
{
if (null !== $properties) {
$properties = array_map(function ($propertyOptions) {
$properties = array_map(static function ($propertyOptions) {
// shorthand for default direction
if (\is_string($propertyOptions)) {
$propertyOptions = [
Expand Down
10 changes: 5 additions & 5 deletions src/Bridge/Symfony/Bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private function addSwaggerSection(ArrayNodeDefinition $rootNode): void
})
->end()
->validate()
->ifTrue(function ($v) use ($defaultVersions) {
->ifTrue(static function ($v) use ($defaultVersions) {
return $v !== array_intersect($v, $defaultVersions);
})
->thenInvalid(sprintf('Only the versions %s are supported. Got %s.', implode(' and ', $defaultVersions), '%s'))
Expand Down Expand Up @@ -337,7 +337,7 @@ private function addHttpCacheSection(ArrayNodeDefinition $rootNode): void
->variableNode('request_options')
->defaultValue([])
->validate()
->ifTrue(function ($v) { return false === \is_array($v); })
->ifTrue(static function ($v) { return false === \is_array($v); })
->thenInvalid('The request_options parameter must be an array.')
->end()
->info('To pass options to the client charged with the request.')
Expand Down Expand Up @@ -435,7 +435,7 @@ private function addExceptionToStatusSection(ArrayNodeDefinition $rootNode): voi
->useAttributeAsKey('exception_class')
->beforeNormalization()
->ifArray()
->then(function (array $exceptionToStatus) {
->then(static function (array $exceptionToStatus) {
foreach ($exceptionToStatus as &$httpStatusCode) {
if (\is_int($httpStatusCode)) {
continue;
Expand All @@ -454,7 +454,7 @@ private function addExceptionToStatusSection(ArrayNodeDefinition $rootNode): voi
->prototype('integer')->end()
->validate()
->ifArray()
->then(function (array $exceptionToStatus) {
->then(static function (array $exceptionToStatus) {
foreach ($exceptionToStatus as $httpStatusCode) {
if ($httpStatusCode < 100 || $httpStatusCode >= 600) {
throw new InvalidConfigurationException(sprintf('The HTTP status code "%s" is not valid.', $httpStatusCode));
Expand All @@ -479,7 +479,7 @@ private function addFormatSection(ArrayNodeDefinition $rootNode, string $key, ar
->useAttributeAsKey('format')
->beforeNormalization()
->ifArray()
->then(function ($v) {
->then(static function ($v) {
foreach ($v as $format => $value) {
if (isset($value['mime_types'])) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQl/Type/FieldsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private function getFilterArgs(array $args, ?string $resourceClass, ?ResourceMet
if (\array_key_exists($key, $parsed) && \is_array($parsed[$key])) {
$parsed = [$key => ''];
}
array_walk_recursive($parsed, function (&$value) use ($graphqlFilterType) {
array_walk_recursive($parsed, static function (&$value) use ($graphqlFilterType) {
$value = $graphqlFilterType;
});
$args = $this->mergeFilterArgs($args, $parsed, $resourceMetadata, $key);
Expand Down
2 changes: 1 addition & 1 deletion src/HttpCache/VarnishPurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function purge(array $iris)
}

// Create the regex to purge all tags in just one request
$parts = array_map(function ($iri) {
$parts = array_map(static function ($iri) {
return sprintf('(^|\,)%s($|\,)', preg_quote($iri));
}, $iris);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ final class ExpressionLanguageProvider implements ExpressionFunctionProviderInte
public function getFunctions(): array
{
return [
new ExpressionFunction('is_granted', function ($attributes, $object = 'null') {
new ExpressionFunction('is_granted', static function ($attributes, $object = 'null') {
return sprintf('$auth_checker->isGranted(%s, %s)', $attributes, $object);
}, function (array $variables, $attributes, $object = null) {
}, static function (array $variables, $attributes, $object = null) {
return $variables['auth_checker']->isGranted($attributes, $object);
}),
];
Expand Down
4 changes: 2 additions & 2 deletions src/Security/ExpressionLanguage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ protected function registerFunctions()
{
parent::registerFunctions();

$this->register('is_granted', function ($attributes, $object = 'null') {
$this->register('is_granted', static function ($attributes, $object = 'null') {
return sprintf('$auth_checker->isGranted(%s, %s)', $attributes, $object);
}, function (array $variables, $attributes, $object = null) {
}, static function (array $variables, $attributes, $object = null) {
return $variables['auth_checker']->isGranted($attributes, $object);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Security/ResourceAccessChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function getEffectiveRoles(TokenInterface $token): array
return $this->roleHierarchy->getReachableRoleNames($token->getRoleNames());
}

return array_map(function (Role $role): string { // @phpstan-ignore-line
return array_map(static function (Role $role): string { // @phpstan-ignore-line
return $role->getRole(); // @phpstan-ignore-line
}, $this->roleHierarchy->getReachableRoles($token->getRoles())); // @phpstan-ignore-line
}
Expand Down
2 changes: 1 addition & 1 deletion src/Util/RequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function parseRequestParams(string $source): array

$source = preg_replace_callback(
'/(^|(?<=&))[^=[&]+/',
function ($key) {
static function ($key) {
return bin2hex(urldecode($key[0]));
},
$source
Expand Down