-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix. HTMLhelper ul and ol attributes type #2488
Conversation
I was just to submit PR for the same issue stringify_attributes() method which process attributes accepts mixed input
So the most logical thing will be to make list attributes mixed as well @lonnieezell what's your input on this one ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the unit tests. Current tests should not be modified. With your current changes the original test fill fail and the methods will still not work as they are supposed to.
Instead 4 additional tests should be created which call ul and ol methods with array and object type attributes value. That way we can be sure that all cases work properly.
@@ -52,10 +52,10 @@ | |||
* multi-dimensional array. | |||
* | |||
* @param array $list | |||
* @param string $attributes HTML attributes | |||
* @param array $attributes HTML attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param mixed $attributes string, array, object HTML attributes
@@ -71,10 +71,10 @@ function ul(array $list, string $attributes = ''): string | |||
* Generates an HTML ordered list from an single or multi-dimensional array. | |||
* | |||
* @param array $list | |||
* @param string $attributes HTML attributes | |||
* @param array $attributes HTML attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param mixed $attributes string, array, object HTML attributes
* @return string | ||
*/ | ||
function ol(array $list, string $attributes = ''): string | ||
function ol(array $list, array $attributes = []): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function ol(array $list, $attributes = ''): string
* @return string | ||
*/ | ||
function ul(array $list, string $attributes = ''): string | ||
function ul(array $list, array $attributes = []): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function ul(array $list, $attributes = ''): string
@@ -91,11 +91,11 @@ function ol(array $list, string $attributes = ''): string | |||
* | |||
* @param string $type | |||
* @param mixed $list | |||
* @param string $attributes | |||
* @param array $attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param mixed $attributes string, array, object HTML attributes
* @param integer $depth | ||
* @return string | ||
*/ | ||
function _list(string $type = 'ul', $list = [], string $attributes = '', int $depth = 0): string | ||
function _list(string $type = 'ul', $list = [], array $attributes = [], int $depth = 0): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function _list(string $type = 'ul', $list = [], $attributes = [], int $depth = 0): string
@@ -120,7 +120,7 @@ function _list(string $type = 'ul', $list = [], string $attributes = '', int $de | |||
{ | |||
$out .= $_last_list_item | |||
. "\n" | |||
. _list($type, $val, '', $depth + 4) | |||
. _list($type, $val, [], $depth + 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed change
fix .#2473
in userguide. attributes type is array. but in code type is string.