src/Generator.php
private function addFeature(ReflectionClass $class, ReflectionMethod $method, array $calls) : void
    {
        Formatter::out("<gray> Adding tests for feature <magenta>{$class->name}::{$method->name}\n");
        $tested = $method->name;
        $this->features[$method->name] = (object)['calls' => []];
        foreach ($calls as $call) {
            $arglist = [];
            foreach ($call as $idx => $p) {
                if ($p == 'NULL') {
                    $arglist[] = 'null';
                } elseif (isset($arguments[$idx + 1])) {
                    preg_match('@\$\w+@', "{$arguments[$idx + 1]}", $matches);
                    $arglist[] = $matches[0];
                } else {
                    $arglist[] = $this->getDefaultForType($p, self::AS_INSTANCE);
                }
            }
            $mt = $method->isStatic() ? '::' : '->';
            $expectedResult = 'true';
            if ($method->hasReturnType()) {
                $type = $method->getReturnType()->__toString();
                $expectedResult = $this->getDefaultForType($type, self::AS_RETURNCHECK);
            }
            $this->features[$method->name]->calls[] = (object)[
                'name' => $method->name,
                'parameters' => implode(', ', $arglist),
                'expectedResult' => $expectedResult,
            ];
        }
    }
private function addFeature(ReflectionClass $class, ReflectionMethod $method, array $calls) : void
    {
        Formatter::out("<gray> Adding tests for feature <magenta>{$class->name}::{$method->name}\n");
        $tested = $method->name;
        $this->features[$method->name] = (object)['calls' => []];
        foreach ($calls as $call) {
            $arglist = [];
            foreach ($call as $idx => $p) {
                if ($p == 'NULL') {
                    $arglist[] = 'null';
                } elseif (isset($arguments[$idx + 1])) {
                    preg_match('@\$\w+@', "{$arguments[$idx + 1]}", $matches);
                    $arglist[] = $matches[0];
                } else {
                    $arglist[] = $this->getDefaultForType($p, self::AS_INSTANCE);
                }
            }
            $mt = $method->isStatic() ? '::' : '->';
            $expectedResult = 'true';
            if ($method->hasReturnType()) {
                $type = $method->getReturnType()->__toString();
                $expectedResult = $this->getDefaultForType($type, self::AS_RETURNCHECK);
            }
            $this->features[$method->name]->calls[] = (object)[
                'name' => $method->name,
                'parameters' => implode(', ', $arglist),
                'expectedResult' => $expectedResult,
            ];
        }
    }
private function addFeature ( ReflectionClass $ class , ReflectionMethod $ method , array $ calls ) : void { Formatter :: out ( "<gray> Adding tests for feature <magenta>{$class->name}::{$method->name}\n" ) ; $ tested = $ method -> name ; $ this -> features [ $ method -> name ] = ( object ) [ 'calls' => [ ] ] ; foreach ( $ calls as $ call ) { $ arglist = [ ] ; foreach ( $ call as $ idx => $ p ) { if ( $ p == 'NULL' ) { $ arglist [ ] = 'null' ; } elseif ( isset ( $ arguments [ $ idx + 1 ] ) ) { preg_match ( '@\$\w+@' , "{$arguments[$idx + 1]}" , $ matches ) ; $ arglist [ ] = $ matches [ 0 ] ; } else { $ arglist [ ] = $ this -> getDefaultForType ( $ p , self :: AS_INSTANCE ) ; } } $ mt = $ method -> isStatic ( ) ? '::' : '->' ; $ expectedResult = 'true' ; if ( $ method -> hasReturnType ( ) ) { $ type = $ method -> getReturnType ( ) -> __toString ( ) ; $ expectedResult = $ this -> getDefaultForType ( $ type , self :: AS_RETURNCHECK ) ; } $ this -> features [ $ method -> name ] -> calls [ ] = ( object ) [ 'name' => $ method -> name , 'parameters' => implode ( ', ' , $ arglist ) , 'expectedResult' => $ expectedResult , ] ; } }
Internal method to add a testable feature.

@param string The reflection of the object or trait to test a feature on.
@param ReflectionMethod $method Reflection of the feature to test.
@param array $calls Array of possible types of calls.
@return void
Internal method to add a testable feature .