Fix PHP warnings + update ecs

pull/3844/head
Julio Montoya 4 years ago
parent 8d1f02765d
commit a1e43341b5
  1. 8
      ecs.php
  2. 6
      public/main/inc/lib/pear/HTML/QuickForm.php
  3. 15
      public/main/inc/lib/pear/HTML/QuickForm/date.php
  4. 4
      public/main/inc/lib/pear/HTML/QuickForm/group.php
  5. 2
      public/main/inc/lib/thematic.lib.php

@ -49,7 +49,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$services->set(\PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer::class); $services->set(\PhpCsFixer\Fixer\ReturnNotation\NoUselessReturnFixer::class);
$services->set(\PhpCsFixer\Fixer\CastNotation\ModernizeTypesCastingFixer::class); $services->set(\PhpCsFixer\Fixer\CastNotation\ModernizeTypesCastingFixer::class);
$services->set(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class); $services->set(\PhpCsFixer\Fixer\Casing\ConstantCaseFixer::class);
//$services->set(\PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer::class);
$services->set(\PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class); $services->set(\PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class);
$services->set(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class) $services->set(\PhpCsFixer\Fixer\Operator\ConcatSpaceFixer::class)
->call( ->call(
@ -76,12 +76,15 @@ return static function (ContainerConfigurator $containerConfigurator): void {
Option::PATHS, Option::PATHS,
[ [
__DIR__.'/src', __DIR__.'/src',
//__DIR__.'/public/main/admin',
] ]
); );
$parameters->set( $parameters->set(
Option::SKIP, Option::SKIP,
[ [
__DIR__.'/public/main/admin/db.php',
__DIR__.'/src/CoreBundle/Hook/*', __DIR__.'/src/CoreBundle/Hook/*',
__DIR__.'/src/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php', __DIR__.'/src/CoreBundle/Component/HTMLPurifier/Filter/AllowIframes.php',
__DIR__.'/src/CoreBundle/Traits/*', __DIR__.'/src/CoreBundle/Traits/*',
@ -94,8 +97,11 @@ return static function (ContainerConfigurator $containerConfigurator): void {
\PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationArrayAssignmentFixer::class, \PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationArrayAssignmentFixer::class,
\PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer::class, \PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer::class,
\PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer::class, \PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer::class,
//\PhpCsFixer\Fixer\Phpdoc\PhpdocOrderFixer::class,
PhpCsFixer\Fixer\Phpdoc\PhpdocTypesOrderFixer::class,
//UnusedVariableSniff::class . '.ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach' => true, //UnusedVariableSniff::class . '.ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach' => true,
//UnusedVariableSniff::class => 'ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach', //UnusedVariableSniff::class => 'ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach',
] ]
); );
}; };

@ -965,7 +965,7 @@ class HTML_QuickForm extends HTML_Common
* @access public * @access public
* @return void * @return void
*/ */
public function updateElementAttr($elements, $attrs) /*public function updateElementAttr($elements, $attrs)
{ {
if (is_string($elements)) { if (is_string($elements)) {
$elements = split('[ ]?,[ ]?', $elements); $elements = split('[ ]?,[ ]?', $elements);
@ -982,7 +982,7 @@ class HTML_QuickForm extends HTML_Common
} }
} }
} }
} }*/
/** /**
* Removes an element * Removes an element
@ -1517,7 +1517,7 @@ class HTML_QuickForm extends HTML_Common
); );
} }
if (!$result || (!empty($rule['howmany']) && $rule['howmany'] > (int)$result)) { if (!$result || (!empty($rule['howmany']) && $rule['howmany'] > (int) $result)) {
if (isset($rule['group'])) { if (isset($rule['group'])) {
$this->_errors[$rule['group']] = $rule['message']; $this->_errors[$rule['group']] = $rule['message'];
} else { } else {

@ -35,15 +35,13 @@
*/ */
class HTML_QuickForm_date extends HTML_QuickForm_group class HTML_QuickForm_date extends HTML_QuickForm_group
{ {
// {{{ properties /**
/**
* Various options to control the element's display. * Various options to control the element's display.
* *
* @access private * @access private
* @var array * @var array
*/ */
var $_options = array( public $_options = array(
'language' => 'en', 'language' => 'en',
'format' => 'dMY', 'format' => 'dMY',
'minYear' => 2001, 'minYear' => 2001,
@ -59,7 +57,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
* @access private * @access private
* @var array * @var array
*/ */
var $_wrap = array('', ''); public $_wrap = array('', '');
/** /**
* Options in different languages * Options in different languages
@ -70,7 +68,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
* @access private * @access private
* @var array * @var array
*/ */
var $_locale = array( public $_locale = array(
'en' => array ( 'en' => array (
'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'), 'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'),
'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), 'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
@ -229,9 +227,6 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
) )
); );
// }}}
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -459,7 +454,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
$value = strtotime($value); $value = strtotime($value);
} }
// might be a unix epoch, then we fill all possible values // might be a unix epoch, then we fill all possible values
$arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value)); $arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int) $value));
$value = array( $value = array(
'D' => $arr[0], 'D' => $arr[0],
'l' => $arr[0], 'l' => $arr[0],

@ -55,7 +55,7 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
* *
* @since 1.0 * @since 1.0
*/ */
private $_elements = []; protected $_elements = [];
/** /**
* String to separate elements. * String to separate elements.
@ -82,7 +82,7 @@ class HTML_QuickForm_group extends HTML_QuickForm_element
* *
* @since 3.0 * @since 3.0
*/ */
private $_appendName = true; protected $_appendName = true;
/** /**
* Class constructor. * Class constructor.

@ -708,7 +708,7 @@ class Thematic
->setTitle($title) ->setTitle($title)
->setDescription($description) ->setDescription($description)
->setThematic($thematic) ->setThematic($thematic)
->setDescriptionType((int) $description_type) ->setDescriptionType($description_type)
//->setParent($course) //->setParent($course)
//->addCourseLink($course, api_get_session_entity()) //->addCourseLink($course, api_get_session_entity())
; ;

Loading…
Cancel
Save