Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Feb 14, 2019
1 parent 81b6631 commit bda1991
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 35 deletions.
22 changes: 11 additions & 11 deletions src/Admin/AbstractAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ public function getParentAssociationMapping()
if (\is_array($this->parentAssociationMapping) && $this->getParent()) {
$parent = $this->getParent()->getCode();

if (array_key_exists($parent, $this->parentAssociationMapping)) {
if (\array_key_exists($parent, $this->parentAssociationMapping)) {
return $this->parentAssociationMapping[$parent];
}

Expand Down Expand Up @@ -1109,11 +1109,11 @@ public function getBatchActions()
}

foreach ($actions as $name => &$action) {
if (!array_key_exists('label', $action)) {
if (!\array_key_exists('label', $action)) {
$action['label'] = $this->getTranslationLabel($name, 'batch', 'label');
}

if (!array_key_exists('translation_domain', $action)) {
if (!\array_key_exists('translation_domain', $action)) {
$action['translation_domain'] = $this->getTranslationDomain();
}
}
Expand Down Expand Up @@ -1646,7 +1646,7 @@ public function getFormFieldDescription($name)
*/
public function hasFormFieldDescription($name)
{
return array_key_exists($name, $this->formFieldDescriptions) ? true : false;
return \array_key_exists($name, $this->formFieldDescriptions) ? true : false;
}

public function addFormFieldDescription($name, FieldDescriptionInterface $fieldDescription)
Expand Down Expand Up @@ -1692,7 +1692,7 @@ public function getShowFieldDescription($name)

public function hasShowFieldDescription($name)
{
return array_key_exists($name, $this->showFieldDescriptions);
return \array_key_exists($name, $this->showFieldDescriptions);
}

public function addShowFieldDescription($name, FieldDescriptionInterface $fieldDescription)
Expand Down Expand Up @@ -1721,7 +1721,7 @@ public function hasListFieldDescription($name)
{
$this->buildList();

return array_key_exists($name, $this->listFieldDescriptions) ? true : false;
return \array_key_exists($name, $this->listFieldDescriptions) ? true : false;
}

public function addListFieldDescription($name, FieldDescriptionInterface $fieldDescription)
Expand All @@ -1741,7 +1741,7 @@ public function getFilterFieldDescription($name)

public function hasFilterFieldDescription($name)
{
return array_key_exists($name, $this->filterFieldDescriptions) ? true : false;
return \array_key_exists($name, $this->filterFieldDescriptions) ? true : false;
}

public function addFilterFieldDescription($name, FieldDescriptionInterface $fieldDescription)
Expand Down Expand Up @@ -2339,7 +2339,7 @@ public function isGranted($name, $object = null)
{
$key = md5(json_encode($name).($object ? '/'.spl_object_hash($object) : ''));

if (!array_key_exists($key, $this->cacheIsGranted)) {
if (!\array_key_exists($key, $this->cacheIsGranted)) {
$this->cacheIsGranted[$key] = $this->securityHandler->isGranted($this, $name, $object ?: $this);
}

Expand Down Expand Up @@ -2555,7 +2555,7 @@ public function checkAccess($action, $object = null)
{
$access = $this->getAccess();

if (!array_key_exists($action, $access)) {
if (!\array_key_exists($action, $access)) {
throw new \InvalidArgumentException(sprintf(
'Action "%s" could not be found in access mapping.'
.' Please make sure your action is defined into your admin class accessMapping property.',
Expand Down Expand Up @@ -2586,7 +2586,7 @@ public function hasAccess($action, $object = null)
{
$access = $this->getAccess();

if (!array_key_exists($action, $access)) {
if (!\array_key_exists($action, $access)) {
return false;
}

Expand Down Expand Up @@ -2770,7 +2770,7 @@ final public function isDefaultFilter($name)
$filter = $this->getFilterParameters();
$default = $this->getDefaultFilterValues();

if (!array_key_exists($name, $filter) || !array_key_exists($name, $default)) {
if (!\array_key_exists($name, $filter) || !\array_key_exists($name, $default)) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Admin/AdminHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ public function appendFormFieldElement(AdminInterface $admin, $subject, $element

if ($childFormBuilder) {
$formData = $admin->getRequest()->get($formBuilder->getName(), []);
if (array_key_exists($childFormBuilder->getName(), $formData)) {
if (\array_key_exists($childFormBuilder->getName(), $formData)) {
$formData = $admin->getRequest()->get($formBuilder->getName(), []);
$i = 0;
foreach ($formData[$childFormBuilder->getName()] as $name => &$field) {
$toDelete[$i] = false;
if (array_key_exists('_delete', $field)) {
if (\array_key_exists('_delete', $field)) {
$toDelete[$i] = true;
unset($field['_delete']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/FieldDescriptionCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getElements()
*/
public function has($name)
{
return array_key_exists($name, $this->elements);
return \array_key_exists($name, $this->elements);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ public function batchAction()
);
}
$batchActions = $this->admin->getBatchActions();
if (!array_key_exists($action, $batchActions)) {
if (!\array_key_exists($action, $batchActions)) {
throw new \RuntimeException(sprintf('The `%s` batch action is not defined', $action));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ private function replaceDefaultArguments(
$parentArguments = $parentDefinition ? $parentDefinition->getArguments() : [];

foreach ($defaultArguments as $index => $value) {
$declaredInParent = $parentDefinition && array_key_exists($index, $parentArguments);
$declaredInParent = $parentDefinition && \array_key_exists($index, $parentArguments);
$argumentValue = $declaredInParent ? $parentArguments[$index] : $arguments[$index];

if (null === $argumentValue || 0 === \strlen($argumentValue)) {
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ public function getConfigTreeBuilder()
->then(function ($items) {
foreach ($items as $key => $item) {
if (\is_array($item)) {
if (!array_key_exists('label', $item) || !array_key_exists('route', $item)) {
if (!\array_key_exists('label', $item) || !\array_key_exists('route', $item)) {
throw new \InvalidArgumentException('Expected either parameters "route" and "label" for array items');
}

if (!array_key_exists('route_params', $item)) {
if (!\array_key_exists('route_params', $item)) {
$items[$key]['route_params'] = [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Filter/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getFormName()

public function getOption($name, $default = null)
{
if (array_key_exists($name, $this->options)) {
if (\array_key_exists($name, $this->options)) {
return $this->options[$name];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Form/ChoiceList/ModelChoiceLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function loadChoiceList($value = null)

$id = implode(AdapterInterface::ID_SEPARATOR, $this->getIdentifierValues($entity));

if (!array_key_exists($valueObject, $choices)) {
if (!\array_key_exists($valueObject, $choices)) {
$choices[$valueObject] = [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Form/Extension/ChoiceTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function configureOptions(OptionsResolver $resolver)

public function buildView(FormView $view, FormInterface $form, array $options)
{
$view->vars['sortable'] = array_key_exists('sortable', $options) && $options['sortable'];
$view->vars['sortable'] = \array_key_exists('sortable', $options) && $options['sortable'];
}

public function getExtendedType()
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/AdminType.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}

if ($options['delete'] && $admin->hasAccess('delete')) {
if (!array_key_exists('translation_domain', $options['delete_options']['type_options'])) {
if (!\array_key_exists('translation_domain', $options['delete_options']['type_options'])) {
$options['delete_options']['type_options']['translation_domain'] = $admin->getTranslationDomain();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/ModelAutocompleteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'disabled',
$options['disabled']
// NEXT_MAJOR: Remove this when bumping Symfony constraint to 2.8+
|| (array_key_exists('read_only', $options) && $options['read_only'])
|| (\array_key_exists('read_only', $options) && $options['read_only'])
);
$builder->setAttribute('to_string_callback', $options['to_string_callback']);
$builder->setAttribute('target_admin_access_action', $options['target_admin_access_action']);
Expand Down
4 changes: 2 additions & 2 deletions src/Manipulator/ServicesManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function addResource($serviceId, $modelClass, $adminClass, $controllerNam
$code .= "\n";
}

if (array_key_exists('services', $data)) {
if (array_key_exists($serviceId, (array) $data['services'])) {
if (\array_key_exists('services', $data)) {
if (\array_key_exists($serviceId, (array) $data['services'])) {
throw new \RuntimeException(sprintf(
'The service "%s" is already defined in the file "%s".',
$serviceId,
Expand Down
2 changes: 1 addition & 1 deletion src/Mapper/BaseGroupedMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function with($name, array $options = [])
$code = $name;

// Open
if (array_key_exists('tab', $options) && $options['tab']) {
if (\array_key_exists('tab', $options) && $options['tab']) {
$tabs = $this->getTabs();

if ($this->currentTab) {
Expand Down
2 changes: 1 addition & 1 deletion src/Object/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ public function getOptions(): array

public function getOption($name, $default = null)
{
return array_key_exists($name, $this->options) ? $this->options[$name] : $default;
return \array_key_exists($name, $this->options) ? $this->options[$name] : $default;
}
}
6 changes: 3 additions & 3 deletions src/Route/DefaultRouteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function generateMenuUrl(

$code = $this->getCode($admin, $name);

if (!array_key_exists($code, $this->caches)) {
if (!\array_key_exists($code, $this->caches)) {
throw new \RuntimeException(sprintf('unable to find the route `%s`', $code));
}

Expand All @@ -120,15 +120,15 @@ public function generateMenuUrl(

public function hasAdminRoute(AdminInterface $admin, $name)
{
return array_key_exists($this->getCode($admin, $name), $this->caches);
return \array_key_exists($this->getCode($admin, $name), $this->caches);
}

private function getCode(AdminInterface $admin, string $name): string
{
$this->loadCache($admin);

// someone provide the fullname
if (!$admin->isChild() && array_key_exists($name, $this->caches)) {
if (!$admin->isChild() && \array_key_exists($name, $this->caches)) {
return $name;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Route/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function getElements()
*/
public function has($name)
{
return array_key_exists($this->getCode($name), $this->elements);
return \array_key_exists($this->getCode($name), $this->elements);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/Extension/SonataAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public function getXEditableChoices(FieldDescriptionInterface $fieldDescription)
reset($choices);
$first = current($choices);
// the choices are already in the right format
if (\is_array($first) && array_key_exists('value', $first) && array_key_exists('text', $first)) {
if (\is_array($first) && \array_key_exists('value', $first) && \array_key_exists('text', $first)) {
$xEditableChoices = $choices;
} else {
foreach ($choices as $value => $text) {
Expand Down
6 changes: 3 additions & 3 deletions src/Util/AdminObjectAclManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ protected function buildAcl(AdminObjectAclData $data, Form $form, \Traversable $
foreach ($aclValues as $aclValue) {
foreach ($matrices as $key => $matrix) {
if ($aclValue instanceof UserInterface) {
if (array_key_exists('user', $matrix) && $aclValue->getUsername() === $matrix['user']) {
if (\array_key_exists('user', $matrix) && $aclValue->getUsername() === $matrix['user']) {
$matrices[$key]['acl_value'] = $aclValue;
}
} elseif (array_key_exists('role', $matrix) && $aclValue === $matrix['role']) {
} elseif (\array_key_exists('role', $matrix) && $aclValue === $matrix['role']) {
$matrices[$key]['acl_value'] = $aclValue;
}
}
Expand Down Expand Up @@ -262,7 +262,7 @@ protected function buildForm(AdminObjectAclData $data, FormBuilderInterface $for
$permissions[$permission] = [
'required' => false,
'data' => $checked,
'disabled' => array_key_exists('disabled', $attr),
'disabled' => \array_key_exists('disabled', $attr),
'attr' => $attr,
];
}
Expand Down

0 comments on commit bda1991

Please sign in to comment.