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

docs: fix PHPDocs for View #8848

Merged
merged 3 commits into from
May 24, 2024
Merged

Conversation

ddevsr
Copy link
Collaborator

@ddevsr ddevsr commented May 2, 2024

Description
See #8732

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@ddevsr ddevsr added the documentation Pull requests for documentation only label May 2, 2024
@ddevsr ddevsr force-pushed the fix-phpdocs-view branch from 77c18e5 to b4d8422 Compare May 3, 2024 01:09
@ddevsr ddevsr marked this pull request as ready for review May 3, 2024 01:12
system/View/View.php Outdated Show resolved Hide resolved
system/View/View.php Outdated Show resolved Hide resolved
*/
public $rows = [];

/**
* Data for table heading
*
* @var array
* @var array<int, mixed>
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible that the element value is not a string?

*/
public $heading = [];

/**
* Data for table footing
*
* @var array
* @var array<int, mixed>
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible that the element value is not a string?

@@ -297,7 +300,7 @@ public function setCaption($caption)
/**
* Generate the table
*
* @param array|BaseResult|null $tableData
* @param array<int, mixed>|BaseResult|null $tableData
Copy link
Member

Choose a reason for hiding this comment

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

Like this?

Suggested change
* @param array<int, mixed>|BaseResult|null $tableData
* @param BaseResult|list<array<int|string, float|int|string>>|null $tableData

var_export($tableData, true):

DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    0 => 'Name',
    1 => 'Color',
    2 => 'Size',
  ),
  1 => 
  array (
    0 => 'Fred',
    1 => 'Blue',
    2 => 'Small',
  ),
  2 => 
  array (
    0 => 
    array (
      'data' => 'Mary',
      'class' => 'cssMary',
    ),
    1 => 
    array (
      'data' => 'Red',
      'class' => 'cssRed',
    ),
    2 => 
    array (
      'data' => 'Large',
      'class' => 'cssLarge',
    ),
  ),
  3 => 
  array (
    0 => 'John',
    1 => 'Green',
    2 => 'Medium',
  ),
)
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    0 => 'Name',
    1 => 'Color',
    2 => 'Size',
  ),
  1 => 
  array (
    0 => 'Fred',
    1 => 'Blue',
    2 => 'Small',
  ),
  2 => 
  array (
    0 => 'Mary',
    1 => 'Red',
    2 => NULL,
  ),
  3 => 
  array (
    0 => 'John',
    1 => 'Green',
    2 => 'Medium',
  ),
)
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    0 => 'Name',
    1 => 'Color',
    2 => 'Size',
  ),
  1 => 
  array (
    0 => 'Fred',
    1 => 'Blue',
    2 => 'Small',
  ),
  2 => 
  array (
    0 => 'Mary',
    1 => 'Red',
    2 => 'Large',
  ),
  3 => 
  array (
    0 => 'John',
    1 => 'Green',
    2 => 'Medium',
  ),
)
DEBUG - 2024-05-06 01:06:12 --> CodeIgniter\View\DBResultDummy::__set_state(array(
   'connID' => NULL,
   'resultID' => NULL,
   'resultArray' => 
  array (
  ),
   'resultObject' => 
  array (
  ),
   'customResultObject' => 
  array (
  ),
   'currentRow' => 0,
   'numRows' => NULL,
   'rowData' => NULL,
))
DEBUG - 2024-05-06 01:06:12 --> array (
)
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> NULL
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    'name' => 'Max',
    'age' => 30,
    'id' => 5,
  ),
)
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    'name' => 'Fred',
    'age' => 30,
    'id' => 5,
  ),
)
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    'name' => 'Fred',
    'age' => 30,
    'id' => 5,
  ),
)
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    'name' => 'Fred',
    'id' => 5,
  ),
)
DEBUG - 2024-05-06 01:06:12 --> array (
  0 => 
  array (
    'id' => 1,
    'id_cliente' => 1,
    'codigo' => 'codigo1',
    'data' => '2023-10-16 21:53:25',
    'tipo_desconto' => 'NENHUM',
    'valor_desconto' => '',
    'created_at' => '2023-10-16 21:53:25',
    'updated_at' => '2023-10-16 21:53:25',
    'deleted_at' => '',
  ),
  1 => 
  array (
    'id' => 2,
    'id_cliente' => 2,
    'codigo' => 'codigo2',
    'data' => '2023-10-16 21:53:25',
    'tipo_desconto' => 'REAL',
    'valor_desconto' => 10.0,
    'created_at' => '2023-10-16 21:53:25',
    'updated_at' => '2023-10-16 21:53:25',
    'deleted_at' => '',
  ),
  2 => 
  array (
    'id' => 3,
    'id_cliente' => 3,
    'codigo' => 'codigo3',
    'data' => '2023-10-16 21:53:25',
    'tipo_desconto' => 'PERCENTUAL',
    'valor_desconto' => 10.0,
    'created_at' => '2023-10-16 21:53:25',
    'updated_at' => '2023-10-16 21:53:25',
    'deleted_at' => '',
  ),
)

*
* @return array|false
* @return array<int, mixed>|false
Copy link
Member

@kenjis kenjis May 6, 2024

Choose a reason for hiding this comment

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

Like this?

Suggested change
* @return array<int, mixed>|false
* @return false|list<list<string>>|list<string>

@ddevsr ddevsr force-pushed the fix-phpdocs-view branch from b4d8422 to 93267da Compare May 22, 2024 08:19
Copy link
Member

@kenjis kenjis left a comment

Choose a reason for hiding this comment

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

Frankly, I am not sure of the exact type of the Table class.
However, I think this PR is not wrong, so I will merge it.

@kenjis kenjis merged commit 4e0719b into codeigniter4:develop May 24, 2024
40 checks passed
@ddevsr ddevsr deleted the fix-phpdocs-view branch May 24, 2024 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests for documentation only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants