[ 'code' => ' [ '$keys' => 'list', ], ], 'arrayKeysOfKeyedArrayReturnsNonEmptyListOfStrings' => [ 'code' => ' "bar"]); ', 'assertions' => [ '$keys' => 'non-empty-list', ], ], 'arrayKeysOfListReturnsNonEmptyListOfInts' => [ 'code' => ' [ '$keys' => 'non-empty-list>', ], ], 'arrayKeysOfKeyedStringIntArrayReturnsNonEmptyListOfIntsOrStrings' => [ 'code' => ' "bar", 42]); ', 'assertions' => [ '$keys' => 'non-empty-list', ], ], 'arrayKeysOfArrayConformsToArrayKeys' => [ 'code' => ' */ function getKeys(array $array) { return array_keys($array); } ', ], 'arrayKeysOfKeyedArrayConformsToCorrectLiteralStringList' => [ 'code' => ' */ function getKeys() { return array_keys(["foo" => 42, "bar" => 42]); } ', ], 'arrayKeysOfLiteralListConformsToCorrectLiteralOffsets' => [ 'code' => ' */ function getKeys() { return array_keys(["foo", "bar"]); } ', ], 'arrayKeyFirstOfLiteralListConformsToCorrectLiteralOffsets' => [ 'code' => ' [ 'code' => ' [ 'code' => ' [ "from" => "79268724911", "to" => "74950235931", ], "b" => [ "from" => "79313044964", "to" => "78124169167", ], ]; private const SIP_FORMAT = "sip:%s@voip.test.com:9090"; /** @return array */ public function test(): array { $redirects = []; foreach (self::REDIRECTS as $redirect) { $redirects[$redirect["from"]] = sprintf(self::SIP_FORMAT, $redirect["to"]); } return $redirects; } }', ], ]; } public function providerInvalidCodeParse(): iterable { return [ 'arrayKeysOfStringArrayDoesntConformsToIntList' => [ 'code' => ' $array * @return list */ function getKeys(array $array) { return array_keys($array); } ', 'error_message' => 'InvalidReturnStatement', ], 'arrayKeysOfStringKeyedArrayDoesntConformToIntList' => [ 'code' => ' */ function getKeys() { return array_keys(["foo" => 42, "bar" => 42]); } ', 'error_message' => 'InvalidReturnStatement', ], 'literalStringAsIntArrayKey' => [ 'code' => ' [ "from" => "79268724911", "to" => "74950235931", ], "b" => [ "from" => "79313044964", "to" => "78124169167", ], ]; private const SIP_FORMAT = "sip:%s@voip.test.com:9090"; /** @return array */ public function test(): array { $redirects = []; foreach (self::REDIRECTS as $redirect) { $redirects[$redirect["from"]] = sprintf(self::SIP_FORMAT, $redirect["to"]); } return $redirects; } }', 'error_message' => 'InvalidReturnStatement', ], ]; } }