public function canConvertFrom($source, $targetType)
    {
        if ((
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\Entity::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\ValueObject::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Entity::class)
        ) === true) {
            return false;
        }

        $methodParameters = $this->reflectionService->getMethodParameters($targetType, '__construct');
        if (count($methodParameters) !== 1) {
            return false;
        }
        $methodParameter = array_shift($methodParameters);
        return TypeHandling::normalizeType($methodParameter['type']) === gettype($source);
    }
public function canConvertFrom($source, $targetType)
    {
        if ((
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\Entity::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\ValueObject::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Entity::class)
        ) === true) {
            return false;
        }

        $methodParameters = $this->reflectionService->getMethodParameters($targetType, '__construct');
        if (count($methodParameters) !== 1) {
            return false;
        }
        $methodParameter = array_shift($methodParameters);
        return TypeHandling::normalizeType($methodParameter['type']) === gettype($source);
    }
public function canConvertFrom ( $ source , $ targetType ) { if ( ( $ this -> reflectionService -> isClassAnnotatedWith ( $ targetType , Flow \ Entity :: class ) || $ this -> reflectionService -> isClassAnnotatedWith ( $ targetType , Flow \ ValueObject :: class ) || $ this -> reflectionService -> isClassAnnotatedWith ( $ targetType , Entity :: class ) ) === true ) { return false ; } $ methodParameters = $ this -> reflectionService -> getMethodParameters ( $ targetType , '__construct' ) ; if ( count ( $ methodParameters ) !== 1 ) { return false ; } $ methodParameter = array_shift ( $ methodParameters ) ; return TypeHandling :: normalizeType ( $ methodParameter [ 'type' ] ) === gettype ( $ source ) ; }
Only convert if the given target class has a constructor with one argument being of type given type

@param string $source
@param string $targetType
@return bool
Only convert if the given target class has a constructor with one argument being of type given type