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);
    unset($this->categories[0]);
    $this->categories = array_flip($this->categories);

How to do this?

Read this section in the guide, filter validator
https://www.yiiframework.com/doc/guide/2.0/en/tutorial-core-validators#filter

$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