for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* 2017 Romain CANON <[email protected]>
*
* This file is part of the TYPO3 FormZ project.
* It is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License, either
* version 3 of the License, or any later version.
* For the full copyright and license information, see:
* http://www.gnu.org/licenses/gpl-3.0.html
*/
namespace Romm\Formz\Middleware\Items\FormValidation;
use Romm\Formz\Middleware\Items\OnBeginMiddleware;
use Romm\Formz\Middleware\Signal\SendsMiddlewareSignal;
class FormValidationMiddleware extends OnBeginMiddleware implements SendsMiddlewareSignal
{
/**
* @todo
protected function process()
$formObject = $this->getFormObject();
if ($formObject->hasForm()
&& $formObject->formWasSubmitted()
) {
$validator = new \Romm\Formz\Validation\Validator\Form\DefaultFormValidator(['name' => $this->getFormObject()->getName()]);
$result = $validator->validate($this->getFormObject()->getForm());
$result
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
$myVar = 'Value'; $higher = false; if (rand(1, 6) > 3) { $higher = true; } else { $higher = false; }
Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.
$myVar
$higher
}
* @return string
public function getSignalName()
return FormValidationSignal::class;
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.