Skip to content
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

Closed
wants to merge 3 commits into from
Closed

fix. HTMLhelper ul and ol attributes type #2488

wants to merge 3 commits into from

Conversation

nyufeng
Copy link
Contributor

@nyufeng nyufeng commented Jan 14, 2020

fix .#2473
in userguide. attributes type is array. but in code type is string.

@nyufeng nyufeng closed this Jan 14, 2020
@nyufeng nyufeng reopened this Jan 14, 2020
@najdanovicivan
Copy link
Contributor

najdanovicivan commented Jan 17, 2020

I was just to submit PR for the same issue

stringify_attributes() method which process attributes accepts mixed input

@param mixed   $attributes string, array, object

So the most logical thing will be to make list attributes mixed as well

@lonnieezell what's your input on this one ?

Copy link
Contributor

@najdanovicivan najdanovicivan left a 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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants