Understanding $variables preprocess_views_view_field() According to this description of hook_preprocess_views_view_field(), $variables contains, among other things, $variables['field'].

However, if I do print_r($variables['field']) just to inspect the object it prints the entire object (to include my username and password!) and even causes the browser to crash. 

I am trying to figure out how to check the field name but it is proving to be strangely non-straightforward.

How can I properly index $variables?
The browser is likely crashing because most of the views objects have circular references in them, and the output can be huge.

$variables['field'] is the field handler object for the field being rendered.  I am 97% sure these are all derived from \Drupal\views\Plugin\views\field\FieldPluginBase() (3% uncertainty because it is the end of the day and I am really tired).

You best bet is to do a debug(get_class($variables['field'])) to get the fully qualified class name, and then typehint in your preprocess, eg:

function MYMODULE_preprocess_views_view_field(&amp;$variables) {
  /** @var \Drupal\views\Plugin\views\field\Boolean $field */
  $field = $variables['field'];
}


and then use your IDE to navigate through what you need to do.

To see what is in $variables, just do a

debug(array_keys($variables));


and go through a similar exercise to get the types; it's just a boring associative array where the keys are all strings.