private function getter(FunctionModel $function, TraitModelInterface $parent): bool
    {
        // Check if function name matches
        preg_match('/^get(.+)$/', $function->getName(), $matches);

        if (Validator::arrayType()->length(2, 2)->validate($matches)) {
            // Check if property exists
            $property = lcfirst($matches[1]);
            if ($parent->hasAttribute($property, $function->isStatic())) {
                $annotation = new GetAnnotation();
                $annotation->setName('@PhpUnitGen\\getter');
                $function->addAnnotation($annotation);
                $annotation->setParentNode($function);
                $annotation->compile();

                return true;
            }
        }

        return false;
    }
private function getter(FunctionModel $function, TraitModelInterface $parent): bool
    {
        // Check if function name matches
        preg_match('/^get(.+)$/', $function->getName(), $matches);

        if (Validator::arrayType()->length(2, 2)->validate($matches)) {
            // Check if property exists
            $property = lcfirst($matches[1]);
            if ($parent->hasAttribute($property, $function->isStatic())) {
                $annotation = new GetAnnotation();
                $annotation->setName('@PhpUnitGen\\getter');
                $function->addAnnotation($annotation);
                $annotation->setParentNode($function);
                $annotation->compile();

                return true;
            }
        }

        return false;
    }
private function getter ( FunctionModel $ function , TraitModelInterface $ parent ) : bool { // Check if function name matches preg_match ( '/^get(.+)$/' , $ function -> getName ( ) , $ matches ) ; if ( Validator :: arrayType ( ) -> length ( 2 , 2 ) -> validate ( $ matches ) ) { // Check if property exists $ property = lcfirst ( $ matches [ 1 ] ) ; if ( $ parent -> hasAttribute ( $ property , $ function -> isStatic ( ) ) ) { $ annotation = new GetAnnotation ( ) ; $ annotation -> setName ( '@PhpUnitGen\\getter' ) ; $ function -> addAnnotation ( $ annotation ) ; $ annotation -> setParentNode ( $ function ) ; $ annotation -> compile ( ) ; return true ; } } return false ; }
Try to create a getter annotation for function.

@param FunctionModel       $function The function to check for.
@param TraitModelInterface $parent   The parent to use.

@return bool True if a getter annotation has been created.
Try to create a getter annotation for function .