@@ -67,7 +67,7 @@ |
||
67 | 67 | * |
68 | 68 | * @throws \RuntimeException |
69 | 69 | * |
70 | - * @return string |
|
70 | + * @return integer |
|
71 | 71 | */ |
72 | 72 | private function tryToMapPaymentMethodName($paymentMethodName) |
73 | 73 | { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Add a step with given name. |
37 | 37 | * |
38 | 38 | * @param string $name |
39 | - * @param string|StepInterface $step Step alias or instance |
|
39 | + * @param string $step Step alias or instance |
|
40 | 40 | * |
41 | 41 | * @return ProcessBuilderInterface |
42 | 42 | */ |
@@ -46,6 +46,7 @@ discard block |
||
46 | 46 | * Remove step with given name. |
47 | 47 | * |
48 | 48 | * @param string $name |
49 | + * @return void |
|
49 | 50 | */ |
50 | 51 | public function remove($name); |
51 | 52 | |
@@ -62,6 +63,7 @@ discard block |
||
62 | 63 | * Set display route. |
63 | 64 | * |
64 | 65 | * @param string $route |
66 | + * @return ProcessBuilder |
|
65 | 67 | */ |
66 | 68 | public function setDisplayRoute($route); |
67 | 69 | |
@@ -69,6 +71,7 @@ discard block |
||
69 | 71 | * Set additional forward route params. |
70 | 72 | * |
71 | 73 | * @param array $params |
74 | + * @return ProcessBuilder |
|
72 | 75 | */ |
73 | 76 | public function setDisplayRouteParams(array $params); |
74 | 77 | |
@@ -76,6 +79,7 @@ discard block |
||
76 | 79 | * Set forward route. |
77 | 80 | * |
78 | 81 | * @param string $route |
82 | + * @return ProcessBuilder |
|
79 | 83 | */ |
80 | 84 | public function setForwardRoute($route); |
81 | 85 | |
@@ -83,6 +87,7 @@ discard block |
||
83 | 87 | * Set additional forward route params. |
84 | 88 | * |
85 | 89 | * @param array $params |
90 | + * @return ProcessBuilder |
|
86 | 91 | */ |
87 | 92 | public function setForwardRouteParams(array $params); |
88 | 93 | |
@@ -90,6 +95,7 @@ discard block |
||
90 | 95 | * Set redirection route after completion. |
91 | 96 | * |
92 | 97 | * @param string $redirect |
98 | + * @return ProcessBuilder |
|
93 | 99 | */ |
94 | 100 | public function setRedirect($redirect); |
95 | 101 | |
@@ -97,13 +103,15 @@ discard block |
||
97 | 103 | * Set redirection route params. |
98 | 104 | * |
99 | 105 | * @param array $params |
106 | + * @return ProcessBuilder |
|
100 | 107 | */ |
101 | 108 | public function setRedirectParams(array $params); |
102 | 109 | |
103 | 110 | /** |
104 | 111 | * Validation of process, if returns false, process is suspended. |
105 | 112 | * |
106 | - * @param \Closure|ProcessValidatorInterface $validator |
|
113 | + * @param \Prophecy\Argument\Token\AnyValueToken $validator |
|
114 | + * @return ProcessBuilder |
|
107 | 115 | */ |
108 | 116 | public function validate($validator); |
109 | 117 | |
@@ -112,6 +120,7 @@ discard block |
||
112 | 120 | * |
113 | 121 | * @param string $alias |
114 | 122 | * @param StepInterface $step |
123 | + * @return void |
|
115 | 124 | */ |
116 | 125 | public function registerStep($alias, StepInterface $step); |
117 | 126 |
@@ -29,6 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param ProcessInterface $process |
31 | 31 | * @param StepInterface $currentStep |
32 | + * @return ProcessContext |
|
32 | 33 | */ |
33 | 34 | public function initialize(ProcessInterface $process, StepInterface $currentStep); |
34 | 35 | |
@@ -78,11 +79,13 @@ discard block |
||
78 | 79 | * Override the default next step. |
79 | 80 | * |
80 | 81 | * @param string $stepAlias |
82 | + * @return void |
|
81 | 83 | */ |
82 | 84 | public function setNextStepByName($stepAlias); |
83 | 85 | |
84 | 86 | /** |
85 | 87 | * Close context and clear all the data. |
88 | + * @return void |
|
86 | 89 | */ |
87 | 90 | public function close(); |
88 | 91 | |
@@ -104,6 +107,7 @@ discard block |
||
104 | 107 | * Set storage. |
105 | 108 | * |
106 | 109 | * @param StorageInterface $storage |
110 | + * @return void |
|
107 | 111 | */ |
108 | 112 | public function setStorage(StorageInterface $storage); |
109 | 113 | |
@@ -118,6 +122,7 @@ discard block |
||
118 | 122 | * Set current request. |
119 | 123 | * |
120 | 124 | * @param Request $request |
125 | + * @return void |
|
121 | 126 | */ |
122 | 127 | public function setRequest(Request $request); |
123 | 128 | |
@@ -139,6 +144,7 @@ discard block |
||
139 | 144 | * Set a new history of step names. |
140 | 145 | * |
141 | 146 | * @param array $history |
147 | + * @return void |
|
142 | 148 | */ |
143 | 149 | public function setStepHistory(array $history); |
144 | 150 | |
@@ -146,6 +152,7 @@ discard block |
||
146 | 152 | * Add the given name to the history of step names. |
147 | 153 | * |
148 | 154 | * @param string $stepName |
155 | + * @return void |
|
149 | 156 | */ |
150 | 157 | public function addStepToHistory($stepName); |
151 | 158 | |
@@ -153,6 +160,7 @@ discard block |
||
153 | 160 | * Goes back from the end fo the history and deletes all step names until the current one is found. |
154 | 161 | * |
155 | 162 | * @throws NotFoundHttpException If the step name is not found in the history. |
163 | + * @return void |
|
156 | 164 | */ |
157 | 165 | public function rewindHistory(); |
158 | 166 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string $stepName |
43 | 43 | * @param ParameterBag $queryParameters |
44 | 44 | * |
45 | - * @return Response|View |
|
45 | + * @return RedirectResponse |
|
46 | 46 | */ |
47 | 47 | public function display($scenarioAlias, $stepName, ParameterBag $queryParameters = null); |
48 | 48 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param string $scenarioAlias |
54 | 54 | * @param string $stepName |
55 | 55 | * |
56 | - * @return Response|View |
|
56 | + * @return RedirectResponse |
|
57 | 57 | */ |
58 | 58 | public function forward($scenarioAlias, $stepName); |
59 | 59 | |
@@ -62,6 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @param string $alias |
64 | 64 | * @param ProcessScenarioInterface $scenario |
65 | + * @return void |
|
65 | 66 | */ |
66 | 67 | public function registerScenario($alias, ProcessScenarioInterface $scenario); |
67 | 68 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | /** |
84 | 84 | * Set validation. |
85 | 85 | * |
86 | - * @param callable $validation |
|
86 | + * @param \Closure $validation |
|
87 | 87 | * |
88 | 88 | * @return $this |
89 | 89 | */ |
@@ -187,6 +187,7 @@ |
||
187 | 187 | |
188 | 188 | /** |
189 | 189 | * {@inheritdoc} |
190 | + * @param string $field |
|
190 | 191 | */ |
191 | 192 | private function getFieldName($field) |
192 | 193 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->queryBuilder->setParameter($field, $value); |
78 | 78 | |
79 | - return $this->queryBuilder->expr()->eq($this->getFieldName($field), ':'.$field); |
|
79 | + return $this->queryBuilder->expr()->eq($this->getFieldName($field), ':' . $field); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $this->queryBuilder->setParameter($field, $value); |
88 | 88 | |
89 | - return $this->queryBuilder->expr()->neq($this->getFieldName($field), ':'.$field); |
|
89 | + return $this->queryBuilder->expr()->neq($this->getFieldName($field), ':' . $field); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function lessThan($field, $value) |
96 | 96 | { |
97 | - $this->queryBuilder->andWhere($this->getFieldName($field).' < :'.$field)->setParameter($field, $value); |
|
97 | + $this->queryBuilder->andWhere($this->getFieldName($field) . ' < :' . $field)->setParameter($field, $value); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function lessThanOrEqual($field, $value) |
104 | 104 | { |
105 | - $this->queryBuilder->andWhere($this->getFieldName($field).' =< :'.$field)->setParameter($field, $value); |
|
105 | + $this->queryBuilder->andWhere($this->getFieldName($field) . ' =< :' . $field)->setParameter($field, $value); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function greaterThan($field, $value) |
112 | 112 | { |
113 | - $this->queryBuilder->andWhere($this->getFieldName($field).' > :'.$field)->setParameter($field, $value); |
|
113 | + $this->queryBuilder->andWhere($this->getFieldName($field) . ' > :' . $field)->setParameter($field, $value); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function greaterThanOrEqual($field, $value) |
120 | 120 | { |
121 | - $this->queryBuilder->andWhere($this->getFieldName($field).' => :%s'.$field)->setParameter($field, $value); |
|
121 | + $this->queryBuilder->andWhere($this->getFieldName($field) . ' => :%s' . $field)->setParameter($field, $value); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | private function getFieldName($field) |
192 | 192 | { |
193 | 193 | if (false === strpos($field, '.')) { |
194 | - return $this->queryBuilder->getRootAlias().'.'.$field; |
|
194 | + return $this->queryBuilder->getRootAlias() . '.' . $field; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return $field; |
@@ -175,6 +175,9 @@ |
||
175 | 175 | return Driver::QB_SOURCE_ALIAS . '.' . $field; |
176 | 176 | } |
177 | 177 | |
178 | + /** |
|
179 | + * @param string $field |
|
180 | + */ |
|
178 | 181 | private function getInConstraint(AbstractNode $parentNode, $field, array $values) |
179 | 182 | { |
180 | 183 | $orNode = $parentNode->orx(); |
@@ -11,14 +11,13 @@ |
||
11 | 11 | |
12 | 12 | namespace Sylius\Bundle\GridBundle\Doctrine\PHPCRODM; |
13 | 13 | |
14 | -use Sylius\Component\Grid\Data\ExpressionBuilderInterface; |
|
15 | -use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder; |
|
16 | -use Doctrine\Common\Collections\Expr\CompositeExpression; |
|
17 | 14 | use Doctrine\Common\Collections\Expr\Comparison; |
15 | +use Doctrine\Common\Collections\Expr\CompositeExpression; |
|
16 | +use Doctrine\Common\Collections\Expr\Expression; |
|
18 | 17 | use Doctrine\Common\Collections\Expr\Value; |
19 | 18 | use Doctrine\ODM\PHPCR\Query\Builder\AbstractNode; |
20 | 19 | use Doctrine\ODM\PHPCR\Query\Builder\OperandFactory; |
21 | -use Doctrine\Common\Collections\Expr\Expression; |
|
20 | +use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder; |
|
22 | 21 | use Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExtraComparison; |
23 | 22 | |
24 | 23 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function walkCompositeExpression(CompositeExpression $expr, AbstractNode $parentNode) |
107 | 107 | { |
108 | - switch($expr->getType()) { |
|
108 | + switch ($expr->getType()) { |
|
109 | 109 | case CompositeExpression::TYPE_AND: |
110 | 110 | $node = $parentNode->andX(); |
111 | 111 | break; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | |
131 | - switch($expr->getType()) { |
|
131 | + switch ($expr->getType()) { |
|
132 | 132 | case CompositeExpression::TYPE_AND: |
133 | 133 | $parentNode = $parentNode->andX(); |
134 | 134 | break; |
@@ -11,14 +11,13 @@ |
||
11 | 11 | |
12 | 12 | namespace spec\Sylius\Bundle\GridBundle\Doctrine\PHPCRODM; |
13 | 13 | |
14 | -use PhpSpec\ObjectBehavior; |
|
15 | -use Prophecy\Argument; |
|
16 | -use Sylius\Component\Grid\Data\DriverInterface; |
|
17 | -use Sylius\Component\Grid\Parameters; |
|
18 | 14 | use Doctrine\ODM\PHPCR\DocumentManagerInterface; |
19 | 15 | use Doctrine\ODM\PHPCR\DocumentRepository; |
20 | 16 | use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder; |
17 | +use PhpSpec\ObjectBehavior; |
|
21 | 18 | use Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\DataSource; |
19 | +use Sylius\Component\Grid\Data\DriverInterface; |
|
20 | +use Sylius\Component\Grid\Parameters; |
|
22 | 21 | |
23 | 22 | /** |
24 | 23 | * @mixin Driver |
@@ -11,11 +11,10 @@ |
||
11 | 11 | |
12 | 12 | namespace spec\Sylius\Bundle\GridBundle\Doctrine\PHPCRODM; |
13 | 13 | |
14 | -use PhpSpec\ObjectBehavior; |
|
15 | -use Prophecy\Argument; |
|
14 | +use Doctrine\Common\Collections\Expr\Comparison; |
|
16 | 15 | use Doctrine\Common\Collections\ExpressionBuilder as CollectionsExpressionBuilder; |
16 | +use PhpSpec\ObjectBehavior; |
|
17 | 17 | use Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExpressionBuilder; |
18 | -use Doctrine\Common\Collections\Expr\Comparison; |
|
19 | 18 | use Sylius\Bundle\GridBundle\Doctrine\PHPCRODM\ExtraComparison; |
20 | 19 | |
21 | 20 | class ExpressionBuilderSpec extends ObjectBehavior |
@@ -33,8 +33,7 @@ discard block |
||
33 | 33 | function it_builds_andx( |
34 | 34 | Comparison $comparison, |
35 | 35 | CollectionsExpressionBuilder $expressionBuilder |
36 | - ) |
|
37 | - { |
|
36 | + ) { |
|
38 | 37 | $this->andX([$comparison]); |
39 | 38 | $expressionBuilder->andX([$comparison])->shouldHaveBeenCalled(); |
40 | 39 | } |
@@ -42,64 +41,56 @@ discard block |
||
42 | 41 | function it_builds_orx( |
43 | 42 | Comparison $comparison, |
44 | 43 | CollectionsExpressionBuilder $expressionBuilder |
45 | - ) |
|
46 | - { |
|
44 | + ) { |
|
47 | 45 | $this->orX([$comparison]); |
48 | 46 | $expressionBuilder->orX([$comparison])->shouldHaveBeenCalled(); |
49 | 47 | } |
50 | 48 | |
51 | 49 | function it_builds_equals( |
52 | 50 | CollectionsExpressionBuilder $expressionBuilder |
53 | - ) |
|
54 | - { |
|
51 | + ) { |
|
55 | 52 | $this->equals('o.foo', 'value'); |
56 | 53 | $expressionBuilder->eq('o.foo', 'value')->shouldHaveBeenCalled(); |
57 | 54 | } |
58 | 55 | |
59 | 56 | function it_builds_not_equals( |
60 | 57 | CollectionsExpressionBuilder $expressionBuilder |
61 | - ) |
|
62 | - { |
|
58 | + ) { |
|
63 | 59 | $this->notEquals('o.foo', 'value'); |
64 | 60 | $expressionBuilder->neq('o.foo', 'value')->shouldHaveBeenCalled(); |
65 | 61 | } |
66 | 62 | |
67 | 63 | function it_builds_less_than_or_equal( |
68 | 64 | CollectionsExpressionBuilder $expressionBuilder |
69 | - ) |
|
70 | - { |
|
65 | + ) { |
|
71 | 66 | $this->lessThanOrEqual('o.foo', 'value'); |
72 | 67 | $expressionBuilder->lte('o.foo', 'value')->shouldHaveBeenCalled(); |
73 | 68 | } |
74 | 69 | |
75 | 70 | function it_builds_greater_than( |
76 | 71 | CollectionsExpressionBuilder $expressionBuilder |
77 | - ) |
|
78 | - { |
|
72 | + ) { |
|
79 | 73 | $this->greaterThan('o.foo', 'value'); |
80 | 74 | $expressionBuilder->gt('o.foo', 'value')->shouldHaveBeenCalled(); |
81 | 75 | } |
82 | 76 | |
83 | 77 | function it_builds_greater_than_or_equal( |
84 | 78 | CollectionsExpressionBuilder $expressionBuilder |
85 | - ) |
|
86 | - { |
|
79 | + ) { |
|
87 | 80 | $this->greaterThanOrequal('o.foo', 'value'); |
88 | 81 | $expressionBuilder->gte('o.foo', 'value')->shouldHaveBeenCalled(); |
89 | 82 | } |
90 | 83 | |
91 | 84 | function it_builds_in( |
92 | 85 | CollectionsExpressionBuilder $expressionBuilder |
93 | - ) |
|
94 | - { |
|
86 | + ) { |
|
95 | 87 | $this->in('o.foo', ['value']); |
96 | 88 | $expressionBuilder->in('o.foo', ['value'])->shouldHaveBeenCalled(); |
97 | 89 | } |
98 | 90 | |
99 | 91 | function it_builds_not_in( |
100 | 92 | CollectionsExpressionBuilder $expressionBuilder |
101 | - ) |
|
102 | - { |
|
93 | + ) { |
|
103 | 94 | $this->notIn('o.foo', ['value']); |
104 | 95 | $expressionBuilder->notIn('o.foo', ['value'])->shouldHaveBeenCalled(); |
105 | 96 | } |
@@ -120,8 +111,7 @@ discard block |
||
120 | 111 | |
121 | 112 | function it_builds_like( |
122 | 113 | CollectionsExpressionBuilder $expressionBuilder |
123 | - ) |
|
124 | - { |
|
114 | + ) { |
|
125 | 115 | $this->like('o.foo', 'value'); |
126 | 116 | $expressionBuilder->contains('o.foo', 'value')->shouldHaveBeenCalled(); |
127 | 117 | } |