diff --git a/grammar/php7.y b/grammar/php7.y index a90c969..b4e8007 100644 --- a/grammar/php7.y +++ b/grammar/php7.y @@ -269,7 +269,7 @@ name_union: ; catch: - T_CATCH '(' name_union plain_variable ')' '{' inner_statement_list '}' + T_CATCH '(' name_union optional_plain_variable ')' '{' inner_statement_list '}' { $$ = Stmt\Catch_[$3, $4, $7]; } ; @@ -916,6 +916,11 @@ callable_variable: { $$ = Expr\MethodCall[$1, $3, $4]; } ; +optional_plain_variable: + /* empty */ { $$ = null; } + | plain_variable { $$ = $1; } +; + variable: callable_variable { $$ = $1; } | static_member { $$ = $1; } diff --git a/lib/PhpParser/Node/Stmt/Catch_.php b/lib/PhpParser/Node/Stmt/Catch_.php index 7d4a703..9b9c094 100644 --- a/lib/PhpParser/Node/Stmt/Catch_.php +++ b/lib/PhpParser/Node/Stmt/Catch_.php @@ -9,7 +9,7 @@ class Catch_ extends Node\Stmt { /** @var Node\Name[] Types of exceptions to catch */ public $types; - /** @var Expr\Variable Variable for exception */ + /** @var Expr\Variable|null Variable for exception */ public $var; /** @var Node\Stmt[] Statements */ public $stmts; @@ -17,13 +17,13 @@ class Catch_ extends Node\Stmt /** * Constructs a catch node. * - * @param Node\Name[] $types Types of exceptions to catch - * @param Expr\Variable $var Variable for exception - * @param Node\Stmt[] $stmts Statements - * @param array $attributes Additional attributes + * @param Node\Name[] $types Types of exceptions to catch + * @param Expr\Variable|null $var Variable for exception + * @param Node\Stmt[] $stmts Statements + * @param array $attributes Additional attributes */ public function __construct( - array $types, Expr\Variable $var, array $stmts = [], array $attributes = [] + array $types, Expr\Variable $var = null, array $stmts = [], array $attributes = [] ) { $this->attributes = $attributes; $this->types = $types; @@ -34,7 +34,7 @@ class Catch_ extends Node\Stmt public function getSubNodeNames() : array { return ['types', 'var', 'stmts']; } - + public function getType() : string { return 'Stmt_Catch'; } diff --git a/lib/PhpParser/Parser/Php7.php b/lib/PhpParser/Parser/Php7.php index db988a4..113f4af 100644 --- a/lib/PhpParser/Parser/Php7.php +++ b/lib/PhpParser/Parser/Php7.php @@ -19,7 +19,7 @@ class Php7 extends \PhpParser\ParserAbstract { protected $tokenToSymbolMapSize = 394; protected $actionTableSize = 939; - protected $gotoTableSize = 502; + protected $gotoTableSize = 505; protected $invalidSymbol = 159; protected $errorSymbol = 1; @@ -235,7 +235,7 @@ class Php7 extends \PhpParser\ParserAbstract ); protected $action = array( - 606, 607, 608, 609, 610, 1083, 611, 612, 613, 649, + 606, 607, 608, 609, 610, 1085, 611, 612, 613, 649, 650,-32766,-32766,-32766,-32767,-32767,-32767,-32767, 94, 95, 96, 97, 98, 684,-32766,-32766,-32766, -219, -219, -219, -32766,-32766,-32766, 368,-32766,-32766,-32766,-32766,-32766,-32766, @@ -253,23 +253,23 @@ class Php7 extends \PhpParser\ParserAbstract 46, 47, 691, 257, 1047, 75, 48, 49, 1027, 50, 30, 257, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 1098, 239,-32766,-32766,-32766, + 97, 98, 99, 100, 101, 1100, 239,-32766,-32766,-32766, 391, 257, 119, 51, 52, 1027, 401, 821, 102, 53, 121, 54, 218, 219, 55, 56, 57, 58, 59, 60, 61, 62, -263, 24, 238, 63, 366, 420,-32766,-32766, - -32766, 1053, 1054, 421, 707, 1080, 708, 756,-32766, 1051, - 36, 20, 422, 1080, 423, 130, 424, 1080, 425,-32766, + -32766, 1053, 1054, 421, 707, 1082, 708, 756,-32766, 1051, + 36, 20, 422, 1082, 423, 130, 424, 1082, 425,-32766, 225, 426, 581, -177, 249, 38, 39, 367, 375, 369, 582, 40, 427, 213, 274, 64, 850, 851, 303, 288, 534, 21, 684, 223, 850, 851, 430, 431, 432, 355, - 384, 1019, 1080, 577, 1080, 583, 433, 434, -239, 1041, + 384, 1019, 1082, 577, 1082, 583, 433, 434, -239, 1041, 1042, 1043, 1044, 1038, 1039, 252, -92,-32766, 588, -178, 442, 1045, 1040, 372, 850, 851, 575, 287, 65,-32766, 266, 690, 271, 276, 126, 686, 304, 882, 1019,-32766, 69, 276,-32766,-32766,-32766, 276,-32766, 822,-32766, 360, -32766, -464, 220,-32766, -299, 307, -299,-32766,-32766,-32766, -32766,-32766,-32766,-32766,-32766, 127, -463,-32766, 686,-32766, - -32766, 334,-32766,-32766,-32766, 465, 311, 69,-32766, 359, + -32766, 334,-32766,-32766,-32766, 465, 312, 69,-32766, 359, 276,-32766, 276,-32766,-32766,-32766,-32766,-32766,-32766, 586, -465, 858, 769,-32766, 686,-32766,-32766,-32766,-32766, 362, 769,-32766,-32766,-32766, 223,-32766, 125,-32766,-32766,-32766, @@ -278,34 +278,34 @@ class Php7 extends \PhpParser\ParserAbstract 334, 507, 363, 1059, -464, 442, -470,-32766, 372, -298, -32766, -298, -463, 500, 549, 550, 686, 269, 364, -463, -32766, -469, -465,-32766,-32766,-32766, 898,-32766, 365,-32766, - 1126,-32766,-32766, 1127,-32766, 68, -465,-32766,-32766,-32766, - -32766, 133, 329, -465,-32766,-32766, 42, 561,-32766, 1102, - 372,-32766, 334, -467, 884, 1101,-32766,-32766, -276,-32766, + 1128,-32766,-32766, 1129,-32766, 68, -465,-32766,-32766,-32766, + -32766, 133, 330, -465,-32766,-32766, 42, 561,-32766, 1104, + 372,-32766, 334, -467, 884, 1103,-32766,-32766, -276,-32766, 380, 381, 686, 488, 134,-32766,-32766, 222, 137,-32766, -32766,-32766, 116,-32766, -467,-32766, 32,-32766, -462, 769, - -32766, -499, 117, -499,-32766,-32766,-32766, 125, 122,-32766, + -32766, -501, 117, -501,-32766,-32766,-32766, 125, 122,-32766, -32766,-32766, 850, 851,-32766, 123, 43,-32766, 334, 411, 224, 8, 129,-32766, 769,-32766, 136, 212, 255, 686, 99, 100, 101,-32766, 239, 138,-32766,-32766,-32766,-32766, - -32766, 707,-32766, 708,-32766, 689, 102,-32766, 1117, 118, + -32766, 707,-32766, 708,-32766, 689, 102,-32766, 1119, 118, 139,-32766,-32766,-32766, -83,-32766,-32766,-32766,-32766, 250, -462,-32766, 686, 589,-32766, 334,-32766, 592, 124,-32766, -32766,-32766,-32766,-32766, -462,-32766, 766,-32766, 256,-32766, -32766, -462, 527, 528,-32766,-32766,-32766, 850, 851, 132, -32766,-32766, 306, 781,-32766, 883, 598,-32766, 334, 120, 258, 259,-32766, 292, 239,-32766, 102, 29, 221, 131, - -32766, 557, 686, 1128,-32766, 474, 686, 569, 684, 540, + -32766, 557, 686, 1130,-32766, 474, 686, 569, 684, 540, -32766, 687, 689,-32766,-32766,-32766, 525,-32766, 912,-32766, 469,-32766, 535, 270,-32766,-32766, 1019, 552,-32766,-32766, -32766, 791, 792, 268,-32766,-32766, -81, 10,-32766, 226, -32766,-32766, 334, 388, 267, 783, 686, 541, 553,-32766, -32766, 337, -428,-32766,-32766,-32766, -237,-32766, 0,-32766, 576,-32766, 0, 34,-32766, 0, 0, 0,-32766,-32766, - -32766, 24, 273, -493,-32766,-32766, 0, 0,-32766,-32766, - 0,-32766, 334, 1080, 1058, 0, 1060, 1051, 342,-32766, + -32766, 24, 273, -495,-32766,-32766, 0, 0,-32766,-32766, + 0,-32766, 334, 1082, 1058, 0, 1060, 1051, 342,-32766, 31, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, -419, 5, 24, -4, 12, 305, - 343, 346, -235, 0, 384, 471, 0, 1019, 1080,-32766, + 343, 346, -235, 0, 384, 471, 0, 1019, 1082,-32766, 356, 357, 1051,-32766,-32766,-32766, 35, 596, 597, 747, 824, 808, 941, 943, 433, 434, 815, 1041, 1042, 1043, 1044, 1038, 1039, -462,-32766, 878,-32766,-32766, 879, 1045, @@ -314,21 +314,21 @@ class Php7 extends \PhpParser\ParserAbstract 434, 580, 1041, 1042, 1043, 1044, 1038, 1039,-32766, 584, -32766,-32766,-32766,-32766, 1045, 1040, 585, -137, -137, -137, 587, 67, 591, 285, 286, 271, 276, 349, 350, 579, - -432, 593, -137, 743, -137, -462, -137, 1123, -137, 1125, + -432, 593, -137, 743, -137, -462, -137, 1125, -137, 1127, 368, 702, 351, 789, 701, 711, 788, 368, 265, -462, - 712, 709, 428, 429, 1124, 787, -462, -491, 1007, 428, + 712, 709, 428, 429, 1126, 787, -462, -493, 1007, 428, 429, 699, 790, 370, 371, 710, 776, 784, 742, 790, - 370, 371, -218, -218, -218, 774, 813, 814, 368, 1122, - 1081, 1074, 290,-32766,-32766,-32766, 1088, 769, 1093, -4, - 428, 429, 1096, -234, 769, -470, -137, 14, 1052, 742, + 370, 371, -218, -218, -218, 774, 813, 814, 368, 1124, + 1083, 1074, 290,-32766,-32766,-32766, 1090, 769, 1095, -4, + 428, 429, 1098, -234, 769, -470, -137, 14, 1052, 742, 790, 370, 371, -469,-32766, -468,-32766,-32766,-32766,-32766, -32766,-32766, 23, 25, 26, 33, 37, 41, 66, 70, 71, 72, 73, 74, 128, 769, 135, -218, 15, 140, 217, 243, 0, 244, 245, 246, 247, 248, 289, 352, - 354, 0, 16, 17, 19, 326, 402, 404, 407, 409, + 354, 0, 16, 17, 19, 327, 402, 404, 407, 409, 410, 417, 566, 1031, 980, 1049, 860, 1011, -92, 13, - 18, 22, 261, 325, 497, 521, 568, 984, 1026, 981, - 1099, 0, 997, 0, 1048, 1073, 1087, 1120, 531 + 18, 22, 261, 326, 497, 521, 568, 984, 1026, 981, + 1101, 0, 997, 0, 1048, 1073, 1089, 1122, 531 ); protected $actionCheck = array( @@ -460,9 +460,9 @@ class Php7 extends \PhpParser\ParserAbstract 410, 428, 410, 410, 410, 418, 418, 418, 357, 260, 122, 511, 260, 609, 638, 776, 540, 684, 541, 685, 323, 378, 562, 192, 563, 192, 192, 192, 454, 187, - 341, 764, 151, 550, 151, 151, 151, 151, 738, 151, - 151, 151, 151, 151, 151, 45, 151, 57, 425, 167, - 137, 137, 549, 137, 357, 529, 60, 632, 236, 529, + 341, 549, 764, 151, 550, 151, 151, 151, 151, 738, + 151, 151, 151, 151, 151, 151, 45, 151, 57, 425, + 167, 137, 137, 137, 357, 529, 60, 632, 236, 529, 529, 529, 633, 636, 58, 240, 637, 135, 396, 514, 514, 520, 520, 528, 537, 514, 514, 514, 514, 514, 719, 719, 520, 522, 520, 528, 724, 520, 537, 537, @@ -520,16 +520,16 @@ class Php7 extends \PhpParser\ParserAbstract 0, 0, 0, 0, 0, 0, 514, 514, 514, 522, 0, 514, 445, 0, 137, 151, 448, 343, 343, 343, 343, 0, 0, 514, 0, 514, 0, 0, 0, 0, - 0, 0, 537, 0, 719, 0, 0, 0, 0, 520, - 0, 0, 0, 0, 0, 0, 0, 0, 522, 0, - 0, 0, 0, 522, 0, 0, 519, 0, 523, 0, + 0, 0, 522, 537, 0, 719, 0, 0, 0, 0, + 520, 0, 0, 0, 0, 0, 0, 0, 0, 522, + 0, 0, 0, 0, 0, 0, 519, 0, 523, 0, 519, 519, 519, 523, 523, 0, 0, 523 ); protected $actionDefault = array( 3,32767,32767,32767,32767,32767,32767,32767,32767, 92, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767, 511, 511, 511, 511, 94,32767, + 32767,32767,32767,32767, 513, 513, 513, 513, 94,32767, 32767,32767,32767, 318, 318, 318,32767,32767, 460, 460, 460, 460, 460, 460,32767,32767,32767,32767,32767, 398, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, @@ -541,10 +541,10 @@ class Php7 extends \PhpParser\ParserAbstract 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767, 92,32767,32767,32767,32767,32767,32767,32767,32767, 94,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767,32767, 504,32767,32767,32767,32767, + 32767,32767,32767,32767,32767, 506,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767, 381, 382, 384, 385, 317, - 461, 510, 262, 507, 316, 130, 273, 264, 211, 243, + 461, 512, 262, 509, 316, 130, 273, 264, 211, 243, 313, 134, 346, 399, 348, 397, 401, 347, 323, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 321, 322, 400, 402, 403, 378, 377, 376, @@ -555,28 +555,28 @@ class Php7 extends \PhpParser\ParserAbstract 32767, 253,32767,32767,32767,32767,32767,32767,32767,32767, 454, 375, 353, 354, 352,32767, 431,32767,32767,32767, 32767,32767, 433,32767, 92,32767,32767,32767, 456, 341, - 343, 424, 505, 324, 508,32767,32767, 94, 418,32767, + 343, 424, 507, 324, 510,32767,32767, 94, 418,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, 455,32767,32767,32767, 92,32767,32767, 92, 174, 230, - 232, 179,32767, 436,32767,32767,32767,32767,32767,32767, + 232, 476, 179,32767, 436,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 32767,32767,32767,32767, 418, 363, 518,32767, 462, 355, + 32767,32767,32767,32767, 418, 363, 520,32767, 462, 355, 356, 357,32767,32767, 462, 462,32767, 462,32767,32767, 32767,32767,32767,32767, 179,32767,32767,32767,32767, 94, 434, 434, 92, 92, 92, 92, 429,32767, 179, 179, 32767,32767,32767,32767,32767, 179, 91, 91, 91, 91, 179, 179, 91, 194,32767, 192, 192, 91,32767, 93, - 93,32767, 93, 196,32767, 478, 196, 91, 179, 91, + 93,32767, 93, 196,32767, 480, 196, 91, 179, 91, 216, 216, 409, 181, 255, 93, 255, 255, 93, 409, 255, 179, 255, 91, 91,32767, 91, 255,32767,32767, 32767, 85,32767,32767,32767,32767,32767,32767,32767,32767, 32767,32767,32767,32767,32767,32767, 420,32767, 449,32767, - 466, 476,32767, 361, 362, 364, 464, 386, 387, 388, - 389, 390, 391, 392, 394, 506,32767, 423,32767,32767, - 32767, 87, 121, 272,32767, 516, 87, 421,32767, 516, + 466, 478,32767, 361, 362, 364, 464, 386, 387, 388, + 389, 390, 391, 392, 394, 508,32767, 423,32767,32767, + 32767, 87, 121, 272,32767, 518, 87, 421,32767, 518, 32767,32767,32767,32767,32767,32767,32767,32767,32767,32767, - 87, 87,32767,32767,32767,32767,32767,32767, 517,32767, - 462, 422,32767, 360, 445, 483,32767, 463, 509,32767, + 87, 87,32767,32767,32767,32767,32767,32767, 519,32767, + 462, 422,32767, 360, 445, 485,32767, 463, 511,32767, 32767,32767, 245, 247,32767, 87,32767,32767,32767,32767, 32767,32767,32767,32767,32767, 449,32767,32767,32767,32767, 32767,32767,32767, 462,32767,32767,32767,32767,32767,32767, @@ -603,45 +603,45 @@ class Php7 extends \PhpParser\ParserAbstract 199, 200, 201, 202, 203, 157, 204, 158, 174, 175, 176, 208, 177, 159, 160, 161, 178, 174, 162, 209, 143, 205, 163, 179, 206, 180, 181, 164, 562, 461, - 571, 764, 345, 539, 1114, 1114, 1016, 338, 279, 280, + 571, 764, 345, 539, 1116, 1116, 697, 338, 279, 280, 282, 490, 283, 344, 284, 347, 523, 513, 536, 466, - 466, 466, 495, 1114, 466, 455, 455, 455, 455, 297, - 847, 852, 853, 498, 515, 515, 481, 697, 466, 1050, + 466, 466, 495, 1116, 466, 455, 455, 455, 455, 847, + 852, 853, 297, 498, 515, 515, 481, 698, 466, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1050, 1068, - 1068, 798, 328, 570, 1068, 1068, 1068, 1068, 1068, 1068, - 1068, 1068, 1068, 1068, 1066, 1066, 759, 1017, 760, 1066, + 1068, 798, 329, 570, 1068, 1068, 1068, 1068, 1068, 1068, + 1068, 1068, 1068, 1068, 1066, 1066, 1005, 786, 1006, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 494, - 894, 574, 698, 466, 466, 556, 892, 1018, 1076, 480, - 505, 466, 466, 466, 330, 331, 1005, 786, 544, 1006, - 333, 733, 446, 446, 724, 293, 467, 446, 446, 446, + 894, 574, 272, 466, 466, 556, 892, 254, 733, 480, + 505, 466, 466, 466, 331, 332, 685, 759, 544, 760, + 333, 487, 446, 446, 724, 293, 467, 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, 479, 491, 492, - 272, 509, 595, 522, 524, 254, 685, 537, 555, 558, - 834, 565, 573, 830, 457, 457, 696, 1090, 1091, 901, - 520, 724, 902, 724, 532, 533, 806, 823, 804, 804, - 802, 804, 594, 700, 458, 832, 827, 316, 320, 473, - 496, 499, 487, 800, 800, 800, 800, 3, 4, 794, - 801, 705, 295, 755, 750, 751, 765, 1103, 706, 752, - 703, 753, 754, 704, 862, 758, 390, 314, 715, 715, - 1113, 1113, 538, 975, 725, 725, 725, 727, 714, 504, - 516, 518, 519, 567, 318, 459, 1129, 842, 916, 1113, - 510, 472, 857, 837, 837, 353, 482, 483, 302, 463, - 529, 1089, 720, 719, 298, 299, 713, 324, 1116, 294, - 1020, 1020, 717, 867, 403, 849, 849, 849, 849, 849, - 849, 849, 849, 849, 599, 1095, 1095, 11, 1013, 849, - 849, 849, 1008, 543, 729, 1086, 1086, 811, 542, 1020, - 1020, 1020, 1020, 559, 871, 1020, 1020, 396, 512, 911, - 412, 0, 1097, 1097, 0, 728, 716, 866, 0, 0, - 870, 772, 0, 0, 773, 809, 0, 0, 0, 0, - 0, 0, 0, 1082, 463, 839, 0, 799, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 478, 0, - 0, 909, 732, 0, 1012, 0, 0, 0, 0, 0, - 869, 0, 1084, 1084, 869, 0, 0, 0, 0, 0, + 806, 509, 595, 522, 524, 1092, 1093, 537, 555, 558, + 834, 565, 573, 830, 728, 716, 866, 901, 295, 870, + 902, 724, 1105, 724, 809, 862, 696, 317, 321, 473, + 496, 499, 1016, 700, 839, 315, 799, 823, 804, 804, + 802, 804, 594, 390, 458, 832, 827, 538, 1115, 1115, + 909, 732, 705, 1012, 755, 750, 751, 765, 975, 706, + 752, 703, 753, 754, 704, 842, 758, 1115, 715, 715, + 457, 457, 3, 4, 725, 725, 725, 727, 714, 504, + 516, 518, 519, 567, 319, 459, 1118, 857, 302, 353, + 529, 472, 1017, 837, 837, 1091, 482, 483, 720, 800, + 800, 800, 800, 294, 325, 794, 801, 298, 299, 717, + 1020, 1020, 1018, 1076, 403, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 1131, 1097, 1097, 11, 867, 849, + 849, 849, 916, 599, 510, 1088, 1088, 463, 543, 1020, + 1020, 1020, 1020, 1013, 520, 1020, 1020, 719, 532, 533, + 713, 1008, 1099, 1099, 729, 811, 871, 396, 512, 911, + 1078, 772, 412, 0, 773, 0, 0, 0, 0, 0, + 0, 0, 0, 1084, 0, 0, 0, 542, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 478, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 460, 476, 0, 0, 0, 1015, 0, 0, 0, - 0, 0, 460, 0, 476, 0, 0, 317, 0, 0, + 869, 0, 1086, 1086, 869, 0, 0, 0, 0, 0, + 0, 0, 463, 0, 0, 0, 0, 0, 0, 0, + 0, 460, 476, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 460, 0, 476, 0, 0, 318, 0, 0, 464, 383, 0, 385, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 723, 0, - 0, 1121 + 0, 1123, 0, 0, 1015 ); protected $gotoCheck = array( @@ -657,83 +657,83 @@ class Php7 extends \PhpParser\ParserAbstract 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 63, 10, - 8, 13, 56, 56, 150, 150, 93, 56, 56, 56, + 8, 13, 56, 56, 151, 151, 17, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 46, 46, 10, - 10, 10, 98, 150, 10, 85, 85, 85, 85, 80, - 91, 91, 91, 85, 86, 86, 10, 17, 10, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 137, - 137, 76, 76, 76, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 138, 138, 55, 93, 55, 138, - 138, 138, 138, 138, 138, 138, 138, 138, 138, 7, - 7, 7, 18, 10, 10, 7, 7, 93, 93, 10, - 10, 10, 10, 10, 69, 69, 67, 67, 69, 67, - 69, 36, 140, 140, 26, 69, 10, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 39, 10, 2, - 136, 2, 39, 39, 39, 136, 5, 39, 39, 39, - 39, 39, 39, 39, 75, 75, 16, 145, 145, 112, - 73, 26, 112, 26, 73, 73, 40, 16, 16, 16, - 16, 16, 16, 13, 16, 16, 16, 49, 49, 49, - 49, 49, 139, 75, 75, 75, 75, 37, 37, 75, - 75, 13, 146, 13, 13, 13, 13, 148, 13, 13, - 13, 13, 13, 13, 95, 13, 117, 52, 26, 26, - 149, 149, 54, 120, 26, 26, 26, 26, 26, 68, - 68, 68, 68, 68, 65, 65, 12, 88, 15, 149, - 15, 65, 90, 85, 85, 89, 65, 65, 20, 12, - 24, 143, 30, 15, 80, 80, 15, 19, 149, 11, - 63, 63, 28, 97, 65, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 82, 8, 8, 65, 129, 63, - 63, 63, 126, 23, 32, 98, 98, 79, 12, 63, - 63, 63, 63, 12, 100, 63, 63, 71, 72, 115, - 124, -1, 98, 98, -1, 14, 14, 14, -1, -1, - 14, 63, -1, -1, 63, 14, -1, -1, -1, -1, - -1, -1, -1, 98, 12, 14, -1, 14, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, - -1, 14, 14, -1, 14, -1, -1, -1, -1, -1, - 98, -1, 98, 98, 98, -1, -1, -1, -1, -1, + 10, 10, 99, 151, 10, 86, 86, 86, 86, 92, + 92, 92, 81, 86, 87, 87, 10, 18, 10, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 138, + 138, 77, 77, 77, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 139, 139, 68, 68, 68, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 7, + 7, 7, 137, 10, 10, 7, 7, 137, 36, 10, + 10, 10, 10, 10, 70, 70, 5, 55, 70, 55, + 70, 140, 141, 141, 26, 70, 10, 141, 141, 141, + 141, 141, 141, 141, 141, 141, 141, 39, 10, 2, + 40, 2, 39, 39, 39, 146, 146, 39, 39, 39, + 39, 39, 39, 39, 14, 14, 14, 113, 147, 14, + 113, 26, 149, 26, 14, 96, 16, 49, 49, 49, + 49, 49, 94, 13, 14, 52, 14, 16, 16, 16, + 16, 16, 16, 118, 16, 16, 16, 54, 150, 150, + 14, 14, 13, 14, 13, 13, 13, 13, 121, 13, + 13, 13, 13, 13, 13, 89, 13, 150, 26, 26, + 76, 76, 37, 37, 26, 26, 26, 26, 26, 69, + 69, 69, 69, 69, 66, 66, 150, 91, 20, 90, + 24, 66, 94, 86, 86, 144, 66, 66, 30, 76, + 76, 76, 76, 11, 19, 76, 76, 81, 81, 28, + 63, 63, 94, 94, 66, 63, 63, 63, 63, 63, + 63, 63, 63, 63, 12, 8, 8, 66, 98, 63, + 63, 63, 15, 83, 15, 99, 99, 12, 23, 63, + 63, 63, 63, 130, 74, 63, 63, 15, 74, 74, + 15, 127, 99, 99, 32, 80, 101, 72, 73, 116, + 12, 63, 125, -1, 63, -1, -1, -1, -1, -1, + -1, -1, -1, 99, -1, -1, -1, 12, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 8, 8, -1, -1, -1, 12, -1, -1, -1, + 99, -1, 99, 99, 99, -1, -1, -1, -1, -1, + -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, + -1, 8, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, 8, -1, -1, 8, -1, -1, 8, 8, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, - -1, 8 + -1, 8, -1, -1, 12 ); protected $gotoBase = array( - 0, 0, -338, 0, 0, 236, 0, 194, 110, 0, - -146, 59, 51, -21, 18, -62, 254, 155, 200, 45, - 73, 0, 0, 23, 54, 0, -41, 0, 48, 0, - 55, 0, 12, -23, 0, 0, 212, -312, 0, -339, - 247, 0, 0, 0, 0, 0, 103, 0, 0, 238, - 0, 0, 271, 0, 99, 171, -90, 0, 0, 0, - 0, 0, 0, 112, 0, -44, 0, -114, 75, -192, - 0, 1, -8, -320, 0, 16, -97, 0, 0, 13, - -252, 0, 35, 0, 0, 121, -58, 0, 78, 84, - 82, -107, 0, -187, 0, 276, 0, 46, 137, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 22, 0, 0, 24, 0, 269, 0, 0, - 74, 0, 0, 0, -19, 0, 11, 0, 0, 14, - 0, 0, 0, 0, 0, 0, -26, -43, -28, 257, - 10, 0, 0, 85, 0, -48, 266, 0, 270, 57, - -129, 0, 0 + 0, 0, -338, 0, 0, 206, 0, 194, 110, 0, + -146, 53, 89, -21, -123, -18, 264, 124, 155, 42, + 63, 0, 0, 28, 44, 0, -41, 0, 45, 0, + 51, 0, 32, -23, 0, 0, 199, -287, 0, -339, + 221, 0, 0, 0, 0, 0, 103, 0, 0, 228, + 0, 0, 239, 0, 74, 202, -90, 0, 0, 0, + 0, 0, 0, 112, 0, 0, -44, 0, -145, 75, + -192, 0, 11, 2, -196, 0, 72, -97, 0, 0, + 31, -249, 0, 43, 0, 0, 121, -58, 0, 56, + 78, 77, -108, 0, -42, 0, 237, 0, 61, 137, + 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 34, 0, 246, 0, + 0, 59, 0, 0, 0, -7, 0, 30, 0, 0, + 29, 0, 0, 0, 0, 0, 0, -64, -43, -28, + 196, 10, 0, 0, 79, 0, -60, 232, 0, 235, + 35, -129, 0, 0 ); protected $gotoDefault = array( -32768, 418, 602, 2, 603, 675, 683, 547, 435, 572, - 436, 462, 336, 757, 915, 777, 739, 740, 741, 321, - 358, 312, 319, 530, 517, 408, 726, 378, 718, 405, + 436, 462, 336, 757, 915, 777, 739, 740, 741, 322, + 358, 313, 320, 530, 517, 408, 726, 378, 718, 405, 721, 377, 730, 141, 548, 414, 734, 1, 736, 468, - 768, 309, 744, 310, 551, 746, 475, 748, 749, 315, - 322, 323, 920, 484, 514, 761, 215, 477, 762, 308, - 763, 771, 332, 313, 389, 415, 327, 896, 501, 526, - 373, 393, 511, 506, 486, 1028, 796, 399, 387, 810, - 296, 818, 600, 826, 829, 437, 438, 397, 841, 398, - 855, 502, 503, 1036, 392, 861, 379, 868, 1072, 382, - 872, 237, 875, 251, 545, 348, 880, 881, 6, 886, - 563, 564, 7, 240, 413, 910, 546, 376, 485, 926, - 361, 994, 996, 470, 406, 1009, 386, 554, 416, 1014, - 1075, 374, 439, 394, 281, 440, 253, 300, 278, 456, - 260, 301, 441, 395, 1078, 1085, 277, 27, 1104, 1115, - 291, 489, 508 + 768, 309, 744, 310, 551, 746, 475, 748, 749, 316, + 323, 324, 920, 484, 514, 761, 215, 477, 762, 308, + 763, 771, 311, 314, 559, 389, 415, 328, 896, 501, + 526, 373, 393, 511, 506, 486, 1028, 796, 399, 387, + 810, 296, 818, 600, 826, 829, 437, 438, 397, 841, + 398, 855, 502, 503, 1036, 392, 861, 379, 868, 1072, + 382, 872, 237, 875, 251, 545, 348, 880, 881, 6, + 886, 563, 564, 7, 240, 413, 910, 546, 376, 485, + 926, 361, 994, 996, 470, 406, 1009, 386, 554, 416, + 1014, 1075, 374, 439, 394, 281, 440, 253, 300, 278, + 456, 260, 301, 441, 395, 1080, 1087, 277, 27, 1106, + 1117, 291, 489, 508 ); protected $ruleToNonTerminal = array( @@ -754,21 +754,21 @@ class Php7 extends \PhpParser\ParserAbstract 38, 38, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 16, 16, 59, - 59, 62, 62, 61, 60, 60, 53, 64, 64, 65, - 65, 66, 66, 67, 67, 17, 18, 18, 18, 70, - 70, 70, 71, 71, 74, 74, 72, 72, 76, 77, - 77, 47, 47, 55, 55, 58, 58, 58, 57, 78, - 78, 79, 48, 48, 48, 48, 80, 80, 81, 81, - 82, 82, 45, 45, 41, 41, 83, 43, 43, 84, - 42, 42, 44, 44, 54, 54, 54, 54, 68, 68, - 87, 87, 88, 88, 88, 90, 90, 90, 91, 91, - 91, 92, 92, 89, 89, 69, 69, 69, 93, 93, - 94, 94, 95, 95, 95, 50, 96, 96, 97, 51, - 99, 99, 100, 100, 101, 101, 73, 102, 102, 102, - 102, 102, 107, 107, 108, 108, 109, 109, 109, 109, - 109, 110, 111, 111, 106, 106, 103, 103, 105, 105, - 113, 113, 112, 112, 112, 112, 112, 112, 104, 114, - 114, 116, 115, 115, 52, 118, 117, 117, 46, 46, + 59, 62, 62, 61, 60, 60, 53, 65, 65, 66, + 66, 67, 67, 68, 68, 17, 18, 18, 18, 71, + 71, 71, 72, 72, 75, 75, 73, 73, 77, 78, + 78, 47, 47, 55, 55, 58, 58, 58, 57, 79, + 79, 80, 48, 48, 48, 48, 81, 81, 82, 82, + 83, 83, 45, 45, 41, 41, 84, 43, 43, 85, + 42, 42, 44, 44, 54, 54, 54, 54, 69, 69, + 88, 88, 89, 89, 89, 91, 91, 91, 92, 92, + 92, 93, 93, 90, 90, 70, 70, 70, 94, 94, + 95, 95, 96, 96, 96, 50, 97, 97, 98, 51, + 100, 100, 101, 101, 102, 102, 74, 103, 103, 103, + 103, 103, 108, 108, 109, 109, 110, 110, 110, 110, + 110, 111, 112, 112, 107, 107, 104, 104, 106, 106, + 114, 114, 113, 113, 113, 113, 113, 113, 105, 115, + 115, 117, 116, 116, 52, 119, 118, 118, 46, 46, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, @@ -777,19 +777,20 @@ class Php7 extends \PhpParser\ParserAbstract 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 125, 119, 119, 124, - 124, 127, 128, 128, 129, 130, 130, 130, 75, 75, - 63, 63, 63, 120, 120, 120, 120, 132, 132, 121, - 121, 123, 123, 123, 126, 126, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 138, 138, 86, 140, 140, - 140, 140, 122, 122, 122, 122, 122, 122, 122, 122, - 49, 49, 135, 135, 135, 135, 141, 141, 131, 131, - 131, 142, 142, 142, 142, 142, 56, 56, 56, 98, - 98, 98, 98, 145, 144, 134, 134, 134, 134, 134, - 134, 133, 133, 133, 143, 143, 143, 143, 85, 139, - 147, 147, 146, 146, 148, 148, 148, 148, 148, 148, - 148, 148, 136, 136, 136, 136, 150, 151, 149, 149, - 149, 149, 149, 149, 149, 152, 152, 152, 152 + 33, 33, 33, 33, 33, 33, 126, 120, 120, 125, + 125, 128, 129, 129, 130, 131, 131, 131, 76, 76, + 63, 63, 63, 121, 121, 121, 121, 133, 133, 122, + 122, 124, 124, 124, 127, 127, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 139, 139, 87, 141, 141, + 141, 141, 123, 123, 123, 123, 123, 123, 123, 123, + 49, 49, 136, 136, 136, 136, 142, 142, 132, 132, + 132, 143, 143, 143, 143, 143, 64, 64, 56, 56, + 56, 99, 99, 99, 99, 146, 145, 135, 135, 135, + 135, 135, 135, 134, 134, 134, 144, 144, 144, 144, + 86, 140, 148, 148, 147, 147, 149, 149, 149, 149, + 149, 149, 149, 149, 137, 137, 137, 137, 151, 152, + 150, 150, 150, 150, 150, 150, 150, 153, 153, 153, + 153 ); protected $ruleToLength = array( @@ -840,12 +841,13 @@ class Php7 extends \PhpParser\ParserAbstract 1, 1, 1, 1, 1, 3, 3, 3, 4, 1, 1, 3, 1, 1, 1, 1, 1, 3, 2, 3, 0, 1, 1, 3, 1, 1, 1, 1, 1, 3, - 1, 1, 4, 4, 1, 4, 1, 1, 3, 1, - 4, 2, 2, 1, 3, 1, 4, 4, 3, 3, - 3, 1, 3, 1, 1, 3, 1, 1, 4, 1, - 1, 1, 3, 1, 1, 2, 1, 3, 4, 3, - 2, 0, 2, 2, 1, 2, 1, 1, 1, 4, - 3, 3, 3, 6, 3, 1, 1, 2, 1 + 1, 1, 4, 4, 1, 4, 0, 1, 1, 1, + 3, 1, 4, 2, 2, 1, 3, 1, 4, 4, + 3, 3, 3, 1, 3, 1, 1, 3, 1, 1, + 4, 1, 1, 1, 3, 1, 1, 2, 1, 3, + 4, 3, 2, 0, 2, 2, 1, 2, 1, 1, + 1, 4, 3, 3, 3, 6, 3, 1, 1, 2, + 1 ); protected function initReduceCallbacks() { @@ -2309,162 +2311,168 @@ class Php7 extends \PhpParser\ParserAbstract $this->semValue = new Expr\MethodCall($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->semStack[$stackPos-(4-4)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 476 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = null; }, 477 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 478 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 479 => function ($stackPos) { - $this->semValue = substr($this->semStack[$stackPos-(1-1)], 1); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 480 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(4-3)]; - }, - 481 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); - }, - 482 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); $this->errorState = 2; - }, - 483 => function ($stackPos) { - $var = $this->semStack[$stackPos-(1-1)]; $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; - }, - 484 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); - }, - 485 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 486 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 487 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); - }, - 488 => function ($stackPos) { $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, - 489 => function ($stackPos) { + 481 => function ($stackPos) { + $this->semValue = substr($this->semStack[$stackPos-(1-1)], 1); + }, + 482 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(4-3)]; + }, + 483 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 484 => function ($stackPos) { + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); $this->errorState = 2; + }, + 485 => function ($stackPos) { + $var = $this->semStack[$stackPos-(1-1)]; $this->semValue = \is_string($var) ? new Node\VarLikeIdentifier($var, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes) : $var; + }, + 486 => function ($stackPos) { $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, + 487 => function ($stackPos) { + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 488 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, + 489 => function ($stackPos) { + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + }, 490 => function ($stackPos) { - $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 491 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 492 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\StaticPropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 493 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); - }, - 494 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, - 495 => function ($stackPos) { + 494 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(3-2)]; }, - 496 => function ($stackPos) { + 495 => function ($stackPos) { $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, + 496 => function ($stackPos) { + $this->semValue = $this->semStack[$stackPos-(1-1)]; + }, 497 => function ($stackPos) { - $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 498 => function ($stackPos) { - $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 499 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end] === null) array_pop($this->semValue); + $this->semValue = new Expr\Error($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2; }, 500 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos]; + $this->semValue = new Expr\List_($this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 501 => function ($stackPos) { - /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ + $this->semValue = $this->semStack[$stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end] === null) array_pop($this->semValue); }, 502 => function ($stackPos) { - $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; + $this->semValue = $this->semStack[$stackPos]; }, 503 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + /* do nothing -- prevent default action of $$=$this->semStack[$1]. See $551. */ }, 504 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semStack[$stackPos-(3-1)][] = $this->semStack[$stackPos-(3-3)]; $this->semValue = $this->semStack[$stackPos-(3-1)]; }, 505 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 506 => function ($stackPos) { $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 507 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 508 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(1-1)], null, false, $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 509 => function ($stackPos) { $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 510 => function ($stackPos) { - $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(4-4)], $this->semStack[$stackPos-(4-1)], true, $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 511 => function ($stackPos) { - $this->semValue = null; + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(3-3)], $this->semStack[$stackPos-(3-1)], false, $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 512 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + $this->semValue = new Expr\ArrayItem($this->semStack[$stackPos-(2-2)], null, false, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, true, $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); }, 513 => function ($stackPos) { - $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; + $this->semValue = null; }, 514 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(1-1)]); + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 515 => function ($stackPos) { - $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); + $this->semStack[$stackPos-(2-1)][] = $this->semStack[$stackPos-(2-2)]; $this->semValue = $this->semStack[$stackPos-(2-1)]; }, 516 => function ($stackPos) { - $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = array($this->semStack[$stackPos-(1-1)]); }, 517 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); }, 518 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(1-1)]; + $this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 519 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 520 => function ($stackPos) { - $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(1-1)]; }, 521 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(4-1)], $this->semStack[$stackPos-(4-3)], $this->startAttributeStack[$stackPos-(4-1)] + $this->endAttributes); }, 522 => function ($stackPos) { - $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); + $this->semValue = new Expr\PropertyFetch($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 523 => function ($stackPos) { - $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 524 => function ($stackPos) { - $this->semValue = $this->semStack[$stackPos-(3-2)]; + $this->semValue = new Expr\Variable($this->semStack[$stackPos-(3-2)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes); }, 525 => function ($stackPos) { - $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = new Expr\ArrayDimFetch($this->semStack[$stackPos-(6-2)], $this->semStack[$stackPos-(6-4)], $this->startAttributeStack[$stackPos-(6-1)] + $this->endAttributes); }, 526 => function ($stackPos) { - $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + $this->semValue = $this->semStack[$stackPos-(3-2)]; }, 527 => function ($stackPos) { - $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + $this->semValue = new Scalar\String_($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); }, 528 => function ($stackPos) { + $this->semValue = $this->parseNumString($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); + }, + 529 => function ($stackPos) { + $this->semValue = $this->parseNumString('-' . $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes); + }, + 530 => function ($stackPos) { $this->semValue = $this->semStack[$stackPos-(1-1)]; }, ]; diff --git a/lib/PhpParser/PrettyPrinter/Standard.php b/lib/PhpParser/PrettyPrinter/Standard.php index 133496f..eb357d1 100644 --- a/lib/PhpParser/PrettyPrinter/Standard.php +++ b/lib/PhpParser/PrettyPrinter/Standard.php @@ -817,8 +817,8 @@ class Standard extends PrettyPrinterAbstract } protected function pStmt_Catch(Stmt\Catch_ $node) { - return 'catch (' . $this->pImplode($node->types, '|') . ' ' - . $this->p($node->var) + return 'catch (' . $this->pImplode($node->types, '|') + . ($node->var !== null ? ' ' . $this->p($node->var) : '') . ') {' . $this->pStmts($node->stmts) . $this->nl . '}'; } diff --git a/test/code/parser/stmt/tryCatch_without_variable.test b/test/code/parser/stmt/tryCatch_without_variable.test new file mode 100644 index 0000000..323dfb4 --- /dev/null +++ b/test/code/parser/stmt/tryCatch_without_variable.test @@ -0,0 +1,32 @@ +Try/Catch without variable +----- +