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
-------
f16d99ecfa
Php Inspections (EA Ultimate): address some of one-time used local variables
This commit is contained in:
commit
ed63ab6254
@ -54,8 +54,7 @@ class TwigExtractor extends AbstractFileExtractor implements ExtractorInterface
|
|||||||
*/
|
*/
|
||||||
public function extract($resource, MessageCatalogue $catalogue)
|
public function extract($resource, MessageCatalogue $catalogue)
|
||||||
{
|
{
|
||||||
$files = $this->extractFiles($resource);
|
foreach ($this->extractFiles($resource) as $file) {
|
||||||
foreach ($files as $file) {
|
|
||||||
try {
|
try {
|
||||||
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
|
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
|
||||||
} catch (Error $e) {
|
} catch (Error $e) {
|
||||||
|
@ -1039,8 +1039,6 @@ class Crawler extends \SplObjectStorage
|
|||||||
*/
|
*/
|
||||||
private function createSubCrawler($nodes)
|
private function createSubCrawler($nodes)
|
||||||
{
|
{
|
||||||
$crawler = new static($nodes, $this->uri, $this->baseHref);
|
return new static($nodes, $this->uri, $this->baseHref);
|
||||||
|
|
||||||
return $crawler;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,9 +133,7 @@ class LegacyChoiceListAdapter implements ChoiceListInterface
|
|||||||
$this->values = array();
|
$this->values = array();
|
||||||
$this->structuredValues = $this->adaptedList->getValues();
|
$this->structuredValues = $this->adaptedList->getValues();
|
||||||
|
|
||||||
$innerChoices = $this->adaptedList->getChoices();
|
foreach ($this->adaptedList->getChoices() as $index => $choice) {
|
||||||
|
|
||||||
foreach ($innerChoices as $index => $choice) {
|
|
||||||
$value = $this->structuredValues[$index];
|
$value = $this->structuredValues[$index];
|
||||||
$this->values[] = $value;
|
$this->values[] = $value;
|
||||||
$this->choices[$value] = $choice;
|
$this->choices[$value] = $choice;
|
||||||
|
@ -81,6 +81,7 @@ class FormType extends BaseType
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$formConfig = $form->getConfig();
|
||||||
$view->vars = array_replace($view->vars, array(
|
$view->vars = array_replace($view->vars, array(
|
||||||
'read_only' => $readOnly,
|
'read_only' => $readOnly,
|
||||||
'errors' => $form->getErrors(),
|
'errors' => $form->getErrors(),
|
||||||
@ -92,9 +93,9 @@ class FormType extends BaseType
|
|||||||
'pattern' => isset($options['attr']['pattern']) ? $options['attr']['pattern'] : null, // Deprecated
|
'pattern' => isset($options['attr']['pattern']) ? $options['attr']['pattern'] : null, // Deprecated
|
||||||
'size' => null,
|
'size' => null,
|
||||||
'label_attr' => $options['label_attr'],
|
'label_attr' => $options['label_attr'],
|
||||||
'compound' => $form->getConfig()->getCompound(),
|
'compound' => $formConfig->getCompound(),
|
||||||
'method' => $form->getConfig()->getMethod(),
|
'method' => $formConfig->getMethod(),
|
||||||
'action' => $form->getConfig()->getAction(),
|
'action' => $formConfig->getAction(),
|
||||||
'submitted' => $form->isSubmitted(),
|
'submitted' => $form->isSubmitted(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -61,9 +61,7 @@ class ValidationListener implements EventSubscriberInterface
|
|||||||
|
|
||||||
if ($form->isRoot()) {
|
if ($form->isRoot()) {
|
||||||
// Validate the form in group "Default"
|
// Validate the form in group "Default"
|
||||||
$violations = $this->validator->validate($form);
|
foreach ($this->validator->validate($form) as $violation) {
|
||||||
|
|
||||||
foreach ($violations as $violation) {
|
|
||||||
// Allow the "invalid" constraint to be put onto
|
// Allow the "invalid" constraint to be put onto
|
||||||
// non-synchronized forms
|
// non-synchronized forms
|
||||||
// ConstraintViolation::getConstraint() must not expect to provide a constraint as long as Symfony\Component\Validator\ExecutionContext exists (before 3.0)
|
// ConstraintViolation::getConstraint() must not expect to provide a constraint as long as Symfony\Component\Validator\ExecutionContext exists (before 3.0)
|
||||||
|
@ -261,12 +261,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
|||||||
$classMetadata = $this->metadataFactory->getMetadataFor($class);
|
$classMetadata = $this->metadataFactory->getMetadataFor($class);
|
||||||
|
|
||||||
if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) {
|
if ($classMetadata instanceof ClassMetadataInterface && $classMetadata->hasPropertyMetadata($property)) {
|
||||||
$memberMetadatas = $classMetadata->getPropertyMetadata($property);
|
foreach ($classMetadata->getPropertyMetadata($property) as $memberMetadata) {
|
||||||
|
foreach ($memberMetadata->getConstraints() as $constraint) {
|
||||||
foreach ($memberMetadatas as $memberMetadata) {
|
|
||||||
$constraints = $memberMetadata->getConstraints();
|
|
||||||
|
|
||||||
foreach ($constraints as $constraint) {
|
|
||||||
if ($guess = $closure($constraint)) {
|
if ($guess = $closure($constraint)) {
|
||||||
$guesses[] = $guess;
|
$guesses[] = $guess;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user