Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b5aaf53

Browse filesBrowse files
author
Andreas Hucks
committed
added fluent interface to validatorbuilder
1 parent 2cf3cb5 commit b5aaf53
Copy full SHA for b5aaf53

File tree

Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed

‎src/Symfony/Component/Validator/ValidatorBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/ValidatorBuilder.php
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class ValidatorBuilder implements ValidatorBuilderInterface
8181
public function addObjectInitializer(ObjectInitializerInterface $initializer)
8282
{
8383
$this->initializers[] = $initializer;
84+
85+
return $this;
8486
}
8587

8688
/**
@@ -89,6 +91,8 @@ public function addObjectInitializer(ObjectInitializerInterface $initializer)
8991
public function addObjectInitializers(array $initializers)
9092
{
9193
$this->initializers = array_merge($this->initializers, $initializers);
94+
95+
return $this;
9296
}
9397

9498
/**
@@ -101,6 +105,8 @@ public function addXmlMapping($path)
101105
}
102106

103107
$this->xmlMappings[] = $path;
108+
109+
return $this;
104110
}
105111

106112
/**
@@ -113,6 +119,8 @@ public function addXmlMappings(array $paths)
113119
}
114120

115121
$this->xmlMappings = array_merge($this->xmlMappings, $paths);
122+
123+
return $this;
116124
}
117125

118126
/**
@@ -125,6 +133,8 @@ public function addYamlMapping($path)
125133
}
126134

127135
$this->yamlMappings[] = $path;
136+
137+
return $this;
128138
}
129139

130140
/**
@@ -137,6 +147,8 @@ public function addYamlMappings(array $paths)
137147
}
138148

139149
$this->yamlMappings = array_merge($this->yamlMappings, $paths);
150+
151+
return $this;
140152
}
141153

142154
/**
@@ -149,6 +161,8 @@ public function addMethodMapping($methodName)
149161
}
150162

151163
$this->methodMappings[] = $methodName;
164+
165+
return $this;
152166
}
153167

154168
/**
@@ -161,6 +175,8 @@ public function addMethodMappings(array $methodNames)
161175
}
162176

163177
$this->methodMappings = array_merge($this->methodMappings, $methodNames);
178+
179+
return $this;
164180
}
165181

166182
/**
@@ -181,6 +197,8 @@ public function enableAnnotationMapping(Reader $annotationReader = null)
181197
}
182198

183199
$this->annotationReader = $annotationReader;
200+
201+
return $this;
184202
}
185203

186204
/**
@@ -189,6 +207,8 @@ public function enableAnnotationMapping(Reader $annotationReader = null)
189207
public function disableAnnotationMapping()
190208
{
191209
$this->annotationReader = null;
210+
211+
return $this;
192212
}
193213

194214
/**
@@ -201,6 +221,8 @@ public function setMetadataFactory(ClassMetadataFactoryInterface $metadataFactor
201221
}
202222

203223
$this->metadataFactory = $metadataFactory;
224+
225+
return $this;
204226
}
205227

206228
/**
@@ -213,6 +235,8 @@ public function setMetadataCache(CacheInterface $cache)
213235
}
214236

215237
$this->metadataCache = $cache;
238+
239+
return $this;
216240
}
217241

218242
/**
@@ -221,6 +245,8 @@ public function setMetadataCache(CacheInterface $cache)
221245
public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $validatorFactory)
222246
{
223247
$this->validatorFactory = $validatorFactory;
248+
249+
return $this;
224250
}
225251

226252
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.