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 ed63ab6

Browse filesBrowse files
committed
minor #26480 [minor] SCA with Php Inspections (EA Ultimate) (kalessil)
This PR was merged into the 2.7 branch. Discussion ---------- [minor] SCA with Php Inspections (EA Ultimate) | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n.a Addressed some cases with one-time used local variables and repetitive calls. Commits ------- f16d99e Php Inspections (EA Ultimate): address some of one-time used local variables
2 parents c202a37 + f16d99e commit ed63ab6
Copy full SHA for ed63ab6

File tree

6 files changed

+10
-20
lines changed
Filter options

6 files changed

+10
-20
lines changed

‎src/Symfony/Bridge/Twig/Translation/TwigExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Translation/TwigExtractor.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public function __construct(Environment $twig)
5454
*/
5555
public function extract($resource, MessageCatalogue $catalogue)
5656
{
57-
$files = $this->extractFiles($resource);
58-
foreach ($files as $file) {
57+
foreach ($this->extractFiles($resource) as $file) {
5958
try {
6059
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
6160
} catch (Error $e) {

‎src/Symfony/Component/DomCrawler/Crawler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Crawler.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,6 @@ private function findNamespacePrefixes($xpath)
10391039
*/
10401040
private function createSubCrawler($nodes)
10411041
{
1042-
$crawler = new static($nodes, $this->uri, $this->baseHref);
1043-
1044-
return $crawler;
1042+
return new static($nodes, $this->uri, $this->baseHref);
10451043
}
10461044
}

‎src/Symfony/Component/Form/ChoiceList/LegacyChoiceListAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ChoiceList/LegacyChoiceListAdapter.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ private function initialize()
133133
$this->values = array();
134134
$this->structuredValues = $this->adaptedList->getValues();
135135

136-
$innerChoices = $this->adaptedList->getChoices();
137-
138-
foreach ($innerChoices as $index => $choice) {
136+
foreach ($this->adaptedList->getChoices() as $index => $choice) {
139137
$value = $this->structuredValues[$index];
140138
$this->values[] = $value;
141139
$this->choices[$value] = $choice;

‎src/Symfony/Component/Form/Extension/Core/Type/FormType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/FormType.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
8181
}
8282
}
8383

84+
$formConfig = $form->getConfig();
8485
$view->vars = array_replace($view->vars, array(
8586
'read_only' => $readOnly,
8687
'errors' => $form->getErrors(),
@@ -92,9 +93,9 @@ public function buildView(FormView $view, FormInterface $form, array $options)
9293
'pattern' => isset($options['attr']['pattern']) ? $options['attr']['pattern'] : null, // Deprecated
9394
'size' => null,
9495
'label_attr' => $options['label_attr'],
95-
'compound' => $form->getConfig()->getCompound(),
96-
'method' => $form->getConfig()->getMethod(),
97-
'action' => $form->getConfig()->getAction(),
96+
'compound' => $formConfig->getCompound(),
97+
'method' => $formConfig->getMethod(),
98+
'action' => $formConfig->getAction(),
9899
'submitted' => $form->isSubmitted(),
99100
));
100101
}

‎src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public function validateForm(FormEvent $event)
6161

6262
if ($form->isRoot()) {
6363
// Validate the form in group "Default"
64-
$violations = $this->validator->validate($form);
65-
66-
foreach ($violations as $violation) {
64+
foreach ($this->validator->validate($form) as $violation) {
6765
// Allow the "invalid" constraint to be put onto
6866
// non-synchronized forms
6967
// ConstraintViolation::getConstraint() must not expect to provide a constraint as long as Symfony\Component\Validator\ExecutionContext exists (before 3.0)

‎src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,8 @@ protected function guess($class, $property, \Closure $closure, $defaultValue = n
261261
$classMetadata = $this->metadataFactory->getMetadataFor($class);
262262

263263
if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) {
264-
$memberMetadatas = $classMetadata->getPropertyMetadata($property);
265-
266-
foreach ($memberMetadatas as $memberMetadata) {
267-
$constraints = $memberMetadata->getConstraints();
268-
269-
foreach ($constraints as $constraint) {
264+
foreach ($classMetadata->getPropertyMetadata($property) as $memberMetadata) {
265+
foreach ($memberMetadata->getConstraints() as $constraint) {
270266
if ($guess = $closure($constraint)) {
271267
$guesses[] = $guess;
272268
}

0 commit comments

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