Commit f314a72d authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

view helper render : return string obligatoire

*sort doit retourner un int et non un bool
parent cb3947d5
Pipeline #12066 failed with stages
in 39 seconds
......@@ -15,7 +15,7 @@ class Form extends ZVHForm {
* @param FormInterface $form
* @return string
*/
public function render(FormInterface $form)
public function render(FormInterface $form): string
{
if (method_exists($form, 'prepare')) {
$form->prepare();
......
......@@ -80,7 +80,7 @@ class FormAdvancedMultiCheckbox extends FormMultiCheckbox
* @throws Exception\DomainException
* @return string
*/
public function render(ElementInterface $element)
public function render(ElementInterface $element): string
{
$template = '
<div class="form-advanced-multi-checkbox input-sm form-control" style="height:auto">
......
......@@ -91,7 +91,7 @@ class FormControlGroup extends AbstractHelper
*
* @return string
*/
public function render(ElementInterface $element, $pluginClass = 'formElement')
public function render(ElementInterface $element, $pluginClass = 'formElement'): string
{
$this->normalizeElement($element);
$this->customFromOptions($element);
......
......@@ -81,7 +81,7 @@ class FormDate extends \Laminas\Form\View\Helper\AbstractHelper
* @param Date $element
* @return string
*/
public function render(Date $element)
public function render(Date $element): string
{
$this->element = $element;
......
......@@ -117,7 +117,7 @@ class FormDateInfSup extends \Laminas\Form\View\Helper\AbstractHelper
* @param DateInfSup $element
* @return string
*/
public function render(DateInfSup $element)
public function render(DateInfSup $element): string
{
$this->element = $element;
......
......@@ -32,7 +32,7 @@ class FormDateTime extends \Laminas\Form\View\Helper\FormDateTime
* @throws Exception\DomainException
* @return string
*/
public function render(ElementInterface $element)
public function render(ElementInterface $element): string
{
$this->setElement($element);
......
......@@ -37,7 +37,7 @@ class FormErrors extends AbstractHelper
* @param \Laminas\Form\Form $form
* @return string Code HTML
*/
public function render(\Laminas\Form\Form $form)
public function render(\Laminas\Form\Form $form): string
{
if (!$form->getMessages()) {
return '';
......
......@@ -32,7 +32,7 @@ class FormRowDateInfSup extends FormRow
* @param null|string $labelPosition
* @return string
*/
public function render(ElementInterface $element, $labelPosition = null)
public function render(ElementInterface $element, $labelPosition = null): string
{
if (!$element instanceof DateInfSup) {
throw new \Laminas\Form\Exception\InvalidArgumentException("Cette aide de vue ne prend en charge que les élément de type 'DateInfSup'.");
......
......@@ -52,7 +52,7 @@ class FormSearchAndSelect extends FormText
/**
* {@inheritdoc}
*/
public function render(ElementInterface $element)
public function render(ElementInterface $element): string
{
if (!$element instanceof SearchAndSelect) {
throw new InvalidElementException("L'élément spécifié n'est pas du type attendu.");
......
......@@ -80,7 +80,7 @@ class MultipageFormFieldset extends AbstractHelper
*
* @return string
*/
public function render()
public function render(): string
{
return
$this->renderTitle() . PHP_EOL . PHP_EOL .
......
......@@ -81,7 +81,7 @@ class MultipageFormRecap extends AbstractHelper
*
* @return string
*/
public function render()
public function render(): string
{
$data = [];
foreach($this->form->getFieldsets() as $fieldset) { /* @var Fieldset $fieldset */
......
......@@ -49,7 +49,7 @@ class MultipageFormRow extends FormRow
* @param null|string $labelPosition
* @return string
*/
public function render(ElementInterface $element, $labelPosition = null)
public function render(ElementInterface $element, $labelPosition = null): string
{
if ($element instanceof MultipageFormNavFieldset) {
return $this->view->multipageFormNav($element);
......
......@@ -514,9 +514,10 @@ class Util
$show_header = !empty($data) || !empty($header);
if (empty($header)) {
if (empty($data)) {
return '';
}
$show_header = false;
reset($data);
$line = current($data);
if (!empty($line)) {
reset($line);
$first = current($line);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment