Help me filtrate zero values that come from vies

$this->categories - here are categories values
I need to remade this code into the rules array, or in-core method

    $this->categories = array_flip($this->categories);
    $this->categories = array_flip($this->categories);

How to do this?

Read this section in the guide, filter validator

$this->categories in my case is an array, and all the variants in Filter that i can see is for the string

There is each validator but in your case you need a custom validation method.

Thanks, will try