From 54f05356e8c2150f71acc8f869cc65f5c24f278e Mon Sep 17 00:00:00 2001 From: Ben Younes Ousama Date: Tue, 8 Aug 2017 22:13:38 +0200 Subject: [PATCH 1/3] [Insight] Files should not be executable - fix #1 --- DependencyInjection/Compiler/GridPass.php | 0 Grid/AbstractType.php | 0 Grid/Column/BooleanColumn.php | 0 Grid/Column/Column.php | 0 Grid/Exception/ColumnAlreadyExistsException.php | 0 Grid/Exception/ColumnNotFoundException.php | 0 Grid/Exception/InvalidArgumentException.php | 0 Grid/Exception/TypeAlreadyExistsException.php | 0 Grid/Exception/TypeNotFoundException.php | 0 Grid/Exception/UnexpectedTypeException.php | 0 Grid/GridBuilder.php | 0 Grid/GridBuilderInterface.php | 0 Grid/GridConfigBuilder.php | 0 Grid/GridConfigBuilderInterface.php | 0 Grid/GridConfigInterface.php | 0 Grid/GridFactory.php | 0 Grid/GridFactoryInterface.php | 0 Grid/GridRegistry.php | 0 Grid/GridRegistryInterface.php | 0 Grid/GridTypeInterface.php | 0 Grid/Source/Source.php | 0 Grid/Type/GridType.php | 0 Resources/config/grid.yml | 0 Resources/doc/columns_configuration/filters/select_filter.md | 0 24 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 DependencyInjection/Compiler/GridPass.php mode change 100755 => 100644 Grid/AbstractType.php mode change 100755 => 100644 Grid/Column/BooleanColumn.php mode change 100755 => 100644 Grid/Column/Column.php mode change 100755 => 100644 Grid/Exception/ColumnAlreadyExistsException.php mode change 100755 => 100644 Grid/Exception/ColumnNotFoundException.php mode change 100755 => 100644 Grid/Exception/InvalidArgumentException.php mode change 100755 => 100644 Grid/Exception/TypeAlreadyExistsException.php mode change 100755 => 100644 Grid/Exception/TypeNotFoundException.php mode change 100755 => 100644 Grid/Exception/UnexpectedTypeException.php mode change 100755 => 100644 Grid/GridBuilder.php mode change 100755 => 100644 Grid/GridBuilderInterface.php mode change 100755 => 100644 Grid/GridConfigBuilder.php mode change 100755 => 100644 Grid/GridConfigBuilderInterface.php mode change 100755 => 100644 Grid/GridConfigInterface.php mode change 100755 => 100644 Grid/GridFactory.php mode change 100755 => 100644 Grid/GridFactoryInterface.php mode change 100755 => 100644 Grid/GridRegistry.php mode change 100755 => 100644 Grid/GridRegistryInterface.php mode change 100755 => 100644 Grid/GridTypeInterface.php mode change 100755 => 100644 Grid/Source/Source.php mode change 100755 => 100644 Grid/Type/GridType.php mode change 100755 => 100644 Resources/config/grid.yml mode change 100755 => 100644 Resources/doc/columns_configuration/filters/select_filter.md diff --git a/DependencyInjection/Compiler/GridPass.php b/DependencyInjection/Compiler/GridPass.php old mode 100755 new mode 100644 diff --git a/Grid/AbstractType.php b/Grid/AbstractType.php old mode 100755 new mode 100644 diff --git a/Grid/Column/BooleanColumn.php b/Grid/Column/BooleanColumn.php old mode 100755 new mode 100644 diff --git a/Grid/Column/Column.php b/Grid/Column/Column.php old mode 100755 new mode 100644 diff --git a/Grid/Exception/ColumnAlreadyExistsException.php b/Grid/Exception/ColumnAlreadyExistsException.php old mode 100755 new mode 100644 diff --git a/Grid/Exception/ColumnNotFoundException.php b/Grid/Exception/ColumnNotFoundException.php old mode 100755 new mode 100644 diff --git a/Grid/Exception/InvalidArgumentException.php b/Grid/Exception/InvalidArgumentException.php old mode 100755 new mode 100644 diff --git a/Grid/Exception/TypeAlreadyExistsException.php b/Grid/Exception/TypeAlreadyExistsException.php old mode 100755 new mode 100644 diff --git a/Grid/Exception/TypeNotFoundException.php b/Grid/Exception/TypeNotFoundException.php old mode 100755 new mode 100644 diff --git a/Grid/Exception/UnexpectedTypeException.php b/Grid/Exception/UnexpectedTypeException.php old mode 100755 new mode 100644 diff --git a/Grid/GridBuilder.php b/Grid/GridBuilder.php old mode 100755 new mode 100644 diff --git a/Grid/GridBuilderInterface.php b/Grid/GridBuilderInterface.php old mode 100755 new mode 100644 diff --git a/Grid/GridConfigBuilder.php b/Grid/GridConfigBuilder.php old mode 100755 new mode 100644 diff --git a/Grid/GridConfigBuilderInterface.php b/Grid/GridConfigBuilderInterface.php old mode 100755 new mode 100644 diff --git a/Grid/GridConfigInterface.php b/Grid/GridConfigInterface.php old mode 100755 new mode 100644 diff --git a/Grid/GridFactory.php b/Grid/GridFactory.php old mode 100755 new mode 100644 diff --git a/Grid/GridFactoryInterface.php b/Grid/GridFactoryInterface.php old mode 100755 new mode 100644 diff --git a/Grid/GridRegistry.php b/Grid/GridRegistry.php old mode 100755 new mode 100644 diff --git a/Grid/GridRegistryInterface.php b/Grid/GridRegistryInterface.php old mode 100755 new mode 100644 diff --git a/Grid/GridTypeInterface.php b/Grid/GridTypeInterface.php old mode 100755 new mode 100644 diff --git a/Grid/Source/Source.php b/Grid/Source/Source.php old mode 100755 new mode 100644 diff --git a/Grid/Type/GridType.php b/Grid/Type/GridType.php old mode 100755 new mode 100644 diff --git a/Resources/config/grid.yml b/Resources/config/grid.yml old mode 100755 new mode 100644 diff --git a/Resources/doc/columns_configuration/filters/select_filter.md b/Resources/doc/columns_configuration/filters/select_filter.md old mode 100755 new mode 100644 From 20aa2e5904700eeaf8242262ff8cc5df3a2b31f0 Mon Sep 17 00:00:00 2001 From: Ben Younes Ousama Date: Wed, 9 Aug 2017 10:53:31 +0200 Subject: [PATCH 2/3] [Insight] Files should be encoded in UTF-8 - fix #972 --- Resources/doc/columns_configuration/types/boolean_column.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/doc/columns_configuration/types/boolean_column.md b/Resources/doc/columns_configuration/types/boolean_column.md index 6f55bb1f..b0659288 100644 --- a/Resources/doc/columns_configuration/types/boolean_column.md +++ b/Resources/doc/columns_configuration/types/boolean_column.md @@ -15,7 +15,7 @@ See [Select filter - additionnal attributes](../filters/select_filter.md#additio ## Filter ### Valid values -1 and 0 ####### A vérifier pour les entier +1 and 0 ####### A vĂ©rifier pour les entier ### Default Operator: `eq` From f9d33a586ad02463875fcd453a9aa9f35fcc9e1b Mon Sep 17 00:00:00 2001 From: Ben Younes Ousama Date: Wed, 9 Aug 2017 11:55:16 +0200 Subject: [PATCH 3/3] [Insight] Boolean should be compared strictly - fix #973 --- Grid/Column/Column.php | 2 +- Grid/Export/Export.php | 2 +- Grid/Grid.php | 34 +++++++++++++++++----------------- Grid/GridFactory.php | 2 +- Grid/Helper/ORMCountWalker.php | 2 +- Grid/Source/Document.php | 2 +- Grid/Source/Entity.php | 4 ++-- Twig/DataGridExtension.php | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Grid/Column/Column.php b/Grid/Column/Column.php index 53a8d7e2..cd73ebb8 100644 --- a/Grid/Column/Column.php +++ b/Grid/Column/Column.php @@ -294,7 +294,7 @@ public function isVisible($isExported = false) { $visible = $isExported && $this->export !== null ? $this->export : $this->visible; - if ($visible && $this->authorizationChecker !== null && $this->getRole() != null) { + if ($visible && $this->authorizationChecker !== null && $this->getRole() !== null) { return $this->authorizationChecker->isGranted($this->getRole()); } diff --git a/Grid/Export/Export.php b/Grid/Export/Export.php index e732da63..a7b5d521 100644 --- a/Grid/Export/Export.php +++ b/Grid/Export/Export.php @@ -459,7 +459,7 @@ protected function getTemplatesFromString($theme) $templates = []; $template = $this->twig->loadTemplate($theme); - while ($template != null) { + while ($template !== null) { $templates[] = $template; $template = $template->getParent([]); } diff --git a/Grid/Grid.php b/Grid/Grid.php index 23530b4c..39827b3e 100644 --- a/Grid/Grid.php +++ b/Grid/Grid.php @@ -345,12 +345,12 @@ public function initialize() } // Route - if (null != $config->getRoute()) { + if (null !== $config->getRoute()) { $this->setRouteUrl($this->router->generate($config->getRoute(), $routeParameters)); } // Route - if (null != $config->getRoute()) { + if (null !== $config->getRoute()) { $this->setRouteUrl($this->router->generate($config->getRoute(), $routeParameters)); } @@ -371,14 +371,14 @@ public function initialize() // Source $source = $config->getSource(); - if (null != $source) { + if (null !== $source) { $this->source = $source; $source->initialise($this->container); if ($source instanceof Entity) { $groupBy = $config->getGroupBy(); - if (null != $groupBy) { + if (null !== $groupBy) { if (!is_array($groupBy)) { $groupBy = [$groupBy]; } @@ -390,11 +390,11 @@ public function initialize() } // Order - if (null != $config->getSortBy()) { + if (null !== $config->getSortBy()) { $this->setDefaultOrder($config->getSortBy(), $config->getOrder()); } - if (null != $config->getMaxPerPage()) { + if (null !== $config->getMaxPerPage()) { $this->setLimits($config->getMaxPerPage()); } @@ -609,7 +609,7 @@ protected function processMassActions($actionId) if (array_key_exists($actionId, $this->massActions)) { $action = $this->massActions[$actionId]; $actionAllKeys = (boolean) $this->getFromRequest(self::REQUEST_QUERY_MASS_ACTION_ALL_KEYS_SELECTED); - $actionKeys = $actionAllKeys == false ? array_keys((array) $this->getFromRequest(MassActionColumn::ID)) : []; + $actionKeys = $actionAllKeys === false ? array_keys((array) $this->getFromRequest(MassActionColumn::ID)) : []; $this->processSessionData(); if ($actionAllKeys) { @@ -619,7 +619,7 @@ protected function processMassActions($actionId) $this->prepare(); - if ($actionAllKeys == true) { + if ($actionAllKeys === true) { foreach ($this->rows as $row) { $actionKeys[] = $row->getPrimaryFieldValue(); } @@ -697,7 +697,7 @@ protected function processExports($exportId) */ protected function processTweaks($tweakId) { - if ($tweakId != null) { + if ($tweakId !== null) { if (array_key_exists($tweakId, $this->tweaks)) { $tweak = $this->tweaks[$tweakId]; $saveAsActive = false; @@ -804,12 +804,12 @@ protected function processRequestFilters() //if no item is selectd in multi select filter : simulate empty first choice if ($column->getFilterType() == 'select' - && $column->getSelectMulti() == true - && $data == null - && $this->getFromRequest(self::REQUEST_QUERY_PAGE) == null - && $this->getFromRequest(self::REQUEST_QUERY_ORDER) == null - && $this->getFromRequest(self::REQUEST_QUERY_LIMIT) == null - && ($this->getFromRequest(self::REQUEST_QUERY_MASS_ACTION) == null || $this->getFromRequest(self::REQUEST_QUERY_MASS_ACTION) == '-1')) { + && $column->getSelectMulti() === true + && $data === null + && $this->getFromRequest(self::REQUEST_QUERY_PAGE) === null + && $this->getFromRequest(self::REQUEST_QUERY_ORDER) === null + && $this->getFromRequest(self::REQUEST_QUERY_LIMIT) === null + && ($this->getFromRequest(self::REQUEST_QUERY_MASS_ACTION) === null || $this->getFromRequest(self::REQUEST_QUERY_MASS_ACTION) == '-1')) { $data = ['from' => '']; } @@ -1836,7 +1836,7 @@ public function isFiltered() */ public function isTitleSectionVisible() { - if ($this->showTitles == true) { + if ($this->showTitles === true) { foreach ($this->columns as $column) { if ($column->getTitle() != '') { return true; @@ -1852,7 +1852,7 @@ public function isTitleSectionVisible() */ public function isFilterSectionVisible() { - if ($this->showFilters == true) { + if ($this->showFilters === true) { foreach ($this->columns as $column) { if ($column->isFilterable() && $column->getType() != 'massaction' && $column->getType() != 'actions') { return true; diff --git a/Grid/GridFactory.php b/Grid/GridFactory.php index ff692de0..7be18ca2 100644 --- a/Grid/GridFactory.php +++ b/Grid/GridFactory.php @@ -124,7 +124,7 @@ private function resolveOptions(GridTypeInterface $type, Source $source = null, $type->configureOptions($resolver); - if (null != $source && !isset($options['source'])) { + if (null !== $source && !isset($options['source'])) { $options['source'] = $source; } diff --git a/Grid/Helper/ORMCountWalker.php b/Grid/Helper/ORMCountWalker.php index 0b1f1f30..9bfc3a99 100644 --- a/Grid/Helper/ORMCountWalker.php +++ b/Grid/Helper/ORMCountWalker.php @@ -68,7 +68,7 @@ public function walkSelectStatement(SelectStatement $AST) // Remove the variables which are not used by other clauses foreach ($AST->selectClause->selectExpressions as $key => $selectExpression) { - if ($selectExpression->fieldIdentificationVariable == null) { + if ($selectExpression->fieldIdentificationVariable === null) { unset($AST->selectClause->selectExpressions[$key]); } elseif ($selectExpression->expression instanceof PathExpression) { $groupByClause[] = $selectExpression->expression; diff --git a/Grid/Source/Document.php b/Grid/Source/Document.php index cf4f6c34..56020e7a 100644 --- a/Grid/Source/Document.php +++ b/Grid/Source/Document.php @@ -267,7 +267,7 @@ public function execute($columns, $page = 0, $limit = 0, $maxResults = null, $gr $this->addReferencedFields($row, $resource); //call overridden prepareRow or associated closure - if (($modifiedRow = $this->prepareRow($row)) != null) { + if (($modifiedRow = $this->prepareRow($row)) !== null) { $result->addRow($modifiedRow); } } diff --git a/Grid/Source/Entity.php b/Grid/Source/Entity.php index d5a5c252..54700a58 100644 --- a/Grid/Source/Entity.php +++ b/Grid/Source/Entity.php @@ -551,7 +551,7 @@ public function execute($columns, $page = 0, $limit = 0, $maxResults = null, $gr $row->setRepository($repository); //call overridden prepareRow or associated closure - if (($modifiedRow = $this->prepareRow($row)) != null) { + if (($modifiedRow = $this->prepareRow($row)) !== null) { $result->addRow($modifiedRow); } } @@ -582,7 +582,7 @@ public function getTotalCount($maxResults = null) $countQuery->setHint(CountWalker::HINT_DISTINCT, true); } - if ($countQuery->getHint(Query::HINT_CUSTOM_OUTPUT_WALKER) == false) { + if ($countQuery->getHint(Query::HINT_CUSTOM_OUTPUT_WALKER) === false) { $platform = $countQuery->getEntityManager()->getConnection()->getDatabasePlatform(); // law of demeter win $rsm = new ResultSetMapping(); diff --git a/Twig/DataGridExtension.php b/Twig/DataGridExtension.php index f6186287..77f37b1b 100644 --- a/Twig/DataGridExtension.php +++ b/Twig/DataGridExtension.php @@ -452,7 +452,7 @@ protected function getTemplatesFromString(Twig_Environment $environment, $theme) $this->templates = []; $template = $environment->loadTemplate($theme); - while ($template != null) { + while ($template !== null) { $this->templates[] = $template; $template = $template->getParent([]); }