", false, null, false, null, ], ["tsimple", true, [false, "tsimple"], true, [false, "tsimple"], ], ['nur\sery\wip\php\impl\ntsimple', true, [false, 'nur\sery\wip\php\impl\ntsimple'], true, [false, 'nur\sery\wip\php\impl\ntsimple'], ], ['tmissing', false, null, true, [false, 'tmissing'], ], ["::tstatic", false, null, false, null, ], ["->tmethod", false, null, false, null, ], ["::tmissing", false, null, false, null, ], ["->tmissing", false, null, false, null, ], [MyClass::class."::tstatic", false, null, false, null, ], [MyClass::class."->tmethod", false, null, false, null, ], [MyClass::class."::tmissing", false, null, false, null, ], [MyClass::class."->tmissing", false, null, false, null, ], # tableaux avec un seul scalaire [[], false, null, false, null, ], [[null], false, null, false, null, ], [[false], false, null, false, null, ], [[""], false, null, false, null, ], [["::"], false, null, false, null, ], [["->"], false, null, false, null, ], [["tsimple"], false, null, false, null, ], [['nur\sery\wip\php\impl\ntsimple'], false, null, false, null, ], [["::tstatic"], false, null, false, null, ], [["->tmethod"], false, null, false, null, ], [["::tmissing"], false, null, false, null, ], [["->tmissing"], false, null, false, null, ], [[MyClass::class."::tstatic"], false, null, false, null, ], [[MyClass::class."->tmethod"], false, null, false, null, ], [[MyClass::class."::tmissing"], false, null, false, null, ], [[MyClass::class."->tmissing"], false, null, false, null, ], # tableaux avec deux scalaires [[null, "tsimple"], false, null, false, null, ], [[null, 'nur\sery\wip\php\impl\ntsimple'], false, null, false, null, ], [[null, "tmissing"], false, null, false, null, ], [[null, "::tstatic"], false, null, false, null, ], [[null, "->tmethod"], false, null, false, null, ], [[null, "::tmissing"], false, null, false, null, ], [[null, "->tmissing"], false, null, false, null, ], [[false, "tsimple"], true, [false, "tsimple"], true, [false, "tsimple"], ], [[false, 'nur\sery\wip\php\impl\ntsimple'], true, [false, 'nur\sery\wip\php\impl\ntsimple'], true, [false, 'nur\sery\wip\php\impl\ntsimple'], ], [[false, "tmissing"], false, null, true, [false, "tmissing"], ], [[false, "::tstatic"], false, null, false, null, ], [[false, "->tmethod"], false, null, false, null, ], [[false, "::tmissing"], false, null, false, null, ], [[false, "->tmissing"], false, null, false, null, ], [["", "tsimple"], false, null, false, null, ], [["", 'nur\sery\wip\php\impl\ntsimple'], false, null, false, null, ], [["", "tmissing"], false, null, false, null, ], [["", "::tstatic"], false, null, false, null, ], [["", "->tmethod"], false, null, false, null, ], [["", "::tmissing"], false, null, false, null, ], [["", "->tmissing"], false, null, false, null, ], [[MyClass::class, "tstatic"], false, null, false, null, ], [[MyClass::class, "::tstatic"], false, null, false, null, ], [[MyClass::class, "tmethod"], false, null, false, null, ], [[MyClass::class, "->tmethod"], false, null, false, null, ], [[MyClass::class, "tmissing"], false, null, false, null, ], [[MyClass::class, "::tmissing"], false, null, false, null, ], [[MyClass::class, "->tmissing"], false, null, false, null, ], ]; function testSimple() { foreach (self::SIMPLE_TESTS as $args) { [$func, $verifix1, $func1, $verifix2, $func2, ] = $args; $workf = $func; $msg = var_export($func, true)." (strict)"; self::assertSame($verifix1, func::verifix_simple($workf, true), "$msg --> verifix"); if ($verifix1) { self::assertSame($func1, $workf, "$msg --> func"); } $workf = $func; $msg = var_export($func, true)." (lenient)"; self::assertSame($verifix2, func::verifix_simple($workf, false), "$msg --> verifix"); if ($verifix2) { self::assertSame($func2, $workf, "$msg --> func"); } } } const STATIC_TESTS = [ # scalaires [null, false, null, null, false, null, null, ], [false, false, null, null, false, null, null, ], ["", false, null, null, false, null, null, ], ["::", false, null, null, false, null, null, ], ["->", false, null, null, false, null, null, ], ["tsimple", false, null, null, false, null, null, ], ['nur\sery\wip\php\impl\ntsimple', false, null, null, false, null, null, ], ['tmissing', false, null, null, false, null, null, ], ["::tstatic", true, false, [null, "tstatic"], true, false, [null, "tstatic"], ], ["->tmethod", false, null, null, false, null, null, ], ["::tmissing", true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], ["->tmissing", false, null, null, false, null, null, ], [MyClass::class."::tstatic", true, true, [MyClass::class, "tstatic"], true, true, [MyClass::class, "tstatic"], ], [MyClass::class."->tmethod", false, null, null, false, null, null, ], [MyClass::class."::tmissing", false, null, null, true, true, [MyClass::class, "tmissing"], ], [MyClass::class."->tmissing", false, null, null, false, null, null, ], # tableaux avec un seul scalaire [[], false, null, null, false, null, null, ], [[null], false, null, null, false, null, null, ], [[false], false, null, null, false, null, null, ], [[""], false, null, null, false, null, null, ], [["::"], false, null, null, false, null, null, ], [["->"], false, null, null, false, null, null, ], [["tsimple"], false, null, null, false, null, null, ], [['nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [["::tstatic"], true, false, [null, "tstatic"], true, false, [null, "tstatic"], ], [["->tmethod"], false, null, null, false, null, null, ], [["::tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [["->tmissing"], false, null, null, false, null, null, ], [[MyClass::class."::tstatic"], true, true, [MyClass::class, "tstatic"], true, true, [MyClass::class, "tstatic"], ], [[MyClass::class."->tmethod"], false, null, null, false, null, null, ], [[MyClass::class."::tmissing"], false, null, null, true, true, [MyClass::class, "tmissing"], ], [[MyClass::class."->tmissing"], false, null, null, false, null, null, ], # tableaux avec deux scalaires [[null, "tsimple"], true, false, [null, "tsimple"], true, false, [null, "tsimple"], ], [[null, 'nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [[null, "tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [[null, "::tstatic"], true, false, [null, "tstatic"], true, false, [null, "tstatic"], ], [[null, "->tmethod"], false, null, null, false, null, null, ], [[null, "::tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [[null, "->tmissing"], false, null, null, false, null, null, ], [[false, "tsimple"], false, null, null, false, null, null, ], [[false, 'nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [[false, "tmissing"], false, null, null, false, null, null, ], [[false, "::tstatic"], false, null, null, false, null, null, ], [[false, "->tmethod"], false, null, null, false, null, null, ], [[false, "::tmissing"], false, null, null, false, null, null, ], [[false, "->tmissing"], false, null, null, false, null, null, ], [["", "tsimple"], true, false, [null, "tsimple"], true, false, [null, "tsimple"], ], [["", 'nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [["", "tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [["", "::tstatic"], true, false, [null, "tstatic"], true, false, [null, "tstatic"], ], [["", "->tmethod"], false, null, null, false, null, null, ], [["", "::tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [["", "->tmissing"], false, null, null, false, null, null, ], [[MyClass::class, "tstatic"], true, true, [MyClass::class, "tstatic"], true, true, [MyClass::class, "tstatic"], ], [[MyClass::class, "::tstatic"], true, true, [MyClass::class, "tstatic"], true, true, [MyClass::class, "tstatic"], ], [[MyClass::class, "tmethod"], true, true, [MyClass::class, "tmethod"], true, true, [MyClass::class, "tmethod"], ], [[MyClass::class, "->tmethod"], false, null, null, false, null, null, ], [[MyClass::class, "tmissing"], false, null, null, true, true, [MyClass::class, "tmissing"], ], [[MyClass::class, "::tmissing"], false, null, null, true, true, [MyClass::class, "tmissing"], ], [[MyClass::class, "->tmissing"], false, null, null, false, null, null, ], ]; function testStatic() { foreach (self::STATIC_TESTS as $args) { [$func, $verifix1, $bound1, $func1, $verifix2, $bound2, $func2, ] = $args; $workf = $func; $msg = var_export($func, true)." (strict)"; self::assertSame($verifix1, func::verifix_static($workf, true, $bound), "$msg --> verifix"); if ($verifix1) { self::assertSame($bound1, $bound, "$msg --> bound"); self::assertSame($func1, $workf, "$msg --> func"); } $workf = $func; $msg = var_export($func, true)." (lenient)"; self::assertSame($verifix2, func::verifix_static($workf, false, $bound), "$msg --> verifix"); if ($verifix2) { self::assertSame($bound2, $bound, "$msg --> bound"); self::assertSame($func2, $workf, "$msg --> func"); } } } const METHOD_TESTS = [ # scalaires [null, false, null, null, false, null, null, ], [false, false, null, null, false, null, null, ], ["", false, null, null, false, null, null, ], ["::", false, null, null, false, null, null, ], ["->", false, null, null, false, null, null, ], ["tsimple", false, null, null, false, null, null, ], ['nur\sery\wip\php\impl\ntsimple', false, null, null, false, null, null, ], ['tmissing', false, null, null, false, null, null, ], ["::tstatic", false, null, null, false, null, null, ], ["->tmethod", true, false, [null, "tmethod"], true, false, [null, "tmethod"], ], ["::tmissing", false, null, null, false, null, null, ], ["->tmissing", true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [MyClass::class."::tstatic", false, null, null, false, null, null, ], [MyClass::class."->tmethod", true, true, [MyClass::class, "tmethod"], true, true, [MyClass::class, "tmethod"], ], [MyClass::class."::tmissing", false, null, null, false, null, null, ], [MyClass::class."->tmissing", false, null, null, true, true, [MyClass::class, "tmissing"], ], # tableaux avec un seul scalaire [[], false, null, null, false, null, null, ], [[null], false, null, null, false, null, null, ], [[false], false, null, null, false, null, null, ], [[""], false, null, null, false, null, null, ], [["::"], false, null, null, false, null, null, ], [["->"], false, null, null, false, null, null, ], [["tsimple"], false, null, null, false, null, null, ], [['nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [["::tstatic"], false, null, null, false, null, null, ], [["->tmethod"], true, false, [null, "tmethod"], true, false, [null, "tmethod"], ], [["::tmissing"], false, null, null, false, null, null, ], [["->tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [[MyClass::class."::tstatic"], false, null, null, false, null, null, ], [[MyClass::class."->tmethod"], true, true, [MyClass::class, "tmethod"], true, true, [MyClass::class, "tmethod"], ], [[MyClass::class."::tmissing"], false, null, null, false, null, null, ], [[MyClass::class."->tmissing"], false, null, null, true, true, [MyClass::class, "tmissing"], ], # tableaux avec deux scalaires [[null, "tsimple"], true, false, [null, "tsimple"], true, false, [null, "tsimple"], ], [[null, 'nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [[null, "tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [[null, "::tstatic"], false, null, null, false, null, null, ], [[null, "->tmethod"], true, false, [null, "tmethod"], true, false, [null, "tmethod"], ], [[null, "::tmissing"], false, null, null, false, null, null, ], [[null, "->tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [[false, "tsimple"], false, null, null, false, null, null, ], [[false, 'nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [[false, "tmissing"], false, null, null, false, null, null, ], [[false, "::tstatic"], false, null, null, false, null, null, ], [[false, "->tmethod"], false, null, null, false, null, null, ], [[false, "::tmissing"], false, null, null, false, null, null, ], [[false, "->tmissing"], false, null, null, false, null, null, ], [["", "tsimple"], true, false, [null, "tsimple"], true, false, [null, "tsimple"], ], [["", 'nur\sery\wip\php\impl\ntsimple'], false, null, null, false, null, null, ], [["", "tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [["", "::tstatic"], false, null, null, false, null, null, ], [["", "->tmethod"], true, false, [null, "tmethod"], true, false, [null, "tmethod"], ], [["", "::tmissing"], false, null, null, false, null, null, ], [["", "->tmissing"], true, false, [null, "tmissing"], true, false, [null, "tmissing"], ], [[MyClass::class, "tstatic"], true, true, [MyClass::class, "tstatic"], true, true, [MyClass::class, "tstatic"], ], [[MyClass::class, "::tstatic"], false, null, null, false, null, null, ], [[MyClass::class, "tmethod"], true, true, [MyClass::class, "tmethod"], true, true, [MyClass::class, "tmethod"], ], [[MyClass::class, "->tmethod"], true, true, [MyClass::class, "tmethod"], true, true, [MyClass::class, "tmethod"], ], [[MyClass::class, "tmissing"], false, null, null, true, true, [MyClass::class, "tmissing"], ], [[MyClass::class, "::tmissing"], false, null, null, false, null, null, ], [[MyClass::class, "->tmissing"], false, null, null, true, true, [MyClass::class, "tmissing"], ], ]; function testMethod() { foreach (self::METHOD_TESTS as $args) { [$func, $verifix1, $bound1, $func1, $verifix2, $bound2, $func2, ] = $args; $workf = $func; $msg = var_export($func, true)." (strict)"; self::assertSame($verifix1, func::verifix_method($workf, true, $bound), "$msg --> verifix"); if ($verifix1) { self::assertSame($bound1, $bound, "$msg --> bound"); self::assertSame($func1, $workf, "$msg --> func"); } $workf = $func; $msg = var_export($func, true)." (lenient)"; self::assertSame($verifix2, func::verifix_method($workf, false, $bound), "$msg --> verifix"); if ($verifix2) { self::assertSame($bound2, $bound, "$msg --> bound"); self::assertSame($func2, $workf, "$msg --> func"); } } } } }