count(): Argument #1 ($value) must be of type Countable|array, null given 📋

TypeError
Toggle Vendor Stack Frames
        
        $data $this->Cities->getFullCity(['Cities.slug' => $alias'Cities.visibility' => 'public']);
        $cities = array();        
        for ($i 0$i count($data['city_states']); $i++) {
            $cities[] = $data['city_states'][$i]['state_id'];
        }
        $counsellor = array(110);
Error in: ROOT/src/Controller/CitiesController.php, line 181

If you want to customize this error message, create templates/Error/error500.php