Skip to content

Bug: [ViewCells] private properties do not work with Computed Properties #7459

Closed
@kenjis

Description

@kenjis

PHP Version

8.1

CodeIgniter4 Version

4.3.3 and develop fe7e2e4

CodeIgniter4 Installation Method

Git

Which operating systems have you tested for this bug?

macOS

Which server did you use?

apache

Database

No response

What happened?

See #7457 (comment)

Cannot access private property App\Cells\AlertMessageCell::$type
in SYSTEMPATH/Traits/PropertiesTrait.php on line 35.
 1 SYSTEMPATH/View/Cell.php(214): CodeIgniter\View\Cells\Cell->fill([...])
 2 SYSTEMPATH/View/Cell.php(99): CodeIgniter\View\Cell->renderCell(Object(App\Cells\AlertMessageCell), 'render', [...])
 3 SYSTEMPATH/Common.php(1200): CodeIgniter\View\Cell->render('AlertMessageCell', [...], 0, 'AppCellsAlertMessageCellrender3ab314af93d2044b8409e6348dd9ff46')

Steps to Reproduce

--- a/tests/_support/View/Cells/ListerCell.php
+++ b/tests/_support/View/Cells/ListerCell.php
@@ -15,7 +15,7 @@ use CodeIgniter\View\Cells\Cell;
 
 class ListerCell extends Cell
 {
-    protected array $items = [];
+    private array $items = [];
 
     public function getItemsProperty()
     {

Expected Output

No error.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions