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

Function TestClassParserUnsupportedTypes

internal/extgen/classparser_test.go:366–511  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

364}
365
366func TestClassParserUnsupportedTypes(t *testing.T) {
367 tests := []struct {
368 name string
369 input string
370 expectedClasses int
371 expectedMethods int
372 hasWarning bool
373 }{
374 {
375 name: "method with array parameter should be rejected",
376 input: `package main
377
378//export_php:class TestClass
379type TestClass struct {
380 Name string
381}
382
383//export_php:method TestClass::arrayMethod(array $data): string
384func (tc *TestClass) arrayMethod(data any) unsafe.Pointer {
385 return nil
386}`,
387 expectedClasses: 1,
388 expectedMethods: 0,
389 hasWarning: true,
390 },
391 {
392 name: "method with object parameter should be rejected",
393 input: `package main
394
395//export_php:class TestClass
396type TestClass struct {
397 Name string
398}
399
400//export_php:method TestClass::objectMethod(object $obj): string
401func (tc *TestClass) objectMethod(obj any) unsafe.Pointer {
402 return nil
403}`,
404 expectedClasses: 1,
405 expectedMethods: 0,
406 hasWarning: true,
407 },
408 {
409 name: "method with mixed parameter should be rejected",
410 input: `package main
411
412//export_php:class TestClass
413type TestClass struct {
414 Name string
415}
416
417//export_php:method TestClass::mixedMethod(mixed $value): string
418func (tc *TestClass) mixedMethod(value any) unsafe.Pointer {
419 return nil
420}`,
421 expectedClasses: 1,
422 expectedMethods: 0,
423 hasWarning: true,

Callers

nothing calls this directly

Calls 1

parseMethod · 0.95

Tested by

no test coverage detected