Validation and filtering of values with InputFilters of Laminas

Code
<?php

use Laminas\InputFilter\InputFilter;
use 
Laminas\InputFilter\Input;
use 
Laminas\Filter;
use 
Laminas\Validator;

// #### Create FilterChain for Input ####
$filterChain = new Filter\FilterChain();
$filterChain->attach(new Filter\StringTrim(' '));
$filterChain->attach(new Filter\PregReplace([
    
'pattern'     => '/^Net/',
    
'replacement' => 'Framework',
]));

// #### Create ValidatorChain for Input ####
$validatorChain = new Validator\ValidatorChain();
$validatorChain->attach(new Validator\Regex('/Laminas$/'));

// #### Create one Input named laminas_input ####
$input = new Input('laminas_input');
$input->setErrorMessage('Only Laminas is allowed here.');
$input->setFilterChain($filterChain);
$input->setValidatorChain($validatorChain);

// #### Create InputFilter and add Input
$inputfilter = new InputFilter();
$inputfilter->add($input);

// #### Use InputFilter on values ####
$printInputFilter = function (InputFilter $inputfilter) {
    echo 
$inputfilter->getRawValue('laminas_input');
    if (
$inputfilter->isValid()) {
        
dump($inputfilter->getValue('laminas_input'));
    } else {
        
dump($inputfilter->getMessages());
    }
};

$inputfilter->setData([
    
'laminas_input' => ' NetSymfony ',
]);
$printInputFilter($inputfilter);

$inputfilter->setData([
    
'laminas_input' => '  NetLaminas ',
]);
$printInputFilter($inputfilter);
Result
NetSymfony
^ array:1 [
  "laminas_input" => array:1 [
    0 => "Only Laminas is allowed here."
  ]
]
NetLaminas
^ "FrameworkLaminas"
Used Versions
PHP 8.0, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8