diff vendor/nikic/php-parser/test/code/parser/stmt/namespace/mix.test @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/namespace/mix.test	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,103 @@
+Namespace types cannot be mixed
+-----
+<?php
+namespace A;
+echo 1;
+namespace B {
+    echo 2;
+}
+echo 3;
+-----
+Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 4
+array(
+    0: Stmt_Namespace(
+        name: Name(
+            parts: array(
+                0: A
+            )
+        )
+        stmts: array(
+            0: Stmt_Echo(
+                exprs: array(
+                    0: Scalar_LNumber(
+                        value: 1
+                    )
+                )
+            )
+        )
+    )
+    1: Stmt_Namespace(
+        name: Name(
+            parts: array(
+                0: B
+            )
+        )
+        stmts: array(
+            0: Stmt_Echo(
+                exprs: array(
+                    0: Scalar_LNumber(
+                        value: 2
+                    )
+                )
+            )
+        )
+    )
+    2: Stmt_Echo(
+        exprs: array(
+            0: Scalar_LNumber(
+                value: 3
+            )
+        )
+    )
+)
+-----
+<?php
+namespace A {
+    echo 1;
+}
+echo 2;
+namespace B;
+echo 3;
+-----
+Cannot mix bracketed namespace declarations with unbracketed namespace declarations on line 6
+array(
+    0: Stmt_Namespace(
+        name: Name(
+            parts: array(
+                0: A
+            )
+        )
+        stmts: array(
+            0: Stmt_Echo(
+                exprs: array(
+                    0: Scalar_LNumber(
+                        value: 1
+                    )
+                )
+            )
+        )
+    )
+    1: Stmt_Echo(
+        exprs: array(
+            0: Scalar_LNumber(
+                value: 2
+            )
+        )
+    )
+    2: Stmt_Namespace(
+        name: Name(
+            parts: array(
+                0: B
+            )
+        )
+        stmts: array(
+            0: Stmt_Echo(
+                exprs: array(
+                    0: Scalar_LNumber(
+                        value: 3
+                    )
+                )
+            )
+        )
+    )
+)
\ No newline at end of file