Permalink
Browse files

API CHANGE Removed $maxlength constructor argument from PasswordField…

…, use setMaxlength() instead
  • Loading branch information...
1 parent 27ec98c commit 3c5c04cd755e6a856a8aa61d8c573f966cdabd99 @chillu chillu committed Jan 2, 2012
Showing with 3 additions and 10 deletions.
  1. +3 −10 forms/PasswordField.php
View
@@ -6,20 +6,13 @@
*/
class PasswordField extends TextField {
- /**
- * maxlength of the password field
- *
- * @var int
- */
- protected $maxLength;
-
-
/**
* Returns an input field, class="text" and type="text" with an optional
* maxlength
*/
- function __construct($name, $title = null, $value = "", $maxLength = null) {
- $this->maxLength = $maxLength;
+ function __construct($name, $title = null, $value = "") {
+ if(count(func_get_args()) > 3) Deprecation::notice('3.0', 'Use setMaxLength() instead of constructor arguments');
+
parent::__construct($name, $title, $value);
}

3 comments on commit 3c5c04c

Contributor

tractorcow replied Jun 14, 2013

@chillu Is there a reason we can't put $maxLength as the 4th parameter to parent::__construct()? PasswordField didn't originally extend TextField, so it probably should have been changed to do that back in a6148c3

Owner

chillu replied Jun 14, 2013

maxLength is just one of many optional properties on a field, it just happened to be the first one somebody felt to put on the TextField constructor. There no need for it to be there (object initial state doesn't rely on it), and now we have a much more expressive way to write it with the fluent API. So I'd rather gradually remove those extra constructor args than re-add them.

Contributor

willmorgan replied Jun 14, 2013

Furthermore, it makes no sense to have a maxlength on a password anyway.

Please sign in to comment.