[ FullOpeningTag( FullOpeningTagStatement { span: Span { line: 1, column: 1, position: 0, }, }, ), Declare( DeclareStatement { declare: Span { line: 11, column: 1, position: 356, }, entries: DeclareEntryGroup { left_parenthesis: Span { line: 11, column: 8, position: 363, }, right_parenthesis: Span { line: 11, column: 23, position: 378, }, entries: [ DeclareEntry { key: SimpleIdentifier { span: Span { line: 11, column: 9, position: 364, }, value: "strict_types", }, equals: Span { line: 11, column: 21, position: 376, }, value: Integer( LiteralInteger { value: "1", span: Span { line: 11, column: 22, position: 377, }, }, ), }, ], }, body: Noop { semicolon: Span { line: 11, column: 24, position: 379, }, }, }, ), Namespace( Unbraced( UnbracedNamespace { start: Span { line: 13, column: 1, position: 382, }, name: SimpleIdentifier { span: Span { line: 13, column: 11, position: 392, }, value: "Psl\Internal", }, end: Span { line: 13, column: 23, position: 404, }, statements: [ Use( UseStatement { kind: Normal, uses: [ Use { name: SimpleIdentifier { span: Span { line: 15, column: 5, position: 411, }, value: "Closure", }, alias: None, kind: None, }, ], }, ), Use( UseStatement { kind: Normal, uses: [ Use { name: SimpleIdentifier { span: Span { line: 16, column: 5, position: 424, }, value: "Psl\Str", }, alias: None, kind: None, }, ], }, ), Use( UseStatement { kind: Function, uses: [ Use { name: SimpleIdentifier { span: Span { line: 18, column: 14, position: 447, }, value: "restore_error_handler", }, alias: None, kind: None, }, ], }, ), Use( UseStatement { kind: Function, uses: [ Use { name: SimpleIdentifier { span: Span { line: 19, column: 14, position: 483, }, value: "set_error_handler", }, alias: None, kind: None, }, ], }, ), Function( FunctionStatement { comments: CommentGroup { comments: [ Comment { span: Span { line: 3, column: 1, position: 7, }, format: SingleLine, content: "// The following code was taken from of PSL.", }, Comment { span: Span { line: 4, column: 1, position: 52, }, format: SingleLine, content: "//", }, Comment { span: Span { line: 5, column: 1, position: 55, }, format: SingleLine, content: "// https://github.com/azjezz/psl/blob/657ce9888be47cee49418989420b83661f7cf1c4/src/Psl/Internal/box.php", }, Comment { span: Span { line: 6, column: 1, position: 159, }, format: SingleLine, content: "//", }, Comment { span: Span { line: 7, column: 1, position: 162, }, format: SingleLine, content: "// Code subject to the MIT license (https://github.com/azjezz/psl/blob/657ce9888be47cee49418989420b83661f7cf1c4/LICENSE).", }, Comment { span: Span { line: 8, column: 1, position: 284, }, format: SingleLine, content: "//", }, Comment { span: Span { line: 9, column: 1, position: 287, }, format: SingleLine, content: "// Copyright (c) 2019-2022 Saif Eddin Gmati ", }, Comment { span: Span { line: 21, column: 1, position: 503, }, format: Document, content: "/**\n * @template T\n *\n * @param (Closure(): T) $fun\n *\n * @return array{0: T, 1: ?string}\n *\n * @internal\n *\n * @psalm-suppress MissingThrowsDocblock\n */", }, ], }, attributes: [], function: Span { line: 32, column: 1, position: 657, }, ampersand: None, name: SimpleIdentifier { span: Span { line: 32, column: 10, position: 666, }, value: "box", }, parameters: FunctionParameterList { comments: CommentGroup { comments: [], }, left_parenthesis: Span { line: 32, column: 13, position: 669, }, parameters: CommaSeparated { inner: [ FunctionParameter { comments: CommentGroup { comments: [], }, name: SimpleVariable { span: Span { line: 32, column: 22, position: 678, }, name: "$fun", }, attributes: [], data_type: Some( Named( Span { line: 32, column: 14, position: 670, }, "Closure", ), ), ellipsis: None, default: None, ampersand: None, }, ], commas: [], }, right_parenthesis: Span { line: 32, column: 26, position: 682, }, }, return_type: Some( ReturnType { colon: Span { line: 32, column: 27, position: 683, }, data_type: Array( Span { line: 32, column: 29, position: 685, }, ), }, ), body: FunctionBody { comments: CommentGroup { comments: [], }, left_brace: Span { line: 33, column: 1, position: 691, }, statements: [ Expression( ExpressionStatement { expression: AssignmentOperation( Assign { left: Variable( SimpleVariable( SimpleVariable { span: Span { line: 34, column: 5, position: 697, }, name: "$last_message", }, ), ), equals: Span { line: 34, column: 19, position: 711, }, right: Null, }, ), ending: Semicolon( Span { line: 34, column: 25, position: 717, }, ), }, ), Expression( ExpressionStatement { expression: FunctionCall( FunctionCallExpression { target: Identifier( SimpleIdentifier( SimpleIdentifier { span: Span { line: 36, column: 5, position: 766, }, value: "set_error_handler", }, ), ), arguments: ArgumentList { comments: CommentGroup { comments: [ Comment { span: Span { line: 35, column: 5, position: 723, }, format: Document, content: "/** @psalm-suppress InvalidArgument */", }, ], }, left_parenthesis: Span { line: 36, column: 22, position: 783, }, arguments: [ Positional( PositionalArgument { comments: CommentGroup { comments: [], }, ellipsis: None, value: Closure( ClosureExpression { comments: CommentGroup { comments: [], }, attributes: [], static: Some( Span { line: 36, column: 23, position: 784, }, ), function: Span { line: 36, column: 30, position: 791, }, ampersand: None, parameters: FunctionParameterList { comments: CommentGroup { comments: [], }, left_parenthesis: Span { line: 36, column: 39, position: 800, }, parameters: CommaSeparated { inner: [ FunctionParameter { comments: CommentGroup { comments: [], }, name: SimpleVariable { span: Span { line: 36, column: 44, position: 805, }, name: "$_type", }, attributes: [], data_type: Some( Integer( Span { line: 36, column: 40, position: 801, }, ), ), ellipsis: None, default: None, ampersand: None, }, FunctionParameter { comments: CommentGroup { comments: [], }, name: SimpleVariable { span: Span { line: 36, column: 59, position: 820, }, name: "$message", }, attributes: [], data_type: Some( String( Span { line: 36, column: 52, position: 813, }, ), ), ellipsis: None, default: None, ampersand: None, }, ], commas: [ Span { line: 36, column: 50, position: 811, }, ], }, right_parenthesis: Span { line: 36, column: 67, position: 828, }, }, uses: Some( ClosureUse { comments: CommentGroup { comments: [], }, use: Span { line: 36, column: 69, position: 830, }, left_parenthesis: Span { line: 36, column: 73, position: 834, }, variables: CommaSeparated { inner: [ ClosureUseVariable { comments: CommentGroup { comments: [], }, ampersand: Some( Span { line: 36, column: 74, position: 835, }, ), variable: SimpleVariable { span: Span { line: 36, column: 75, position: 836, }, name: "$last_message", }, }, ], commas: [], }, right_parenthesis: Span { line: 36, column: 88, position: 849, }, }, ), return_type: None, body: FunctionBody { comments: CommentGroup { comments: [], }, left_brace: Span { line: 36, column: 90, position: 851, }, statements: [ Expression( ExpressionStatement { expression: AssignmentOperation( Assign { left: Variable( SimpleVariable( SimpleVariable { span: Span { line: 37, column: 9, position: 861, }, name: "$last_message", }, ), ), equals: Span { line: 37, column: 23, position: 875, }, right: Variable( SimpleVariable( SimpleVariable { span: Span { line: 37, column: 25, position: 877, }, name: "$message", }, ), ), }, ), ending: Semicolon( Span { line: 37, column: 33, position: 885, }, ), }, ), ], right_brace: Span { line: 38, column: 5, position: 891, }, }, }, ), }, ), ], right_parenthesis: Span { line: 38, column: 6, position: 892, }, }, }, ), ending: Semicolon( Span { line: 38, column: 7, position: 893, }, ), }, ), If( IfStatement { if: Span { line: 43, column: 5, position: 954, }, left_parenthesis: Span { line: 43, column: 8, position: 957, }, condition: LogicalOperation( And { left: ComparisonOperation( NotIdentical { left: Null, bang_double_equals: Span { line: 43, column: 14, position: 963, }, right: Variable( SimpleVariable( SimpleVariable { span: Span { line: 43, column: 18, position: 967, }, name: "$last_message", }, ), ), }, ), double_ampersand: Span { line: 43, column: 32, position: 981, }, right: FunctionCall( FunctionCallExpression { target: Identifier( SimpleIdentifier( SimpleIdentifier { span: Span { line: 43, column: 35, position: 984, }, value: "Str\contains", }, ), ), arguments: ArgumentList { comments: CommentGroup { comments: [ Comment { span: Span { line: 40, column: 5, position: 900, }, format: Document, content: "/**\n * @var string|null $last_message\n */", }, ], }, left_parenthesis: Span { line: 43, column: 47, position: 996, }, arguments: [ Positional( PositionalArgument { comments: CommentGroup { comments: [], }, ellipsis: None, value: Variable( SimpleVariable( SimpleVariable { span: Span { line: 43, column: 48, position: 997, }, name: "$last_message", }, ), ), }, ), Positional( PositionalArgument { comments: CommentGroup { comments: [], }, ellipsis: None, value: Literal( String( LiteralString { value: "): ", span: Span { line: 43, column: 63, position: 1012, }, kind: SingleQuoted, }, ), ), }, ), ], right_parenthesis: Span { line: 43, column: 68, position: 1017, }, }, }, ), }, ), right_parenthesis: Span { line: 43, column: 69, position: 1018, }, body: Statement { statement: Block( BlockStatement { left_brace: Span { line: 43, column: 71, position: 1020, }, statements: [ Expression( ExpressionStatement { expression: AssignmentOperation( Assign { left: Variable( SimpleVariable( SimpleVariable { span: Span { line: 44, column: 9, position: 1030, }, name: "$last_message", }, ), ), equals: Span { line: 44, column: 23, position: 1044, }, right: FunctionCall( FunctionCallExpression { target: Identifier( SimpleIdentifier( SimpleIdentifier { span: Span { line: 44, column: 25, position: 1046, }, value: "Str\after", }, ), ), arguments: ArgumentList { comments: CommentGroup { comments: [], }, left_parenthesis: Span { line: 44, column: 34, position: 1055, }, arguments: [ Positional( PositionalArgument { comments: CommentGroup { comments: [], }, ellipsis: None, value: FunctionCall( FunctionCallExpression { target: Identifier( SimpleIdentifier( SimpleIdentifier { span: Span { line: 45, column: 13, position: 1069, }, value: "Str\lowercase", }, ), ), arguments: ArgumentList { comments: CommentGroup { comments: [], }, left_parenthesis: Span { line: 45, column: 26, position: 1082, }, arguments: [ Positional( PositionalArgument { comments: CommentGroup { comments: [], }, ellipsis: None, value: Variable( SimpleVariable( SimpleVariable { span: Span { line: 45, column: 27, position: 1083, }, name: "$last_message", }, ), ), }, ), ], right_parenthesis: Span { line: 45, column: 40, position: 1096, }, }, }, ), }, ), Positional( PositionalArgument { comments: CommentGroup { comments: [ Comment { span: Span { line: 46, column: 13, position: 1111, }, format: SingleLine, content: "// how i feel toward PHP error handling:", }, ], }, ellipsis: None, value: Literal( String( LiteralString { value: "): ", span: Span { line: 47, column: 13, position: 1164, }, kind: SingleQuoted, }, ), ), }, ), ], right_parenthesis: Span { line: 48, column: 9, position: 1178, }, }, }, ), }, ), ending: Semicolon( Span { line: 48, column: 10, position: 1179, }, ), }, ), ], right_brace: Span { line: 49, column: 5, position: 1185, }, }, ), elseifs: [], else: None, }, }, ), Try( TryStatement { start: Span { line: 51, column: 5, position: 1192, }, end: Span { line: 61, column: 1, position: 1399, }, body: [ Expression( ExpressionStatement { expression: AssignmentOperation( Assign { left: Variable( SimpleVariable( SimpleVariable { span: Span { line: 52, column: 9, position: 1206, }, name: "$value", }, ), ), equals: Span { line: 52, column: 16, position: 1213, }, right: FunctionCall( FunctionCallExpression { target: Variable( SimpleVariable( SimpleVariable { span: Span { line: 52, column: 18, position: 1215, }, name: "$fun", }, ), ), arguments: ArgumentList { comments: CommentGroup { comments: [], }, left_parenthesis: Span { line: 52, column: 22, position: 1219, }, arguments: [], right_parenthesis: Span { line: 52, column: 23, position: 1220, }, }, }, ), }, ), ending: Semicolon( Span { line: 52, column: 24, position: 1221, }, ), }, ), Expression( ExpressionStatement { expression: AssignmentOperation( Assign { left: Variable( SimpleVariable( SimpleVariable { span: Span { line: 55, column: 9, position: 1284, }, name: "$result", }, ), ), equals: Span { line: 55, column: 17, position: 1292, }, right: ShortArray( ShortArrayExpression { start: Span { line: 55, column: 19, position: 1294, }, items: CommaSeparated { inner: [ Value { value: Variable( SimpleVariable( SimpleVariable { span: Span { line: 55, column: 20, position: 1295, }, name: "$value", }, ), ), }, Value { value: Variable( SimpleVariable( SimpleVariable { span: Span { line: 55, column: 28, position: 1303, }, name: "$last_message", }, ), ), }, ], commas: [ Span { line: 55, column: 26, position: 1301, }, ], }, end: Span { line: 55, column: 41, position: 1316, }, }, ), }, ), ending: Semicolon( Span { line: 55, column: 42, position: 1317, }, ), }, ), Return( ReturnStatement { return: Span { line: 57, column: 9, position: 1328, }, value: Some( Variable( SimpleVariable( SimpleVariable { span: Span { line: 57, column: 16, position: 1335, }, name: "$result", }, ), ), ), ending: Semicolon( Span { line: 57, column: 23, position: 1342, }, ), }, ), ], catches: [], finally: Some( FinallyBlock { start: Span { line: 58, column: 7, position: 1350, }, end: Span { line: 61, column: 1, position: 1399, }, body: [ Expression( ExpressionStatement { expression: FunctionCall( FunctionCallExpression { target: Identifier( SimpleIdentifier( SimpleIdentifier { span: Span { line: 59, column: 9, position: 1368, }, value: "restore_error_handler", }, ), ), arguments: ArgumentList { comments: CommentGroup { comments: [ Comment { span: Span { line: 54, column: 9, position: 1232, }, format: Document, content: "/** @var array{0: T, 1: ?string} $result */", }, ], }, left_parenthesis: Span { line: 59, column: 30, position: 1389, }, arguments: [], right_parenthesis: Span { line: 59, column: 31, position: 1390, }, }, }, ), ending: Semicolon( Span { line: 59, column: 32, position: 1391, }, ), }, ), ], }, ), }, ), ], right_brace: Span { line: 61, column: 1, position: 1399, }, }, }, ), ], }, ), ), ]