Completed
Pull Request — 1.3 (#56)
by David
01:31
created
src/SQLParser/Query/StatementFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
         if (isset($desc['SELECT'])) {
49 49
             $select = new Select();
50 50
 
51
-            $columns = array_map(function ($item) {
51
+            $columns = array_map(function($item) {
52 52
                 return NodeFactory::toObject($item);
53 53
             }, $desc['SELECT']);
54 54
             $columns = NodeFactory::simplify($columns);
Please login to merge, or discard this patch.
src/Mouf/Database/MagicQuery.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
             $sql = $this->getTwigEnvironment()->render($sql, $parameters);
86 86
         }
87 87
 
88
-        $availableParameterKeys = array_keys(array_filter($parameters, static function($param) { return $param !== null;}));
88
+        $availableParameterKeys = array_keys(array_filter($parameters, static function($param) { return $param !== null; }));
89 89
         // We choose md4 because it is fast.
90 90
         $cacheKey = 'request_build_'.hash('md4', $sql.'__'.implode('_/_', $availableParameterKeys));
91 91
         $newSql = $this->cache->fetch($cacheKey);
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -168,7 +168,6 @@
 block discarded – undo
168 168
      * @param NodeInterface $sqlNode
169 169
      * @param array $parameters
170 170
      * @param bool $extrapolateParameters Whether the parameters should be fed into the returned SQL query
171
-
172 171
      * @return string
173 172
      */
174 173
     public function toSql(NodeInterface $sqlNode, array $parameters = array(), bool $extrapolateParameters = true)
Please login to merge, or discard this patch.
src/Mouf/Database/MagicQuery/Twig/SqlTwigEnvironmentFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 
34 34
         /** @var Twig_Extension_Core $twigExtensionCore */
35 35
         $twigExtensionCore = $twig->getExtension('Twig_Extension_Core');
36
-        $twigExtensionCore->setEscaper('sql', function () {
36
+        $twigExtensionCore->setEscaper('sql', function() {
37 37
             throw new ForbiddenTwigParameterInSqlException('You cannot use Twig expressions (like "{{ id }}"). Instead, you should use SQL parameters (like ":id"). Twig integration is limited to Twig statements (like "{% for .... %}"');
38 38
         });
39 39
 
Please login to merge, or discard this patch.
src/SQLParser/Node/In.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 
34 34
         if ($parameterNode !== null) {
35 35
             if (!isset($parameters[$parameterNode->getName()])) {
36
-                throw new MagicQueryException("Missing parameter '" . $parameterNode->getName() . "' for 'IN' operand.");
36
+                throw new MagicQueryException("Missing parameter '".$parameterNode->getName()."' for 'IN' operand.");
37 37
             }
38 38
             if ($parameters[$parameterNode->getName()] === []) {
39 39
                 return "FALSE";
Please login to merge, or discard this patch.
src/SQLParser/Node/NodeFactory.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Doctrine\DBAL\Platforms\AbstractPlatform;
5 5
 use Mouf\Database\MagicQueryException;
6
-use Mouf\Database\MagicQueryParserException;
7 6
 use SQLParser\SqlRenderInterface;
8 7
 use Mouf\MoufManager;
9 8
 use Mouf\MoufInstanceDescriptor;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
             array('NOT'),
507 507
             array('&&', 'AND'),
508 508
             array('XOR'),
509
-            array('||', 'OR'), );
509
+            array('||', 'OR'),);
510 510
 
511 511
     private static $OPERATOR_TO_CLASS = array(
512 512
             '=' => 'SQLParser\Node\Equal',
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
      */
814 814
     public static function nodeToInstanceDescriptor($node, MoufManager $moufManager)
815 815
     {
816
-        return self::array_map_deep($node, function ($item) use ($moufManager) {
816
+        return self::array_map_deep($node, function($item) use ($moufManager) {
817 817
             if ($item instanceof NodeInterface) {
818 818
                 return $item->toInstanceDescriptor($moufManager);
819 819
             } else {
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
     {
858 858
         if (is_array($nodes)) {
859 859
             $elems = array();
860
-            array_walk_recursive($nodes, function ($item) use (&$elems, $platform, $indent, $parameters, $conditionsMode, $extrapolateParameters) {
860
+            array_walk_recursive($nodes, function($item) use (&$elems, $platform, $indent, $parameters, $conditionsMode, $extrapolateParameters) {
861 861
                 if ($item instanceof SqlRenderInterface) {
862 862
                     $itemSql = $item->toSql($parameters, $platform, $indent, $conditionsMode, $extrapolateParameters);
863 863
                     if ($itemSql !== null) {
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -822,6 +822,9 @@
 block discarded – undo
822 822
         });
823 823
     }
824 824
 
825
+    /**
826
+     * @param \Closure $callback
827
+     */
825 828
     private static function array_map_deep($array, $callback)
826 829
     {
827 830
         $new = array();
Please login to merge, or discard this patch.
src/SQLParser/Query/Select.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
  */
33 33
 namespace SQLParser\Query;
34 34
 
35
-use Doctrine\DBAL\Connection;
36 35
 use Doctrine\DBAL\Platforms\AbstractPlatform;
37 36
 use Mouf\MoufInstanceDescriptor;
38 37
 use SQLParser\Node\NodeFactory;
Please login to merge, or discard this patch.
src/SQLParser/Query/Union.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace SQLParser\Query;
4 4
 
5
-use Doctrine\DBAL\Connection;
6 5
 use Doctrine\DBAL\Platforms\AbstractPlatform;
7 6
 use Mouf\MoufInstanceDescriptor;
8 7
 use SQLParser\Node\NodeFactory;
Please login to merge, or discard this patch.
src/SQLParser/Node/Parameter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@
 block discarded – undo
166 166
             if ($parameters[$this->name] === null) {
167 167
                 return 'null';
168 168
             } elseif (is_array($parameters[$this->name])) {
169
-                return implode(',', array_map(function ($item) use ($platform) {
169
+                return implode(',', array_map(function($item) use ($platform) {
170 170
                         return $platform->quoteStringLiteral($this->autoPrepend.$item.$this->autoAppend);
171 171
                     }, $parameters[$this->name]));
172 172
             } else {
Please login to merge, or discard this patch.