MCPcopy Index your code
hub / github.com/php/frankenphp / TestFunctionParserUnsupportedTypes

Function TestFunctionParserUnsupportedTypes

internal/extgen/funcparser_test.go:352–458  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

350}
351
352func TestFunctionParserUnsupportedTypes(t *testing.T) {
353 tests := []struct {
354 name string
355 input string
356 expected int
357 hasWarning bool
358 }{
359 {
360 name: "function with array parameter should be rejected",
361 input: `package main
362
363//export_php:function arrayFunc(array $data): string
364func arrayFunc(data any) unsafe.Pointer {
365 return String("processed")
366}`,
367 expected: 0,
368 hasWarning: true,
369 },
370 {
371 name: "function with object parameter should be rejected",
372 input: `package main
373
374//export_php:function objectFunc(object $obj): string
375func objectFunc(obj any) unsafe.Pointer {
376 return String("processed")
377}`,
378 expected: 0,
379 hasWarning: true,
380 },
381 {
382 name: "function with mixed parameter should be rejected",
383 input: `package main
384
385//export_php:function mixedFunc(mixed $value): string
386func mixedFunc(value any) unsafe.Pointer {
387 return String("processed")
388}`,
389 expected: 0,
390 hasWarning: true,
391 },
392 {
393 name: "function with array return type should be rejected",
394 input: `package main
395
396//export_php:function arrayReturnFunc(string $name): array
397func arrayReturnFunc(name *C.zend_string) any {
398 return []string{"result"}
399}`,
400 expected: 0,
401 hasWarning: true,
402 },
403 {
404 name: "function with object return type should be rejected",
405 input: `package main
406
407//export_php:function objectReturnFunc(string $name): object
408func objectReturnFunc(name *C.zend_string) any {
409 return map[string]any{"key": "value"}

Callers

nothing calls this directly

Calls 3

parseMethod · 0.95
captureWarningsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected