-
- {% for link in section[1] %}
-
- - {{ link[0] }} - - {% endfor %} -
printFormatPreserving($newStmts, $oldStmts, $oldTokens);
+ $this->assertSame(canonicalize($expected), canonicalize($newCode), $name);
+ }
+
+ public function provideTestFormatPreservingPrint() {
+ return $this->getTests(__DIR__ . '/../code/formatPreservation', 'test', 3);
+ }
+
+ /**
+ * @dataProvider provideTestRoundTripPrint
+ * @covers \PhpParser\PrettyPrinter\Standard
+ */
+ public function testRoundTripPrint($name, $code, $expected, $modeLine) {
+ /**
+ * This test makes sure that the format-preserving pretty printer round-trips for all
+ * the pretty printer tests (i.e. returns the input if no changes occurred).
+ */
+
+ list($version) = $this->parseModeLine($modeLine);
+
+ $lexer = new Lexer\Emulative([
+ 'usedAttributes' => [
+ 'comments',
+ 'startLine', 'endLine',
+ 'startTokenPos', 'endTokenPos',
+ ],
+ ]);
+
+ $parserClass = $version === 'php5' ? Parser\Php5::class : Parser\Php7::class;
+ /** @var Parser $parser */
+ $parser = new $parserClass($lexer);
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(new NodeVisitor\CloningVisitor());
+
+ $printer = new PrettyPrinter\Standard();
+
+ try {
+ $oldStmts = $parser->parse($code);
+ } catch (Error $e) {
+ // Can't do a format-preserving print on a file with errors
+ return;
+ }
+
+ $oldTokens = $lexer->getTokens();
+
+ $newStmts = $traverser->traverse($oldStmts);
+
+ $newCode = $printer->printFormatPreserving($newStmts, $oldStmts, $oldTokens);
+ $this->assertSame(canonicalize($code), canonicalize($newCode), $name);
+ }
+
+ public function provideTestRoundTripPrint() {
+ return array_merge(
+ $this->getTests(__DIR__ . '/../code/prettyPrinter', 'test'),
+ $this->getTests(__DIR__ . '/../code/parser', 'test')
+ );
+ }
}
diff --git a/vendor/nikic/php-parser/test/PhpParser/Serializer/XMLTest.php b/vendor/nikic/php-parser/test/PhpParser/Serializer/XMLTest.php
deleted file mode 100644
index e1186f4d..00000000
--- a/vendor/nikic/php-parser/test/PhpParser/Serializer/XMLTest.php
+++ /dev/null
@@ -1,172 +0,0 @@
-
- */
- public function testSerialize() {
- $code = <<
-
-
-
-
- 4
-
-
-
- // comment
-
- /** doc comment */
-
-
-
- 6
-
-
-
-
-
- functionName
-
-
-
-
-
- 4
-
-
- 4
-
-
-
-
-
-
-
-
-
-
-
- a
-
-
-
-
- 4
-
-
- 4
-
-
- 10
-
-
- 0
-
-
-
-
-
-
- 4
-
-
- 4
-
-
-
-
-
-
-
-
-
-
-
- b
-
-
-
-
- 4
-
-
- 4
-
-
- 1
-
-
-
-
-
-
-
-
-
-
-
-
-
- 5
-
-
- 5
-
-
-
-
-
- 5
-
-
- 5
-
-
- 1
-
-
- Foo
-
-
-
-
-
-
-
-
-
-
-XML;
-
- $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer);
- $serializer = new XML;
-
- $code = str_replace("\r\n", "\n", $code);
- $stmts = $parser->parse($code);
- $this->assertXmlStringEqualsXmlString($xml, $serializer->serialize($stmts));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Unexpected node type
- */
- public function testError() {
- $serializer = new XML;
- $serializer->serialize(array(new \stdClass));
- }
-}
diff --git a/vendor/nikic/php-parser/test/PhpParser/Unserializer/XMLTest.php b/vendor/nikic/php-parser/test/PhpParser/Unserializer/XMLTest.php
deleted file mode 100644
index 3bc86dbe..00000000
--- a/vendor/nikic/php-parser/test/PhpParser/Unserializer/XMLTest.php
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
- 1
-
-
-
- // comment
-
- /** doc comment */
-
-
-
- Test
-
-
-
-XML;
-
- $unserializer = new XML;
- $this->assertEquals(
- new Scalar\String_('Test', array(
- 'startLine' => 1,
- 'comments' => array(
- new Comment('// comment' . "\n", 2),
- new Comment\Doc('/** doc comment */', 3),
- ),
- )),
- $unserializer->unserialize($xml)
- );
- }
-
- public function testEmptyNode() {
- $xml = <<
-
-
-
-XML;
-
- $unserializer = new XML;
-
- $this->assertEquals(
- new Scalar\MagicConst\Class_,
- $unserializer->unserialize($xml)
- );
- }
-
- public function testScalars() {
- $xml = <<
-
-
-
-
- test
-
-
- 1
- 1
- 1.5
-
-
-
-
-
-XML;
- $result = array(
- array(), array(),
- 'test', '', '',
- 1,
- 1, 1.5,
- true, false, null
- );
-
- $unserializer = new XML;
- $this->assertEquals($result, $unserializer->unserialize($xml));
- }
-
- /**
- * @expectedException \DomainException
- * @expectedExceptionMessage AST root element not found
- */
- public function testWrongRootElementError() {
- $xml = <<
-
-XML;
-
- $unserializer = new XML;
- $unserializer->unserialize($xml);
- }
-
- /**
- * @dataProvider provideTestErrors
- */
- public function testErrors($xml, $errorMsg) {
- $this->setExpectedException('DomainException', $errorMsg);
-
- $xml = <<
-
- $xml
-
-XML;
-
- $unserializer = new XML;
- $unserializer->unserialize($xml);
- }
-
- public function provideTestErrors() {
- return array(
- array('test ', '"true" scalar must be empty'),
- array('test ', '"false" scalar must be empty'),
- array('test ', '"null" scalar must be empty'),
- array('bar ', 'Unknown scalar type "foo"'),
- array('x ', '"x" is not a valid int'),
- array('x ', '"x" is not a valid float'),
- array('', 'Expected node or scalar'),
- array('test ', 'Unexpected node of type "foo:bar"'),
- array(
- 'test ',
- 'Expected sub node or attribute, got node of type "foo:bar"'
- ),
- array(
- ' ',
- 'Expected node or scalar'
- ),
- array(
- ' ',
- 'Unknown node type "Foo"'
- ),
- );
- }
-}
diff --git a/vendor/nikic/php-parser/test/bootstrap.php b/vendor/nikic/php-parser/test/bootstrap.php
index 9526b648..0bfa9d0a 100644
--- a/vendor/nikic/php-parser/test/bootstrap.php
+++ b/vendor/nikic/php-parser/test/bootstrap.php
@@ -18,3 +18,14 @@ function canonicalize($str) {
}, $lines);
return implode("\n", $lines);
}
+
+function filesInDir($directory, $fileExtension) {
+ $directory = realpath($directory);
+ $it = new \RecursiveDirectoryIterator($directory);
+ $it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::LEAVES_ONLY);
+ $it = new \RegexIterator($it, '(\.' . preg_quote($fileExtension) . '$)');
+ foreach ($it as $file) {
+ $fileName = $file->getPathname();
+ yield $fileName => file_get_contents($fileName);
+ }
+}
diff --git a/vendor/nikic/php-parser/test/code/formatPreservation/anonClasses.test b/vendor/nikic/php-parser/test/code/formatPreservation/anonClasses.test
new file mode 100644
index 00000000..7551059f
--- /dev/null
+++ b/vendor/nikic/php-parser/test/code/formatPreservation/anonClasses.test
@@ -0,0 +1,16 @@
+Anonymous classes
+-----
+expr;
+$new->class->extends = null;
+$new->args[] = new Expr\Variable('y');
+-----
+exprs[0]->left->right->value = 42;
+-----
+name = new Node\Identifier('bar');
+-----
+byRef = true;
+-----
+byRef = true;
+-----
+stmts[0];
+$stmts[0]->stmts[0] = $stmts[1];
+$stmts[1] = $tmp;
+-----
+stmts[0];
+$stmts[1]->stmts[0] = $stmts[2];
+$stmts[2] = $tmp;
+// Same test, but also removing first statement, triggering fallback
+array_splice($stmts, 0, 1, []);
+-----
+exprs[0] = new Expr\ConstFetch(new Node\Name('C'));
+-----
+exprs[0]->parts[0] = new Expr\Variable('bar');
+$stmts[1]->exprs[0]->parts[0] = new Expr\Variable('bar');
+-----
+stmts[] = new Stmt\Expression(new Expr\Variable('c'));
+-----
+stmts[] = new Stmt\Expression(new Expr\Variable('c'));
+-----
+setAttribute('comments', []);
+-----
+getComments();
+$comments[] = new Comment("// foo");
+$stmts[1]->setAttribute('comments', $comments);
+-----
+stmts[0];
+$method->setAttribute('comments', [new Comment\Doc("/**\n *\n */")]);
+-----
+expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+// The parens here are "correct", because add is left assoc
+$stmts[1]->expr->right = new Expr\BinaryOp\Plus(new Expr\Variable('b'), new Expr\Variable('c'));
+// No parens necessary
+$stmts[2]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+// Parens for RHS not strictly necessary due to assign speciality
+$stmts[3]->expr->cond = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[3]->expr->if = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[3]->expr->else = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
+// Already has parens
+$stmts[4]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[5]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+-----
+ bar;
+$foo -> bar;
+$foo -> bar;
+$foo -> bar;
+$foo -> bar;
+self :: $foo;
+self :: $foo;
+-----
+$stmts[0]->expr->name = new Expr\Variable('a');
+$stmts[1]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[2]->expr->var = new Expr\Variable('bar');
+$stmts[3]->expr->var = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[4]->expr->name = new Node\Identifier('foo');
+// In this case the braces are not strictly necessary. However, on PHP 5 they may be required
+// depending on where the property fetch node itself occurs.
+$stmts[5]->expr->name = new Expr\Variable('bar');
+$stmts[6]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[7]->expr->name = new Node\VarLikeIdentifier('bar');
+$stmts[8]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+-----
+ bar;
+($a . $b) -> bar;
+$foo -> foo;
+$foo -> {$bar};
+$foo -> {$a . $b};
+self :: $bar;
+self :: ${$a . $b};
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/formatPreservation/inlineHtml.test b/vendor/nikic/php-parser/test/code/formatPreservation/inlineHtml.test
new file mode 100644
index 00000000..7494e535
--- /dev/null
+++ b/vendor/nikic/php-parser/test/code/formatPreservation/inlineHtml.test
@@ -0,0 +1,54 @@
+Handling of inline HTML
+-----
+FoosetAttribute('origNode', null);
+-----
+FooBarstmts[2] = $stmts[0]->stmts[1];
+-----
+BarBarstmts[1] = $stmts[0]->stmts[2];
+-----
+returnType = new Node\Name('Foo');
+$stmts[0]->params[0]->type = new Node\Identifier('int');
+$stmts[0]->params[1]->type = new Node\Identifier('array');
+$stmts[0]->params[1]->default = new Expr\ConstFetch(new Node\Name('null'));
+$stmts[1]->expr->dim = new Expr\Variable('a');
+$stmts[2]->expr->items[0]->key = new Scalar\String_('X');
+$stmts[3]->expr->returnType = new Node\Name('Bar');
+$stmts[4]->expr->if = new Expr\Variable('z');
+$stmts[5]->expr->key = new Expr\Variable('k');
+$stmts[6]->expr->value = new Expr\Variable('v');
+$stmts[7]->num = new Scalar\LNumber(2);
+$stmts[8]->num = new Scalar\LNumber(2);
+$stmts[9]->expr = new Expr\Variable('x');
+$stmts[10]->extends = new Node\Name\FullyQualified('Bar');
+$stmts[10]->stmts[0]->returnType = new Node\Name('Y');
+$stmts[10]->stmts[1]->props[0]->default = new Scalar\DNumber(42.0);
+$stmts[11]->keyVar = new Expr\Variable('z');
+$stmts[12]->vars[0]->default = new Scalar\String_('abc');
+$stmts[13]->finally = new Stmt\Finally_([]);
+$stmts[14]->else = new Stmt\Else_([]);
+-----
+ $value
+];
+
+function
+() : Bar
+{};
+
+$x
+? $z
+:
+$y;
+
+yield
+$k => $v ;
+yield $v ;
+
+break 2
+;
+continue 2
+;
+return $x
+;
+
+class
+X extends \Bar
+{
+ public
+ function y() : Y
+ {}
+
+ private
+ $x = 42.0
+ ;
+}
+
+foreach (
+ $x
+ as
+ $z => $y
+) {}
+
+static
+$var = 'abc'
+;
+
+try {
+} catch (X
+$y) {
+} finally {
+}
+
+if ($cond) { // Foo
+} elseif ($cond2) { // Bar
+} else {
+}
+-----
+name = new Node\Name('Foo');
+-----
+stmts[] = new Stmt\Expression(new Expr\Variable('baz'));
+-----
+params[] = new Node\Param(new Expr\Variable('param2'));
+-----
+catches[0]->types[] = new Node\Name('Bar');
+-----
+params, new Node\Param(new Expr\Variable('param0')));
+-----
+params[] = new Node\Param(new Expr\Variable('param0'));
+/* Insertion into empty list not handled yet */
+-----
+elseifs[] = new Stmt\ElseIf_(new Expr\Variable('cond3'), []);
+-----
+catches[] = new Stmt\Catch_([new Node\Name('Bar')], new Expr\Variable('bar'), []);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+$stmts[] = $node;
+-----
+setAttribute('comments', [new Comment('// Test'), new Comment('// Test 2')]);
+$stmts[0]->stmts[] = $node;
+-----
+name->parts[0] = 'Xyz';
+-----
+stmts, $node);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+$stmts[0]->stmts[1]->setAttribute('comments', [new Comment('// Bar foo')]);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+$stmts[0]->stmts[1]->setAttribute('comments', []);
+-----
+stmts,
+ new Stmt\Expression(new Expr\Variable('a')),
+ new Stmt\Expression(new Expr\Variable('b')));
+-----
+stmts = [
+ new Stmt\Expression(new Expr\Variable('a')),
+ new Stmt\Expression(new Expr\Variable('b')),
+];
+-----
+expr->expr->items, new Expr\ArrayItem(new Scalar\LNumber(42)));
+$stmts[0]->expr->expr->items[] = new Expr\ArrayItem(new Scalar\LNumber(24));
+-----
+expr->expr->items[] = new Expr\ArrayItem(new Scalar\LNumber(24));
+-----
+foo = new Foo;
+$this->foo->a()
+ ->b();
+-----
+$outerCall = $stmts[1]->expr;
+$innerCall = $outerCall->var;
+$var = $innerCall->var;
+$stmts[1]->expr = $innerCall;
+$stmts[2] = new Stmt\Expression(new Expr\MethodCall($var, $outerCall->name));
+-----
+foo = new Foo;
+$this->foo->a();
+$this->foo->b();
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/formatPreservation/listRemoval.test b/vendor/nikic/php-parser/test/code/formatPreservation/listRemoval.test
new file mode 100644
index 00000000..0ac42390
--- /dev/null
+++ b/vendor/nikic/php-parser/test/code/formatPreservation/listRemoval.test
@@ -0,0 +1,41 @@
+Removing from list nodes
+-----
+params);
+-----
+params);
+$stmts[0]->params[] = new Node\Param(new Expr\Variable('x'));
+$stmts[0]->params[] = new Node\Param(new Expr\Variable('y'));
+-----
+flags = Stmt\Class_::MODIFIER_ABSTRACT;
+$stmts[1]->flags = 0;
+$stmts[1]->stmts[0]->flags = Stmt\Class_::MODIFIER_PRIVATE;
+$stmts[1]->stmts[1]->flags = Stmt\Class_::MODIFIER_PROTECTED;
+$stmts[1]->stmts[2]->flags |= Stmt\Class_::MODIFIER_FINAL;
+-----
+ $b
+, $c => $d];
+
+yield
+$foo
+=>
+$bar;
+yield
+$bar;
+
+break
+2
+;
+continue
+2
+;
+
+foreach(
+ $array
+as
+ $key
+ =>
+ $value
+) {}
+
+if
+($x)
+{
+}
+
+else {}
+
+return
+$val
+;
+static
+ $x
+ =
+ $y
+;
+
+try {} catch
+ (X $y)
+ {}
+finally
+{}
+-----
+$stmts[0]->returnType = null;
+$stmts[0]->params[0]->default = null;
+$stmts[0]->params[1]->type = null;
+$stmts[1]->expr->returnType = null;
+$stmts[2]->extends = null;
+$stmts[2]->stmts[0]->returnType = null;
+$stmts[2]->stmts[1]->props[0]->default = null;
+$stmts[2]->stmts[2]->adaptations[0]->newName = null;
+$stmts[3]->expr->dim = null;
+$stmts[4]->expr->expr = null;
+$stmts[5]->expr->if = null;
+$stmts[6]->expr->items[1]->key = null;
+$stmts[7]->expr->key = null;
+$stmts[8]->expr->value = null;
+$stmts[9]->num = null;
+$stmts[10]->num = null;
+$stmts[11]->keyVar = null;
+$stmts[12]->else = null;
+$stmts[13]->expr = null;
+$stmts[14]->vars[0]->default = null;
+$stmts[15]->finally = null;
+-----
+ $b
+, $d];
+
+yield
+$bar;
+yield;
+
+break;
+continue;
+
+foreach(
+ $array
+as
+ $value
+) {}
+
+if
+($x)
+{
+}
+
+return;
+static
+ $x
+;
+
+try {} catch
+ (X $y)
+ {}
+-----
+name = null;
+-----
+
!!positions
Syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' from 3:1 to 3:1
array(
- 0: Expr_PropertyFetch[2:1 - 2:6](
- var: Expr_Variable[2:1 - 2:4](
- name: foo
- )
- name: Expr_Error[3:1 - 2:6](
+ 0: Stmt_Expression[2:1 - 3:1](
+ expr: Expr_PropertyFetch[2:1 - 2:6](
+ var: Expr_Variable[2:1 - 2:4](
+ name: foo
+ )
+ name: Expr_Error[3:1 - 2:6](
+ )
)
)
)
@@ -267,16 +307,20 @@ Syntax error, unexpected '}', expecting T_STRING or T_VARIABLE or '{' or '$' fro
array(
0: Stmt_Function[2:1 - 4:1](
byRef: false
- name: foo
+ name: Identifier[2:10 - 2:12](
+ name: foo
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_PropertyFetch[3:5 - 3:10](
- var: Expr_Variable[3:5 - 3:8](
- name: bar
- )
- name: Expr_Error[4:1 - 3:10](
+ 0: Stmt_Expression[3:5 - 3:10](
+ expr: Expr_PropertyFetch[3:5 - 3:10](
+ var: Expr_Variable[3:5 - 3:8](
+ name: bar
+ )
+ name: Expr_Error[4:1 - 3:10](
+ )
)
)
)
@@ -288,13 +332,15 @@ new T
-----
Syntax error, unexpected EOF from 2:6 to 2:6
array(
- 0: Expr_New(
- class: Name(
- parts: array(
- 0: T
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: T
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
)
@@ -305,10 +351,12 @@ new
!!php7,positions
Syntax error, unexpected EOF from 2:4 to 2:4
array(
- 0: Expr_New[2:1 - 2:3](
- class: Expr_Error[2:4 - 2:3](
- )
- args: array(
+ 0: Stmt_Expression[2:1 - 2:3](
+ expr: Expr_New[2:1 - 2:3](
+ class: Expr_Error[2:4 - 2:3](
+ )
+ args: array(
+ )
)
)
)
@@ -319,11 +367,13 @@ $foo instanceof
!!php7
Syntax error, unexpected EOF from 2:16 to 2:16
array(
- 0: Expr_Instanceof(
- expr: Expr_Variable(
- name: foo
- )
- class: Expr_Error(
+ 0: Stmt_Expression(
+ expr: Expr_Instanceof(
+ expr: Expr_Variable(
+ name: foo
+ )
+ class: Expr_Error(
+ )
)
)
)
@@ -334,8 +384,10 @@ $
!!php7
Syntax error, unexpected EOF, expecting T_VARIABLE or '{' or '$' from 2:2 to 2:2
array(
- 0: Expr_Variable(
- name: Expr_Error(
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_Error(
+ )
)
)
)
@@ -346,13 +398,15 @@ Foo::$
!!php7
Syntax error, unexpected EOF, expecting T_VARIABLE or '{' or '$' from 2:7 to 2:7
array(
- 0: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: Foo
+ 0: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Expr_Error(
)
- )
- name: Expr_Error(
)
)
)
@@ -363,13 +417,15 @@ Foo::
!!php7
Syntax error, unexpected EOF from 2:6 to 2:6
array(
- 0: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Foo
+ 0: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Expr_Error(
)
- )
- name: Expr_Error(
)
)
)
@@ -415,7 +471,7 @@ array(
0: A
)
)
- alias: A
+ alias: null
)
)
)
@@ -429,7 +485,7 @@ array(
0: a
)
)
- alias: a
+ alias: null
)
)
)
@@ -448,14 +504,16 @@ array(
0: B
)
)
- alias: B
+ alias: null
)
)
)
3: Stmt_Const(
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 1
)
@@ -506,7 +564,9 @@ array(
)
)
13: Stmt_Goto(
- name: label
+ name: Identifier(
+ name: label
+ )
)
)
)
@@ -553,11 +613,8 @@ A trailing comma is not allowed here from 11:25 to 11:25
A trailing comma is not allowed here from 13:17 to 13:17
A trailing comma is not allowed here from 14:14 to 14:14
A trailing comma is not allowed here from 16:22 to 16:22
-A trailing comma is not allowed here from 18:9 to 18:9
-A trailing comma is not allowed here from 19:9 to 19:9
A trailing comma is not allowed here from 21:13 to 21:13
A trailing comma is not allowed here from 23:16 to 23:16
-A trailing comma is not allowed here from 24:7 to 24:7
A trailing comma is not allowed here from 25:10 to 25:10
A trailing comma is not allowed here from 26:10 to 26:10
A trailing comma is not allowed here from 27:8 to 27:8
@@ -582,7 +639,7 @@ array(
0: B
)
)
- alias: B
+ alias: null
)
)
)
@@ -601,7 +658,7 @@ array(
0: b
)
)
- alias: b
+ alias: null
)
)
)
@@ -615,14 +672,16 @@ array(
0: A
)
)
- alias: A
+ alias: null
)
)
)
3: Stmt_Const(
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 42
)
@@ -631,7 +690,9 @@ array(
)
4: Stmt_Class(
flags: 0
- name: X
+ name: Identifier(
+ name: X
+ )
extends: null
implements: array(
0: Name(
@@ -667,7 +728,9 @@ array(
0: A
)
)
- method: b
+ method: Identifier(
+ name: b
+ )
insteadof: array(
0: Name(
parts: array(
@@ -682,7 +745,9 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 42
)
@@ -693,7 +758,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: x
+ name: VarLikeIdentifier(
+ name: x
+ )
default: null
)
)
@@ -701,7 +768,9 @@ array(
)
)
5: Stmt_Interface(
- name: I
+ name: Identifier(
+ name: I
+ )
extends: array(
0: Name(
parts: array(
@@ -719,17 +788,21 @@ array(
)
)
)
- 7: Expr_Isset(
- vars: array(
- 0: Expr_Variable(
- name: x
+ 7: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: x
+ )
)
)
)
8: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: a
+ key: Identifier(
+ name: a
+ )
value: Scalar_LNumber(
value: 42
)
@@ -739,13 +812,17 @@ array(
)
9: Stmt_Function(
byRef: false
- name: foo
+ name: Identifier(
+ name: foo
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
)
@@ -753,19 +830,21 @@ array(
stmts: array(
)
)
- 10: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: foo
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ 10: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
@@ -779,7 +858,9 @@ array(
12: Stmt_Static(
vars: array(
0: Stmt_StaticVar(
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
)
@@ -810,26 +891,32 @@ array(
stmts: array(
)
)
- 15: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 15: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
)
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: b
- byRef: false
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ )
+ )
+ returnType: null
+ stmts: array(
)
- )
- returnType: null
- stmts: array(
)
)
)
@@ -841,25 +928,341 @@ foo(Bar::);
!!php7,positions
Syntax error, unexpected ')' from 3:10 to 3:10
array(
- 0: Expr_FuncCall[3:1 - 3:10](
- name: Name[3:1 - 3:3](
- parts: array(
- 0: foo
+ 0: Stmt_Expression[3:1 - 3:11](
+ expr: Expr_FuncCall[3:1 - 3:10](
+ name: Name[3:1 - 3:3](
+ parts: array(
+ 0: foo
+ )
)
- )
- args: array(
- 0: Arg[3:5 - 3:9](
- value: Expr_ClassConstFetch[3:5 - 3:9](
- class: Name[3:5 - 3:7](
- parts: array(
- 0: Bar
+ args: array(
+ 0: Arg[3:5 - 3:9](
+ value: Expr_ClassConstFetch[3:5 - 3:9](
+ class: Name[3:5 - 3:7](
+ parts: array(
+ 0: Bar
+ )
+ )
+ name: Expr_Error[3:10 - 3:9](
)
)
- name: Expr_Error[3:10 - 3:9](
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+)
+-----
+ 'd', 'e' => &$f);
['a' => 'b'];
-----
array(
- 0: Expr_Array(
- items: array(
- )
- )
- 1: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
- )
- byRef: false
+ 0: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
)
)
)
- 2: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
+ 1: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
)
- byRef: false
)
)
)
- 3: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
+ 2: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: b
- )
- byRef: false
)
)
)
- 4: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
+ 3: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: b
+ )
+ byRef: false
)
- byRef: true
- )
- 2: Expr_ArrayItem(
- key: Scalar_String(
- value: c
- )
- value: Scalar_String(
- value: d
- )
- byRef: false
- )
- 3: Expr_ArrayItem(
- key: Scalar_String(
- value: e
- )
- value: Expr_Variable(
- name: f
- )
- byRef: true
)
)
)
- 5: Expr_Array(
- items: array(
+ 4: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: true
+ )
+ 2: Expr_ArrayItem(
+ key: Scalar_String(
+ value: c
+ )
+ value: Scalar_String(
+ value: d
+ )
+ byRef: false
+ )
+ 3: Expr_ArrayItem(
+ key: Scalar_String(
+ value: e
+ )
+ value: Expr_Variable(
+ name: f
+ )
+ byRef: true
+ )
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ )
+ comments: array(
+ 0: // short array syntax
+ )
)
comments: array(
0: // short array syntax
)
)
- 6: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 6: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
)
- 7: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
+ 7: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Scalar_String(
+ value: b
+ )
+ byRef: false
)
- value: Scalar_String(
- value: b
- )
- byRef: false
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test b/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
index 4ca76b21..7865e6ff 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
@@ -9,136 +9,144 @@ Array destructuring
-----
!!php7
array(
- 0: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: c
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: c
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: d
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: d
+ )
+ byRef: false
)
- byRef: false
)
)
)
)
- 1: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: null
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: null
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 2: null
- 3: null
- 4: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 2: null
+ 3: null
+ 4: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
+ 5: null
)
- 5: null
+ )
+ expr: Expr_Variable(
+ name: foo
)
)
- expr: Expr_Variable(
- name: foo
- )
)
- 2: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: null
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: null
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 2: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: bar
+ expr: Expr_Variable(
+ name: bar
+ )
)
)
- 3: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
+ 3: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- value: Expr_Variable(
- name: b
+ 1: Expr_ArrayItem(
+ key: Scalar_String(
+ value: b
+ )
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: Scalar_String(
- value: b
- )
- value: Expr_Variable(
- name: a
- )
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: baz
+ expr: Expr_Variable(
+ name: baz
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/assign.test b/vendor/nikic/php-parser/test/code/parser/expr/assign.test
index 1d6b187a..33335f89 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/assign.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/assign.test
@@ -36,266 +36,328 @@ $a++;
$a--;
-----
array(
- 0: Expr_Assign(
- var: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // simple assign
+ )
+ )
+ expr: Expr_Variable(
+ name: b
+ )
comments: array(
0: // simple assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // simple assign
)
)
- 1: Expr_AssignOp_BitwiseAnd(
- var: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_AssignOp_BitwiseAnd(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // combined assign
+ )
+ )
+ expr: Expr_Variable(
+ name: b
+ )
comments: array(
0: // combined assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // combined assign
)
)
- 2: Expr_AssignOp_BitwiseOr(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 3: Expr_AssignOp_BitwiseXor(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 4: Expr_AssignOp_Concat(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 5: Expr_AssignOp_Div(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 6: Expr_AssignOp_Minus(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 7: Expr_AssignOp_Mod(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 8: Expr_AssignOp_Mul(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 9: Expr_AssignOp_Plus(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 10: Expr_AssignOp_ShiftLeft(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 11: Expr_AssignOp_ShiftRight(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 12: Expr_AssignOp_Pow(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 13: Expr_Assign(
- var: Expr_Variable(
- name: a
- comments: array(
- 0: // chained assign
- )
- )
- expr: Expr_AssignOp_Mul(
+ 2: Stmt_Expression(
+ expr: Expr_AssignOp_BitwiseOr(
var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
name: b
)
- expr: Expr_AssignOp_Pow(
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_AssignOp_BitwiseXor(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_AssignOp_Concat(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_AssignOp_Div(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_AssignOp_Minus(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_AssignOp_Mod(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 8: Stmt_Expression(
+ expr: Expr_AssignOp_Mul(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 9: Stmt_Expression(
+ expr: Expr_AssignOp_Plus(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 10: Stmt_Expression(
+ expr: Expr_AssignOp_ShiftLeft(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 11: Stmt_Expression(
+ expr: Expr_AssignOp_ShiftRight(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 12: Stmt_Expression(
+ expr: Expr_AssignOp_Pow(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 13: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // chained assign
+ )
+ )
+ expr: Expr_AssignOp_Mul(
var: Expr_Variable(
- name: c
+ name: b
)
- expr: Expr_Variable(
- name: d
+ expr: Expr_AssignOp_Pow(
+ var: Expr_Variable(
+ name: c
+ )
+ expr: Expr_Variable(
+ name: d
+ )
)
)
+ comments: array(
+ 0: // chained assign
+ )
)
comments: array(
0: // chained assign
)
)
- 14: Expr_AssignRef(
- var: Expr_Variable(
- name: a
+ 14: Stmt_Expression(
+ expr: Expr_AssignRef(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // by ref assign
+ )
+ )
+ expr: Expr_Variable(
+ name: b
+ )
comments: array(
0: // by ref assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // by ref assign
)
)
- 15: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 15: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
)
+ comments: array(
+ 0: // list() assign
+ )
+ )
+ expr: Expr_Variable(
+ name: b
)
comments: array(
0: // list() assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // list() assign
)
)
- 16: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 16: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: null
- 2: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 1: null
+ 2: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: c
+ expr: Expr_Variable(
+ name: c
+ )
)
)
- 17: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 17: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_List(
- items: array(
- 0: null
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: c
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_List(
+ items: array(
+ 0: null
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: c
+ )
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: d
+ 2: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: d
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: e
+ expr: Expr_Variable(
+ name: e
+ )
)
)
- 18: Expr_PreInc(
- var: Expr_Variable(
- name: a
+ 18: Stmt_Expression(
+ expr: Expr_PreInc(
+ var: Expr_Variable(
+ name: a
+ )
+ comments: array(
+ 0: // inc/dec
+ )
)
comments: array(
0: // inc/dec
)
)
- 19: Expr_PostInc(
- var: Expr_Variable(
- name: a
+ 19: Stmt_Expression(
+ expr: Expr_PostInc(
+ var: Expr_Variable(
+ name: a
+ )
)
)
- 20: Expr_PreDec(
- var: Expr_Variable(
- name: a
+ 20: Stmt_Expression(
+ expr: Expr_PreDec(
+ var: Expr_Variable(
+ name: a
+ )
)
)
- 21: Expr_PostDec(
- var: Expr_Variable(
- name: a
+ 21: Stmt_Expression(
+ expr: Expr_PostDec(
+ var: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test b/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
index 10e1317f..a66d943a 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
@@ -5,17 +5,19 @@ $a =& new B;
-----
!!php5
array(
- 0: Expr_AssignRef(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_New(
- class: Name(
- parts: array(
- 0: B
- )
+ 0: Stmt_Expression(
+ expr: Expr_AssignRef(
+ var: Expr_Variable(
+ name: a
)
- args: array(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: B
+ )
+ )
+ args: array(
+ )
)
)
)
@@ -27,13 +29,15 @@ $a =& new B;
!!php7
Syntax error, unexpected T_NEW from 2:7 to 2:9
array(
- 0: Expr_New(
- class: Name(
- parts: array(
- 0: B
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: B
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/cast.test b/vendor/nikic/php-parser/test/code/parser/expr/cast.test
index 3c54ba72..a875bb47 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/cast.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/cast.test
@@ -14,59 +14,81 @@ Casts
(unset) $a;
-----
array(
- 0: Expr_Cast_Array(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Cast_Array(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 1: Expr_Cast_Bool(
- expr: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_Cast_Bool(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 2: Expr_Cast_Bool(
- expr: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_Cast_Bool(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 3: Expr_Cast_Double(
- expr: Expr_Variable(
- name: a
+ 3: Stmt_Expression(
+ expr: Expr_Cast_Double(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 4: Expr_Cast_Double(
- expr: Expr_Variable(
- name: a
+ 4: Stmt_Expression(
+ expr: Expr_Cast_Double(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 5: Expr_Cast_Double(
- expr: Expr_Variable(
- name: a
+ 5: Stmt_Expression(
+ expr: Expr_Cast_Double(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 6: Expr_Cast_Int(
- expr: Expr_Variable(
- name: a
+ 6: Stmt_Expression(
+ expr: Expr_Cast_Int(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 7: Expr_Cast_Int(
- expr: Expr_Variable(
- name: a
+ 7: Stmt_Expression(
+ expr: Expr_Cast_Int(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 8: Expr_Cast_Object(
- expr: Expr_Variable(
- name: a
+ 8: Stmt_Expression(
+ expr: Expr_Cast_Object(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 9: Expr_Cast_String(
- expr: Expr_Variable(
- name: a
+ 9: Stmt_Expression(
+ expr: Expr_Cast_String(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 10: Expr_Cast_Unset(
- expr: Expr_Variable(
- name: a
+ 10: Stmt_Expression(
+ expr: Expr_Cast_Unset(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/clone.test b/vendor/nikic/php-parser/test/code/parser/expr/clone.test
index 64015660..418eb0e6 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/clone.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/clone.test
@@ -5,9 +5,11 @@ Clone
clone $a;
-----
array(
- 0: Expr_Clone(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Clone(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/closure.test b/vendor/nikic/php-parser/test/code/parser/expr/closure.test
index f459b602..c88de78b 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/closure.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/closure.test
@@ -10,133 +10,167 @@ function($a) : array {};
function() use($a) : \Foo\Bar {};
-----
array(
- 0: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 0: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
)
- )
- uses: array(
- )
- returnType: null
- stmts: array(
- 0: Expr_Variable(
- name: a
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
+ )
)
)
)
- 1: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 1: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
)
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: b
- byRef: false
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ )
+ )
+ returnType: null
+ stmts: array(
)
- )
- returnType: null
- stmts: array(
)
)
- 2: Expr_Closure(
- static: false
- byRef: false
- params: array(
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: a
- byRef: false
+ 2: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
)
- 1: Expr_ClosureUse(
- var: b
- byRef: true
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ )
+ 1: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: b
+ )
+ byRef: true
+ )
+ )
+ returnType: null
+ stmts: array(
)
- )
- returnType: null
- stmts: array(
)
)
- 3: Expr_Closure(
- static: false
- byRef: true
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 3: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: true
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
+ )
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
)
)
- uses: array(
- )
- returnType: null
- stmts: array(
- )
)
- 4: Expr_Closure(
- static: true
- byRef: false
- params: array(
- )
- uses: array(
- )
- returnType: null
- stmts: array(
- )
- )
- 5: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 4: Stmt_Expression(
+ expr: Expr_Closure(
+ static: true
+ byRef: false
+ params: array(
+ )
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
)
)
- uses: array(
- )
- returnType: array
- stmts: array(
- )
)
- 6: Expr_Closure(
- static: false
- byRef: false
- params: array(
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: a
- byRef: false
+ 5: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
+ )
+ uses: array(
+ )
+ returnType: Identifier(
+ name: array
+ )
+ stmts: array(
)
)
- returnType: Name_FullyQualified(
- parts: array(
- 0: Foo
- 1: Bar
+ )
+ 6: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ )
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ )
+ )
+ returnType: Name_FullyQualified(
+ parts: array(
+ 0: Foo
+ 1: Bar
+ )
+ )
+ stmts: array(
)
)
- stmts: array(
- )
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/comparison.test b/vendor/nikic/php-parser/test/code/parser/expr/comparison.test
index d5b1e354..011692f0 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/comparison.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/comparison.test
@@ -14,94 +14,116 @@ $a instanceof B;
$a instanceof $b;
-----
array(
- 0: Expr_BinaryOp_Smaller(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 1: Expr_BinaryOp_SmallerOrEqual(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 2: Expr_BinaryOp_Greater(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 3: Expr_BinaryOp_GreaterOrEqual(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 4: Expr_BinaryOp_Equal(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 5: Expr_BinaryOp_Identical(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 6: Expr_BinaryOp_NotEqual(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 7: Expr_BinaryOp_NotIdentical(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 8: Expr_BinaryOp_Spaceship(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 9: Expr_Instanceof(
- expr: Expr_Variable(
- name: a
- )
- class: Name(
- parts: array(
- 0: B
+ 0: Stmt_Expression(
+ expr: Expr_BinaryOp_Smaller(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
)
)
)
- 10: Expr_Instanceof(
- expr: Expr_Variable(
- name: a
- )
- class: Expr_Variable(
- name: b
+ 1: Stmt_Expression(
+ expr: Expr_BinaryOp_SmallerOrEqual(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
-)
+ 2: Stmt_Expression(
+ expr: Expr_BinaryOp_Greater(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_BinaryOp_GreaterOrEqual(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_Equal(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_Identical(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_BinaryOp_NotEqual(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_NotIdentical(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 8: Stmt_Expression(
+ expr: Expr_BinaryOp_Spaceship(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 9: Stmt_Expression(
+ expr: Expr_Instanceof(
+ expr: Expr_Variable(
+ name: a
+ )
+ class: Name(
+ parts: array(
+ 0: B
+ )
+ )
+ )
+ )
+ 10: Stmt_Expression(
+ expr: Expr_Instanceof(
+ expr: Expr_Variable(
+ name: a
+ )
+ class: Expr_Variable(
+ name: b
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test b/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
index 3e7a23ef..d774de71 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
@@ -44,7 +44,9 @@ array(
0: Stmt_Const(
consts: array(
0: Const(
- name: T_1
+ name: Identifier(
+ name: T_1
+ )
value: Expr_BinaryOp_ShiftLeft(
left: Scalar_LNumber(
value: 1
@@ -59,7 +61,9 @@ array(
1: Stmt_Const(
consts: array(
0: Const(
- name: T_2
+ name: Identifier(
+ name: T_2
+ )
value: Expr_BinaryOp_Div(
left: Scalar_LNumber(
value: 1
@@ -74,7 +78,9 @@ array(
2: Stmt_Const(
consts: array(
0: Const(
- name: T_3
+ name: Identifier(
+ name: T_3
+ )
value: Expr_BinaryOp_Plus(
left: Scalar_DNumber(
value: 1.5
@@ -89,7 +95,9 @@ array(
3: Stmt_Const(
consts: array(
0: Const(
- name: T_4
+ name: Identifier(
+ name: T_4
+ )
value: Expr_BinaryOp_Concat(
left: Scalar_String(
value: foo
@@ -104,7 +112,9 @@ array(
4: Stmt_Const(
consts: array(
0: Const(
- name: T_5
+ name: Identifier(
+ name: T_5
+ )
value: Expr_BinaryOp_Mul(
left: Expr_BinaryOp_Plus(
left: Scalar_DNumber(
@@ -124,7 +134,9 @@ array(
5: Stmt_Const(
consts: array(
0: Const(
- name: T_6
+ name: Identifier(
+ name: T_6
+ )
value: Expr_BinaryOp_Concat(
left: Expr_BinaryOp_Concat(
left: Expr_BinaryOp_Concat(
@@ -149,7 +161,9 @@ array(
6: Stmt_Const(
consts: array(
0: Const(
- name: T_7
+ name: Identifier(
+ name: T_7
+ )
value: Scalar_MagicConst_Line(
)
)
@@ -158,7 +172,9 @@ array(
7: Stmt_Const(
consts: array(
0: Const(
- name: T_8
+ name: Identifier(
+ name: T_8
+ )
value: Scalar_String(
value: This is a test string
)
@@ -168,7 +184,9 @@ array(
8: Stmt_Const(
consts: array(
0: Const(
- name: T_9
+ name: Identifier(
+ name: T_9
+ )
value: Expr_BitwiseNot(
expr: Expr_UnaryMinus(
expr: Scalar_LNumber(
@@ -182,7 +200,9 @@ array(
9: Stmt_Const(
consts: array(
0: Const(
- name: T_10
+ name: Identifier(
+ name: T_10
+ )
value: Expr_BinaryOp_Plus(
left: Expr_Ternary(
cond: Expr_UnaryMinus(
@@ -213,7 +233,9 @@ array(
10: Stmt_Const(
consts: array(
0: Const(
- name: T_11
+ name: Identifier(
+ name: T_11
+ )
value: Expr_BinaryOp_BooleanAnd(
left: Scalar_LNumber(
value: 1
@@ -228,7 +250,9 @@ array(
11: Stmt_Const(
consts: array(
0: Const(
- name: T_12
+ name: Identifier(
+ name: T_12
+ )
value: Expr_BinaryOp_LogicalAnd(
left: Scalar_LNumber(
value: 1
@@ -243,7 +267,9 @@ array(
12: Stmt_Const(
consts: array(
0: Const(
- name: T_13
+ name: Identifier(
+ name: T_13
+ )
value: Expr_BinaryOp_BooleanOr(
left: Scalar_LNumber(
value: 0
@@ -258,7 +284,9 @@ array(
13: Stmt_Const(
consts: array(
0: Const(
- name: T_14
+ name: Identifier(
+ name: T_14
+ )
value: Expr_BinaryOp_LogicalOr(
left: Scalar_LNumber(
value: 1
@@ -273,7 +301,9 @@ array(
14: Stmt_Const(
consts: array(
0: Const(
- name: T_15
+ name: Identifier(
+ name: T_15
+ )
value: Expr_BinaryOp_LogicalXor(
left: Scalar_LNumber(
value: 1
@@ -288,7 +318,9 @@ array(
15: Stmt_Const(
consts: array(
0: Const(
- name: T_16
+ name: Identifier(
+ name: T_16
+ )
value: Expr_BinaryOp_LogicalXor(
left: Scalar_LNumber(
value: 1
@@ -303,7 +335,9 @@ array(
16: Stmt_Const(
consts: array(
0: Const(
- name: T_17
+ name: Identifier(
+ name: T_17
+ )
value: Expr_BinaryOp_Smaller(
left: Scalar_LNumber(
value: 1
@@ -318,7 +352,9 @@ array(
17: Stmt_Const(
consts: array(
0: Const(
- name: T_18
+ name: Identifier(
+ name: T_18
+ )
value: Expr_BinaryOp_SmallerOrEqual(
left: Scalar_LNumber(
value: 0
@@ -333,7 +369,9 @@ array(
18: Stmt_Const(
consts: array(
0: Const(
- name: T_19
+ name: Identifier(
+ name: T_19
+ )
value: Expr_BinaryOp_Greater(
left: Scalar_LNumber(
value: 1
@@ -348,7 +386,9 @@ array(
19: Stmt_Const(
consts: array(
0: Const(
- name: T_20
+ name: Identifier(
+ name: T_20
+ )
value: Expr_BinaryOp_GreaterOrEqual(
left: Scalar_LNumber(
value: 1
@@ -363,7 +403,9 @@ array(
20: Stmt_Const(
consts: array(
0: Const(
- name: T_21
+ name: Identifier(
+ name: T_21
+ )
value: Expr_BinaryOp_Identical(
left: Scalar_LNumber(
value: 1
@@ -378,7 +420,9 @@ array(
21: Stmt_Const(
consts: array(
0: Const(
- name: T_22
+ name: Identifier(
+ name: T_22
+ )
value: Expr_BinaryOp_NotIdentical(
left: Scalar_LNumber(
value: 1
@@ -393,7 +437,9 @@ array(
22: Stmt_Const(
consts: array(
0: Const(
- name: T_23
+ name: Identifier(
+ name: T_23
+ )
value: Expr_BinaryOp_NotEqual(
left: Scalar_LNumber(
value: 0
@@ -408,7 +454,9 @@ array(
23: Stmt_Const(
consts: array(
0: Const(
- name: T_24
+ name: Identifier(
+ name: T_24
+ )
value: Expr_BinaryOp_Equal(
left: Scalar_LNumber(
value: 1
@@ -423,7 +471,9 @@ array(
24: Stmt_Const(
consts: array(
0: Const(
- name: T_25
+ name: Identifier(
+ name: T_25
+ )
value: Expr_BinaryOp_Plus(
left: Scalar_LNumber(
value: 1
@@ -443,7 +493,9 @@ array(
25: Stmt_Const(
consts: array(
0: Const(
- name: T_26
+ name: Identifier(
+ name: T_26
+ )
value: Expr_BinaryOp_Plus(
left: Expr_BinaryOp_Plus(
left: Scalar_String(
@@ -463,7 +515,9 @@ array(
26: Stmt_Const(
consts: array(
0: Const(
- name: T_27
+ name: Identifier(
+ name: T_27
+ )
value: Expr_BinaryOp_Pow(
left: Scalar_LNumber(
value: 2
@@ -478,7 +532,9 @@ array(
27: Stmt_Const(
consts: array(
0: Const(
- name: T_28
+ name: Identifier(
+ name: T_28
+ )
value: Expr_ArrayDimFetch(
var: Expr_Array(
items: array(
@@ -515,7 +571,9 @@ array(
28: Stmt_Const(
consts: array(
0: Const(
- name: T_29
+ name: Identifier(
+ name: T_29
+ )
value: Expr_BinaryOp_Minus(
left: Scalar_LNumber(
value: 12
@@ -530,7 +588,9 @@ array(
29: Stmt_Const(
consts: array(
0: Const(
- name: T_30
+ name: Identifier(
+ name: T_30
+ )
value: Expr_BinaryOp_BitwiseXor(
left: Scalar_LNumber(
value: 12
@@ -545,7 +605,9 @@ array(
30: Stmt_Const(
consts: array(
0: Const(
- name: T_31
+ name: Identifier(
+ name: T_31
+ )
value: Expr_BinaryOp_BitwiseAnd(
left: Scalar_LNumber(
value: 12
@@ -560,7 +622,9 @@ array(
31: Stmt_Const(
consts: array(
0: Const(
- name: T_32
+ name: Identifier(
+ name: T_32
+ )
value: Expr_BinaryOp_BitwiseOr(
left: Scalar_LNumber(
value: 12
@@ -575,7 +639,9 @@ array(
32: Stmt_Const(
consts: array(
0: Const(
- name: T_33
+ name: Identifier(
+ name: T_33
+ )
value: Expr_BinaryOp_Mod(
left: Scalar_LNumber(
value: 12
@@ -590,7 +656,9 @@ array(
33: Stmt_Const(
consts: array(
0: Const(
- name: T_34
+ name: Identifier(
+ name: T_34
+ )
value: Expr_BinaryOp_ShiftRight(
left: Scalar_LNumber(
value: 100
@@ -605,7 +673,9 @@ array(
34: Stmt_Const(
consts: array(
0: Const(
- name: T_35
+ name: Identifier(
+ name: T_35
+ )
value: Expr_BooleanNot(
expr: Expr_ConstFetch(
name: Name(
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test b/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
index ce3fce96..7f099988 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
@@ -4,9 +4,11 @@ Error suppression
@$a;
-----
array(
- 0: Expr_ErrorSuppress(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_ErrorSuppress(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/exit.test b/vendor/nikic/php-parser/test/code/parser/expr/exit.test
index 8f21e5ba..c880921f 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/exit.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/exit.test
@@ -9,26 +9,38 @@ die();
die('Exit!');
-----
array(
- 0: Expr_Exit(
- expr: null
- )
- 1: Expr_Exit(
- expr: null
- )
- 2: Expr_Exit(
- expr: Scalar_String(
- value: Die!
+ 0: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
)
)
- 3: Expr_Exit(
- expr: null
+ 1: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
+ )
)
- 4: Expr_Exit(
- expr: null
+ 2: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: Scalar_String(
+ value: Die!
+ )
+ )
)
- 5: Expr_Exit(
- expr: Scalar_String(
- value: Exit!
+ 3: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: Scalar_String(
+ value: Exit!
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
index 6d735209..24ca0310 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
@@ -9,90 +9,100 @@ f(&$a);
f($a, ...$b);
-----
array(
- 0: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
- )
- )
- args: array(
- )
- )
- 1: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
)
- byRef: false
- unpack: false
+ )
+ args: array(
)
)
)
- 2: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
)
- byRef: false
- unpack: false
)
- 1: Arg(
- value: Expr_Variable(
- name: b
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 3: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
)
- byRef: true
- unpack: false
)
)
)
- 4: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: true
+ unpack: false
+ )
)
)
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ )
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
)
- byRef: false
- unpack: false
)
- 1: Arg(
- value: Expr_Variable(
- name: b
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: true
)
- byRef: false
- unpack: true
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
index 7686d2d9..d00084ba 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
@@ -7,27 +7,37 @@ A::B;
A::class;
-----
array(
- 0: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: A
+ )
)
)
)
- 1: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: B
)
)
- name: B
)
- 2: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ 2: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: class
)
)
- name: class
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
index 682f7808..4d14c09a 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
@@ -16,216 +16,238 @@ Foo::BAR[1];
$foo::BAR[2][1][0];
-----
array(
- 0: Expr_ArrayDimFetch(
- var: Scalar_String(
- value: abc
- )
- dim: Scalar_LNumber(
- value: 2
- )
- )
- 1: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Scalar_String(
- value: abc
- )
- dim: Scalar_LNumber(
- value: 2
- )
+ 0: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Scalar_String(
+ value: abc
)
dim: Scalar_LNumber(
- value: 0
+ value: 2
)
)
- dim: Scalar_LNumber(
- value: 0
- )
)
- 2: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Scalar_String(
+ value: abc
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
+ dim: Scalar_LNumber(
value: 2
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
- )
- byRef: false
- )
- )
- )
- dim: Scalar_LNumber(
- value: 2
- )
- )
- 3: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
- )
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
- )
- byRef: false
- )
- )
)
dim: Scalar_LNumber(
- value: 2
+ value: 0
)
)
dim: Scalar_LNumber(
value: 0
)
)
- dim: Scalar_LNumber(
- value: 0
+ )
+ 2: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
+ )
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
+ )
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 2
+ )
)
)
- 4: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
+ )
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
+ )
+ )
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
+ dim: Scalar_LNumber(
value: 2
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
- )
- byRef: false
- )
- )
- )
- dim: Scalar_LNumber(
- value: 2
- )
- )
- 5: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
- )
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
- )
- byRef: false
- )
- )
)
dim: Scalar_LNumber(
- value: 2
+ value: 0
)
)
dim: Scalar_LNumber(
value: 0
)
)
- dim: Scalar_LNumber(
- value: 0
- )
)
- 6: Expr_ArrayDimFetch(
- var: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: FOO
- )
- )
- )
- dim: Scalar_LNumber(
- value: 0
- )
- )
- 7: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Foo
- )
- )
- name: BAR
- )
- dim: Scalar_LNumber(
- value: 1
- )
- )
- 8: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Expr_Variable(
- name: foo
+ 4: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
+ )
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
+ )
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 2
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
+ )
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
+ )
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 2
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: FOO
+ )
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Identifier(
name: BAR
)
- dim: Scalar_LNumber(
- value: 2
- )
)
dim: Scalar_LNumber(
value: 1
)
)
- dim: Scalar_LNumber(
- value: 0
+ )
+ 8: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Expr_Variable(
+ name: foo
+ )
+ name: Identifier(
+ name: BAR
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 2
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 1
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
index 62f69e34..4a826514 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
@@ -16,114 +16,140 @@ $a->b['c']();
a()['b'];
-----
array(
- 0: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: a
- )
- comments: array(
- 0: // function name variations
- )
- )
- args: array(
- )
- comments: array(
- 0: // function name variations
- )
- )
- 1: Expr_FuncCall(
- name: Expr_Variable(
- name: a
- )
- args: array(
- )
- )
- 2: Expr_FuncCall(
- name: Expr_Variable(
- name: Scalar_String(
- value: a
- )
- )
- args: array(
- )
- )
- 3: Expr_FuncCall(
- name: Expr_Variable(
- name: Expr_Variable(
- name: a
- )
- )
- args: array(
- )
- )
- 4: Expr_FuncCall(
- name: Expr_Variable(
- name: Expr_Variable(
- name: Expr_Variable(
- name: a
- )
- )
- )
- args: array(
- )
- )
- 5: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
- )
- )
- args: array(
- )
- )
- 6: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
- )
- )
- args: array(
- )
- )
- 7: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
- )
- name: b
- )
- dim: Scalar_String(
- value: c
- )
- )
- args: array(
- )
- )
- 8: Expr_ArrayDimFetch(
- var: Expr_FuncCall(
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Name(
parts: array(
0: a
)
comments: array(
- 0: // array dereferencing
+ 0: // function name variations
)
)
args: array(
)
comments: array(
- 0: // array dereferencing
+ 0: // function name variations
)
)
- dim: Scalar_String(
- value: b
+ comments: array(
+ 0: // function name variations
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_Variable(
+ name: a
+ )
+ args: array(
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_Variable(
+ name: Scalar_String(
+ value: a
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_Variable(
+ name: Expr_Variable(
+ name: a
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_Variable(
+ name: Expr_Variable(
+ name: Expr_Variable(
+ name: a
+ )
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 8: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: a
+ )
+ comments: array(
+ 0: // array dereferencing
+ )
+ )
+ args: array(
+ )
+ comments: array(
+ 0: // array dereferencing
+ )
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ comments: array(
+ 0: // array dereferencing
+ )
)
comments: array(
0: // array dereferencing
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
index 5e36ff81..a4b7a724 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
@@ -8,48 +8,42 @@ New expression dereferencing
(new A)['b']['c'];
-----
array(
- 0: Expr_PropertyFetch(
- var: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
+ args: array(
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
+ )
+ )
+ name: Identifier(
+ name: b
)
args: array(
)
)
- name: b
)
- 1: Expr_MethodCall(
- var: Expr_New(
- class: Name(
- parts: array(
- 0: A
- )
- )
- args: array(
- )
- )
- name: b
- args: array(
- )
- )
- 2: Expr_ArrayDimFetch(
- var: Expr_New(
- class: Name(
- parts: array(
- 0: A
- )
- )
- args: array(
- )
- )
- dim: Scalar_String(
- value: b
- )
- )
- 3: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 2: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_New(
class: Name(
parts: array(
@@ -63,8 +57,26 @@ array(
value: b
)
)
- dim: Scalar_String(
- value: c
+ )
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
+ )
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
index 584461bd..2d1808b0 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
@@ -19,123 +19,162 @@ $a->b(){'c'}; // invalid PHP: drop Support?
-----
!!php5
array(
- 0: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // property fetch variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
comments: array(
0: // property fetch variations
)
)
- name: b
comments: array(
0: // property fetch variations
)
)
- 1: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
- )
- name: b
- )
- dim: Scalar_String(
- value: c
- )
- )
- 2: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
- )
- name: b
- )
- dim: Scalar_String(
- value: c
- )
- )
- 3: Expr_MethodCall(
- var: Expr_Variable(
- name: a
- comments: array(
- 0: // method call variations
- )
- )
- name: b
- args: array(
- )
- comments: array(
- 0: // method call variations
- )
- )
- 4: Expr_MethodCall(
- var: Expr_Variable(
- name: a
- )
- name: Scalar_String(
- value: b
- )
- args: array(
- )
- )
- 5: Expr_MethodCall(
- var: Expr_Variable(
- name: a
- )
- name: Expr_Variable(
- name: b
- )
- args: array(
- )
- )
- 6: Expr_MethodCall(
- var: Expr_Variable(
- name: a
- )
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: b
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
)
dim: Scalar_String(
value: c
)
)
- args: array(
+ )
+ 2: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
)
)
- 7: Expr_ArrayDimFetch(
- var: Expr_MethodCall(
+ 3: Stmt_Expression(
+ expr: Expr_MethodCall(
var: Expr_Variable(
name: a
+ comments: array(
+ 0: // method call variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
+ comments: array(
+ 0: // method call variations
+ )
+ )
+ comments: array(
+ 0: // method call variations
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Scalar_String(
+ value: b
+ )
+ args: array(
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Expr_Variable(
+ name: b
+ )
+ args: array(
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: b
+ )
+ dim: Scalar_String(
+ value: c
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // array dereferencing
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
comments: array(
0: // array dereferencing
)
)
- name: b
- args: array(
+ dim: Scalar_String(
+ value: c
)
comments: array(
0: // array dereferencing
)
)
- dim: Scalar_String(
- value: c
- )
comments: array(
0: // array dereferencing
)
)
- 8: Expr_ArrayDimFetch(
- var: Expr_MethodCall(
- var: Expr_Variable(
- name: a
+ 8: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
)
- name: b
- args: array(
+ dim: Scalar_String(
+ value: c
)
)
- dim: Scalar_String(
- value: c
- )
)
9: Stmt_Nop(
comments: array(
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
index ea3f9ef4..133771b7 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
@@ -9,16 +9,8 @@ $a{'b'};
${$a}['b'];
-----
array(
- 0: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
- )
- )
- 1: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 0: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_Variable(
name: a
)
@@ -26,37 +18,55 @@ array(
value: b
)
)
- dim: Scalar_String(
- value: c
+ )
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
)
)
- 2: Expr_Assign(
- var: Expr_ArrayDimFetch(
+ 2: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: null
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_Variable(
name: a
)
- dim: null
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 3: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
- )
- )
- 4: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: Expr_Variable(
- name: a
+ dim: Scalar_String(
+ value: b
)
)
- dim: Scalar_String(
- value: b
+ )
+ 4: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: Expr_Variable(
+ name: a
+ )
+ )
+ dim: Scalar_String(
+ value: b
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
index b806f7de..a34a3e4b 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
@@ -20,71 +20,65 @@ $a['b']::c();
-----
!!php5
array(
- 0: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ comments: array(
+ 0: // method name variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
)
comments: array(
0: // method name variations
)
)
- name: b
- args: array(
- )
comments: array(
0: // method name variations
)
)
- 1: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Scalar_String(
+ value: b
+ )
+ args: array(
)
- )
- name: Scalar_String(
- value: b
- )
- args: array(
)
)
- 2: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 2: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- name: Expr_Variable(
- name: b
- )
- args: array(
- )
- )
- 3: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
- )
- )
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
+ name: Expr_Variable(
name: b
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
- )
)
- 4: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 3: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- name: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ name: Expr_ArrayDimFetch(
var: Expr_Variable(
name: b
)
@@ -92,82 +86,129 @@ array(
value: c
)
)
- dim: Scalar_String(
- value: d
+ args: array(
)
)
- args: array(
- )
)
- 5: Expr_ArrayDimFetch(
- var: Expr_StaticCall(
+ 4: Stmt_Expression(
+ expr: Expr_StaticCall(
class: Name(
parts: array(
0: A
)
+ )
+ name: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: b
+ )
+ dim: Scalar_String(
+ value: c
+ )
+ )
+ dim: Scalar_String(
+ value: d
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ comments: array(
+ 0: // array dereferencing
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
comments: array(
0: // array dereferencing
)
)
- name: b
- args: array(
+ dim: Scalar_String(
+ value: c
)
comments: array(
0: // array dereferencing
)
)
- dim: Scalar_String(
- value: c
- )
comments: array(
0: // array dereferencing
)
)
- 6: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: static
+ 6: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: static
+ )
+ comments: array(
+ 0: // class name variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
)
comments: array(
0: // class name variations
)
)
- name: b
- args: array(
- )
comments: array(
0: // class name variations
)
)
- 7: Expr_StaticCall(
- class: Expr_Variable(
- name: a
- )
- name: b
- args: array(
- )
- )
- 8: Expr_StaticCall(
- class: Expr_Variable(
- name: Scalar_String(
- value: a
- )
- )
- name: b
- args: array(
- )
- )
- 9: Expr_StaticCall(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
+ 7: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Expr_Variable(
name: a
)
- dim: Scalar_String(
- value: b
+ name: Identifier(
+ name: b
+ )
+ args: array(
)
)
- name: c
- args: array(
+ )
+ 8: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Expr_Variable(
+ name: Scalar_String(
+ value: a
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
+ )
+ )
+ 9: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ name: Identifier(
+ name: c
+ )
+ args: array(
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
index 3d3cde51..a1de3c8c 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
@@ -14,73 +14,95 @@ A::$b{'c'};
// class name variations can be found in staticCall.test
-----
array(
- 0: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
- )
- comments: array(
- 0: // property name variations
- )
- )
- name: b
- comments: array(
- 0: // property name variations
- )
- )
- 1: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
- )
- )
- name: Expr_Variable(
- name: b
- )
- )
- 2: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
- )
- )
- name: Scalar_String(
- value: b
- )
- )
- 3: Expr_ArrayDimFetch(
- var: Expr_StaticPropertyFetch(
+ 0: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
class: Name(
parts: array(
0: A
)
comments: array(
- 0: // array access
+ 0: // property name variations
)
)
- name: b
+ name: VarLikeIdentifier(
+ name: b
+ )
comments: array(
- 0: // array access
+ 0: // property name variations
)
)
- dim: Scalar_String(
- value: c
- )
comments: array(
- 0: // array access
+ 0: // property name variations
)
)
- 4: Expr_ArrayDimFetch(
- var: Expr_StaticPropertyFetch(
+ 1: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
class: Name(
parts: array(
0: A
)
)
- name: b
+ name: Expr_Variable(
+ name: b
+ )
)
- dim: Scalar_String(
- value: c
+ )
+ 2: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Scalar_String(
+ value: b
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ comments: array(
+ 0: // array access
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
+ comments: array(
+ 0: // array access
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
+ comments: array(
+ 0: // array access
+ )
+ )
+ comments: array(
+ 0: // array access
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
)
)
5: Stmt_Nop(
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test b/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
index 8870ea5e..0ab18908 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
@@ -8,33 +8,43 @@ require_once 'A.php';
eval('A');
-----
array(
- 0: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 0: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_INCLUDE (1)
)
- type: TYPE_INCLUDE (1)
)
- 1: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 1: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_INCLUDE_ONCE (2)
)
- type: TYPE_INCLUDE_ONCE (2)
)
- 2: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 2: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_REQUIRE (3)
)
- type: TYPE_REQUIRE (3)
)
- 3: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 3: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_REQUIRE_ONCE (4)
)
- type: TYPE_REQURE_ONCE (4)
)
- 4: Expr_Eval(
- expr: Scalar_String(
- value: A
+ 4: Stmt_Expression(
+ expr: Expr_Eval(
+ expr: Scalar_String(
+ value: A
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test b/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
index 3a43d0d4..cd074b1a 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
@@ -9,65 +9,75 @@ empty(foo());
empty(array(1, 2, 3));
-----
array(
- 0: Expr_Isset(
- vars: array(
- 0: Expr_Variable(
+ 0: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
+ )
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
+ 1: Expr_Variable(
+ name: b
+ )
+ 2: Expr_Variable(
+ name: c
+ )
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Empty(
+ expr: Expr_Variable(
name: a
)
)
)
- 1: Expr_Isset(
- vars: array(
- 0: Expr_Variable(
- name: a
- )
- 1: Expr_Variable(
- name: b
- )
- 2: Expr_Variable(
- name: c
+ 3: Stmt_Expression(
+ expr: Expr_Empty(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
+ )
+ args: array(
+ )
)
)
)
- 2: Expr_Empty(
- expr: Expr_Variable(
- name: a
- )
- )
- 3: Expr_Empty(
- expr: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: foo
- )
- )
- args: array(
- )
- )
- )
- 4: Expr_Empty(
- expr: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 4: Stmt_Expression(
+ expr: Expr_Empty(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/listReferences.test b/vendor/nikic/php-parser/test/code/parser/expr/listReferences.test
new file mode 100644
index 00000000..fd9b1e87
--- /dev/null
+++ b/vendor/nikic/php-parser/test/code/parser/expr/listReferences.test
@@ -0,0 +1,88 @@
+List reference assignments (PHP 7.3)
+-----
+ &$v) = $x;
+[&$v] = $x;
+['k' => &$v] = $x;
+-----
+!!php7
+array(
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: k
+ )
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: k
+ )
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test b/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
index 48e9637a..d0cfbb5f 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
@@ -7,69 +7,73 @@ list('a' => list($b => $c), 'd' => $e) = $x;
-----
!!php7
array(
- 0: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- value: Expr_Variable(
- name: b
- )
- byRef: false
)
)
- )
- expr: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Scalar_String(
+ value: b
+ )
+ byRef: false
)
- value: Scalar_String(
- value: b
- )
- byRef: false
)
)
)
)
- 1: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: Expr_Variable(
- name: b
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Expr_Variable(
+ name: b
+ )
+ value: Expr_Variable(
+ name: c
+ )
+ byRef: false
)
- value: Expr_Variable(
- name: c
- )
- byRef: false
)
)
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: Scalar_String(
- value: d
+ 1: Expr_ArrayItem(
+ key: Scalar_String(
+ value: d
+ )
+ value: Expr_Variable(
+ name: e
+ )
+ byRef: false
)
- value: Expr_Variable(
- name: e
- )
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: x
+ expr: Expr_Variable(
+ name: x
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/logic.test b/vendor/nikic/php-parser/test/code/parser/expr/logic.test
index b3634e91..6b434565 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/logic.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/logic.test
@@ -21,103 +21,148 @@ $a = $b || $c;
$a = $b or $c;
-----
array(
- 0: Expr_BinaryOp_BooleanAnd(
- left: Expr_Variable(
- name: a
- comments: array(
- 0: // boolean ops
- )
- )
- right: Expr_Variable(
- name: b
- )
- comments: array(
- 0: // boolean ops
- )
- )
- 1: Expr_BinaryOp_BooleanOr(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 2: Expr_BooleanNot(
- expr: Expr_Variable(
- name: a
- )
- )
- 3: Expr_BooleanNot(
- expr: Expr_BooleanNot(
- expr: Expr_Variable(
- name: a
- )
- )
- )
- 4: Expr_BinaryOp_LogicalAnd(
- left: Expr_Variable(
- name: a
- comments: array(
- 0: // logical ops
- )
- )
- right: Expr_Variable(
- name: b
- )
- comments: array(
- 0: // logical ops
- )
- )
- 5: Expr_BinaryOp_LogicalOr(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 6: Expr_BinaryOp_LogicalXor(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 7: Expr_BinaryOp_BooleanOr(
- left: Expr_BinaryOp_BooleanAnd(
+ 0: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanAnd(
left: Expr_Variable(
name: a
comments: array(
- 0: // precedence
+ 0: // boolean ops
)
)
right: Expr_Variable(
name: b
)
comments: array(
- 0: // precedence
+ 0: // boolean ops
)
)
- right: Expr_BinaryOp_BooleanAnd(
+ comments: array(
+ 0: // boolean ops
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanOr(
left: Expr_Variable(
- name: c
+ name: a
)
right: Expr_Variable(
- name: d
+ name: b
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_BooleanNot(
+ expr: Expr_Variable(
+ name: a
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_BooleanNot(
+ expr: Expr_BooleanNot(
+ expr: Expr_Variable(
+ name: a
+ )
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalAnd(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // logical ops
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ comments: array(
+ 0: // logical ops
+ )
+ )
+ comments: array(
+ 0: // logical ops
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalXor(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanOr(
+ left: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // precedence
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ comments: array(
+ 0: // precedence
+ )
+ )
+ right: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
+ name: c
+ )
+ right: Expr_Variable(
+ name: d
+ )
+ )
+ comments: array(
+ 0: // precedence
)
)
comments: array(
0: // precedence
)
)
- 8: Expr_BinaryOp_BooleanAnd(
- left: Expr_BinaryOp_BooleanAnd(
- left: Expr_Variable(
+ 8: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanAnd(
+ left: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_BinaryOp_BooleanOr(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
+ )
+ )
+ right: Expr_Variable(
+ name: d
+ )
+ )
+ )
+ 9: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
name: a
)
- right: Expr_BinaryOp_BooleanOr(
+ expr: Expr_BinaryOp_BooleanOr(
left: Expr_Variable(
name: b
)
@@ -126,34 +171,20 @@ array(
)
)
)
- right: Expr_Variable(
- name: d
- )
)
- 9: Expr_Assign(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_BinaryOp_BooleanOr(
- left: Expr_Variable(
- name: b
+ 10: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
+ left: Expr_Assign(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
right: Expr_Variable(
name: c
)
)
)
- 10: Expr_BinaryOp_LogicalOr(
- left: Expr_Assign(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- right: Expr_Variable(
- name: c
- )
- )
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/math.test b/vendor/nikic/php-parser/test/code/parser/expr/math.test
index 3c00ebc7..8399400c 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/math.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/math.test
@@ -34,223 +34,280 @@ $a ** $b ** $c;
($a ** $b) ** $c;
-----
array(
- 0: Expr_BitwiseNot(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_BitwiseNot(
+ expr: Expr_Variable(
+ name: a
+ )
+ comments: array(
+ 0: // unary ops
+ )
)
comments: array(
0: // unary ops
)
)
- 1: Expr_UnaryPlus(
- expr: Expr_Variable(
- name: a
- )
- )
- 2: Expr_UnaryMinus(
- expr: Expr_Variable(
- name: a
- )
- )
- 3: Expr_BinaryOp_BitwiseAnd(
- left: Expr_Variable(
- name: a
- comments: array(
- 0: // binary ops
+ 1: Stmt_Expression(
+ expr: Expr_UnaryPlus(
+ expr: Expr_Variable(
+ name: a
)
)
- right: Expr_Variable(
- name: b
- )
- comments: array(
- 0: // binary ops
+ )
+ 2: Stmt_Expression(
+ expr: Expr_UnaryMinus(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 4: Expr_BinaryOp_BitwiseOr(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 5: Expr_BinaryOp_BitwiseXor(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 6: Expr_BinaryOp_Concat(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 7: Expr_BinaryOp_Div(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 8: Expr_BinaryOp_Minus(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 9: Expr_BinaryOp_Mod(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 10: Expr_BinaryOp_Mul(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 11: Expr_BinaryOp_Plus(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 12: Expr_BinaryOp_ShiftLeft(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 13: Expr_BinaryOp_ShiftRight(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 14: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 15: Expr_BinaryOp_Mul(
- left: Expr_BinaryOp_Mul(
+ 3: Stmt_Expression(
+ expr: Expr_BinaryOp_BitwiseAnd(
left: Expr_Variable(
name: a
comments: array(
- 0: // associativity
+ 0: // binary ops
)
)
right: Expr_Variable(
name: b
)
comments: array(
- 0: // associativity
+ 0: // binary ops
)
)
- right: Expr_Variable(
- name: c
+ comments: array(
+ 0: // binary ops
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_BitwiseOr(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_BitwiseXor(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_BinaryOp_Concat(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_Div(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 8: Stmt_Expression(
+ expr: Expr_BinaryOp_Minus(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 9: Stmt_Expression(
+ expr: Expr_BinaryOp_Mod(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 10: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 11: Stmt_Expression(
+ expr: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 12: Stmt_Expression(
+ expr: Expr_BinaryOp_ShiftLeft(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 13: Stmt_Expression(
+ expr: Expr_BinaryOp_ShiftRight(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 14: Stmt_Expression(
+ expr: Expr_BinaryOp_Pow(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 15: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // associativity
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ comments: array(
+ 0: // associativity
+ )
+ )
+ right: Expr_Variable(
+ name: c
+ )
+ comments: array(
+ 0: // associativity
+ )
)
comments: array(
0: // associativity
)
)
- 16: Expr_BinaryOp_Mul(
- left: Expr_Variable(
- name: a
- )
- right: Expr_BinaryOp_Mul(
+ 16: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
left: Expr_Variable(
- name: b
+ name: a
)
- right: Expr_Variable(
- name: c
+ right: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
)
)
)
- 17: Expr_BinaryOp_Plus(
- left: Expr_Variable(
- name: a
+ 17: Stmt_Expression(
+ expr: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // precedence
+ )
+ )
+ right: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
+ )
comments: array(
0: // precedence
)
)
- right: Expr_BinaryOp_Mul(
- left: Expr_Variable(
- name: b
- )
- right: Expr_Variable(
- name: c
- )
- )
comments: array(
0: // precedence
)
)
- 18: Expr_BinaryOp_Mul(
- left: Expr_BinaryOp_Plus(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- right: Expr_Variable(
- name: c
- )
- )
- 19: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: a
- comments: array(
- 0: // pow is special
- )
- )
- right: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: b
+ 18: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
right: Expr_Variable(
name: c
)
)
+ )
+ 19: Stmt_Expression(
+ expr: Expr_BinaryOp_Pow(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // pow is special
+ )
+ )
+ right: Expr_BinaryOp_Pow(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
+ )
+ comments: array(
+ 0: // pow is special
+ )
+ )
comments: array(
0: // pow is special
)
)
- 20: Expr_BinaryOp_Pow(
- left: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: a
+ 20: Stmt_Expression(
+ expr: Expr_BinaryOp_Pow(
+ left: Expr_BinaryOp_Pow(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
right: Expr_Variable(
- name: b
+ name: c
)
)
- right: Expr_Variable(
- name: c
- )
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/new.test b/vendor/nikic/php-parser/test/code/parser/expr/new.test
index a132bbb4..2735bfe9 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/new.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/new.test
@@ -19,128 +19,169 @@ new $a->b{'c'}();
(new A);
-----
array(
- 0: Expr_New(
- class: Name(
- parts: array(
- 0: A
- )
- )
- args: array(
- )
- )
- 1: Expr_New(
- class: Name(
- parts: array(
- 0: A
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: b
- )
- byRef: false
- unpack: false
- )
- )
- )
- 2: Expr_New(
- class: Expr_Variable(
- name: a
- )
- args: array(
- )
- comments: array(
- 0: // class name variations
- )
- )
- 3: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
- )
- )
- args: array(
- )
- )
- 4: Expr_New(
- class: Expr_StaticPropertyFetch(
+ 0: Stmt_Expression(
+ expr: Expr_New(
class: Name(
parts: array(
0: A
)
)
- name: b
- )
- args: array(
+ args: array(
+ )
)
)
- 5: Expr_New(
- class: Expr_PropertyFetch(
- var: Expr_Variable(
+ 1: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_Variable(
name: a
)
- name: b
+ args: array(
+ )
+ comments: array(
+ 0: // class name variations
+ )
)
- args: array(
+ comments: array(
+ 0: // class name variations
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ args: array(
+ )
+ comments: array(
+ 0: // DNCR object access
+ )
)
comments: array(
0: // DNCR object access
)
)
- 6: Expr_New(
- class: Expr_PropertyFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 6: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_PropertyFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ name: Identifier(
+ name: c
)
- name: b
)
- name: c
- )
- args: array(
+ args: array(
+ )
)
)
- 7: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 7: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
)
- name: b
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
- )
)
- 8: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 8: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
)
- name: b
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
- )
)
- 9: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ 9: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
)
)
- args: array(
+ comments: array(
+ 0: // test regression introduces by new dereferencing syntax
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test b/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
index ca7f4981..318f9301 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
@@ -14,10 +14,12 @@ new;
!!php7
Syntax error, unexpected ';' from 2:4 to 2:4
array(
- 0: Expr_New(
- class: Expr_Error(
- )
- args: array(
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_Error(
+ )
+ args: array(
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/print.test b/vendor/nikic/php-parser/test/code/parser/expr/print.test
index d07afda0..84ed7775 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/print.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/print.test
@@ -4,9 +4,11 @@ Print
print $a;
-----
array(
- 0: Expr_Print(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Print(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test b/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
index 2304fd98..115d9f0a 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
@@ -8,38 +8,48 @@ Shell execution
`test \"`;
-----
array(
- 0: Expr_ShellExec(
- parts: array(
- )
- )
- 1: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test
+ 0: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
)
)
)
- 2: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test
- )
- 1: Expr_Variable(
- name: A
+ 1: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test
+ )
)
)
)
- 3: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test `
+ 2: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test
+ )
+ 1: Expr_Variable(
+ name: A
+ )
)
)
)
- 4: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test \"
+ 3: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test `
+ )
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test \"
+ )
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test b/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
index 268935db..ea1010ca 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
@@ -17,38 +17,12 @@ $a ?? $b ? $c : $d;
$a && $b ?? $c;
-----
array(
- 0: Expr_Ternary(
- cond: Expr_Variable(
- name: a
- comments: array(
- 0: // ternary
- )
- )
- if: Expr_Variable(
- name: b
- )
- else: Expr_Variable(
- name: c
- )
- comments: array(
- 0: // ternary
- )
- )
- 1: Expr_Ternary(
- cond: Expr_Variable(
- name: a
- )
- if: null
- else: Expr_Variable(
- name: c
- )
- )
- 2: Expr_Ternary(
- cond: Expr_Ternary(
+ 0: Stmt_Expression(
+ expr: Expr_Ternary(
cond: Expr_Variable(
name: a
comments: array(
- 0: // precedence
+ 0: // ternary
)
)
if: Expr_Variable(
@@ -58,92 +32,143 @@ array(
name: c
)
comments: array(
- 0: // precedence
+ 0: // ternary
)
)
- if: Expr_Variable(
- name: d
- )
- else: Expr_Variable(
- name: e
- )
comments: array(
- 0: // precedence
+ 0: // ternary
)
)
- 3: Expr_Ternary(
- cond: Expr_Variable(
- name: a
- )
- if: Expr_Variable(
- name: b
- )
- else: Expr_Ternary(
+ 1: Stmt_Expression(
+ expr: Expr_Ternary(
cond: Expr_Variable(
+ name: a
+ )
+ if: null
+ else: Expr_Variable(
name: c
)
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Ternary(
+ cond: Expr_Ternary(
+ cond: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // precedence
+ )
+ )
+ if: Expr_Variable(
+ name: b
+ )
+ else: Expr_Variable(
+ name: c
+ )
+ comments: array(
+ 0: // precedence
+ )
+ )
if: Expr_Variable(
name: d
)
else: Expr_Variable(
name: e
)
+ comments: array(
+ 0: // precedence
+ )
+ )
+ comments: array(
+ 0: // precedence
)
)
- 4: Expr_BinaryOp_Coalesce(
- left: Expr_Variable(
- name: a
+ 3: Stmt_Expression(
+ expr: Expr_Ternary(
+ cond: Expr_Variable(
+ name: a
+ )
+ if: Expr_Variable(
+ name: b
+ )
+ else: Expr_Ternary(
+ cond: Expr_Variable(
+ name: c
+ )
+ if: Expr_Variable(
+ name: d
+ )
+ else: Expr_Variable(
+ name: e
+ )
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_Coalesce(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // null coalesce
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
comments: array(
0: // null coalesce
)
)
- right: Expr_Variable(
- name: b
- )
comments: array(
0: // null coalesce
)
)
- 5: Expr_BinaryOp_Coalesce(
- left: Expr_Variable(
- name: a
- )
- right: Expr_BinaryOp_Coalesce(
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_Coalesce(
left: Expr_Variable(
- name: b
+ name: a
+ )
+ right: Expr_BinaryOp_Coalesce(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_Ternary(
+ cond: Expr_BinaryOp_Coalesce(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ if: Expr_Variable(
+ name: c
+ )
+ else: Expr_Variable(
+ name: d
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_Coalesce(
+ left: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
right: Expr_Variable(
name: c
)
)
)
- 6: Expr_Ternary(
- cond: Expr_BinaryOp_Coalesce(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- if: Expr_Variable(
- name: c
- )
- else: Expr_Variable(
- name: d
- )
- )
- 7: Expr_BinaryOp_Coalesce(
- left: Expr_BinaryOp_BooleanAnd(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- right: Expr_Variable(
- name: c
- )
- )
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/trailingCommas.test b/vendor/nikic/php-parser/test/code/parser/expr/trailingCommas.test
new file mode 100644
index 00000000..11092d98
--- /dev/null
+++ b/vendor/nikic/php-parser/test/code/parser/expr/trailingCommas.test
@@ -0,0 +1,140 @@
+PHP 7.3 trailing comma additions
+-----
+bar($a, $b, );
+Foo::bar($a, $b, );
+new Foo($a, $b, );
+unset($a, $b, );
+isset($a, $b, );
+-----
+!!php7
+array(
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: foo
+ )
+ name: Identifier(
+ name: bar
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Identifier(
+ name: bar
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 4: Stmt_Unset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
+ 1: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
+ 1: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test b/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
index 4cd2e680..5ae4f958 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
@@ -15,10 +15,12 @@ array(
)
)
)
- 1: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: bar
+ 1: Stmt_Expression(
+ expr: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: bar
+ )
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test b/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
index bb3e7fbe..2f36cc7a 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
@@ -17,35 +17,8 @@ id(['udef', 'id'])[1]()('var_dump')(5);
-----
!!php7
array(
- 0: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: id
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_String(
- value: var_dump
- )
- byRef: false
- unpack: false
- )
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- unpack: false
- )
- )
- )
- 1: Expr_FuncCall(
- name: Expr_FuncCall(
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Name(
parts: array(
@@ -55,7 +28,7 @@ array(
args: array(
0: Arg(
value: Scalar_String(
- value: id
+ value: var_dump
)
byRef: false
unpack: false
@@ -64,26 +37,17 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 1
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 2
- )
- byRef: false
- unpack: false
- )
- )
)
- 2: Expr_FuncCall(
- name: Expr_FuncCall(
+ 1: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
name: Name(
@@ -92,123 +56,19 @@ array(
)
)
args: array(
- )
- )
- args: array(
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_String(
- value: var_dump
- )
- byRef: false
- unpack: false
- )
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 4
- )
- byRef: false
- unpack: false
- )
- )
- )
- 3: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: id
+ 0: Arg(
+ value: Scalar_String(
+ value: id
)
- )
- args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: udef
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: id
- )
- byRef: false
- )
- )
- )
- byRef: false
- unpack: false
- )
- )
- )
- dim: Scalar_LNumber(
- value: 1
- )
- )
- args: array(
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_String(
- value: var_dump
- )
- byRef: false
- unpack: false
- )
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 5
- )
- byRef: false
- unpack: false
- )
- )
- )
- 4: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
byRef: false
- variadic: false
- name: x
- default: null
- )
- )
- uses: array(
- )
- returnType: null
- stmts: array(
- 0: Stmt_Return(
- expr: Expr_Variable(
- name: x
- )
+ unpack: false
)
)
)
args: array(
0: Arg(
value: Scalar_String(
- value: id
+ value: var_dump
)
byRef: false
unpack: false
@@ -217,71 +77,23 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 2
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 8
- )
- byRef: false
- unpack: false
- )
- )
)
- 5: Expr_FuncCall(
- name: Expr_FuncCall(
+ 2: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_Assign(
- var: Expr_Variable(
- name: f
- )
- expr: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: x
- default: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: null
- )
- )
- )
- )
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: f
- byRef: true
- )
- )
- returnType: null
- stmts: array(
- 0: Stmt_Return(
- expr: Expr_Ternary(
- cond: Expr_Variable(
- name: x
- )
- if: null
- else: Expr_Variable(
- name: f
- )
- )
- )
- )
+ name: Name(
+ parts: array(
+ 0: id
)
)
args: array(
@@ -291,50 +103,309 @@ array(
)
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 4
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 9
+ )
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: id
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: udef
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
+ )
+ )
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 1
+ )
+ )
+ args: array(
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_LNumber(
+ value: 5
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 6: Expr_FuncCall(
- name: Expr_FuncCall(
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: x
+ )
+ default: null
+ )
+ )
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
+ 0: Stmt_Return(
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_LNumber(
+ value: 8
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: obj
- )
- byRef: false
+ name: Expr_FuncCall(
+ name: Expr_Assign(
+ var: Expr_Variable(
+ name: f
)
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: id
- )
+ expr: Expr_Closure(
+ static: false
byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: x
+ )
+ default: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: null
+ )
+ )
+ )
+ )
+ )
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: f
+ )
+ byRef: true
+ )
+ )
+ returnType: null
+ stmts: array(
+ 0: Stmt_Return(
+ expr: Expr_Ternary(
+ cond: Expr_Variable(
+ name: x
+ )
+ if: null
+ else: Expr_Variable(
+ name: f
+ )
+ )
+ )
+ )
)
)
+ args: array(
+ )
+ )
+ args: array(
+ )
+ )
+ args: array(
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_LNumber(
+ value: 9
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: obj
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
+ )
+ )
+ )
+ args: array(
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: id
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_LNumber(
+ value: 10
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Scalar_String(
+ value: id
)
args: array(
)
@@ -351,8 +422,8 @@ array(
)
args: array(
0: Arg(
- value: Expr_Variable(
- name: id
+ value: Scalar_String(
+ value: var_dump
)
byRef: false
unpack: false
@@ -361,30 +432,26 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 12
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 10
- )
- byRef: false
- unpack: false
- )
- )
)
- 7: Expr_FuncCall(
- name: Expr_FuncCall(
+ 8: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
- name: Scalar_String(
- value: id
+ name: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: i
+ )
+ right: Scalar_String(
+ value: d
+ )
)
args: array(
)
@@ -392,7 +459,7 @@ array(
args: array(
0: Arg(
value: Scalar_String(
- value: id
+ value: var_dump
)
byRef: false
unpack: false
@@ -401,81 +468,40 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 13
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 12
- )
- byRef: false
- unpack: false
- )
- )
)
- 8: Expr_FuncCall(
- name: Expr_FuncCall(
+ 9: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: i
- )
- right: Scalar_String(
- value: d
- )
+ name: Scalar_String(
+ value: \id
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 14
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 13
- )
- byRef: false
- unpack: false
- )
- )
)
- 9: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Scalar_String(
- value: \id
- )
- args: array(
- 0: Arg(
- value: Scalar_String(
- value: var_dump
- )
- byRef: false
- unpack: false
- )
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 14
- )
- byRef: false
- unpack: false
- )
- )
- )
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test b/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
index 35bc8ed1..68133a86 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
@@ -8,67 +8,77 @@ isset("str"->a);
-----
!!php7
array(
- 0: Expr_Isset(
- vars: array(
- 0: Expr_ArrayDimFetch(
- var: Expr_BinaryOp_Plus(
- left: Expr_Array(
+ 0: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_ArrayDimFetch(
+ var: Expr_BinaryOp_Plus(
+ left: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 0
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
+ )
+ )
+ )
+ right: Expr_Array(
+ items: array(
+ )
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ )
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_PropertyFetch(
+ var: Expr_Array(
items: array(
0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 0
+ key: Scalar_String(
+ value: a
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ value: Scalar_String(
+ value: b
)
byRef: false
)
)
)
- right: Expr_Array(
- items: array(
- )
+ name: Identifier(
+ name: a
)
)
- dim: Scalar_LNumber(
- value: 0
- )
)
)
)
- 1: Expr_Isset(
- vars: array(
- 0: Expr_PropertyFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Scalar_String(
- value: b
- )
- byRef: false
- )
+ 2: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_PropertyFetch(
+ var: Scalar_String(
+ value: str
+ )
+ name: Identifier(
+ name: a
)
)
- name: a
)
)
)
- 2: Expr_Isset(
- vars: array(
- 0: Expr_PropertyFetch(
- var: Scalar_String(
- value: str
- )
- name: a
- )
- )
- )
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test b/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
index 2c5ba900..73b515f0 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
@@ -10,100 +10,118 @@ A::A[0][1][2];
-----
!!php7
array(
- 0: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: A
)
)
- name: A
- )
- dim: Scalar_LNumber(
- value: 0
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
)
- 1: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ var: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: A
)
)
- name: A
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 1
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 2
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Scalar_String(
+ value: string
+ )
+ name: Identifier(
+ name: length
+ )
+ args: array(
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Clone(
+ expr: Expr_Variable(
+ name: obj
+ )
+ )
+ name: Identifier(
+ name: b
+ )
)
dim: Scalar_LNumber(
value: 0
)
)
- dim: Scalar_LNumber(
+ args: array(
+ 0: Arg(
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 0
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
+ )
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ expr: Scalar_LNumber(
value: 1
)
)
- dim: Scalar_LNumber(
- value: 2
- )
)
- 2: Expr_MethodCall(
- var: Scalar_String(
- value: string
- )
- name: length
- args: array(
- )
- )
- 3: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Clone(
- expr: Expr_Variable(
- name: obj
- )
- )
- name: b
- )
- dim: Scalar_LNumber(
- value: 0
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- unpack: false
- )
- )
- )
- 4: Expr_Assign(
- var: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 0
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- )
- )
- )
- dim: Scalar_LNumber(
- value: 0
- )
- )
- expr: Scalar_LNumber(
- value: 1
- )
- )
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test b/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
index e5f92f97..5e1caf2f 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
@@ -11,85 +11,109 @@ new $weird[0]->foo::$className;
-----
!!php7
array(
- 0: Expr_New(
- class: Expr_Variable(
- name: className
- )
- args: array(
- )
- )
- 1: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: array
- )
- dim: Scalar_String(
- value: className
- )
- )
- args: array(
- )
- )
- 2: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: array
- )
- dim: Scalar_String(
- value: className
- )
- )
- args: array(
- )
- )
- 3: Expr_New(
- class: Expr_PropertyFetch(
- var: Expr_Variable(
- name: obj
- )
- name: className
- )
- args: array(
- )
- )
- 4: Expr_New(
- class: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: Test
- )
- )
- name: className
- )
- args: array(
- )
- )
- 5: Expr_New(
- class: Expr_StaticPropertyFetch(
+ 0: Stmt_Expression(
+ expr: Expr_New(
class: Expr_Variable(
- name: test
+ name: className
+ )
+ args: array(
)
- name: className
- )
- args: array(
)
)
- 6: Expr_New(
- class: Expr_StaticPropertyFetch(
+ 1: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: array
+ )
+ dim: Scalar_String(
+ value: className
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: array
+ )
+ dim: Scalar_String(
+ value: className
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_New(
class: Expr_PropertyFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: weird
- )
- dim: Scalar_LNumber(
- value: 0
+ var: Expr_Variable(
+ name: obj
+ )
+ name: Identifier(
+ name: className
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: Test
)
)
- name: foo
+ name: VarLikeIdentifier(
+ name: className
+ )
+ )
+ args: array(
)
- name: className
- )
- args: array(
)
)
-)
+ 5: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Expr_Variable(
+ name: test
+ )
+ name: VarLikeIdentifier(
+ name: className
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Expr_PropertyFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: weird
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ name: Identifier(
+ name: foo
+ )
+ )
+ name: VarLikeIdentifier(
+ name: className
+ )
+ )
+ args: array(
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test b/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
index 5fadfc48..bf3547ca 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
@@ -12,82 +12,112 @@ A::$A::$b;
-----
!!php7
array(
- 0: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
)
)
- name: b
)
- 1: Expr_StaticPropertyFetch(
- class: Expr_Variable(
- name: A
+ 1: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_Variable(
+ name: A
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
)
- name: b
)
- 2: Expr_StaticPropertyFetch(
- class: Scalar_String(
- value: A
- )
- name: b
- )
- 3: Expr_StaticPropertyFetch(
- class: Expr_BinaryOp_Concat(
- left: Scalar_String(
+ 2: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Scalar_String(
value: A
)
- right: Scalar_String(
- value:
+ name: VarLikeIdentifier(
+ name: b
)
)
- name: b
- )
- 4: Expr_StaticPropertyFetch(
- class: Expr_ArrayDimFetch(
- var: Scalar_String(
- value: A
- )
- dim: Scalar_LNumber(
- value: 0
- )
- )
- name: b
- )
- 5: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
- )
- )
- name: Expr_Variable(
- name: b
- )
)
- 6: Expr_ArrayDimFetch(
- var: Expr_StaticPropertyFetch(
+ 3: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: A
+ )
+ right: Scalar_String(
+ value:
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_ArrayDimFetch(
+ var: Scalar_String(
+ value: A
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
class: Name(
parts: array(
0: A
)
)
name: Expr_Variable(
- name: c
+ name: b
)
)
- dim: Scalar_LNumber(
- value: 1
- )
)
- 7: Expr_StaticPropertyFetch(
- class: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 6: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Expr_Variable(
+ name: c
)
)
- name: A
+ dim: Scalar_LNumber(
+ value: 1
+ )
)
- name: b
)
-)
+ 7: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/expr/variable.test b/vendor/nikic/php-parser/test/code/parser/expr/variable.test
index 3a709f99..c30326cc 100644
--- a/vendor/nikic/php-parser/test/code/parser/expr/variable.test
+++ b/vendor/nikic/php-parser/test/code/parser/expr/variable.test
@@ -11,45 +11,57 @@ $$a['b'];
-----
!!php5
array(
- 0: Expr_Variable(
- name: a
- )
- 1: Expr_Variable(
- name: Scalar_String(
- value: a
- )
- )
- 2: Expr_Variable(
- name: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: foo
- )
- )
- args: array(
- )
- )
- )
- 3: Expr_Variable(
- name: Expr_Variable(
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
name: a
)
)
- 4: Expr_Variable(
- name: Expr_Variable(
+ 1: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Scalar_String(
+ value: a
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_Variable(
name: Expr_Variable(
name: a
)
)
)
- 5: Expr_Variable(
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
+ 4: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_Variable(
+ name: Expr_Variable(
+ name: a
+ )
)
)
)
-)
+ 5: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/exprStmtMode.test b/vendor/nikic/php-parser/test/code/parser/exprStmtMode.test
new file mode 100644
index 00000000..759e9e54
--- /dev/null
+++ b/vendor/nikic/php-parser/test/code/parser/exprStmtMode.test
@@ -0,0 +1,57 @@
+Expression statement mode
+-----
+ float overflows
+ 1: // (all are actually the same number, just in different representations)
+ )
+ )
comments: array(
0: // various integer -> float overflows
1: // (all are actually the same number, just in different representations)
)
)
- 11: Scalar_DNumber(
- value: 1.844674407371E+19
+ 11: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
- 12: Scalar_DNumber(
- value: 1.844674407371E+19
+ 12: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
- 13: Scalar_DNumber(
- value: 1.844674407371E+19
+ 13: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
- 14: Scalar_DNumber(
- value: 1.844674407371E+19
+ 14: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/scalar/int.test b/vendor/nikic/php-parser/test/code/parser/scalar/int.test
index 5a212677..b65858db 100644
--- a/vendor/nikic/php-parser/test/code/parser/scalar/int.test
+++ b/vendor/nikic/php-parser/test/code/parser/scalar/int.test
@@ -13,31 +13,49 @@ Different integer syntaxes
0b111000111000;
-----
array(
- 0: Scalar_LNumber(
- value: 0
+ 0: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 0
+ )
)
- 1: Scalar_LNumber(
- value: 1
+ 1: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 1
+ )
)
- 2: Scalar_LNumber(
- value: @@{ PHP_INT_MAX }@@
+ 2: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: @@{ PHP_INT_MAX }@@
+ )
)
- 3: Scalar_DNumber(
- value: @@{ PHP_INT_MAX + 1 }@@
+ 3: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: @@{ PHP_INT_MAX + 1 }@@
+ )
)
- 4: Scalar_LNumber(
- value: 4095
+ 4: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 4095
+ )
)
- 5: Scalar_LNumber(
- value: 4095
+ 5: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 4095
+ )
)
- 6: Scalar_LNumber(
- value: 4095
+ 6: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 4095
+ )
)
- 7: Scalar_LNumber(
- value: 511
+ 7: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 511
+ )
)
- 8: Scalar_LNumber(
- value: 3640
+ 8: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 3640
+ )
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test b/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
index bef3061c..cd0cbfba 100644
--- a/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
+++ b/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
@@ -6,8 +6,10 @@ Invalid octal literals
!!php7
Invalid numeric literal from 2:1 to 2:4
array(
- 0: Scalar_LNumber(
- value: 0
+ 0: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 0
+ )
)
)
-----
@@ -16,7 +18,9 @@ array(
-----
!!php5
array(
- 0: Scalar_LNumber(
- value: 7
+ 0: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 7
+ )
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test b/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test
index 9b981eb6..520ea177 100644
--- a/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test
+++ b/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test
@@ -12,20 +12,36 @@ __NAMESPACE__;
__TRAIT__;
-----
array(
- 0: Scalar_MagicConst_Class(
+ 0: Stmt_Expression(
+ expr: Scalar_MagicConst_Class(
+ )
)
- 1: Scalar_MagicConst_Dir(
+ 1: Stmt_Expression(
+ expr: Scalar_MagicConst_Dir(
+ )
)
- 2: Scalar_MagicConst_File(
+ 2: Stmt_Expression(
+ expr: Scalar_MagicConst_File(
+ )
)
- 3: Scalar_MagicConst_Function(
+ 3: Stmt_Expression(
+ expr: Scalar_MagicConst_Function(
+ )
)
- 4: Scalar_MagicConst_Line(
+ 4: Stmt_Expression(
+ expr: Scalar_MagicConst_Line(
+ )
)
- 5: Scalar_MagicConst_Method(
+ 5: Stmt_Expression(
+ expr: Scalar_MagicConst_Method(
+ )
)
- 6: Scalar_MagicConst_Namespace(
+ 6: Stmt_Expression(
+ expr: Scalar_MagicConst_Namespace(
+ )
)
- 7: Scalar_MagicConst_Trait(
+ 7: Stmt_Expression(
+ expr: Scalar_MagicConst_Trait(
+ )
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test b/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
index 33a96119..95d98295 100644
--- a/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
+++ b/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
@@ -8,13 +8,19 @@ Unicode escape sequence
-----
!!php7
array(
- 0: Scalar_String(
- value: @@{"\0"}@@
+ 0: Stmt_Expression(
+ expr: Scalar_String(
+ value: @@{"\0"}@@
+ )
)
- 1: Scalar_String(
- value: Ĕ
+ 1: Stmt_Expression(
+ expr: Scalar_String(
+ value: Ĕ
+ )
)
- 2: Scalar_String(
- value: @@{"\xF0\x9F\x98\x82"}@@
+ 2: Stmt_Expression(
+ expr: Scalar_String(
+ value: @@{"\xF0\x9F\x98\x82"}@@
+ )
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/semiReserved.test b/vendor/nikic/php-parser/test/code/parser/semiReserved.test
index 34105300..da155e64 100644
--- a/vendor/nikic/php-parser/test/code/parser/semiReserved.test
+++ b/vendor/nikic/php-parser/test/code/parser/semiReserved.test
@@ -55,7 +55,9 @@ class Foo {
array(
0: Stmt_Class(
flags: 0
- name: Test
+ name: Identifier(
+ name: Test
+ )
extends: null
implements: array(
)
@@ -63,7 +65,9 @@ array(
0: Stmt_ClassMethod(
flags: 0
byRef: false
- name: array
+ name: Identifier(
+ name: array
+ )
params: array(
)
returnType: null
@@ -73,7 +77,9 @@ array(
1: Stmt_ClassMethod(
flags: 0
byRef: false
- name: public
+ name: Identifier(
+ name: public
+ )
params: array(
)
returnType: null
@@ -83,7 +89,9 @@ array(
2: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: list
+ name: Identifier(
+ name: list
+ )
params: array(
)
returnType: null
@@ -93,7 +101,9 @@ array(
3: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: protected
+ name: Identifier(
+ name: protected
+ )
params: array(
)
returnType: null
@@ -104,7 +114,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: class
+ name: VarLikeIdentifier(
+ name: class
+ )
default: null
)
)
@@ -113,7 +125,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: private
+ name: VarLikeIdentifier(
+ name: private
+ )
default: null
)
)
@@ -122,13 +136,17 @@ array(
flags: 0
consts: array(
0: Const(
- name: TRAIT
+ name: Identifier(
+ name: TRAIT
+ )
value: Scalar_LNumber(
value: 3
)
)
1: Const(
- name: FINAL
+ name: Identifier(
+ name: FINAL
+ )
value: Scalar_LNumber(
value: 4
)
@@ -139,49 +157,65 @@ array(
flags: 0
consts: array(
0: Const(
- name: __CLASS__
+ name: Identifier(
+ name: __CLASS__
+ )
value: Scalar_LNumber(
value: 1
)
)
1: Const(
- name: __TRAIT__
+ name: Identifier(
+ name: __TRAIT__
+ )
value: Scalar_LNumber(
value: 2
)
)
2: Const(
- name: __FUNCTION__
+ name: Identifier(
+ name: __FUNCTION__
+ )
value: Scalar_LNumber(
value: 3
)
)
3: Const(
- name: __METHOD__
+ name: Identifier(
+ name: __METHOD__
+ )
value: Scalar_LNumber(
value: 4
)
)
4: Const(
- name: __LINE__
+ name: Identifier(
+ name: __LINE__
+ )
value: Scalar_LNumber(
value: 5
)
)
5: Const(
- name: __FILE__
+ name: Identifier(
+ name: __FILE__
+ )
value: Scalar_LNumber(
value: 6
)
)
6: Const(
- name: __DIR__
+ name: Identifier(
+ name: __DIR__
+ )
value: Scalar_LNumber(
value: 7
)
)
7: Const(
- name: __NAMESPACE__
+ name: Identifier(
+ name: __NAMESPACE__
+ )
value: Scalar_LNumber(
value: 8
)
@@ -190,87 +224,123 @@ array(
)
)
)
- 1: Expr_Assign(
- var: Expr_Variable(
- name: t
- )
- expr: Expr_New(
- class: Name(
- parts: array(
- 0: Test
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: t
+ )
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
)
+ args: array(
+ )
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: array
)
args: array(
)
)
)
- 2: Expr_MethodCall(
- var: Expr_Variable(
- name: t
- )
- name: array
- args: array(
- )
- )
- 3: Expr_MethodCall(
- var: Expr_Variable(
- name: t
- )
- name: public
- args: array(
- )
- )
- 4: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: Test
+ 3: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: public
+ )
+ args: array(
)
)
- name: list
- args: array(
- )
)
- 5: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: Test
+ 4: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: list
+ )
+ args: array(
)
)
- name: protected
- args: array(
- )
)
- 6: Expr_PropertyFetch(
- var: Expr_Variable(
- name: t
- )
- name: class
- )
- 7: Expr_PropertyFetch(
- var: Expr_Variable(
- name: t
- )
- name: private
- )
- 8: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Test
+ 5: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: protected
+ )
+ args: array(
)
)
- name: TRAIT
)
- 9: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Test
+ 6: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: class
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: private
+ )
+ )
+ )
+ 8: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: TRAIT
+ )
+ )
+ )
+ 9: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: FINAL
)
)
- name: FINAL
)
10: Stmt_Class(
flags: 0
- name: Foo
+ name: Identifier(
+ name: Foo
+ )
extends: null
implements: array(
)
@@ -295,7 +365,9 @@ array(
0: TraitA
)
)
- method: catch
+ method: Identifier(
+ name: catch
+ )
insteadof: array(
0: Name_Relative(
parts: array(
@@ -310,9 +382,13 @@ array(
0: TraitA
)
)
- method: list
+ method: Identifier(
+ name: list
+ )
newModifier: null
- newName: foreach
+ newName: Identifier(
+ name: foreach
+ )
)
2: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -320,9 +396,13 @@ array(
0: TraitB
)
)
- method: throw
+ method: Identifier(
+ name: throw
+ )
newModifier: MODIFIER_PROTECTED (2)
- newName: public
+ newName: Identifier(
+ name: public
+ )
)
3: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -330,15 +410,21 @@ array(
0: TraitB
)
)
- method: self
+ method: Identifier(
+ name: self
+ )
newModifier: MODIFIER_PROTECTED (2)
newName: null
)
4: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: exit
+ method: Identifier(
+ name: exit
+ )
newModifier: null
- newName: die
+ newName: Identifier(
+ name: die
+ )
)
5: Stmt_TraitUseAdaptation_Alias(
trait: Name_FullyQualified(
@@ -346,9 +432,13 @@ array(
0: TraitC
)
)
- method: exit
+ method: Identifier(
+ name: exit
+ )
newModifier: null
- newName: bye
+ newName: Identifier(
+ name: bye
+ )
)
6: Stmt_TraitUseAdaptation_Alias(
trait: Name_Relative(
@@ -356,9 +446,13 @@ array(
0: TraitC
)
)
- method: exit
+ method: Identifier(
+ name: exit
+ )
newModifier: null
- newName: byebye
+ newName: Identifier(
+ name: byebye
+ )
)
7: Stmt_TraitUseAdaptation_Precedence(
trait: Name(
@@ -366,7 +460,14 @@ array(
0: TraitA
)
)
- method: catch
+ method: Identifier(
+ name: catch
+ comments: array(
+ 0: //
+ 1: /** doc comment */
+ 2: #
+ )
+ )
insteadof: array(
0: Name(
parts: array(
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test b/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
index ae83dabb..abf58646 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
@@ -22,8 +22,10 @@ array(
name: a
)
stmts: array(
- 0: Expr_Variable(
- name: A
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: A
+ )
)
)
elseifs: array(
@@ -32,16 +34,20 @@ array(
name: b
)
stmts: array(
- 0: Expr_Variable(
- name: B
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: B
+ )
)
)
)
)
else: Stmt_Else(
stmts: array(
- 0: Expr_Variable(
- name: C
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: C
+ )
)
)
)
@@ -54,8 +60,10 @@ array(
loop: array(
)
stmts: array(
- 0: Expr_Variable(
- name: foo
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: foo
+ )
)
)
)
@@ -69,8 +77,10 @@ array(
name: b
)
stmts: array(
- 0: Expr_Variable(
- name: AB
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: AB
+ )
)
)
)
@@ -79,33 +89,41 @@ array(
name: a
)
stmts: array(
- 0: Expr_Variable(
- name: A
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: A
+ )
)
)
)
4: Stmt_Do(
+ stmts: array(
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: A
+ )
+ )
+ )
cond: Expr_Variable(
name: a
)
- stmts: array(
- 0: Expr_Variable(
- name: A
- )
- )
)
5: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: a
+ key: Identifier(
+ name: a
+ )
value: Scalar_String(
value: b
)
)
)
stmts: array(
- 0: Expr_Variable(
- name: C
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: C
+ )
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
index 8c9a99c7..01a82e51 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
@@ -10,7 +10,9 @@ abstract class A {
array(
0: Stmt_Class(
flags: MODIFIER_ABSTRACT (16)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -18,7 +20,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -28,7 +32,9 @@ array(
1: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC | MODIFIER_ABSTRACT (17)
byRef: false
- name: b
+ name: Identifier(
+ name: b
+ )
params: array(
)
returnType: null
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
index 266d9435..a676db68 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
@@ -22,123 +22,137 @@ class A {
}
-----
array(
- 0: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: null
- implements: array(
- )
- stmts: array(
- 0: Stmt_ClassMethod(
- flags: MODIFIER_PUBLIC (1)
- byRef: false
- name: test
- params: array(
- )
- returnType: null
- stmts: array(
- )
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: null
+ implements: array(
)
- )
- )
- args: array(
- )
- )
- 1: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: Name(
- parts: array(
- 0: A
- )
- )
- implements: array(
- 0: Name(
- parts: array(
- 0: B
- )
- )
- 1: Name(
- parts: array(
- 0: C
- )
- )
- )
- stmts: array(
- )
- )
- args: array(
- )
- )
- 2: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: null
- implements: array(
- )
- stmts: array(
- 0: Stmt_Property(
- flags: MODIFIER_PUBLIC (1)
- props: array(
- 0: Stmt_PropertyProperty(
- name: foo
- default: null
+ stmts: array(
+ 0: Stmt_ClassMethod(
+ flags: MODIFIER_PUBLIC (1)
+ byRef: false
+ name: Identifier(
+ name: test
+ )
+ params: array(
+ )
+ returnType: null
+ stmts: array(
)
)
)
)
- )
- args: array(
+ args: array(
+ )
)
)
- 3: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ implements: array(
+ 0: Name(
+ parts: array(
+ 0: B
+ )
+ )
+ 1: Name(
+ parts: array(
+ 0: C
+ )
+ )
+ )
+ stmts: array(
)
)
- implements: array(
+ args: array(
)
- stmts: array(
- 0: Stmt_TraitUse(
- traits: array(
- 0: Name(
- parts: array(
- 0: T
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: null
+ implements: array(
+ )
+ stmts: array(
+ 0: Stmt_Property(
+ flags: MODIFIER_PUBLIC (1)
+ props: array(
+ 0: Stmt_PropertyProperty(
+ name: VarLikeIdentifier(
+ name: foo
+ )
+ default: null
)
)
)
- adaptations: array(
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ implements: array(
+ )
+ stmts: array(
+ 0: Stmt_TraitUse(
+ traits: array(
+ 0: Name(
+ parts: array(
+ 0: T
+ )
+ )
+ )
+ adaptations: array(
+ )
)
)
)
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
- )
- 1: Arg(
- value: Expr_Variable(
- name: b
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
4: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -146,7 +160,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
)
returnType: null
@@ -168,7 +184,9 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
index e18090c7..40a93508 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
@@ -18,7 +18,9 @@ array(
stmts: array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
index b3604ed6..a6aa7972 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
@@ -10,7 +10,9 @@ Cannot use 'static' as constant modifier from 3:5 to 3:10
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -19,7 +21,9 @@ array(
flags: MODIFIER_STATIC (8)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
@@ -40,7 +44,9 @@ Cannot use 'abstract' as constant modifier from 3:5 to 3:12
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -49,7 +55,9 @@ array(
flags: MODIFIER_ABSTRACT (16)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
@@ -70,7 +78,9 @@ Cannot use 'final' as constant modifier from 3:5 to 3:9
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -79,7 +89,9 @@ array(
flags: MODIFIER_FINAL (32)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
@@ -100,7 +112,9 @@ Multiple access type modifiers are not allowed from 3:12 to 3:17
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -109,7 +123,9 @@ array(
flags: MODIFIER_PUBLIC (1)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
index 7129d284..24d72198 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
@@ -13,7 +13,9 @@ class Foo {
array(
0: Stmt_Class(
flags: 0
- name: Foo
+ name: Identifier(
+ name: Foo
+ )
extends: null
implements: array(
)
@@ -22,7 +24,9 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 1
)
@@ -33,7 +37,9 @@ array(
flags: MODIFIER_PUBLIC (1)
consts: array(
0: Const(
- name: B
+ name: Identifier(
+ name: B
+ )
value: Scalar_LNumber(
value: 2
)
@@ -44,7 +50,9 @@ array(
flags: MODIFIER_PROTECTED (2)
consts: array(
0: Const(
- name: C
+ name: Identifier(
+ name: C
+ )
value: Scalar_LNumber(
value: 3
)
@@ -55,7 +63,9 @@ array(
flags: MODIFIER_PRIVATE (4)
consts: array(
0: Const(
- name: D
+ name: Identifier(
+ name: D
+ )
value: Scalar_LNumber(
value: 4
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
index 86cc4586..ecb7a5c3 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
@@ -7,7 +7,9 @@ final class A {}
array(
0: Stmt_Class(
flags: MODIFIER_FINAL (32)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
index 08452c15..bd43dce9 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
@@ -15,7 +15,9 @@ abstract class A {
array(
0: Stmt_Class(
flags: MODIFIER_ABSTRACT (16)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -24,7 +26,9 @@ array(
flags: 0
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -33,7 +37,9 @@ array(
flags: MODIFIER_STATIC (8)
props: array(
0: Stmt_PropertyProperty(
- name: b
+ name: VarLikeIdentifier(
+ name: b
+ )
default: null
)
)
@@ -41,7 +47,9 @@ array(
2: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT (16)
byRef: false
- name: c
+ name: Identifier(
+ name: c
+ )
params: array(
)
returnType: null
@@ -50,7 +58,9 @@ array(
3: Stmt_ClassMethod(
flags: MODIFIER_FINAL (32)
byRef: false
- name: d
+ name: Identifier(
+ name: d
+ )
params: array(
)
returnType: null
@@ -60,7 +70,9 @@ array(
4: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: e
+ name: Identifier(
+ name: e
+ )
params: array(
)
returnType: null
@@ -70,7 +82,9 @@ array(
5: Stmt_ClassMethod(
flags: MODIFIER_STATIC | MODIFIER_FINAL (40)
byRef: false
- name: f
+ name: Identifier(
+ name: f
+ )
params: array(
)
returnType: null
@@ -80,7 +94,9 @@ array(
6: Stmt_ClassMethod(
flags: 0
byRef: false
- name: g
+ name: Identifier(
+ name: g
+ )
params: array(
)
returnType: null
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
index d00bdbdc..7ac15970 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
@@ -8,7 +8,9 @@ interface A extends C, D {
-----
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
@@ -25,7 +27,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
index 5a1fd3fc..cbeb57e1 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
@@ -6,7 +6,9 @@ Multiple access type modifiers are not allowed from 1:24 to 1:29
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -15,7 +17,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -30,7 +34,9 @@ Multiple access type modifiers are not allowed from 1:24 to 1:32
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -39,7 +45,9 @@ array(
flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -54,7 +62,9 @@ Multiple abstract modifiers are not allowed from 1:26 to 1:33
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -62,7 +72,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT (16)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -78,7 +90,9 @@ Multiple static modifiers are not allowed from 1:24 to 1:29
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -87,7 +101,9 @@ array(
flags: MODIFIER_STATIC (8)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -102,7 +118,9 @@ Multiple final modifiers are not allowed from 1:23 to 1:27
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -110,7 +128,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_FINAL (32)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -127,7 +147,9 @@ Cannot use the final modifier on an abstract class member from 1:26 to 1:30
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -135,7 +157,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -152,7 +176,9 @@ Syntax error, unexpected T_FINAL, expecting T_CLASS from 1:16 to 1:20
array(
0: Stmt_Class(
flags: MODIFIER_FINAL (32)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -172,7 +198,9 @@ Properties cannot be declared abstract from 1:17 to 1:24
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -181,7 +209,9 @@ array(
flags: MODIFIER_ABSTRACT (16)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -196,7 +226,9 @@ Properties cannot be declared final from 1:17 to 1:21
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -205,11 +237,13 @@ array(
flags: MODIFIER_FINAL (32)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
)
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
index d5333052..40cb2fe2 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
@@ -6,7 +6,9 @@ Cannot use 'self' as class name as it is reserved from 1:13 to 1:16
array(
0: Stmt_Class(
flags: 0
- name: self
+ name: Identifier(
+ name: self
+ )
extends: null
implements: array(
)
@@ -21,7 +23,9 @@ Cannot use 'PARENT' as class name as it is reserved from 1:13 to 1:18
array(
0: Stmt_Class(
flags: 0
- name: PARENT
+ name: Identifier(
+ name: PARENT
+ )
extends: null
implements: array(
)
@@ -42,7 +46,9 @@ Cannot use 'self' as class name as it is reserved from 1:23 to 1:26
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: self
@@ -61,7 +67,9 @@ Cannot use 'PARENT' as class name as it is reserved from 1:23 to 1:28
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: PARENT
@@ -80,7 +88,9 @@ Cannot use 'static' as class name as it is reserved from 1:23 to 1:28
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: static
@@ -99,7 +109,9 @@ Cannot use 'self' as interface name as it is reserved from 1:26 to 1:29
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
0: Name(
@@ -119,7 +131,9 @@ Cannot use 'PARENT' as interface name as it is reserved from 1:26 to 1:31
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
0: Name(
@@ -139,7 +153,9 @@ Cannot use 'static' as interface name as it is reserved from 1:26 to 1:31
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
0: Name(
@@ -158,7 +174,9 @@ array(
Cannot use 'self' as class name as it is reserved from 1:17 to 1:20
array(
0: Stmt_Interface(
- name: self
+ name: Identifier(
+ name: self
+ )
extends: array(
)
stmts: array(
@@ -171,7 +189,9 @@ array(
Cannot use 'PARENT' as class name as it is reserved from 1:17 to 1:22
array(
0: Stmt_Interface(
- name: PARENT
+ name: Identifier(
+ name: PARENT
+ )
extends: array(
)
stmts: array(
@@ -190,7 +210,9 @@ array(
Cannot use 'self' as interface name as it is reserved from 1:27 to 1:30
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
@@ -208,7 +230,9 @@ array(
Cannot use 'PARENT' as interface name as it is reserved from 1:27 to 1:32
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
@@ -226,7 +250,9 @@ array(
Cannot use 'static' as interface name as it is reserved from 1:27 to 1:32
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
index e459e175..d6070b88 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
@@ -11,7 +11,9 @@ class A {
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -20,7 +22,9 @@ array(
flags: 0
props: array(
0: Stmt_PropertyProperty(
- name: foo
+ name: VarLikeIdentifier(
+ name: foo
+ )
default: null
)
)
@@ -28,7 +32,9 @@ array(
1: Stmt_ClassMethod(
flags: 0
byRef: false
- name: bar
+ name: Identifier(
+ name: bar
+ )
params: array(
)
returnType: null
@@ -38,7 +44,9 @@ array(
2: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT | MODIFIER_STATIC (24)
byRef: false
- name: baz
+ name: Identifier(
+ name: baz
+ )
params: array(
)
returnType: null
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
index b2f89944..9247eec9 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
@@ -19,7 +19,9 @@ class A extends B implements C, D {
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: B
@@ -42,13 +44,17 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
)
1: Const(
- name: C
+ name: Identifier(
+ name: C
+ )
value: Scalar_String(
value: D
)
@@ -59,13 +65,17 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: Scalar_String(
value: b
)
)
1: Stmt_PropertyProperty(
- name: c
+ name: VarLikeIdentifier(
+ name: c
+ )
default: Scalar_String(
value: d
)
@@ -76,7 +86,9 @@ array(
flags: MODIFIER_PROTECTED (2)
props: array(
0: Stmt_PropertyProperty(
- name: e
+ name: VarLikeIdentifier(
+ name: e
+ )
default: null
)
)
@@ -85,7 +97,9 @@ array(
flags: MODIFIER_PRIVATE (4)
props: array(
0: Stmt_PropertyProperty(
- name: f
+ name: VarLikeIdentifier(
+ name: f
+ )
default: null
)
)
@@ -93,7 +107,9 @@ array(
4: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -103,13 +119,17 @@ array(
5: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC | MODIFIER_STATIC (9)
byRef: false
- name: b
+ name: Identifier(
+ name: b
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
)
@@ -120,7 +140,9 @@ array(
6: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC | MODIFIER_FINAL (33)
byRef: false
- name: c
+ name: Identifier(
+ name: c
+ )
params: array(
)
returnType: Name(
@@ -134,7 +156,9 @@ array(
7: Stmt_ClassMethod(
flags: MODIFIER_PROTECTED (2)
byRef: false
- name: d
+ name: Identifier(
+ name: d
+ )
params: array(
)
returnType: null
@@ -144,7 +168,9 @@ array(
8: Stmt_ClassMethod(
flags: MODIFIER_PRIVATE (4)
byRef: false
- name: e
+ name: Identifier(
+ name: e
+ )
params: array(
)
returnType: null
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
index 225596ac..0540930e 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
@@ -6,7 +6,9 @@ Constructor __construct() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -14,7 +16,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __construct
+ name: Identifier(
+ name: __construct
+ )
params: array(
)
returnType: null
@@ -31,7 +35,9 @@ Destructor __destruct() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -39,7 +45,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __destruct
+ name: Identifier(
+ name: __destruct
+ )
params: array(
)
returnType: null
@@ -56,7 +64,9 @@ Clone method __clone() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -64,7 +74,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __clone
+ name: Identifier(
+ name: __clone
+ )
params: array(
)
returnType: null
@@ -81,7 +93,9 @@ Constructor __CONSTRUCT() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -89,7 +103,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __CONSTRUCT
+ name: Identifier(
+ name: __CONSTRUCT
+ )
params: array(
)
returnType: null
@@ -106,7 +122,9 @@ Destructor __Destruct() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -114,7 +132,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __Destruct
+ name: Identifier(
+ name: __Destruct
+ )
params: array(
)
returnType: null
@@ -131,7 +151,9 @@ Clone method __cLoNe() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -139,7 +161,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __cLoNe
+ name: Identifier(
+ name: __cLoNe
+ )
params: array(
)
returnType: null
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test b/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
index 75c6ec66..bda3cc56 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
@@ -23,12 +23,16 @@ class B {
-----
array(
0: Stmt_Trait(
- name: A
+ name: Identifier(
+ name: A
+ )
stmts: array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -39,7 +43,9 @@ array(
)
1: Stmt_Class(
flags: 0
- name: B
+ name: Identifier(
+ name: B
+ )
extends: null
implements: array(
)
@@ -66,19 +72,29 @@ array(
adaptations: array(
0: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: a
+ method: Identifier(
+ name: a
+ )
newModifier: MODIFIER_PROTECTED (2)
- newName: b
+ newName: Identifier(
+ name: b
+ )
)
1: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: c
+ method: Identifier(
+ name: c
+ )
newModifier: null
- newName: d
+ newName: Identifier(
+ name: d
+ )
)
2: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: e
+ method: Identifier(
+ name: e
+ )
newModifier: MODIFIER_PRIVATE (4)
newName: null
)
@@ -109,7 +125,9 @@ array(
0: E
)
)
- method: a
+ method: Identifier(
+ name: a
+ )
insteadof: array(
0: Name(
parts: array(
@@ -129,9 +147,13 @@ array(
0: E
)
)
- method: b
+ method: Identifier(
+ name: b
+ )
newModifier: MODIFIER_PROTECTED (2)
- newName: c
+ newName: Identifier(
+ name: c
+ )
)
2: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -139,9 +161,13 @@ array(
0: E
)
)
- method: d
+ method: Identifier(
+ name: d
+ )
newModifier: null
- newName: e
+ newName: Identifier(
+ name: e
+ )
)
3: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -149,7 +175,9 @@ array(
0: E
)
)
- method: f
+ method: Identifier(
+ name: f
+ )
newModifier: MODIFIER_PRIVATE (4)
newName: null
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/const.test b/vendor/nikic/php-parser/test/code/parser/stmt/const.test
index da21f416..e6c4db84 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/const.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/const.test
@@ -8,25 +8,33 @@ array(
0: Stmt_Const(
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 0
)
)
1: Const(
- name: B
+ name: Identifier(
+ name: B
+ )
value: Scalar_DNumber(
value: 1
)
)
2: Const(
- name: C
+ name: Identifier(
+ name: C
+ )
value: Scalar_String(
value: A
)
)
3: Const(
- name: D
+ name: Identifier(
+ name: D
+ )
value: Expr_ConstFetch(
name: Name(
parts: array(
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test b/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
index 2de1c4f2..d9c9fcf3 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
@@ -47,9 +47,13 @@ array(
)
)
7: Stmt_Label(
- name: label
+ name: Identifier(
+ name: label
+ )
)
8: Stmt_Goto(
- name: label
+ name: Identifier(
+ name: label
+ )
)
)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/declare.test b/vendor/nikic/php-parser/test/code/parser/stmt/declare.test
index 93afe67b..f044d24f 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/declare.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/declare.test
@@ -13,7 +13,9 @@ array(
0: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: X
+ key: Identifier(
+ name: X
+ )
value: Scalar_String(
value: Y
)
@@ -24,13 +26,17 @@ array(
1: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: A
+ key: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
)
1: Stmt_DeclareDeclare(
- key: C
+ key: Identifier(
+ name: C
+ )
value: Scalar_String(
value: D
)
@@ -42,13 +48,17 @@ array(
2: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: A
+ key: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
)
1: Stmt_DeclareDeclare(
- key: C
+ key: Identifier(
+ name: C
+ )
value: Scalar_String(
value: D
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
index aecced5d..b90fd019 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
@@ -7,52 +7,80 @@ function test(bool $a, Int $b, FLOAT $c, StRiNg $d, iterable $e, object $f) : vo
array(
0: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
- type: bool
+ type: Identifier(
+ name: bool
+ )
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
- type: int
+ type: Identifier(
+ name: int
+ )
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
2: Param(
- type: float
+ type: Identifier(
+ name: float
+ )
byRef: false
variadic: false
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: null
)
3: Param(
- type: string
+ type: Identifier(
+ name: string
+ )
byRef: false
variadic: false
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: null
)
4: Param(
- type: iterable
+ type: Identifier(
+ name: iterable
+ )
byRef: false
variadic: false
- name: e
+ var: Expr_Variable(
+ name: e
+ )
default: null
)
5: Param(
- type: object
+ type: Identifier(
+ name: object
+ )
byRef: false
variadic: false
- name: f
+ var: Expr_Variable(
+ name: f
+ )
default: null
)
)
- returnType: void
+ returnType: Identifier(
+ name: void
+ )
stmts: array(
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
index 1c1669c1..4b276e73 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
@@ -8,13 +8,17 @@ function &a($b) {}
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: true
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -24,13 +28,17 @@ array(
)
1: Stmt_Function(
byRef: true
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -38,4 +46,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
index d9c886ed..8495aad1 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
@@ -18,7 +18,9 @@ array(
stmts: array(
0: Stmt_Function(
byRef: false
- name: A
+ name: Identifier(
+ name: A
+ )
params: array(
)
returnType: null
@@ -30,4 +32,4 @@ array(
)
else: null
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
index d77d4f35..6ae96fa6 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
@@ -17,13 +17,17 @@ function a(
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: Expr_ConstFetch(
name: Name(
parts: array(
@@ -36,7 +40,9 @@ array(
type: null
byRef: false
variadic: false
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: Scalar_String(
value: foo
)
@@ -45,21 +51,27 @@ array(
type: null
byRef: false
variadic: false
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: Expr_ClassConstFetch(
class: Name(
parts: array(
0: A
)
)
- name: B
+ name: Identifier(
+ name: B
+ )
)
)
3: Param(
type: null
byRef: false
variadic: false
- name: f
+ var: Expr_Variable(
+ name: f
+ )
default: Expr_UnaryPlus(
expr: Scalar_LNumber(
value: 1
@@ -70,7 +82,9 @@ array(
type: null
byRef: false
variadic: false
- name: g
+ var: Expr_Variable(
+ name: g
+ )
default: Expr_UnaryMinus(
expr: Scalar_DNumber(
value: 1
@@ -81,7 +95,9 @@ array(
type: null
byRef: false
variadic: false
- name: h
+ var: Expr_Variable(
+ name: h
+ )
default: Expr_Array(
items: array(
)
@@ -91,7 +107,9 @@ array(
type: null
byRef: false
variadic: false
- name: i
+ var: Expr_Variable(
+ name: i
+ )
default: Expr_Array(
items: array(
)
@@ -101,7 +119,9 @@ array(
type: null
byRef: false
variadic: false
- name: j
+ var: Expr_Variable(
+ name: j
+ )
default: Expr_Array(
items: array(
0: Expr_ArrayItem(
@@ -118,7 +138,9 @@ array(
type: null
byRef: false
variadic: false
- name: k
+ var: Expr_Variable(
+ name: k
+ )
default: Expr_Array(
items: array(
0: Expr_ArrayItem(
@@ -145,4 +167,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
index d96df4fa..8bf2d31d 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
@@ -9,7 +9,9 @@ function test(?Foo $bar, ?string $foo) : ?Baz {
array(
0: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: NullableType(
@@ -21,16 +23,22 @@ array(
)
byRef: false
variadic: false
- name: bar
+ var: Expr_Variable(
+ name: bar
+ )
default: null
)
1: Param(
type: NullableType(
- type: string
+ type: Identifier(
+ name: string
+ )
)
byRef: false
variadic: false
- name: foo
+ var: Expr_Variable(
+ name: foo
+ )
default: null
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
index ca6c3106..8b71595e 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
@@ -10,7 +10,9 @@ function test4() : Foo\Bar {}
array(
0: Stmt_Function(
byRef: false
- name: test1
+ name: Identifier(
+ name: test1
+ )
params: array(
)
returnType: null
@@ -19,25 +21,35 @@ array(
)
1: Stmt_Function(
byRef: false
- name: test2
+ name: Identifier(
+ name: test2
+ )
params: array(
)
- returnType: array
+ returnType: Identifier(
+ name: array
+ )
stmts: array(
)
)
2: Stmt_Function(
byRef: false
- name: test3
+ name: Identifier(
+ name: test3
+ )
params: array(
)
- returnType: callable
+ returnType: Identifier(
+ name: callable
+ )
stmts: array(
)
)
3: Stmt_Function(
byRef: false
- name: test4
+ name: Identifier(
+ name: test4
+ )
params: array(
)
returnType: Name(
@@ -49,4 +61,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
index f2f35acf..10a9e079 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
@@ -10,7 +10,9 @@ function a() {
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -35,11 +37,15 @@ array(
1: Stmt_Static(
vars: array(
0: Stmt_StaticVar(
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: null
)
1: Stmt_StaticVar(
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: Scalar_String(
value: e
)
@@ -48,4 +54,4 @@ array(
)
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
index 53c462c5..8327cf32 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
@@ -7,27 +7,39 @@ function a($b, array $c, callable $d, E $f) {}
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
1: Param(
- type: array
+ type: Identifier(
+ name: array
+ )
byRef: false
variadic: false
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: null
)
2: Param(
- type: callable
+ type: Identifier(
+ name: callable
+ )
byRef: false
variadic: false
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: null
)
3: Param(
@@ -38,7 +50,9 @@ array(
)
byRef: false
variadic: false
- name: f
+ var: Expr_Variable(
+ name: f
+ )
default: null
)
)
@@ -46,4 +60,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
index f9d848c7..afbcf68f 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
@@ -9,20 +9,26 @@ function test($a, Type &... $b) {}
array(
0: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
type: null
byRef: false
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -32,20 +38,26 @@ array(
)
1: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
type: null
byRef: true
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -55,13 +67,17 @@ array(
)
2: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
@@ -72,7 +88,9 @@ array(
)
byRef: false
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -82,13 +100,17 @@ array(
)
3: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
@@ -99,7 +121,9 @@ array(
)
byRef: true
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -107,4 +131,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test b/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
index 0c3714f2..0431f39a 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
@@ -7,13 +7,17 @@ Variadic parameter cannot have a default value from 2:24 to 2:25
array(
0: Stmt_Function(
byRef: false
- name: foo
+ name: Identifier(
+ name: foo
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: true
- name: foo
+ var: Expr_Variable(
+ name: foo
+ )
default: Expr_Array(
items: array(
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test b/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test
index 8a184aaf..78ea9c09 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test
@@ -34,51 +34,26 @@ function gen() {
array(
0: Stmt_Function(
byRef: false
- name: gen
+ name: Identifier(
+ name: gen
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_Yield(
- key: null
- value: null
+ 0: Stmt_Expression(
+ expr: Expr_Yield(
+ key: null
+ value: null
+ comments: array(
+ 0: // statements
+ )
+ )
comments: array(
0: // statements
)
)
- 1: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: value
- )
- )
- 2: Expr_Yield(
- key: Expr_Variable(
- name: key
- )
- value: Expr_Variable(
- name: value
- )
- )
- 3: Expr_Assign(
- var: Expr_Variable(
- name: data
- comments: array(
- 0: // expressions
- )
- )
- expr: Expr_Yield(
- key: null
- value: null
- )
- comments: array(
- 0: // expressions
- )
- )
- 4: Expr_Assign(
- var: Expr_Variable(
- name: data
- )
+ 1: Stmt_Expression(
expr: Expr_Yield(
key: null
value: Expr_Variable(
@@ -86,10 +61,7 @@ array(
)
)
)
- 5: Expr_Assign(
- var: Expr_Variable(
- name: data
- )
+ 2: Stmt_Expression(
expr: Expr_Yield(
key: Expr_Variable(
name: key
@@ -99,6 +71,54 @@ array(
)
)
)
+ 3: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: data
+ comments: array(
+ 0: // expressions
+ )
+ )
+ expr: Expr_Yield(
+ key: null
+ value: null
+ )
+ comments: array(
+ 0: // expressions
+ )
+ )
+ comments: array(
+ 0: // expressions
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: data
+ )
+ expr: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: value
+ )
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: data
+ )
+ expr: Expr_Yield(
+ key: Expr_Variable(
+ name: key
+ )
+ value: Expr_Variable(
+ name: value
+ )
+ )
+ )
+ )
6: Stmt_If(
cond: Expr_Yield(
key: null
@@ -159,14 +179,14 @@ array(
)
)
9: Stmt_Do(
+ stmts: array(
+ )
cond: Expr_Yield(
key: null
value: Expr_Variable(
name: foo
)
)
- stmts: array(
- )
)
10: Stmt_Switch(
cond: Expr_Yield(
@@ -178,100 +198,119 @@ array(
cases: array(
)
)
- 11: Expr_Exit(
- expr: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
+ 11: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
)
)
)
- 12: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: func
+ 12: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: func
+ )
+ comments: array(
+ 0: // yield in function calls
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
+ )
+ byRef: false
+ unpack: false
+ )
)
comments: array(
0: // yield in function calls
)
)
- args: array(
- 0: Arg(
- value: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
- )
- )
- byRef: false
- unpack: false
- )
- )
comments: array(
0: // yield in function calls
)
)
- 13: Expr_MethodCall(
- var: Expr_Variable(
- name: foo
- )
- name: func
- args: array(
- 0: Arg(
- value: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
+ 13: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: foo
+ )
+ name: Identifier(
+ name: func
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 14: Expr_New(
- class: Name(
- parts: array(
- 0: Foo
+ 14: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
+ args: array(
+ 0: Arg(
+ value: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 15: Expr_YieldFrom(
- expr: Expr_Variable(
- name: foo
- )
- )
- 16: Expr_BinaryOp_LogicalAnd(
- left: Expr_YieldFrom(
+ 15: Stmt_Expression(
+ expr: Expr_YieldFrom(
expr: Expr_Variable(
name: foo
)
)
- right: Expr_YieldFrom(
- expr: Expr_Variable(
- name: bar
+ )
+ 16: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalAnd(
+ left: Expr_YieldFrom(
+ expr: Expr_Variable(
+ name: foo
+ )
+ )
+ right: Expr_YieldFrom(
+ expr: Expr_Variable(
+ name: bar
+ )
)
)
)
- 17: Expr_YieldFrom(
- expr: Expr_BinaryOp_Plus(
- left: Expr_Variable(
- name: foo
- )
- right: Expr_Variable(
- name: bar
+ 17: Stmt_Expression(
+ expr: Expr_YieldFrom(
+ expr: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: foo
+ )
+ right: Expr_Variable(
+ name: bar
+ )
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test b/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
index ff0d4df0..1f843c31 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
@@ -18,154 +18,85 @@ function gen() {
array(
0: Stmt_Function(
byRef: false
- name: gen
+ name: Identifier(
+ name: gen
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_Yield(
- key: null
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
- )
- )
- )
- 1: Expr_BinaryOp_LogicalOr(
- left: Expr_Yield(
+ 0: Stmt_Expression(
+ expr: Expr_Yield(
key: null
- value: Scalar_String(
- value: a
- )
- )
- right: Expr_Exit(
- expr: null
- )
- )
- 2: Expr_Yield(
- key: Scalar_String(
- value: k
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
)
)
- 3: Expr_BinaryOp_LogicalOr(
- left: Expr_Yield(
+ 1: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
+ left: Expr_Yield(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ )
+ right: Expr_Exit(
+ expr: null
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Yield(
key: Scalar_String(
value: k
)
- value: Scalar_String(
- value: a
- )
- )
- right: Expr_Exit(
- expr: null
- )
- )
- 4: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: var_dump
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Yield(
- key: Scalar_String(
- value: k
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
- )
- )
- )
- byRef: false
- )
- )
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
)
- byRef: false
- unpack: false
)
)
)
- 5: Expr_Yield(
- key: null
- value: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
- value: Expr_Yield(
+ 3: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
+ left: Expr_Yield(
key: Scalar_String(
- value: k2
+ value: k
)
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
- )
- )
- )
- )
- )
- 6: Expr_Yield(
- key: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
- value: Expr_Yield(
- key: null
value: Scalar_String(
- value: k2
+ value: a
)
)
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
+ right: Expr_Exit(
+ expr: null
)
)
)
- 7: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: var_dump
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: var_dump
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
value: Expr_Yield(
key: Scalar_String(
- value: k2
+ value: k
)
value: Expr_BinaryOp_Concat(
left: Scalar_String(
@@ -176,55 +107,144 @@ array(
)
)
)
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 8: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: var_dump
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
- value: Expr_Yield(
- key: null
- value: Scalar_String(
- value: k2
- )
- )
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
- )
- )
- byRef: false
+ 5: Stmt_Expression(
+ expr: Expr_Yield(
+ key: null
+ value: Expr_Yield(
+ key: Scalar_String(
+ value: k1
+ )
+ value: Expr_Yield(
+ key: Scalar_String(
+ value: k2
+ )
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
)
)
)
- byRef: false
- unpack: false
+ )
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Expr_Yield(
+ key: Expr_Yield(
+ key: Scalar_String(
+ value: k1
+ )
+ value: Expr_Yield(
+ key: null
+ value: Scalar_String(
+ value: k2
+ )
+ )
+ )
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: var_dump
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Yield(
+ key: Scalar_String(
+ value: k1
+ )
+ value: Expr_Yield(
+ key: Scalar_String(
+ value: k2
+ )
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
+ )
+ )
+ )
+ byRef: false
+ )
+ )
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 8: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: var_dump
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Expr_Yield(
+ key: Scalar_String(
+ value: k1
+ )
+ value: Expr_Yield(
+ key: null
+ value: Scalar_String(
+ value: k2
+ )
+ )
+ )
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
+ )
+ byRef: false
+ )
+ )
+ )
+ byRef: false
+ unpack: false
+ )
)
)
)
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test b/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
index 13f96602..6b77d335 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
@@ -11,38 +11,46 @@ function gen() {
array(
0: Stmt_Function(
byRef: false
- name: gen
+ name: Identifier(
+ name: gen
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_Yield(
- key: null
- value: Expr_UnaryPlus(
- expr: Scalar_LNumber(
- value: 1
- )
- )
- )
- 1: Expr_Yield(
- key: null
- value: Expr_UnaryMinus(
- expr: Scalar_LNumber(
- value: 1
- )
- )
- )
- 2: Expr_BinaryOp_Mul(
- left: Expr_Yield(
+ 0: Stmt_Expression(
+ expr: Expr_Yield(
key: null
- value: null
+ value: Expr_UnaryPlus(
+ expr: Scalar_LNumber(
+ value: 1
+ )
+ )
)
- right: Expr_UnaryMinus(
- expr: Scalar_LNumber(
- value: 1
+ )
+ 1: Stmt_Expression(
+ expr: Expr_Yield(
+ key: null
+ value: Expr_UnaryMinus(
+ expr: Scalar_LNumber(
+ value: 1
+ )
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_Yield(
+ key: null
+ value: null
+ )
+ right: Expr_UnaryMinus(
+ expr: Scalar_LNumber(
+ value: 1
+ )
)
)
)
)
)
-)
+)
\ No newline at end of file
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test b/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
index 67133ba7..112946ea 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
@@ -8,8 +8,10 @@ __halt_compiler()
Hallo World!
-----
array(
- 0: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
)
1: Stmt_HaltCompiler(
remaining: Hallo World!
@@ -22,8 +24,10 @@ $a;
__halt_compiler();Hallo World!
-----
array(
- 0: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
)
1: Stmt_HaltCompiler(
remaining: Hallo World!
@@ -44,8 +48,10 @@ array(
)
)
stmts: array(
- 0: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
diff --git a/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test b/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test
index 597710f2..381019a9 100644
--- a/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test
+++ b/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test
@@ -3,4 +3,4 @@ Invalid __halt_compiler() syntax
+Test
+
+Test
+ $code) {
+ if (false !== strpos($code, '@@{')) {
+ // Skip tests with evaluate segments
+ continue;
+ }
+
+ list($name, $tests) = $testParser->parseTest($code, 2);
+ $newTests = [];
+ foreach ($tests as list($modeLine, list($input, $expected))) {
+ $modes = null !== $modeLine ? array_fill_keys(explode(',', $modeLine), true) : [];
+ list($parser5, $parser7) = $codeParsingTest->createParsers($modes);
+ $output = isset($modes['php5'])
+ ? $codeParsingTest->getParseOutput($parser5, $input, $modes)
+ : $codeParsingTest->getParseOutput($parser7, $input, $modes);
+ $newTests[] = [$modeLine, [$input, $output]];
+ }
+
+ $newCode = $testParser->reconstructTest($name, $newTests);
+ file_put_contents($fileName, $newCode);
+}
diff --git a/vendor/nikic/php-parser/test_old/run.php b/vendor/nikic/php-parser/test_old/run.php
index bc14d893..2d7cdacc 100644
--- a/vendor/nikic/php-parser/test_old/run.php
+++ b/vendor/nikic/php-parser/test_old/run.php
@@ -110,17 +110,24 @@ switch ($testType) {
showHelp('Test type must be one of: PHP5, PHP7 or Symfony');
}
-require_once dirname(__FILE__) . '/../lib/PhpParser/Autoloader.php';
-PhpParser\Autoloader::register();
+require_once __DIR__ . '/../vendor/autoload.php';
-$parserName = 'PhpParser\Parser\\' . $version;
-$parser = new $parserName(new PhpParser\Lexer\Emulative);
+$lexer = new PhpParser\Lexer\Emulative(['usedAttributes' => [
+ 'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos',
+]]);
+$parserName = 'PhpParser\Parser\\' . $version;
+/** @var PhpParser\Parser $parser */
+$parser = new $parserName($lexer);
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
-$nodeDumper = new PhpParser\NodeDumper;
+$nodeDumper = new PhpParser\NodeDumper;
-$parseFail = $ppFail = $compareFail = $count = 0;
+$cloningTraverser = new PhpParser\NodeTraverser;
+$cloningTraverser->addVisitor(new PhpParser\NodeVisitor\CloningVisitor);
-$readTime = $parseTime = $ppTime = $reparseTime = $compareTime = 0;
+$parseFail = $fpppFail = $ppFail = $compareFail = $count = 0;
+
+$readTime = $parseTime = $cloneTime = 0;
+$fpppTime = $ppTime = $reparseTime = $compareTime = 0;
$totalStartTime = microtime(true);
foreach (new RecursiveIteratorIterator(
@@ -132,10 +139,10 @@ foreach (new RecursiveIteratorIterator(
}
$startTime = microtime(true);
- $code = file_get_contents($file);
+ $origCode = file_get_contents($file);
$readTime += microtime(true) - $startTime;
- if (null === $code = $codeExtractor($file, $code)) {
+ if (null === $origCode = $codeExtractor($file, $origCode)) {
continue;
}
@@ -149,11 +156,30 @@ foreach (new RecursiveIteratorIterator(
try {
$startTime = microtime(true);
- $stmts = $parser->parse($code);
+ $origStmts = $parser->parse($origCode);
$parseTime += microtime(true) - $startTime;
+ $origTokens = $lexer->getTokens();
+
$startTime = microtime(true);
- $code = 'prettyPrint($stmts);
+ $stmts = $cloningTraverser->traverse($origStmts);
+ $cloneTime += microtime(true) - $startTime;
+
+ $startTime = microtime(true);
+ $code = $prettyPrinter->printFormatPreserving($stmts, $origStmts, $origTokens);
+ $fpppTime += microtime(true) - $startTime;
+
+ if ($code !== $origCode) {
+ echo $file, ":\n Result of format-preserving pretty-print differs\n";
+ if ($verbose) {
+ echo "FPPP output:\n=====\n$code\n=====\n\n";
+ }
+
+ ++$fpppFail;
+ }
+
+ $startTime = microtime(true);
+ $code = "prettyPrint($stmts);
$ppTime += microtime(true) - $startTime;
try {
@@ -200,6 +226,9 @@ if (0 === $parseFail && 0 === $ppFail && 0 === $compareFail) {
if (0 !== $ppFail) {
echo ' ', $ppFail, ' pretty print failures.', "\n";
}
+ if (0 !== $fpppFail) {
+ echo ' ', $fpppFail, ' FPPP failures.', "\n";
+ }
if (0 !== $compareFail) {
echo ' ', $compareFail, ' compare failures.', "\n";
}
@@ -210,6 +239,8 @@ echo "\n",
"\n",
'Reading files took: ', $readTime, "\n",
'Parsing took: ', $parseTime, "\n",
+ 'Cloning took: ', $cloneTime, "\n",
+ 'FPPP took: ', $fpppTime, "\n",
'Pretty printing took: ', $ppTime, "\n",
'Reparsing took: ', $reparseTime, "\n",
'Comparing took: ', $compareTime, "\n",
diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json
index 1c5978c6..34f1381d 100644
--- a/vendor/paragonie/random_compat/composer.json
+++ b/vendor/paragonie/random_compat/composer.json
@@ -4,6 +4,7 @@
"keywords": [
"csprng",
"random",
+ "polyfill",
"pseudorandom"
],
"license": "MIT",
diff --git a/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/vendor/paragonie/random_compat/lib/byte_safe_strings.php
index 3de86b22..2a7335dd 100644
--- a/vendor/paragonie/random_compat/lib/byte_safe_strings.php
+++ b/vendor/paragonie/random_compat/lib/byte_safe_strings.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php
index 9a4fab99..14b4b348 100644
--- a/vendor/paragonie/random_compat/lib/cast_to_int.php
+++ b/vendor/paragonie/random_compat/lib/cast_to_int.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/error_polyfill.php b/vendor/paragonie/random_compat/lib/error_polyfill.php
index 6a91990c..6d4a19ac 100644
--- a/vendor/paragonie/random_compat/lib/error_polyfill.php
+++ b/vendor/paragonie/random_compat/lib/error_polyfill.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php
index df74c8a4..d5391882 100644
--- a/vendor/paragonie/random_compat/lib/random.php
+++ b/vendor/paragonie/random_compat/lib/random.php
@@ -3,12 +3,12 @@
* Random_* Compatibility Library
* for using the new PHP 7 random_* API in PHP 5 projects
*
- * @version 2.0.10
- * @released 2017-03-13
+ * @version 2.0.15
+ * @released 2018-06-08
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -54,9 +54,9 @@ if (!defined('RANDOM_COMPAT_READ_BUFFER')) {
$RandomCompatDIR = dirname(__FILE__);
-require_once $RandomCompatDIR . '/byte_safe_strings.php';
-require_once $RandomCompatDIR . '/cast_to_int.php';
-require_once $RandomCompatDIR . '/error_polyfill.php';
+require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php';
+require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php';
+require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php';
if (!is_callable('random_bytes')) {
/**
@@ -76,9 +76,9 @@ if (!is_callable('random_bytes')) {
if (extension_loaded('libsodium')) {
// See random_bytes_libsodium.php
if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) {
- require_once $RandomCompatDIR . '/random_bytes_libsodium.php';
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php';
} elseif (method_exists('Sodium', 'randombytes_buf')) {
- require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php';
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php';
}
}
@@ -117,7 +117,7 @@ if (!is_callable('random_bytes')) {
// place, that is not helpful to us here.
// See random_bytes_dev_urandom.php
- require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php';
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php';
}
// Unset variables after use
$RandomCompat_basedir = null;
@@ -159,7 +159,7 @@ if (!is_callable('random_bytes')) {
extension_loaded('mcrypt')
) {
// See random_bytes_mcrypt.php
- require_once $RandomCompatDIR . '/random_bytes_mcrypt.php';
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php';
}
$RandomCompatUrandom = null;
@@ -184,7 +184,7 @@ if (!is_callable('random_bytes')) {
$RandomCompatCOMtest = new COM('CAPICOM.Utilities.1');
if (method_exists($RandomCompatCOMtest, 'GetRandom')) {
// See random_bytes_com_dotnet.php
- require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php';
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php';
}
} catch (com_exception $e) {
// Don't try to use it.
@@ -203,8 +203,10 @@ if (!is_callable('random_bytes')) {
* and hope the developer won't let it fail silently.
*
* @param mixed $length
- * @return void
+ * @psalm-suppress MissingReturnType
+ * @psalm-suppress InvalidReturnType
* @throws Exception
+ * @return string
*/
function random_bytes($length)
{
@@ -212,12 +214,13 @@ if (!is_callable('random_bytes')) {
throw new Exception(
'There is no suitable CSPRNG installed on your system'
);
+ return '';
}
}
}
if (!is_callable('random_int')) {
- require_once $RandomCompatDIR . '/random_int.php';
+ require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php';
}
$RandomCompatDIR = null;
diff --git a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php
index fc1926e5..2b83369e 100644
--- a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php
+++ b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php
index df5b9152..ac36034a 100644
--- a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php
+++ b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php
index 4af1a242..1e017c14 100644
--- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php
+++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php
index 705af526..388da4dc 100644
--- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php
+++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
index aac9c013..879450c9 100644
--- a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
+++ b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php
@@ -5,7 +5,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/lib/random_int.php b/vendor/paragonie/random_compat/lib/random_int.php
index 5b2143a1..81bb725a 100644
--- a/vendor/paragonie/random_compat/lib/random_int.php
+++ b/vendor/paragonie/random_compat/lib/random_int.php
@@ -7,7 +7,7 @@ if (!is_callable('random_int')) {
*
* The MIT License (MIT)
*
- * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises
+ * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/paragonie/random_compat/psalm.xml b/vendor/paragonie/random_compat/psalm.xml
index 1e914098..596d99dd 100644
--- a/vendor/paragonie/random_compat/psalm.xml
+++ b/vendor/paragonie/random_compat/psalm.xml
@@ -8,9 +8,12 @@
+
+
+
diff --git a/vendor/phpspec/prophecy/CHANGES.md b/vendor/phpspec/prophecy/CHANGES.md
index 6a3ad33a..0dadd52a 100644
--- a/vendor/phpspec/prophecy/CHANGES.md
+++ b/vendor/phpspec/prophecy/CHANGES.md
@@ -1,3 +1,19 @@
+1.7.5 / 2018/04/18
+==================
+
+* Allow sebastian/comparator ^3.0 (@sebastianbergmann)
+
+1.7.4 / 2018/02/11
+==================
+
+* Fix issues with PHP 7.2 (thanks @greg0ire)
+* Support object type hints in PHP 7.2 (thanks @@jansvoboda11)
+
+1.7.3 / 2017/11/24
+==================
+
+* Fix SplInfo ClassPatch to work with Symfony 4 (Thanks @gnugat)
+
1.7.2 / 2017-10-04
==================
diff --git a/vendor/phpspec/prophecy/composer.json b/vendor/phpspec/prophecy/composer.json
index 5bdbdb3e..bb3d3726 100644
--- a/vendor/phpspec/prophecy/composer.json
+++ b/vendor/phpspec/prophecy/composer.json
@@ -20,14 +20,14 @@
"require": {
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
- "sebastian/comparator": "^1.1|^2.0",
+ "sebastian/comparator": "^1.1|^2.0|^3.0",
"doctrine/instantiator": "^1.0.2",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
- "phpunit/phpunit": "^4.8.35 || ^5.7"
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
},
"autoload": {
diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php
index fc1079c5..891faa8f 100644
--- a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php
+++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php
@@ -19,6 +19,16 @@ namespace Prophecy\Doubler\Generator;
*/
class ClassCodeGenerator
{
+ /**
+ * @var TypeHintReference
+ */
+ private $typeHintReference;
+
+ public function __construct(TypeHintReference $typeHintReference = null)
+ {
+ $this->typeHintReference = $typeHintReference ?: new TypeHintReference();
+ }
+
/**
* Generates PHP code for class node.
*
@@ -91,7 +101,8 @@ class ClassCodeGenerator
private function generateArguments(array $arguments)
{
- return array_map(function (Node\ArgumentNode $argument) {
+ $typeHintReference = $this->typeHintReference;
+ return array_map(function (Node\ArgumentNode $argument) use ($typeHintReference) {
$php = '';
if (version_compare(PHP_VERSION, '7.1', '>=')) {
@@ -99,34 +110,7 @@ class ClassCodeGenerator
}
if ($hint = $argument->getTypeHint()) {
- switch ($hint) {
- case 'array':
- case 'callable':
- $php .= $hint;
- break;
-
- case 'iterable':
- if (version_compare(PHP_VERSION, '7.1', '>=')) {
- $php .= $hint;
- break;
- }
-
- $php .= '\\'.$hint;
- break;
-
- case 'string':
- case 'int':
- case 'float':
- case 'bool':
- if (version_compare(PHP_VERSION, '7.0', '>=')) {
- $php .= $hint;
- break;
- }
- // Fall-through to default case for PHP 5.x
-
- default:
- $php .= '\\'.$hint;
- }
+ $php .= $typeHintReference->isBuiltInParamTypeHint($hint) ? $hint : '\\'.$hint;
}
$php .= ' '.($argument->isPassedByReference() ? '&' : '');
diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php
index ee363ab3..c74b4831 100644
--- a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php
+++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/Node/MethodNode.php
@@ -11,6 +11,7 @@
namespace Prophecy\Doubler\Generator\Node;
+use Prophecy\Doubler\Generator\TypeHintReference;
use Prophecy\Exception\InvalidArgumentException;
/**
@@ -33,14 +34,20 @@ class MethodNode
*/
private $arguments = array();
+ /**
+ * @var TypeHintReference
+ */
+ private $typeHintReference;
+
/**
* @param string $name
* @param string $code
*/
- public function __construct($name, $code = null)
+ public function __construct($name, $code = null, TypeHintReference $typeHintReference = null)
{
$this->name = $name;
$this->code = $code;
+ $this->typeHintReference = $typeHintReference ?: new TypeHintReference();
}
public function getVisibility()
@@ -112,38 +119,22 @@ class MethodNode
*/
public function setReturnType($type = null)
{
- switch ($type) {
- case '':
- $this->returnType = null;
- break;
-
- case 'string':
- case 'float':
- case 'int':
- case 'bool':
- case 'array':
- case 'callable':
- case 'iterable':
- case 'void':
- $this->returnType = $type;
- break;
-
- case 'double':
- case 'real':
- $this->returnType = 'float';
- break;
-
- case 'boolean':
- $this->returnType = 'bool';
- break;
-
- case 'integer':
- $this->returnType = 'int';
- break;
-
- default:
- $this->returnType = '\\' . ltrim($type, '\\');
+ if ($type === '' || $type === null) {
+ $this->returnType = null;
+ return;
}
+ $typeMap = array(
+ 'double' => 'float',
+ 'real' => 'float',
+ 'boolean' => 'bool',
+ 'integer' => 'int',
+ );
+ if (isset($typeMap[$type])) {
+ $type = $typeMap[$type];
+ }
+ $this->returnType = $this->typeHintReference->isBuiltInReturnTypeHint($type) ?
+ $type :
+ '\\' . ltrim($type, '\\');
}
public function getReturnType()
diff --git a/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php
new file mode 100644
index 00000000..ce952029
--- /dev/null
+++ b/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/TypeHintReference.php
@@ -0,0 +1,46 @@
+= 50400;
+
+ case 'bool':
+ case 'float':
+ case 'int':
+ case 'string':
+ return PHP_VERSION_ID >= 70000;
+
+ case 'iterable':
+ return PHP_VERSION_ID >= 70100;
+
+ case 'object':
+ return PHP_VERSION_ID >= 70200;
+
+ default:
+ return false;
+ }
+ }
+
+ public function isBuiltInReturnTypeHint($type)
+ {
+ if ($type === 'void') {
+ return PHP_VERSION_ID >= 70100;
+ }
+
+ return $this->isBuiltInParamTypeHint($type);
+ }
+}
diff --git a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php
index b113941f..a5383494 100644
--- a/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php
+++ b/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/MethodNotFoundException.php
@@ -14,7 +14,7 @@ namespace Prophecy\Exception\Doubler;
class MethodNotFoundException extends DoubleException
{
/**
- * @var string
+ * @var string|object
*/
private $classname;
@@ -30,7 +30,7 @@ class MethodNotFoundException extends DoubleException
/**
* @param string $message
- * @param string $classname
+ * @param string|object $classname
* @param string $methodName
* @param null|Argument\ArgumentsWildcard|array $arguments
*/
diff --git a/vendor/phpunit/php-code-coverage/ChangeLog-5.3.md b/vendor/phpunit/php-code-coverage/ChangeLog-5.3.md
index 00b5fe2c..ca839b13 100644
--- a/vendor/phpunit/php-code-coverage/ChangeLog-5.3.md
+++ b/vendor/phpunit/php-code-coverage/ChangeLog-5.3.md
@@ -2,6 +2,22 @@
All notable changes of the PHP_CodeCoverage 5.3 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
+## [5.3.2] - 2018-04-06
+
+### Fixed
+
+* Fixed [#602](https://github.com/sebastianbergmann/php-code-coverage/pull/602): Regression introduced in version 5.3.1
+
+## [5.3.1] - 2018-04-06
+
+### Changed
+
+* `Clover`, `Crap4j`, and `PHP` report writers now raise an exception when their call to `file_put_contents()` fails
+
+### Fixed
+
+* Fixed [#559](https://github.com/sebastianbergmann/php-code-coverage/issues/559): Ignored classes and methods are reported as 100% covered
+
## [5.3.0] - 2017-12-06
### Added
@@ -12,5 +28,7 @@ All notable changes of the PHP_CodeCoverage 5.3 release series are documented in
* Fixed [#564](https://github.com/sebastianbergmann/php-code-coverage/issues/564): `setDisableIgnoredLines(true)` disables more than it should
+[5.3.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.3.1...5.3.2
+[5.3.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.3.0...5.3.1
[5.3.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/5.2...5.3.0
diff --git a/vendor/phpunit/php-code-coverage/src/Report/Clover.php b/vendor/phpunit/php-code-coverage/src/Report/Clover.php
index 358d0ddd..2758d905 100644
--- a/vendor/phpunit/php-code-coverage/src/Report/Clover.php
+++ b/vendor/phpunit/php-code-coverage/src/Report/Clover.php
@@ -12,6 +12,7 @@ namespace SebastianBergmann\CodeCoverage\Report;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Node\File;
+use SebastianBergmann\CodeCoverage\RuntimeException;
/**
* Generates a Clover XML logfile from a code coverage object.
@@ -24,6 +25,8 @@ class Clover
* @param string $name
*
* @return string
+ *
+ * @throws \SebastianBergmann\CodeCoverage\RuntimeException
*/
public function process(CodeCoverage $coverage, $target = null, $name = null)
{
@@ -243,7 +246,14 @@ class Clover
\mkdir(\dirname($target), 0777, true);
}
- \file_put_contents($target, $buffer);
+ if (@\file_put_contents($target, $buffer) === false) {
+ throw new RuntimeException(
+ \sprintf(
+ 'Could not write to "%s',
+ $target
+ )
+ );
+ }
}
return $buffer;
diff --git a/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php b/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php
index 3851a27d..5ef11af0 100644
--- a/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php
+++ b/vendor/phpunit/php-code-coverage/src/Report/Crap4j.php
@@ -13,6 +13,7 @@ namespace SebastianBergmann\CodeCoverage\Report;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\InvalidArgumentException;
use SebastianBergmann\CodeCoverage\Node\File;
+use SebastianBergmann\CodeCoverage\RuntimeException;
class Crap4j
{
@@ -42,6 +43,8 @@ class Crap4j
* @param string $name
*
* @return string
+ *
+ * @throws \SebastianBergmann\CodeCoverage\RuntimeException
*/
public function process(CodeCoverage $coverage, $target = null, $name = null)
{
@@ -135,7 +138,14 @@ class Crap4j
\mkdir(\dirname($target), 0777, true);
}
- \file_put_contents($target, $buffer);
+ if (@\file_put_contents($target, $buffer) === false) {
+ throw new RuntimeException(
+ \sprintf(
+ 'Could not write to "%s',
+ $target
+ )
+ );
+ }
}
return $buffer;
diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php
index 8e8bacde..d2016b36 100644
--- a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php
+++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php
@@ -131,19 +131,23 @@ class File extends Renderer
*/
protected function renderTraitOrClassItems(array $items, \Text_Template $template, \Text_Template $methodItemTemplate)
{
- if (empty($items)) {
- return '';
- }
-
$buffer = '';
+ if (empty($items)) {
+ return $buffer;
+ }
+
foreach ($items as $name => $item) {
- $numMethods = \count($item['methods']);
+ $numMethods = 0;
$numTestedMethods = 0;
foreach ($item['methods'] as $method) {
- if ($method['executedLines'] == $method['executableLines']) {
- $numTestedMethods++;
+ if ($method['executableLines'] > 0) {
+ $numMethods++;
+
+ if ($method['executedLines'] === $method['executableLines']) {
+ $numTestedMethods++;
+ }
}
}
@@ -244,7 +248,16 @@ class File extends Renderer
*/
protected function renderFunctionOrMethodItem(\Text_Template $template, array $item, $indent = '')
{
- $numTestedItems = $item['executedLines'] == $item['executableLines'] ? 1 : 0;
+ $numMethods = 0;
+ $numTestedMethods = 0;
+
+ if ($item['executableLines'] > 0) {
+ $numMethods = 1;
+
+ if ($item['executedLines'] === $item['executableLines']) {
+ $numTestedMethods = 1;
+ }
+ }
return $this->renderItemTemplate(
$template,
@@ -256,8 +269,8 @@ class File extends Renderer
\htmlspecialchars($item['signature']),
isset($item['functionName']) ? $item['functionName'] : $item['methodName']
),
- 'numMethods' => 1,
- 'numTestedMethods' => $numTestedItems,
+ 'numMethods' => $numMethods,
+ 'numTestedMethods' => $numTestedMethods,
'linesExecutedPercent' => Util::percent(
$item['executedLines'],
$item['executableLines'],
@@ -271,12 +284,12 @@ class File extends Renderer
'numExecutedLines' => $item['executedLines'],
'numExecutableLines' => $item['executableLines'],
'testedMethodsPercent' => Util::percent(
- $numTestedItems,
+ $numTestedMethods,
1,
false
),
'testedMethodsPercentAsString' => Util::percent(
- $numTestedItems,
+ $numTestedMethods,
1,
true
),
diff --git a/vendor/phpunit/php-code-coverage/src/Report/PHP.php b/vendor/phpunit/php-code-coverage/src/Report/PHP.php
index 60321b9a..6873593b 100644
--- a/vendor/phpunit/php-code-coverage/src/Report/PHP.php
+++ b/vendor/phpunit/php-code-coverage/src/Report/PHP.php
@@ -11,6 +11,7 @@
namespace SebastianBergmann\CodeCoverage\Report;
use SebastianBergmann\CodeCoverage\CodeCoverage;
+use SebastianBergmann\CodeCoverage\RuntimeException;
/**
* Uses var_export() to write a SebastianBergmann\CodeCoverage\CodeCoverage object to a file.
@@ -27,7 +28,7 @@ class PHP
{
$filter = $coverage->filter();
- $output = \sprintf(
+ $buffer = \sprintf(
'setData(%s);
@@ -43,9 +44,16 @@ return $coverage;',
);
if ($target !== null) {
- return \file_put_contents($target, $output);
- } else {
- return $output;
+ if (@\file_put_contents($target, $buffer) === false) {
+ throw new RuntimeException(
+ \sprintf(
+ 'Could not write to "%s',
+ $target
+ )
+ );
+ }
}
+
+ return $buffer;
}
}
diff --git a/vendor/phpunit/php-code-coverage/src/Version.php b/vendor/phpunit/php-code-coverage/src/Version.php
index eae3eb6f..50dd6b98 100644
--- a/vendor/phpunit/php-code-coverage/src/Version.php
+++ b/vendor/phpunit/php-code-coverage/src/Version.php
@@ -22,7 +22,7 @@ class Version
public static function id()
{
if (self::$version === null) {
- $version = new VersionId('5.3.0', \dirname(__DIR__));
+ $version = new VersionId('5.3.2', \dirname(__DIR__));
self::$version = $version->getVersion();
}
diff --git a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html
index b7d8bc24..91f62768 100644
--- a/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html
+++ b/vendor/phpunit/php-code-coverage/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html
@@ -65,16 +65,11 @@
- baz
-
-
-
-
- 100.00%
- 1 / 1
- 1
+ baz
+
+ n/a
+ 0 / 0
+ 1
n/a
0 / 0
@@ -85,31 +80,21 @@
n/a
0 / 0
-
-
-
-
- 100.00%
- 1 / 1
- 1
+
+ n/a
+ 0 / 0
+ 1
n/a
0 / 0
- bar
-
-
-
-
- 100.00%
- 1 / 1
- 1
+ bar
+
+ n/a
+ 0 / 0
+ 1
n/a
0 / 0
@@ -120,31 +105,21 @@
n/a
0 / 0
-
-
-
-
- 100.00%
- 1 / 1
- 1
+
+ n/a
+ 0 / 0
+ 1
n/a
0 / 0
- foo
-
-
-
-
- 100.00%
- 1 / 1
- 1
+ foo
+
+ n/a
+ 0 / 0
+ 1
n/a
0 / 0
diff --git a/vendor/phpunit/phpunit-mock-objects/src/Generator.php b/vendor/phpunit/phpunit-mock-objects/src/Generator.php
index ce22885e..cb742ba3 100644
--- a/vendor/phpunit/phpunit-mock-objects/src/Generator.php
+++ b/vendor/phpunit/phpunit-mock-objects/src/Generator.php
@@ -1115,8 +1115,13 @@ class Generator
if (!$parameter->isVariadic()) {
if ($parameter->isDefaultValueAvailable()) {
- $value = $parameter->getDefaultValue();
- $default = ' = ' . \var_export($value, true);
+ $value = $parameter->getDefaultValueConstantName();
+
+ if ($value === null) {
+ $value = \var_export($parameter->getDefaultValue(), true);
+ }
+
+ $default = ' = ' . $value;
} elseif ($parameter->isOptional()) {
$default = ' = null';
}
diff --git a/vendor/phpunit/phpunit-mock-objects/tests/Generator/397.phpt b/vendor/phpunit/phpunit-mock-objects/tests/Generator/397.phpt
index 1259e6f8..71e32a48 100644
--- a/vendor/phpunit/phpunit-mock-objects/tests/Generator/397.phpt
+++ b/vendor/phpunit/phpunit-mock-objects/tests/Generator/397.phpt
@@ -1,5 +1,8 @@
--TEST--
https://github.com/sebastianbergmann/phpunit-mock-objects/issues/397
+--SKIPIF--
+=')) print 'skip: PHP >= 7.1 required';
--FILE--
generate(
+ 'Foo',
+ [],
+ 'MockFoo',
+ true,
+ true
+);
+
+print $mock['code'];
+?>
+--EXPECT--
+class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
+{
+ private $__phpunit_invocationMocker;
+ private $__phpunit_originalObject;
+ private $__phpunit_configurable = ['bar'];
+
+ public function __clone()
+ {
+ $this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
+ }
+
+ public function bar(int $baz = PHP_INT_MIN)
+ {
+ $arguments = array($baz);
+ $count = func_num_args();
+
+ if ($count > 1) {
+ $_arguments = func_get_args();
+
+ for ($i = 1; $i < $count; $i++) {
+ $arguments[] = $_arguments[$i];
+ }
+ }
+
+ $result = $this->__phpunit_getInvocationMocker()->invoke(
+ new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
+ 'Foo', 'bar', $arguments, '', $this, true
+ )
+ );
+
+ return $result;
+ }
+
+ public function expects(\PHPUnit\Framework\MockObject\Matcher\Invocation $matcher)
+ {
+ return $this->__phpunit_getInvocationMocker()->expects($matcher);
+ }
+
+ public function method()
+ {
+ $any = new \PHPUnit\Framework\MockObject\Matcher\AnyInvokedCount;
+ $expects = $this->expects($any);
+ return call_user_func_array(array($expects, 'method'), func_get_args());
+ }
+
+ public function __phpunit_setOriginalObject($originalObject)
+ {
+ $this->__phpunit_originalObject = $originalObject;
+ }
+
+ public function __phpunit_getInvocationMocker()
+ {
+ if ($this->__phpunit_invocationMocker === null) {
+ $this->__phpunit_invocationMocker = new \PHPUnit\Framework\MockObject\InvocationMocker($this->__phpunit_configurable);
+ }
+
+ return $this->__phpunit_invocationMocker;
+ }
+
+ public function __phpunit_hasMatchers()
+ {
+ return $this->__phpunit_getInvocationMocker()->hasMatchers();
+ }
+
+ public function __phpunit_verify($unsetInvocationMocker = true)
+ {
+ $this->__phpunit_getInvocationMocker()->verify();
+
+ if ($unsetInvocationMocker) {
+ $this->__phpunit_invocationMocker = null;
+ }
+ }
+}
diff --git a/vendor/phpunit/phpunit/.github/CONTRIBUTING.md b/vendor/phpunit/phpunit/.github/CONTRIBUTING.md
index 5468deba..1a0916f7 100644
--- a/vendor/phpunit/phpunit/.github/CONTRIBUTING.md
+++ b/vendor/phpunit/phpunit/.github/CONTRIBUTING.md
@@ -21,12 +21,10 @@ Due to time constraints, we are not always able to respond as quickly as we woul
## Coding Guidelines
-This project comes with a configuration file for [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (`.php_cs`) that you can use to (re)format your sourcecode for compliance with this project's coding guidelines:
+This project comes with a configuration file and an executable for [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (`.php_cs`) that you can use to (re)format your sourcecode for compliance with this project's coding guidelines:
```bash
-$ wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -O php-cs-fixer.phar
-
-$ php php-cs-fixer.phar fix
+$ ./build/tools/php-cs-fixer fix
```
## Using PHPUnit from a Git checkout
diff --git a/vendor/phpunit/phpunit/.stickler.yml b/vendor/phpunit/phpunit/.stickler.yml
deleted file mode 100644
index f4afbc00..00000000
--- a/vendor/phpunit/phpunit/.stickler.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-linters:
- phpcs:
- standard: 'build/phpcs.xml'
diff --git a/vendor/phpunit/phpunit/ChangeLog-6.5.md b/vendor/phpunit/phpunit/ChangeLog-6.5.md
index d40e5f44..8a703bc0 100644
--- a/vendor/phpunit/phpunit/ChangeLog-6.5.md
+++ b/vendor/phpunit/phpunit/ChangeLog-6.5.md
@@ -2,6 +2,18 @@
All notable changes of the PHPUnit 6.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
+## [6.5.8] - 2018-04-10
+
+### Fixed
+
+* Fixed [#2830](https://github.com/sebastianbergmann/phpunit/issues/2830): `@runClassInSeparateProcess` does not work for tests that use `@dataProvider`
+
+## [6.5.7] - 2018-02-26
+
+### Fixed
+
+* Fixed [#2974](https://github.com/sebastianbergmann/phpunit/issues/2974): JUnit XML logfile contains invalid characters when test output contains binary data
+
## [6.5.6] - 2018-02-01
### Fixed
@@ -50,6 +62,8 @@ All notable changes of the PHPUnit 6.5 release series are documented in this fil
* Fixed [#2654](https://github.com/sebastianbergmann/phpunit/issues/2654): Problems with `assertJsonStringEqualsJsonString()`
* Fixed [#2810](https://github.com/sebastianbergmann/phpunit/pull/2810): Code Coverage for PHPT tests does not work
+[6.5.8]: https://github.com/sebastianbergmann/phpunit/compare/6.5.7...6.5.8
+[6.5.7]: https://github.com/sebastianbergmann/phpunit/compare/6.5.6...6.5.7
[6.5.6]: https://github.com/sebastianbergmann/phpunit/compare/6.5.5...6.5.6
[6.5.5]: https://github.com/sebastianbergmann/phpunit/compare/6.5.4...6.5.5
[6.5.4]: https://github.com/sebastianbergmann/phpunit/compare/6.5.3...6.5.4
diff --git a/vendor/phpunit/phpunit/build.xml b/vendor/phpunit/phpunit/build.xml
index f0db7303..957e2b9b 100644
--- a/vendor/phpunit/phpunit/build.xml
+++ b/vendor/phpunit/phpunit/build.xml
@@ -376,7 +376,7 @@
-
+
@@ -390,21 +390,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/vendor/phpunit/phpunit/src/Framework/TestCase.php b/vendor/phpunit/phpunit/src/Framework/TestCase.php
index ea1e4091..8bcd401f 100644
--- a/vendor/phpunit/phpunit/src/Framework/TestCase.php
+++ b/vendor/phpunit/phpunit/src/Framework/TestCase.php
@@ -875,7 +875,8 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests,
'isStrictAboutResourceUsageDuringSmallTests' => $isStrictAboutResourceUsageDuringSmallTests,
'codeCoverageFilter' => $codeCoverageFilter,
- 'configurationFilePath' => $configurationFilePath
+ 'configurationFilePath' => $configurationFilePath,
+ 'name' => $this->getName(false),
];
if (!$runEntireClass) {
diff --git a/vendor/phpunit/phpunit/src/Runner/Version.php b/vendor/phpunit/phpunit/src/Runner/Version.php
index 2f3f2000..387fcf13 100644
--- a/vendor/phpunit/phpunit/src/Runner/Version.php
+++ b/vendor/phpunit/phpunit/src/Runner/Version.php
@@ -32,7 +32,7 @@ class Version
}
if (self::$version === null) {
- $version = new VersionId('6.5.6', \dirname(\dirname(__DIR__)));
+ $version = new VersionId('6.5.8', \dirname(\dirname(__DIR__)));
self::$version = $version->getVersion();
}
diff --git a/vendor/phpunit/phpunit/src/Util/Log/JUnit.php b/vendor/phpunit/phpunit/src/Util/Log/JUnit.php
index 6d46b4d1..15101878 100644
--- a/vendor/phpunit/phpunit/src/Util/Log/JUnit.php
+++ b/vendor/phpunit/phpunit/src/Util/Log/JUnit.php
@@ -362,10 +362,9 @@ class JUnit extends Printer implements TestListener
$this->testSuiteTimes[$this->testSuiteLevel] += $time;
if (\method_exists($test, 'hasOutput') && $test->hasOutput()) {
- $systemOut = $this->document->createElement('system-out');
-
- $systemOut->appendChild(
- $this->document->createTextNode($test->getActualOutput())
+ $systemOut = $this->document->createElement(
+ 'system-out',
+ Xml::prepareString($test->getActualOutput())
);
$this->currentTestCase->appendChild($systemOut);
diff --git a/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist
index 1c237969..56463740 100644
--- a/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist
+++ b/vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseClass.tpl.dist
@@ -47,7 +47,7 @@ function __phpunit_run_isolated_test()
$result->beStrictAboutTodoAnnotatedTests({isStrictAboutTodoAnnotatedTests});
$result->beStrictAboutResourceUsageDuringSmallTests({isStrictAboutResourceUsageDuringSmallTests});
- $test = new {className}(null, unserialize('{data}'), '{dataName}');
+ $test = new {className}('{name}', unserialize('{data}'), '{dataName}');
$test->setDependencyInput(unserialize('{dependencyInput}'));
$test->setInIsolation(TRUE);
diff --git a/vendor/phpunit/phpunit/tests/Regression/GitHub/2830.phpt b/vendor/phpunit/phpunit/tests/Regression/GitHub/2830.phpt
new file mode 100644
index 00000000..f46079da
--- /dev/null
+++ b/vendor/phpunit/phpunit/tests/Regression/GitHub/2830.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GH-2830: @runClassInSeparateProcess fails for tests with a @dataProvider
+--FILE--
+
+--EXPECTF--
+PHPUnit %s by Sebastian Bergmann and contributors.
+
+. 1 / 1 (100%)
+
+Time: %s, Memory: %s
+
+OK (1 test, 1 assertion)
diff --git a/vendor/phpunit/phpunit/tests/Regression/GitHub/2830/Issue2830Test.php b/vendor/phpunit/phpunit/tests/Regression/GitHub/2830/Issue2830Test.php
new file mode 100644
index 00000000..4a949768
--- /dev/null
+++ b/vendor/phpunit/phpunit/tests/Regression/GitHub/2830/Issue2830Test.php
@@ -0,0 +1,22 @@
+assertTrue(true);
+ }
+
+ public function simpleDataProvider()
+ {
+ return [
+ ['foo'],
+ ];
+ }
+}
\ No newline at end of file
diff --git a/vendor/psr/simple-cache/src/CacheInterface.php b/vendor/psr/simple-cache/src/CacheInterface.php
index 53ef49fa..99e8d957 100644
--- a/vendor/psr/simple-cache/src/CacheInterface.php
+++ b/vendor/psr/simple-cache/src/CacheInterface.php
@@ -20,11 +20,11 @@ interface CacheInterface
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
*
- * @param string $key The key of the item to store.
- * @param mixed $value The value of the item to store, must be serializable.
- * @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
- * the driver supports TTL then the library may set a default value
- * for it or let the driver take care of that.
+ * @param string $key The key of the item to store.
+ * @param mixed $value The value of the item to store, must be serializable.
+ * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
+ * the driver supports TTL then the library may set a default value
+ * for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
@@ -69,10 +69,10 @@ interface CacheInterface
/**
* Persists a set of key => value pairs in the cache, with an optional TTL.
*
- * @param iterable $values A list of key => value pairs for a multiple-set operation.
- * @param null|int|DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
- * the driver supports TTL then the library may set a default value
- * for it or let the driver take care of that.
+ * @param iterable $values A list of key => value pairs for a multiple-set operation.
+ * @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
+ * the driver supports TTL then the library may set a default value
+ * for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
diff --git a/vendor/psy/psysh/.editorconfig b/vendor/psy/psysh/.editorconfig
index 779f99a1..fddf9c1c 100644
--- a/vendor/psy/psysh/.editorconfig
+++ b/vendor/psy/psysh/.editorconfig
@@ -10,3 +10,6 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
+
+[Makefile]
+indent_style = tab
diff --git a/vendor/psy/psysh/.github/CONTRIBUTING.md b/vendor/psy/psysh/.github/CONTRIBUTING.md
new file mode 100644
index 00000000..efb87446
--- /dev/null
+++ b/vendor/psy/psysh/.github/CONTRIBUTING.md
@@ -0,0 +1,9 @@
+## Code style
+
+Please make your code look like the other code in the project.
+
+PsySH follows [PSR-1](http://php-fig.org/psr/psr-1/) and [PSR-2](http://php-fig.org/psr/psr-2/). The easiest way to do make sure you're following the coding standard is to [install `php-cs-fixer`](https://github.com/friendsofphp/php-cs-fixer) and run `php-cs-fixer fix` before committing.
+
+## Branching model
+
+Please branch off and send pull requests to the `develop` branch.
diff --git a/vendor/psy/psysh/.gitignore b/vendor/psy/psysh/.gitignore
index d4300e2b..da05f58c 100644
--- a/vendor/psy/psysh/.gitignore
+++ b/vendor/psy/psysh/.gitignore
@@ -1,11 +1,9 @@
-build-vendor/
-vendor/
-composer.lock
-composer-compat.json
-composer-compat.lock
-manual/
-dist/
-__pycache__
-.php_cs.cache
-psysh.phar
-psysh-compat.phar
+/build/
+/dist/
+/composer.lock
+/manual/
+/psysh
+/__pycache__
+/.php_cs.cache
+/vendor/
+/vendor-bin/*/vendor/
diff --git a/vendor/psy/psysh/.php_cs b/vendor/psy/psysh/.php_cs
index 94e2ce16..421c31d2 100644
--- a/vendor/psy/psysh/.php_cs
+++ b/vendor/psy/psysh/.php_cs
@@ -10,7 +10,7 @@ $finder = PhpCsFixer\Finder::create()
$header = <<setRules(array(
'@Symfony' => true,
- 'array_syntax' => array('syntax' => 'long'),
+ 'array_syntax' => array('syntax' => 'short'),
'binary_operator_spaces' => false,
'concat_space' => array('spacing' => 'one'),
'header_comment' => array('header' => $header),
diff --git a/vendor/psy/psysh/.styleci.yml b/vendor/psy/psysh/.styleci.yml
index 27a247ed..96fc96bf 100644
--- a/vendor/psy/psysh/.styleci.yml
+++ b/vendor/psy/psysh/.styleci.yml
@@ -3,7 +3,7 @@ preset: symfony
enabled:
- align_double_arrow
- concat_with_spaces
- - long_array_syntax
+ - short_array_syntax
- ordered_use
- strict
@@ -18,6 +18,8 @@ disabled:
- unalign_double_arrow
- unalign_equals
- yoda_style
+ - property_separation
+ - const_separation
finder:
name:
diff --git a/vendor/psy/psysh/.travis.yml b/vendor/psy/psysh/.travis.yml
index 20277ef9..3a77512a 100644
--- a/vendor/psy/psysh/.travis.yml
+++ b/vendor/psy/psysh/.travis.yml
@@ -4,23 +4,32 @@ sudo: false
matrix:
include:
- - php: 5.3
- dist: precise
- php: 5.4
+ - php: 5.4
+ env: 'COMPOSER_FLAGS="--prefer-lowest --prefer-stable"'
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
+ - php: 7.2
- php: hhvm
dist: trusty
allow_failures:
+ - php: 5.4
+ env: 'COMPOSER_FLAGS="--prefer-lowest --prefer-stable"'
- php: hhvm
+ fast_finish: true
-install: travis_retry composer update --no-interaction
+install: travis_retry composer update --no-interaction $COMPOSER_FLAGS
-script: vendor/bin/phpunit --verbose
+script:
+ - vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
+ - '[[ $TRAVIS_PHP_VERSION = 7.2* ]] && make build -j 4 || true'
-before_deploy: bin/package -v $TRAVIS_TAG
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
+
+before_deploy: make dist -j 4
deploy:
provider: releases
@@ -32,4 +41,4 @@ deploy:
on:
tags: true
repo: bobthecow/psysh
- condition: ($TRAVIS_PHP_VERSION = 5.3* || $TRAVIS_PHP_VERSION = 7.0*)
+ condition: $TRAVIS_PHP_VERSION = 7.2*
diff --git a/vendor/psy/psysh/CONTRIBUTING.md b/vendor/psy/psysh/CONTRIBUTING.md
deleted file mode 100644
index a5c726ba..00000000
--- a/vendor/psy/psysh/CONTRIBUTING.md
+++ /dev/null
@@ -1,18 +0,0 @@
-## Code style
-
-Please make your code look like the other code in the project. PsySH follows [PSR-1](http://php-fig.org/psr/psr-1/) and [PSR-2](http://php-fig.org/psr/psr-2/). The easiest way to do make sure you're following the coding standard is to run `vendor/bin/php-cs-fixer fix` before committing.
-
-## Branching model
-
-Please branch off and send pull requests to the `develop` branch.
-
-## Building the manual
-
-```sh
-svn co https://svn.php.net/repository/phpdoc/en/trunk/reference/ php_manual
-bin/build_manual phpdoc_manual ~/.local/share/psysh/php_manual.sqlite
-```
-
-To build the manual for another language, switch out `en` above for `de`, `es`, or any of the other languages listed in the docs.
-
-[Partial or outdated documentation is available for other languages](http://www.php.net/manual/help-translate.php) but these translations are outdated, so their content may be completely wrong or insecure!
diff --git a/vendor/psy/psysh/LICENSE b/vendor/psy/psysh/LICENSE
index fdd27fb7..2c6a4513 100644
--- a/vendor/psy/psysh/LICENSE
+++ b/vendor/psy/psysh/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2012-2017 Justin Hileman
+Copyright (c) 2012-2018 Justin Hileman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/psy/psysh/Makefile b/vendor/psy/psysh/Makefile
new file mode 100644
index 00000000..a1fdb42e
--- /dev/null
+++ b/vendor/psy/psysh/Makefile
@@ -0,0 +1,95 @@
+PSYSH_SRC = bin src box.json.dist composer.json build/stub
+PSYSH_SRC_FILES = $(shell find src -type f -name "*.php")
+VERSION = $(shell git describe --tag --always --dirty=-dev)
+
+COMPOSER_OPTS = --no-interaction --no-progress --verbose
+COMPOSER_REQUIRE_OPTS = $(COMPOSER_OPTS) --no-update
+COMPOSER_UPDATE_OPTS = $(COMPOSER_OPTS) --prefer-stable --no-dev --classmap-authoritative --prefer-dist
+
+
+# Commands
+
+.PHONY: help clean build dist
+.DEFAULT_GOAL := help
+
+help:
+ @echo "\033[33mUsage:\033[0m\n make TARGET\n\n\033[33mTargets:\033[0m"
+ @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-7s\033[0m %s\n", $$1, $$2}'
+
+clean: ## Clean all created artifacts
+ rm -rf build/*
+ rm -rf dist/*
+ rm -rf vendor-bin/*/vendor/
+
+build: ## Compile PHARs
+build: build/psysh/psysh build/psysh-compat/psysh build/psysh-php54/psysh build/psysh-php54-compat/psysh
+
+dist: ## Build tarballs for distribution
+dist: dist/psysh-$(VERSION).tar.gz dist/psysh-$(VERSION)-compat.tar.gz dist/psysh-$(VERSION)-php54.tar.gz dist/psysh-$(VERSION)-php54-compat.tar.gz
+
+
+# All the composer stuffs
+
+composer.lock: composer.json
+ composer install
+ touch $@
+
+vendor/autoload.php: composer.lock
+ composer install
+ touch $@
+
+vendor/bin/box: vendor/autoload.php
+ composer bin box install
+ touch $@
+
+
+# Lots of PHARs
+
+build/stub: bin/build-stub bin/psysh LICENSE
+ bin/build-stub
+
+build/psysh: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 7.0
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0'
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/psysh-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 7.0
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0'
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/psysh-php54: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 5.4
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/psysh-php54-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 5.4
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console:^2.15
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/%/psysh: vendor/bin/box build/%
+ vendor/bin/box compile --working-dir $(dir $@)
+
+
+# Dist packages
+
+dist/psysh-$(VERSION).tar.gz: build/psysh/psysh
+ @mkdir -p $(@D)
+ tar -C $(dir $<) -czf $@ $(notdir $<)
+
+dist/psysh-$(VERSION)-%.tar.gz: build/psysh-%/psysh
+ @mkdir -p $(@D)
+ tar -C $(dir $<) -czf $@ $(notdir $<)
diff --git a/vendor/psy/psysh/README.md b/vendor/psy/psysh/README.md
index 45dd6a3b..710434ca 100644
--- a/vendor/psy/psysh/README.md
+++ b/vendor/psy/psysh/README.md
@@ -17,6 +17,7 @@ PsySH is a runtime developer console, interactive debugger and [REPL](https://en
### [💾 Installation](https://github.com/bobthecow/psysh/wiki/Installation)
* [📕 PHP manual installation](https://github.com/bobthecow/psysh/wiki/PHP-manual)
+ * Windows
### [🖥 Usage](https://github.com/bobthecow/psysh/wiki/Usage)
* [✨ Magic variables](https://github.com/bobthecow/psysh/wiki/Magic-variables)
diff --git a/vendor/psy/psysh/bin/build b/vendor/psy/psysh/bin/build
deleted file mode 100755
index 79f2192b..00000000
--- a/vendor/psy/psysh/bin/build
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-echo "Building phar"
-./bin/build-vendor
-php -d 'phar.readonly=0' ./bin/build-phar
-
-echo "Building compat phar"
-./bin/build-vendor-compat
-php -d 'phar.readonly=0' ./bin/build-phar --compat
diff --git a/vendor/psy/psysh/bin/build-manual b/vendor/psy/psysh/bin/build-manual
deleted file mode 100755
index ece22781..00000000
--- a/vendor/psy/psysh/bin/build-manual
+++ /dev/null
@@ -1,312 +0,0 @@
-#!/usr/bin/env php
-':
- $inTag = false;
- break;
- }
-
- if ($inTag) {
- $tagWidth++;
- }
-
- $i++;
-
- if (!$inTag && ($i - $tagWidth > $width)) {
- $lastSpace = $lastSpace ?: $width;
-
- $return[] = trim(substr($text, 0, $lastSpace));
- $text = substr($text, $lastSpace);
- $len = strlen($text);
-
- $i = $tagWidth = 0;
- }
- } while ($i < $len);
-
- $return[] = trim($text);
-
- return implode("\n", $return);
-}
-
-function extract_paragraphs($element)
-{
- $paragraphs = array();
- foreach ($element->getElementsByTagName('para') as $p) {
- $text = '';
- foreach ($p->childNodes as $child) {
- // @todo figure out if there's something we can do with tables.
- if ($child instanceof DOMElement && $child->tagName === 'table') {
- continue;
- }
-
- // skip references, because ugh.
- if (preg_match('{^\s*&[a-z][a-z\.]+;\s*$}', $child->textContent)) {
- continue;
- }
-
- $text .= $child->ownerDocument->saveXML($child);
- }
-
- if ($text = trim(preg_replace('{\n[ \t]+}', ' ', $text))) {
- $paragraphs[] = $text;
- }
- }
-
- return implode("\n\n", $paragraphs);
-}
-
-function format_doc($doc)
-{
- $chunks = array();
-
- if (!empty($doc['description'])) {
- $chunks[] = 'Description: ';
- $chunks[] = indent_text(htmlwrap(thunk_tags($doc['description']), WRAP_WIDTH - 2));
- $chunks[] = '';
- }
-
- if (!empty($doc['params'])) {
- $chunks[] = 'Param: ';
-
- $typeMax = max(array_map(function ($param) {
- return strlen($param['type']);
- }, $doc['params']));
-
- $max = max(array_map(function ($param) {
- return strlen($param['name']);
- }, $doc['params']));
-
- $template = ' %-' . $typeMax . 's %-' . $max . 's %s';
- $indent = str_repeat(' ', $typeMax + $max + 6);
- $wrapWidth = WRAP_WIDTH - strlen($indent);
-
- foreach ($doc['params'] as $param) {
- $desc = indent_text(htmlwrap(thunk_tags($param['description']), $wrapWidth), $indent, false);
- $chunks[] = sprintf($template, $param['type'], $param['name'], $desc);
- }
- $chunks[] = '';
- }
-
- if (isset($doc['return']) || isset($doc['return_type'])) {
- $chunks[] = 'Return: ';
-
- $type = isset($doc['return_type']) ? $doc['return_type'] : 'unknown';
- $desc = isset($doc['return']) ? $doc['return'] : '';
-
- $indent = str_repeat(' ', strlen($type) + 4);
- $wrapWidth = WRAP_WIDTH - strlen($indent);
-
- if (!empty($desc)) {
- $desc = indent_text(htmlwrap(thunk_tags($doc['return']), $wrapWidth), $indent, false);
- }
-
- $chunks[] = sprintf(' %s %s', $type, $desc);
- $chunks[] = '';
- }
-
- array_pop($chunks); // get rid of the trailing newline
-
- return implode("\n", $chunks);
-}
-
-function thunk_tags($text)
-{
- $tagMap = array(
- 'parameter>' => 'strong>',
- 'function>' => 'strong>',
- 'literal>' => 'return>',
- 'type>' => 'info>',
- 'constant>' => 'info>',
- );
-
- $andBack = array(
- '&' => '&',
- '&true;' => 'true ',
- '&false;' => 'false ',
- '&null;' => 'null ',
- );
-
- return strtr(strip_tags(strtr($text, $tagMap), ''), $andBack);
-}
-
-function indent_text($text, $indent = ' ', $leading = true)
-{
- return ($leading ? $indent : '') . str_replace("\n", "\n" . $indent, $text);
-}
-
-function find_type($xml, $paramName)
-{
- foreach ($xml->getElementsByTagName('methodparam') as $param) {
- if ($type = $param->getElementsByTagName('type')->item(0)) {
- if ($parameter = $param->getElementsByTagName('parameter')->item(0)) {
- if ($paramName === $parameter->textContent) {
- return $type->textContent;
- }
- }
- }
- }
-}
-
-function format_function_doc($xml)
-{
- $doc = array();
- $refsect1s = $xml->getElementsByTagName('refsect1');
- foreach ($refsect1s as $refsect1) {
- $role = $refsect1->getAttribute('role');
- switch ($role) {
- case 'description':
- $doc['description'] = extract_paragraphs($refsect1);
-
- if ($synopsis = $refsect1->getElementsByTagName('methodsynopsis')->item(0)) {
- foreach ($synopsis->childNodes as $node) {
- if ($node instanceof DOMElement && $node->tagName === 'type') {
- $doc['return_type'] = $node->textContent;
- break;
- }
- }
- }
- break;
-
- case 'returnvalues':
- // do nothing.
- $doc['return'] = extract_paragraphs($refsect1);
- break;
-
- case 'parameters':
- $params = array();
- $vars = $refsect1->getElementsByTagName('varlistentry');
- foreach ($vars as $var) {
- if ($name = $var->getElementsByTagName('parameter')->item(0)) {
- $params[] = array(
- 'name' => '$' . $name->textContent,
- 'type' => find_type($xml, $name->textContent),
- 'description' => extract_paragraphs($var),
- );
- }
- }
-
- $doc['params'] = $params;
- break;
- }
- }
-
- // and the purpose
- if ($purpose = $xml->getElementsByTagName('refpurpose')->item(0)) {
- $desc = htmlwrap($purpose->textContent);
- if (isset($doc['description'])) {
- $desc .= "\n\n" . $doc['description'];
- }
-
- $doc['description'] = trim($desc);
- }
-
- $ids = array();
- foreach ($xml->getElementsByTagName('refname') as $ref) {
- $ids[] = $ref->textContent;
- }
-
- return array($ids, format_doc($doc));
-}
-
-function format_class_doc($xml)
-{
- // @todo implement this
- return array(array(), null);
-}
-
-$dir = new RecursiveDirectoryIterator($argv[1]);
-$filter = new RecursiveCallbackFilterIterator($dir, function ($current, $key, $iterator) {
- return $current->getFilename()[0] !== '.' &&
- ($current->isDir() || $current->getExtension() === 'xml') &&
- strpos($current->getFilename(), 'entities.') !== 0 &&
- $current->getFilename() !== 'pdo_4d'; // Temporarily blacklist this one, the docs are weird.
-});
-$iterator = new RecursiveIteratorIterator($filter);
-
-$docs = array();
-foreach ($iterator as $file) {
- $xmlstr = str_replace('&', '&', file_get_contents($file));
-
- $xml = new DOMDocument();
- $xml->preserveWhiteSpace = false;
-
- if (!@$xml->loadXml($xmlstr)) {
- echo "XML Parse Error: $file\n";
- continue;
- }
-
- if ($xml->getElementsByTagName('refentry')->length !== 0) {
- list($ids, $doc) = format_function_doc($xml);
- } elseif ($xml->getElementsByTagName('classref')->length !== 0) {
- list($ids, $doc) = format_class_doc($xml);
- } else {
- $ids = array();
- $doc = null;
- }
-
- foreach ($ids as $id) {
- $docs[$id] = $doc;
- }
-}
-
-if (is_file($argv[2])) {
- unlink($argv[2]);
-}
-
-$db = new PDO('sqlite:' . $argv[2]);
-
-$db->query('CREATE TABLE php_manual (id char(256) PRIMARY KEY, doc TEXT)');
-$cmd = $db->prepare('INSERT INTO php_manual (id, doc) VALUES (?, ?)');
-foreach ($docs as $id => $doc) {
- $cmd->execute(array($id, $doc));
-}
diff --git a/vendor/psy/psysh/bin/build-phar b/vendor/psy/psysh/bin/build-phar
deleted file mode 100755
index 43db2f6b..00000000
--- a/vendor/psy/psysh/bin/build-phar
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env php
-compile('psysh-compat.phar');
-} else {
- $compiler->compile();
-}
diff --git a/vendor/psy/psysh/bin/build-stub b/vendor/psy/psysh/bin/build-stub
new file mode 100755
index 00000000..0d26110e
--- /dev/null
+++ b/vendor/psy/psysh/bin/build-stub
@@ -0,0 +1,22 @@
+#!/usr/bin/env php
+>> \*/}sm', $autoload, $content);
+$content = preg_replace('/\\(c\\) .*?with this source code./sm', $license, $content);
+
+$content .= '__HALT_COMPILER();';
+
+@mkdir(dirname(__DIR__) . '/build');
+
+file_put_contents(dirname(__DIR__) . '/build/stub', $content);
diff --git a/vendor/psy/psysh/bin/build-vendor b/vendor/psy/psysh/bin/build-vendor
deleted file mode 100755
index f0057d52..00000000
--- a/vendor/psy/psysh/bin/build-vendor
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-rm -rf build-vendor
-
-COMPOSER_VENDOR_DIR=build-vendor composer update \
- --prefer-stable --no-dev --no-progress --classmap-authoritative --no-interaction --verbose
diff --git a/vendor/psy/psysh/bin/build-vendor-compat b/vendor/psy/psysh/bin/build-vendor-compat
deleted file mode 100755
index a3cedb59..00000000
--- a/vendor/psy/psysh/bin/build-vendor-compat
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-rm -rf build-vendor
-rm composer*.lock
-
-cp composer.json composer-compat.json
-
-if [[ $(php --version) = PHP\ 5.3* ]]; then
- HOA_VERSION=^1.14
-fi
-
-COMPOSER=composer-compat.json COMPOSER_VENDOR_DIR=build-vendor \
- composer require symfony/intl hoa/console $HOA_VERSION --no-progress --no-update --no-interaction --verbose
-
-COMPOSER=composer-compat.json COMPOSER_VENDOR_DIR=build-vendor \
- composer update --prefer-stable --no-dev --no-progress --classmap-authoritative --no-interaction --verbose
-
diff --git a/vendor/psy/psysh/bin/package b/vendor/psy/psysh/bin/package
deleted file mode 100755
index 2bb6e411..00000000
--- a/vendor/psy/psysh/bin/package
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-USAGE="usage: bin/package [-v PACKAGE_VERSION]"
-
-while getopts ":v:h" opt; do
- case $opt in
- v)
- PKG_VERSION=$OPTARG
- ;;
- h)
- echo $USAGE >&2
- exit
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- echo $USAGE >&2
- exit 1
- ;;
- :)
- echo "Option -$OPTARG requires an argument" >&2
- echo $USAGE >&2
- exit 1
- ;;
- esac
-done
-
-if [ -z "$PKG_VERSION" ]; then
- PKG_VERSION=$(git describe --tag --exact-match)
-fi
-
-if [[ $(php --version) = PHP\ 5.3* ]]; then
- PKG_VERSION=${PKG_VERSION}-php53
-fi
-
-echo "Packaging $PKG_VERSION"
-
-mkdir -p dist || exit 1
-
-./bin/build || exit 1
-chmod +x *.phar
-
-echo "Creating tarballs"
-
-# Support BSD tar because OS X :(
-if [[ $(tar --version) = bsdtar* ]]; then
- tar -s "/.*/psysh/" -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
- tar -s "/.*/psysh/" -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar
-else
- tar --transform "s/.*/psysh/" -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
- tar --transform "s/.*/psysh/" -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar
-fi
diff --git a/vendor/psy/psysh/bin/psysh b/vendor/psy/psysh/bin/psysh
index e1d6350c..7dbd203e 100755
--- a/vendor/psy/psysh/bin/psysh
+++ b/vendor/psy/psysh/bin/psysh
@@ -98,6 +98,9 @@ if (!class_exists('Psy\Shell')) {
// If the psysh binary was included directly, assume they just wanted an
// autoloader and bail early.
+//
+// Keep this PHP 5.3 code around for a while in case someone is using a globally
+// installed psysh as a bin launcher for older local versions.
if (version_compare(PHP_VERSION, '5.3.6', '<')) {
$trace = debug_backtrace();
} elseif (version_compare(PHP_VERSION, '5.4.0', '<')) {
diff --git a/vendor/psy/psysh/box.json.dist b/vendor/psy/psysh/box.json.dist
new file mode 100644
index 00000000..32305a52
--- /dev/null
+++ b/vendor/psy/psysh/box.json.dist
@@ -0,0 +1,13 @@
+{
+ "stub": "stub",
+ "output": "psysh",
+ "compactors": [
+ "KevinGH\\Box\\Compactor\\Php"
+ ],
+ "chmod": "0755",
+ "blacklist": [
+ "grammar",
+ "test_old",
+ "Documentation"
+ ]
+}
diff --git a/vendor/psy/psysh/composer.json b/vendor/psy/psysh/composer.json
index 69c226cb..3e169be9 100644
--- a/vendor/psy/psysh/composer.json
+++ b/vendor/psy/psysh/composer.json
@@ -13,17 +13,17 @@
}
],
"require": {
- "php": ">=5.3.9",
+ "php": ">=5.4.0",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0",
- "nikic/php-parser": "~1.3|~2.0|~3.0",
+ "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"dnoegel/php-xdg-base-dir": "0.1",
"jakub-onderka/php-console-highlighter": "0.3.*"
},
"require-dev": {
- "phpunit/phpunit": "^4.8.35|^5.4.3",
- "symfony/finder": "~2.1|~3.0|~4.0",
- "hoa/console": "~3.16|~1.14"
+ "phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0",
+ "hoa/console": "~2.15|~3.16",
+ "bamarni/composer-bin-plugin": "^1.2"
},
"suggest": {
"ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)",
@@ -33,20 +33,20 @@
"hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit."
},
"autoload": {
- "files": ["src/Psy/functions.php"],
+ "files": ["src/functions.php"],
"psr-4": {
- "Psy\\": "src/Psy/"
+ "Psy\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
- "Psy\\Test\\": "test/Psy/Test/"
+ "Psy\\Test\\": "test/"
}
},
"bin": ["bin/psysh"],
"extra": {
"branch-alias": {
- "dev-develop": "0.8.x-dev"
+ "dev-develop": "0.9.x-dev"
}
}
}
diff --git a/vendor/psy/psysh/phpunit.xml.dist b/vendor/psy/psysh/phpunit.xml.dist
index 78b2b330..3534fca2 100644
--- a/vendor/psy/psysh/phpunit.xml.dist
+++ b/vendor/psy/psysh/phpunit.xml.dist
@@ -6,7 +6,7 @@
- ./src/Psy
+ ./src
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner.php b/vendor/psy/psysh/src/CodeCleaner.php
similarity index 71%
rename from vendor/psy/psysh/src/Psy/CodeCleaner.php
rename to vendor/psy/psysh/src/CodeCleaner.php
index fa3a8785..0f0d378f 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner.php
+++ b/vendor/psy/psysh/src/CodeCleaner.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,16 +26,17 @@ use Psy\CodeCleaner\ImplicitReturnPass;
use Psy\CodeCleaner\InstanceOfPass;
use Psy\CodeCleaner\LeavePsyshAlonePass;
use Psy\CodeCleaner\LegacyEmptyPass;
+use Psy\CodeCleaner\ListPass;
use Psy\CodeCleaner\LoopContextPass;
use Psy\CodeCleaner\MagicConstantsPass;
use Psy\CodeCleaner\NamespacePass;
use Psy\CodeCleaner\PassableByReferencePass;
use Psy\CodeCleaner\RequirePass;
-use Psy\CodeCleaner\StaticConstructorPass;
use Psy\CodeCleaner\StrictTypesPass;
use Psy\CodeCleaner\UseStatementPass;
use Psy\CodeCleaner\ValidClassNamePass;
use Psy\CodeCleaner\ValidConstantPass;
+use Psy\CodeCleaner\ValidConstructorPass;
use Psy\CodeCleaner\ValidFunctionNamePass;
use Psy\Exception\ParseErrorException;
@@ -80,7 +81,14 @@ class CodeCleaner
*/
private function getDefaultPasses()
{
- return array(
+ $useStatementPass = new UseStatementPass();
+ $namespacePass = new NamespacePass($this);
+
+ // Try to add implicit `use` statements and an implicit namespace,
+ // based on the file in which the `debug` call was made.
+ $this->addImplicitDebugContext([$useStatementPass, $namespacePass]);
+
+ return [
// Validation passes
new AbstractClassPass(),
new AssignThisVariablePass(),
@@ -92,16 +100,17 @@ class CodeCleaner
new InstanceOfPass(),
new LeavePsyshAlonePass(),
new LegacyEmptyPass(),
+ new ListPass(),
new LoopContextPass(),
new PassableByReferencePass(),
- new StaticConstructorPass(),
+ new ValidConstructorPass(),
// Rewriting shenanigans
- new UseStatementPass(), // must run before the namespace pass
+ $useStatementPass, // must run before the namespace pass
new ExitPass(),
new ImplicitReturnPass(),
new MagicConstantsPass(),
- new NamespacePass($this), // must run after the implicit return pass
+ $namespacePass, // must run after the implicit return pass
new RequirePass(),
new StrictTypesPass(),
@@ -109,7 +118,88 @@ class CodeCleaner
new ValidClassNamePass(),
new ValidConstantPass(),
new ValidFunctionNamePass(),
- );
+ ];
+ }
+
+ /**
+ * "Warm up" code cleaner passes when we're coming from a debug call.
+ *
+ * This is useful, for example, for `UseStatementPass` and `NamespacePass`
+ * which keep track of state between calls, to maintain the current
+ * namespace and a map of use statements.
+ *
+ * @param array $passes
+ */
+ private function addImplicitDebugContext(array $passes)
+ {
+ $file = $this->getDebugFile();
+ if ($file === null) {
+ return;
+ }
+
+ try {
+ $code = @file_get_contents($file);
+ if (!$code) {
+ return;
+ }
+
+ $stmts = $this->parse($code, true);
+ if ($stmts === false) {
+ return;
+ }
+
+ // Set up a clean traverser for just these code cleaner passes
+ $traverser = new NodeTraverser();
+ foreach ($passes as $pass) {
+ $traverser->addVisitor($pass);
+ }
+
+ $traverser->traverse($stmts);
+ } catch (\Throwable $e) {
+ // Don't care.
+ } catch (\Exception $e) {
+ // Still don't care.
+ }
+ }
+
+ /**
+ * Search the stack trace for a file in which the user called Psy\debug.
+ *
+ * @return string|null
+ */
+ private static function getDebugFile()
+ {
+ $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+
+ foreach (array_reverse($trace) as $stackFrame) {
+ if (!self::isDebugCall($stackFrame)) {
+ continue;
+ }
+
+ if (preg_match('/eval\(/', $stackFrame['file'])) {
+ preg_match_all('/([^\(]+)\((\d+)/', $stackFrame['file'], $matches);
+
+ return $matches[1][0];
+ }
+
+ return $stackFrame['file'];
+ }
+ }
+
+ /**
+ * Check whether a given backtrace frame is a call to Psy\debug.
+ *
+ * @param array $stackFrame
+ *
+ * @return bool
+ */
+ private static function isDebugCall(array $stackFrame)
+ {
+ $class = isset($stackFrame['class']) ? $stackFrame['class'] : null;
+ $function = isset($stackFrame['function']) ? $stackFrame['function'] : null;
+
+ return ($class === null && $function === 'Psy\debug') ||
+ ($class === 'Psy\Shell' && $function === 'debug');
}
/**
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php b/vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php
rename to vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php
index fad6d8f5..66eaf42c 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/AbstractClassPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -33,7 +33,7 @@ class AbstractClassPass extends CodeCleanerPass
{
if ($node instanceof Class_) {
$this->class = $node;
- $this->abstractMethods = array();
+ $this->abstractMethods = [];
} elseif ($node instanceof ClassMethod) {
if ($node->isAbstract()) {
$name = sprintf('%s::%s', $this->class->name, $node->name);
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/AssignThisVariablePass.php b/vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/AssignThisVariablePass.php
rename to vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php
index b1b3eaf1..4c42d97f 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/AssignThisVariablePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/CallTimePassByReferencePass.php b/vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php
similarity index 90%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/CallTimePassByReferencePass.php
rename to vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php
index 5a5eeba1..cff2c519 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/CallTimePassByReferencePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -31,16 +31,12 @@ class CallTimePassByReferencePass extends CodeCleanerPass
/**
* Validate of use call-time pass-by-reference.
*
- * @throws RuntimeException if the user used call-time pass-by-reference in PHP >= 5.4.0
+ * @throws RuntimeException if the user used call-time pass-by-reference
*
* @param Node $node
*/
public function enterNode(Node $node)
{
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- return;
- }
-
if (!$node instanceof FuncCall && !$node instanceof MethodCall && !$node instanceof StaticCall) {
return;
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/CalledClassPass.php b/vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/CalledClassPass.php
rename to vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php
index 4a0f7ea8..280be3b7 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/CalledClassPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -59,7 +59,7 @@ class CalledClassPass extends CodeCleanerPass
}
$name = strtolower($node->name);
- if (in_array($name, array('get_class', 'get_called_class'))) {
+ if (in_array($name, ['get_class', 'get_called_class'])) {
$msg = sprintf('%s() called without object from outside a class', $name);
throw new ErrorException($msg, 0, E_USER_WARNING, null, $node->getLine());
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/CodeCleanerPass.php b/vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/CodeCleanerPass.php
rename to vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php
index 4c61b8b5..58e5d05e 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/CodeCleanerPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/ExitPass.php b/vendor/psy/psysh/src/CodeCleaner/ExitPass.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/ExitPass.php
rename to vendor/psy/psysh/src/CodeCleaner/ExitPass.php
index bdd132a7..349a5c57 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/ExitPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/ExitPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/FinalClassPass.php b/vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/FinalClassPass.php
rename to vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php
index c509bef5..bf1063fd 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/FinalClassPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -27,7 +27,7 @@ class FinalClassPass extends CodeCleanerPass
*/
public function beforeTraverse(array $nodes)
{
- $this->finalClasses = array();
+ $this->finalClasses = [];
}
/**
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/FunctionContextPass.php b/vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php
similarity index 97%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/FunctionContextPass.php
rename to vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php
index 16ee9fc2..adff5ca1 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/FunctionContextPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php b/vendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php
rename to vendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php
index 42aae5ec..c3aad342 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/FunctionReturnInWriteContextPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -32,11 +32,11 @@ class FunctionReturnInWriteContextPass extends CodeCleanerPass
const PHP55_MESSAGE = 'Cannot use isset() on the result of a function call (you can use "null !== func()" instead)';
const EXCEPTION_MESSAGE = "Can't use function return value in write context";
- private $isPhp55;
+ private $atLeastPhp55;
public function __construct()
{
- $this->isPhp55 = version_compare(PHP_VERSION, '5.5', '>=');
+ $this->atLeastPhp55 = version_compare(PHP_VERSION, '5.5', '>=');
}
/**
@@ -64,11 +64,11 @@ class FunctionReturnInWriteContextPass extends CodeCleanerPass
continue;
}
- $msg = ($node instanceof Isset_ && $this->isPhp55) ? self::PHP55_MESSAGE : self::EXCEPTION_MESSAGE;
+ $msg = ($node instanceof Isset_ && $this->atLeastPhp55) ? self::PHP55_MESSAGE : self::EXCEPTION_MESSAGE;
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
- } elseif ($node instanceof Empty_ && !$this->isPhp55 && $this->isCallNode($node->expr)) {
- throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
+ } elseif ($node instanceof Empty_ && !$this->atLeastPhp55 && $this->isCallNode($node->expr)) {
+ throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine()); // @codeCoverageIgnore
} elseif ($node instanceof Assign && $this->isCallNode($node->var)) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/ImplicitReturnPass.php b/vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php
similarity index 71%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/ImplicitReturnPass.php
rename to vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php
index c738bdc1..971a9804 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/ImplicitReturnPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,12 +11,12 @@
namespace Psy\CodeCleaner;
+use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Exit_;
-use PhpParser\Node\Expr\New_;
-use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Break_;
+use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Return_;
@@ -46,7 +46,7 @@ class ImplicitReturnPass extends CodeCleanerPass
{
// If nodes is empty, it can't have a return value.
if (empty($nodes)) {
- return array(new Return_(new New_(new FullyQualifiedName('Psy\CodeCleaner\NoReturnValue'))));
+ return [new Return_(NoReturnValue::create())];
}
$last = end($nodes);
@@ -75,10 +75,18 @@ class ImplicitReturnPass extends CodeCleanerPass
}
}
} elseif ($last instanceof Expr && !($last instanceof Exit_)) {
- $nodes[count($nodes) - 1] = new Return_($last, array(
+ // @codeCoverageIgnoreStart
+ $nodes[count($nodes) - 1] = new Return_($last, [
'startLine' => $last->getLine(),
'endLine' => $last->getLine(),
- ));
+ ]);
+ // @codeCoverageIgnoreEnd
+ } elseif ($last instanceof Expression && !($last->expr instanceof Exit_)) {
+ // For PHP Parser 4.x
+ $nodes[count($nodes) - 1] = new Return_($last->expr, [
+ 'startLine' => $last->getLine(),
+ 'endLine' => $last->getLine(),
+ ]);
} elseif ($last instanceof Namespace_) {
$last->stmts = $this->addImplicitReturn($last->stmts);
}
@@ -93,10 +101,28 @@ class ImplicitReturnPass extends CodeCleanerPass
// We're not adding a fallback return after namespace statements,
// because code outside namespace statements doesn't really work, and
// there's already an implicit return in the namespace statement anyway.
- if ($last instanceof Stmt && !$last instanceof Return_ && !$last instanceof Namespace_) {
- $nodes[] = new Return_(new New_(new FullyQualifiedName('Psy\CodeCleaner\NoReturnValue')));
+ if (self::isNonExpressionStmt($last)) {
+ $nodes[] = new Return_(NoReturnValue::create());
}
return $nodes;
}
+
+ /**
+ * Check whether a given node is a non-expression statement.
+ *
+ * As of PHP Parser 4.x, Expressions are now instances of Stmt as well, so
+ * we'll exclude them here.
+ *
+ * @param Node $node
+ *
+ * @return bool
+ */
+ private static function isNonExpressionStmt(Node $node)
+ {
+ return $node instanceof Stmt &&
+ !$node instanceof Expression &&
+ !$node instanceof Return_ &&
+ !$node instanceof Namespace_;
+ }
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php b/vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php
similarity index 97%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php
rename to vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php
index 78ce98e9..44e24cae 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/InstanceOfPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/LeavePsyshAlonePass.php b/vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/LeavePsyshAlonePass.php
rename to vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php
index e6a3bbde..08f6fbee 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/LeavePsyshAlonePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -30,7 +30,7 @@ class LeavePsyshAlonePass extends CodeCleanerPass
public function enterNode(Node $node)
{
if ($node instanceof Variable && $node->name === '__psysh__') {
- throw new RuntimeException('Don\'t mess with $__psysh__. Bad things will happen.');
+ throw new RuntimeException('Don\'t mess with $__psysh__; bad things will happen');
}
}
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php b/vendor/psy/psysh/src/CodeCleaner/LegacyEmptyPass.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php
rename to vendor/psy/psysh/src/CodeCleaner/LegacyEmptyPass.php
index dc5a01ed..a298c849 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/LegacyEmptyPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/LegacyEmptyPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -19,9 +19,18 @@ use Psy\Exception\ParseErrorException;
/**
* Validate that the user did not call the language construct `empty()` on a
* statement in PHP < 5.5.
+ *
+ * @codeCoverageIgnore
*/
class LegacyEmptyPass extends CodeCleanerPass
{
+ private $atLeastPhp55;
+
+ public function __construct()
+ {
+ $this->atLeastPhp55 = version_compare(PHP_VERSION, '5.5', '>=');
+ }
+
/**
* Validate use of empty in PHP < 5.5.
*
@@ -31,7 +40,7 @@ class LegacyEmptyPass extends CodeCleanerPass
*/
public function enterNode(Node $node)
{
- if (version_compare(PHP_VERSION, '5.5', '>=')) {
+ if ($this->atLeastPhp55) {
return;
}
diff --git a/vendor/psy/psysh/src/CodeCleaner/ListPass.php b/vendor/psy/psysh/src/CodeCleaner/ListPass.php
new file mode 100644
index 00000000..04d32e9f
--- /dev/null
+++ b/vendor/psy/psysh/src/CodeCleaner/ListPass.php
@@ -0,0 +1,89 @@
+atLeastPhp71 = version_compare(PHP_VERSION, '7.1', '>=');
+ }
+
+ /**
+ * Validate use of list assignment.
+ *
+ * @throws ParseErrorException if the user used empty with anything but a variable
+ *
+ * @param Node $node
+ */
+ public function enterNode(Node $node)
+ {
+ if (!$node instanceof Assign) {
+ return;
+ }
+
+ if (!$node->var instanceof Array_ && !$node->var instanceof List_) {
+ return;
+ }
+
+ if (!$this->atLeastPhp71 && $node->var instanceof Array_) {
+ $msg = "syntax error, unexpected '='";
+ throw new ParseErrorException($msg, $node->expr->getLine());
+ }
+
+ // Polyfill for PHP-Parser 2.x
+ $items = isset($node->var->items) ? $node->var->items : $node->var->vars;
+
+ if ($items === [] || $items === [null]) {
+ throw new ParseErrorException('Cannot use empty list', $node->var->getLine());
+ }
+
+ $itemFound = false;
+ foreach ($items as $item) {
+ if ($item === null) {
+ continue;
+ }
+
+ $itemFound = true;
+
+ // List_->$vars in PHP-Parser 2.x is Variable instead of ArrayItem.
+ if (!$this->atLeastPhp71 && $item instanceof ArrayItem && $item->key !== null) {
+ $msg = 'Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \',\' or \')\'';
+ throw new ParseErrorException($msg, $item->key->getLine());
+ }
+
+ $value = ($item instanceof ArrayItem) ? $item->value : $item;
+
+ if (!$value instanceof Variable) {
+ $msg = 'Assignments can only happen to writable values';
+ throw new ParseErrorException($msg, $item->getLine());
+ }
+ }
+
+ if (!$itemFound) {
+ throw new ParseErrorException('Cannot use empty list');
+ }
+ }
+}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/LoopContextPass.php b/vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/LoopContextPass.php
rename to vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php
index e8f65bb9..9744fcb6 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/LoopContextPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -28,14 +28,8 @@ use Psy\Exception\FatalErrorException;
*/
class LoopContextPass extends CodeCleanerPass
{
- private $isPHP54;
private $loopDepth;
- public function __construct()
- {
- $this->isPHP54 = version_compare(PHP_VERSION, '5.4.0', '>=');
- }
-
/**
* {@inheritdoc}
*/
@@ -74,7 +68,7 @@ class LoopContextPass extends CodeCleanerPass
if ($node->num instanceof LNumber || $node->num instanceof DNumber) {
$num = $node->num->value;
- if ($this->isPHP54 && ($node->num instanceof DNumber || $num < 1)) {
+ if ($node->num instanceof DNumber || $num < 1) {
$msg = sprintf("'%s' operator accepts only positive numbers", $operator);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
@@ -83,7 +77,7 @@ class LoopContextPass extends CodeCleanerPass
$msg = sprintf("Cannot '%s' %d levels", $operator, $num);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
- } elseif ($node->num && $this->isPHP54) {
+ } elseif ($node->num) {
$msg = sprintf("'%s' operator with non-constant operand is no longer supported", $operator);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/MagicConstantsPass.php b/vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php
similarity index 89%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/MagicConstantsPass.php
rename to vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php
index 328eb256..50936b2c 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/MagicConstantsPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -34,7 +34,7 @@ class MagicConstantsPass extends CodeCleanerPass
public function enterNode(Node $node)
{
if ($node instanceof Dir) {
- return new FuncCall(new Name('getcwd'), array(), $node->getAttributes());
+ return new FuncCall(new Name('getcwd'), [], $node->getAttributes());
} elseif ($node instanceof File) {
return new String_('', $node->getAttributes());
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php b/vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php
rename to vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php
index 4a76d0f6..9b404450 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/NamespaceAwarePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -32,8 +32,8 @@ abstract class NamespaceAwarePass extends CodeCleanerPass
*/
public function beforeTraverse(array $nodes)
{
- $this->namespace = array();
- $this->currentScope = array();
+ $this->namespace = [];
+ $this->currentScope = [];
}
/**
@@ -45,7 +45,7 @@ abstract class NamespaceAwarePass extends CodeCleanerPass
public function enterNode(Node $node)
{
if ($node instanceof Namespace_) {
- $this->namespace = isset($node->name) ? $node->name->parts : array();
+ $this->namespace = isset($node->name) ? $node->name->parts : [];
}
}
@@ -63,7 +63,7 @@ abstract class NamespaceAwarePass extends CodeCleanerPass
} elseif ($name instanceof Name) {
$name = $name->parts;
} elseif (!is_array($name)) {
- $name = array($name);
+ $name = [$name];
}
return implode('\\', array_merge($this->namespace, $name));
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/NamespacePass.php b/vendor/psy/psysh/src/CodeCleaner/NamespacePass.php
similarity index 70%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/NamespacePass.php
rename to vendor/psy/psysh/src/CodeCleaner/NamespacePass.php
index 37ef9f24..af825376 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/NamespacePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/NamespacePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -54,13 +54,24 @@ class NamespacePass extends CodeCleanerPass
}
$last = end($nodes);
- if (!$last instanceof Namespace_) {
- return $this->namespace ? array(new Namespace_($this->namespace, $nodes)) : $nodes;
+
+ if ($last instanceof Namespace_) {
+ $kind = $last->getAttribute('kind');
+
+ // Treat all namespace statements pre-PHP-Parser v3.1.2 as "open",
+ // even though we really have no way of knowing.
+ if ($kind === null || $kind === Namespace_::KIND_SEMICOLON) {
+ // Save the current namespace for open namespaces
+ $this->setNamespace($last->name);
+ } else {
+ // Clear the current namespace after a braced namespace
+ $this->setNamespace(null);
+ }
+
+ return $nodes;
}
- $this->setNamespace($last->name);
-
- return $nodes;
+ return $this->namespace ? [new Namespace_($this->namespace, $nodes)] : $nodes;
}
/**
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/NoReturnValue.php b/vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php
similarity index 56%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/NoReturnValue.php
rename to vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php
index 3784f4b3..90325701 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/NoReturnValue.php
+++ b/vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,6 +11,9 @@
namespace Psy\CodeCleaner;
+use PhpParser\Node\Expr\New_;
+use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
+
/**
* A class used internally by CodeCleaner to represent input, such as
* non-expression statements, with no return value.
@@ -20,5 +23,13 @@ namespace Psy\CodeCleaner;
*/
class NoReturnValue
{
- // this space intentionally left blank
+ /**
+ * Get PhpParser AST expression for creating a new NoReturnValue.
+ *
+ * @return PhpParser\Node\Expr\New_
+ */
+ public static function create()
+ {
+ return new New_(new FullyQualifiedName('Psy\CodeCleaner\NoReturnValue'));
+ }
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/PassableByReferencePass.php b/vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php
similarity index 99%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/PassableByReferencePass.php
rename to vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php
index 5d9936c7..4380eef2 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/PassableByReferencePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/RequirePass.php b/vendor/psy/psysh/src/CodeCleaner/RequirePass.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/RequirePass.php
rename to vendor/psy/psysh/src/CodeCleaner/RequirePass.php
index 00b50608..0e805611 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/RequirePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/RequirePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,7 +26,7 @@ use Psy\Shell;
*/
class RequirePass extends CodeCleanerPass
{
- private static $requireTypes = array(Include_::TYPE_REQUIRE, Include_::TYPE_REQUIRE_ONCE);
+ private static $requireTypes = [Include_::TYPE_REQUIRE, Include_::TYPE_REQUIRE_ONCE];
/**
* {@inheritdoc}
@@ -51,7 +51,7 @@ class RequirePass extends CodeCleanerPass
$node->expr = new StaticCall(
new FullyQualifiedName('Psy\CodeCleaner\RequirePass'),
'resolve',
- array(new Arg($origNode->expr), new Arg(new LNumber($origNode->getLine()))),
+ [new Arg($origNode->expr), new Arg(new LNumber($origNode->getLine()))],
$origNode->getAttributes()
);
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/StrictTypesPass.php b/vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.php
similarity index 77%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/StrictTypesPass.php
rename to vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.php
index 5966f0c5..a63fe75e 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/StrictTypesPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,6 +11,7 @@
namespace Psy\CodeCleaner;
+use PhpParser\Node\Identifier;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Stmt\Declare_;
use PhpParser\Node\Stmt\DeclareDeclare;
@@ -31,6 +32,12 @@ class StrictTypesPass extends CodeCleanerPass
const EXCEPTION_MESSAGE = 'strict_types declaration must have 0 or 1 as its value';
private $strictTypes = false;
+ private $atLeastPhp7;
+
+ public function __construct()
+ {
+ $this->atLeastPhp7 = version_compare(PHP_VERSION, '7.0', '>=');
+ }
/**
* If this is a standalone strict types declaration, remember it for later.
@@ -44,8 +51,8 @@ class StrictTypesPass extends CodeCleanerPass
*/
public function beforeTraverse(array $nodes)
{
- if (version_compare(PHP_VERSION, '7.0', '<')) {
- return;
+ if (!$this->atLeastPhp7) {
+ return; // @codeCoverageIgnore
}
$prependStrictTypes = $this->strictTypes;
@@ -53,7 +60,9 @@ class StrictTypesPass extends CodeCleanerPass
foreach ($nodes as $key => $node) {
if ($node instanceof Declare_) {
foreach ($node->declares as $declare) {
- if ($declare->key === 'strict_types') {
+ // For PHP Parser 4.x
+ $declareKey = $declare->key instanceof Identifier ? $declare->key->toString() : $declare->key;
+ if ($declareKey === 'strict_types') {
$value = $declare->value;
if (!$value instanceof LNumber || ($value->value !== 0 && $value->value !== 1)) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
@@ -68,7 +77,7 @@ class StrictTypesPass extends CodeCleanerPass
if ($prependStrictTypes) {
$first = reset($nodes);
if (!$first instanceof Declare_) {
- $declare = new Declare_(array(new DeclareDeclare('strict_types', new LNumber(1))));
+ $declare = new Declare_([new DeclareDeclare('strict_types', new LNumber(1))]);
array_unshift($nodes, $declare);
}
}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php b/vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php
rename to vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php
index c1ce64d3..d6ca878c 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/UseStatementPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -17,6 +17,7 @@ use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Stmt\GroupUse;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Use_;
+use PhpParser\NodeTraverser;
/**
* Provide implicit use statements for subsequent execution.
@@ -30,8 +31,8 @@ use PhpParser\Node\Stmt\Use_;
*/
class UseStatementPass extends CodeCleanerPass
{
- private $aliases = array();
- private $lastAliases = array();
+ private $aliases = [];
+ private $lastAliases = [];
private $lastNamespace = null;
/**
@@ -68,26 +69,28 @@ class UseStatementPass extends CodeCleanerPass
// Store a reference to every "use" statement, because we'll need
// them in a bit.
foreach ($node->uses as $use) {
- $this->aliases[strtolower($use->alias)] = $use->name;
+ $alias = $use->alias ?: end($use->name->parts);
+ $this->aliases[strtolower($alias)] = $use->name;
}
- return false;
+ return NodeTraverser::REMOVE_NODE;
} elseif ($node instanceof GroupUse) {
// Expand every "use" statement in the group into a full, standalone
// "use" and store 'em with the others.
foreach ($node->uses as $use) {
- $this->aliases[strtolower($use->alias)] = Name::concat($node->prefix, $use->name, array(
+ $alias = $use->alias ?: end($use->name->parts);
+ $this->aliases[strtolower($alias)] = Name::concat($node->prefix, $use->name, [
'startLine' => $node->prefix->getAttribute('startLine'),
'endLine' => $use->name->getAttribute('endLine'),
- ));
+ ]);
}
- return false;
+ return NodeTraverser::REMOVE_NODE;
} elseif ($node instanceof Namespace_) {
// Start fresh, since we're done with this namespace.
$this->lastNamespace = $node->name;
$this->lastAliases = $this->aliases;
- $this->aliases = array();
+ $this->aliases = [];
} else {
foreach ($node as $name => $subNode) {
if ($subNode instanceof Name) {
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidClassNamePass.php b/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/ValidClassNamePass.php
rename to vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php
index c91471ef..682399bf 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidClassNamePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -38,12 +38,12 @@ class ValidClassNamePass extends NamespaceAwarePass
const INTERFACE_TYPE = 'interface';
const TRAIT_TYPE = 'trait';
- protected $checkTraits;
private $conditionalScopes = 0;
+ private $atLeastPhp55;
public function __construct()
{
- $this->checkTraits = function_exists('trait_exists');
+ $this->atLeastPhp55 = version_compare(PHP_VERSION, '5.5', '>=');
}
/**
@@ -53,7 +53,7 @@ class ValidClassNamePass extends NamespaceAwarePass
* presence and can validate constant fetches and static calls in class or
* trait methods.
*
- * @param Node
+ * @param Node $node
*/
public function enterNode(Node $node)
{
@@ -115,7 +115,7 @@ class ValidClassNamePass extends NamespaceAwarePass
*/
protected function validateClassStatement(Class_ $stmt)
{
- $this->ensureCanDefine($stmt);
+ $this->ensureCanDefine($stmt, self::CLASS_TYPE);
if (isset($stmt->extends)) {
$this->ensureClassExists($this->getFullyQualifiedName($stmt->extends), $stmt);
}
@@ -129,7 +129,7 @@ class ValidClassNamePass extends NamespaceAwarePass
*/
protected function validateInterfaceStatement(Interface_ $stmt)
{
- $this->ensureCanDefine($stmt);
+ $this->ensureCanDefine($stmt, self::INTERFACE_TYPE);
$this->ensureInterfacesExist($stmt->extends, $stmt);
}
@@ -140,7 +140,7 @@ class ValidClassNamePass extends NamespaceAwarePass
*/
protected function validateTraitStatement(Trait_ $stmt)
{
- $this->ensureCanDefine($stmt);
+ $this->ensureCanDefine($stmt, self::TRAIT_TYPE);
}
/**
@@ -164,8 +164,7 @@ class ValidClassNamePass extends NamespaceAwarePass
protected function validateClassConstFetchExpression(ClassConstFetch $stmt)
{
// there is no need to check exists for ::class const for php 5.5 or newer
- if (strtolower($stmt->name) === 'class'
- && version_compare(PHP_VERSION, '5.5', '>=')) {
+ if (strtolower($stmt->name) === 'class' && $this->atLeastPhp55) {
return;
}
@@ -193,9 +192,10 @@ class ValidClassNamePass extends NamespaceAwarePass
*
* @throws FatalErrorException
*
- * @param Stmt $stmt
+ * @param Stmt $stmt
+ * @param string $scopeType
*/
- protected function ensureCanDefine(Stmt $stmt)
+ protected function ensureCanDefine(Stmt $stmt, $scopeType = self::CLASS_TYPE)
{
$name = $this->getFullyQualifiedName($stmt->name);
@@ -215,7 +215,7 @@ class ValidClassNamePass extends NamespaceAwarePass
// Store creation for the rest of this code snippet so we can find local
// issue too
- $this->currentScope[strtolower($name)] = $this->getScopeType($stmt);
+ $this->currentScope[strtolower($name)] = $scopeType;
}
/**
@@ -262,7 +262,7 @@ class ValidClassNamePass extends NamespaceAwarePass
$this->ensureClassExists($class, $stmt);
// let's pretend all calls to self, parent and static are valid
- if (in_array(strtolower($class), array('self', 'parent', 'static'))) {
+ if (in_array(strtolower($class), ['self', 'parent', 'static'])) {
return;
}
@@ -286,8 +286,8 @@ class ValidClassNamePass extends NamespaceAwarePass
*
* @throws FatalErrorException
*
- * @param $interfaces
- * @param Stmt $stmt
+ * @param Interface_[] $interfaces
+ * @param Stmt $stmt
*/
protected function ensureInterfacesExist($interfaces, $stmt)
{
@@ -303,6 +303,9 @@ class ValidClassNamePass extends NamespaceAwarePass
/**
* Get a symbol type key for storing in the scope name cache.
*
+ * @deprecated No longer used. Scope type should be passed into ensureCanDefine directly.
+ * @codeCoverageIgnore
+ *
* @param Stmt $stmt
*
* @return string
@@ -332,7 +335,7 @@ class ValidClassNamePass extends NamespaceAwarePass
// Give `self`, `static` and `parent` a pass. This will actually let
// some errors through, since we're not checking whether the keyword is
// being used in a class scope.
- if (in_array(strtolower($name), array('self', 'static', 'parent'))) {
+ if (in_array(strtolower($name), ['self', 'static', 'parent'])) {
return true;
}
@@ -360,7 +363,7 @@ class ValidClassNamePass extends NamespaceAwarePass
*/
protected function traitExists($name)
{
- return $this->checkTraits && (trait_exists($name) || $this->findInScope($name) === self::TRAIT_TYPE);
+ return trait_exists($name) || $this->findInScope($name) === self::TRAIT_TYPE;
}
/**
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php b/vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php
similarity index 89%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php
rename to vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php
index e84f3de6..7134bb28 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -15,6 +15,7 @@ use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\ConstFetch;
+use PhpParser\Node\Identifier;
use Psy\Exception\FatalErrorException;
/**
@@ -62,8 +63,11 @@ class ValidConstantPass extends NamespaceAwarePass
*/
protected function validateClassConstFetchExpression(ClassConstFetch $stmt)
{
+ // For PHP Parser 4.x
+ $constName = $stmt->name instanceof Identifier ? $stmt->name->toString() : $stmt->name;
+
// give the `class` pseudo-constant a pass
- if ($stmt->name === 'class') {
+ if ($constName === 'class') {
return;
}
@@ -75,9 +79,9 @@ class ValidConstantPass extends NamespaceAwarePass
// defined in the same line it's used or something stupid like that.
if (class_exists($className) || interface_exists($className)) {
$refl = new \ReflectionClass($className);
- if (!$refl->hasConstant($stmt->name)) {
+ if (!$refl->hasConstant($constName)) {
$constType = class_exists($className) ? 'Class' : 'Interface';
- $msg = sprintf('%s constant \'%s::%s\' not found', $constType, $className, $stmt->name);
+ $msg = sprintf('%s constant \'%s::%s\' not found', $constType, $className, $constName);
throw new FatalErrorException($msg, 0, E_ERROR, null, $stmt->getLine());
}
}
diff --git a/vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.php b/vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.php
new file mode 100644
index 00000000..b049dbc0
--- /dev/null
+++ b/vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.php
@@ -0,0 +1,112 @@
+
+ */
+class ValidConstructorPass extends CodeCleanerPass
+{
+ private $namespace;
+
+ public function beforeTraverse(array $nodes)
+ {
+ $this->namespace = [];
+ }
+
+ /**
+ * Validate that the constructor is not static and does not have a return type.
+ *
+ * @throws FatalErrorException the constructor function is static
+ * @throws FatalErrorException the constructor function has a return type
+ *
+ * @param Node $node
+ */
+ public function enterNode(Node $node)
+ {
+ if ($node instanceof Namespace_) {
+ $this->namespace = isset($node->name) ? $node->name->parts : [];
+ } elseif ($node instanceof Class_) {
+ $constructor = null;
+ foreach ($node->stmts as $stmt) {
+ if ($stmt instanceof ClassMethod) {
+ // If we find a new-style constructor, no need to look for the old-style
+ if ('__construct' === strtolower($stmt->name)) {
+ $this->validateConstructor($stmt, $node);
+
+ return;
+ }
+
+ // We found a possible old-style constructor (unless there is also a __construct method)
+ if (empty($this->namespace) && strtolower($node->name) === strtolower($stmt->name)) {
+ $constructor = $stmt;
+ }
+ }
+ }
+
+ if ($constructor) {
+ $this->validateConstructor($constructor, $node);
+ }
+ }
+ }
+
+ /**
+ * @throws FatalErrorException the constructor function is static
+ * @throws FatalErrorException the constructor function has a return type
+ *
+ * @param Node $constructor
+ * @param Node $classNode
+ */
+ private function validateConstructor(Node $constructor, Node $classNode)
+ {
+ if ($constructor->isStatic()) {
+ // For PHP Parser 4.x
+ $className = $classNode->name instanceof Identifier ? $classNode->name->toString() : $classNode->name;
+
+ $msg = sprintf(
+ 'Constructor %s::%s() cannot be static',
+ implode('\\', array_merge($this->namespace, (array) $className)),
+ $constructor->name
+ );
+ throw new FatalErrorException($msg, 0, E_ERROR, null, $classNode->getLine());
+ }
+
+ if (method_exists($constructor, 'getReturnType') && $constructor->getReturnType()) {
+ // For PHP Parser 4.x
+ $className = $classNode->name instanceof Identifier ? $classNode->name->toString() : $classNode->name;
+
+ $msg = sprintf(
+ 'Constructor %s::%s() cannot declare a return type',
+ implode('\\', array_merge($this->namespace, (array) $className)),
+ $constructor->name
+ );
+ throw new FatalErrorException($msg, 0, E_ERROR, null, $classNode->getLine());
+ }
+ }
+}
diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php b/vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php
similarity index 99%
rename from vendor/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php
rename to vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php
index 0da5138f..a6bf01e7 100644
--- a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidFunctionNamePass.php
+++ b/vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Command/BufferCommand.php b/vendor/psy/psysh/src/Command/BufferCommand.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/Command/BufferCommand.php
rename to vendor/psy/psysh/src/Command/BufferCommand.php
index 3a8abcb1..6319ccf8 100644
--- a/vendor/psy/psysh/src/Psy/Command/BufferCommand.php
+++ b/vendor/psy/psysh/src/Command/BufferCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -30,10 +30,10 @@ class BufferCommand extends Command
{
$this
->setName('buffer')
- ->setAliases(array('buf'))
- ->setDefinition(array(
+ ->setAliases(['buf'])
+ ->setDefinition([
new InputOption('clear', '', InputOption::VALUE_NONE, 'Clear the current buffer.'),
- ))
+ ])
->setDescription('Show (or clear) the contents of the code input buffer.')
->setHelp(
<<<'HELP'
diff --git a/vendor/psy/psysh/src/Psy/Command/ClearCommand.php b/vendor/psy/psysh/src/Command/ClearCommand.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/Command/ClearCommand.php
rename to vendor/psy/psysh/src/Command/ClearCommand.php
index 470f61de..1a5b845d 100644
--- a/vendor/psy/psysh/src/Psy/Command/ClearCommand.php
+++ b/vendor/psy/psysh/src/Command/ClearCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -28,7 +28,7 @@ class ClearCommand extends Command
{
$this
->setName('clear')
- ->setDefinition(array())
+ ->setDefinition([])
->setDescription('Clear the Psy Shell screen.')
->setHelp(
<<<'HELP'
diff --git a/vendor/psy/psysh/src/Psy/Command/Command.php b/vendor/psy/psysh/src/Command/Command.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Command/Command.php
rename to vendor/psy/psysh/src/Command/Command.php
index c8aaedee..83e1dcea 100644
--- a/vendor/psy/psysh/src/Psy/Command/Command.php
+++ b/vendor/psy/psysh/src/Command/Command.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -34,7 +34,7 @@ abstract class Command extends BaseCommand
public function setApplication(Application $application = null)
{
if ($application !== null && !$application instanceof Shell) {
- throw new \InvalidArgumentException('PsySH Commands require an instance of Psy\Shell.');
+ throw new \InvalidArgumentException('PsySH Commands require an instance of Psy\Shell');
}
return parent::setApplication($application);
@@ -45,11 +45,11 @@ abstract class Command extends BaseCommand
*/
public function asText()
{
- $messages = array(
+ $messages = [
'Usage: ',
' ' . $this->getSynopsis(),
'',
- );
+ ];
if ($this->getAliases()) {
$messages[] = $this->aliasesAsText();
@@ -90,7 +90,7 @@ abstract class Command extends BaseCommand
*/
protected function getHiddenArguments()
{
- return array('command');
+ return ['command'];
}
/**
@@ -112,7 +112,7 @@ abstract class Command extends BaseCommand
*/
protected function getHiddenOptions()
{
- return array('verbose');
+ return ['verbose'];
}
/**
@@ -133,7 +133,7 @@ abstract class Command extends BaseCommand
private function argumentsAsText()
{
$max = $this->getMaxWidth();
- $messages = array();
+ $messages = [];
$arguments = $this->getArguments();
if (!empty($arguments)) {
@@ -164,7 +164,7 @@ abstract class Command extends BaseCommand
private function optionsAsText()
{
$max = $this->getMaxWidth();
- $messages = array();
+ $messages = [];
$options = $this->getOptions();
if ($options) {
@@ -260,7 +260,7 @@ abstract class Command extends BaseCommand
$table = new Table($output);
return $table
- ->setRows(array())
+ ->setRows([])
->setStyle($style);
}
@@ -274,7 +274,7 @@ abstract class Command extends BaseCommand
$table = $this->getApplication()->getHelperSet()->get('table');
return $table
- ->setRows(array())
+ ->setRows([])
->setLayout(TableHelper::LAYOUT_BORDERLESS)
->setHorizontalBorderChar('')
->setCrossingChar('');
diff --git a/vendor/psy/psysh/src/Psy/Command/DocCommand.php b/vendor/psy/psysh/src/Command/DocCommand.php
similarity index 79%
rename from vendor/psy/psysh/src/Psy/Command/DocCommand.php
rename to vendor/psy/psysh/src/Command/DocCommand.php
index 9f5fb5b9..fe202869 100644
--- a/vendor/psy/psysh/src/Psy/Command/DocCommand.php
+++ b/vendor/psy/psysh/src/Command/DocCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,8 +13,9 @@ namespace Psy\Command;
use Psy\Formatter\DocblockFormatter;
use Psy\Formatter\SignatureFormatter;
+use Psy\Input\CodeArgument;
+use Psy\Reflection\ReflectionClassConstant;
use Psy\Reflection\ReflectionLanguageConstruct;
-use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -30,10 +31,10 @@ class DocCommand extends ReflectingCommand
{
$this
->setName('doc')
- ->setAliases(array('rtfm', 'man'))
- ->setDefinition(array(
- new InputArgument('value', InputArgument::REQUIRED, 'Function, class, instance, constant, method or property to document.'),
- ))
+ ->setAliases(['rtfm', 'man'])
+ ->setDefinition([
+ new CodeArgument('target', CodeArgument::REQUIRED, 'Function, class, instance, constant, method or property to document.'),
+ ])
->setDescription('Read the documentation for an object, class, constant, method or property.')
->setHelp(
<<getArgument('value');
+ $value = $input->getArgument('target');
if (ReflectionLanguageConstruct::isLanguageConstruct($value)) {
$reflector = new ReflectionLanguageConstruct($value);
$doc = $this->getManualDocById($value);
@@ -101,6 +102,18 @@ HELP
$id = $reflector->class . '::$' . $reflector->name;
break;
+ case 'ReflectionClassConstant':
+ case 'Psy\Reflection\ReflectionClassConstant':
+ // @todo this is going to collide with ReflectionMethod ids
+ // someday... start running the query by id + type if the DB
+ // supports it.
+ $id = $reflector->class . '::' . $reflector->name;
+ break;
+
+ case 'Psy\Reflection\ReflectionConstant_':
+ $id = $reflector->name;
+ break;
+
default:
return false;
}
diff --git a/vendor/psy/psysh/src/Psy/Command/DumpCommand.php b/vendor/psy/psysh/src/Command/DumpCommand.php
similarity index 63%
rename from vendor/psy/psysh/src/Psy/Command/DumpCommand.php
rename to vendor/psy/psysh/src/Command/DumpCommand.php
index abb9b88a..77bd0e2d 100644
--- a/vendor/psy/psysh/src/Psy/Command/DumpCommand.php
+++ b/vendor/psy/psysh/src/Command/DumpCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,10 +11,9 @@
namespace Psy\Command;
-use Psy\Exception\RuntimeException;
+use Psy\Input\CodeArgument;
use Psy\VarDumper\Presenter;
use Psy\VarDumper\PresenterAware;
-use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -45,11 +44,11 @@ class DumpCommand extends ReflectingCommand implements PresenterAware
{
$this
->setName('dump')
- ->setDefinition(array(
- new InputArgument('target', InputArgument::REQUIRED, 'A target object or primitive to dump.', null),
- new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse', 10),
+ ->setDefinition([
+ new CodeArgument('target', CodeArgument::REQUIRED, 'A target object or primitive to dump.'),
+ new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse.', 10),
new InputOption('all', 'a', InputOption::VALUE_NONE, 'Include private and protected methods and properties.'),
- ))
+ ])
->setDescription('Dump an object or primitive.')
->setHelp(
<<<'HELP'
@@ -60,6 +59,7 @@ This is like var_dump but way awesomer.
e.g.
>>> dump $_
>>> dump $someVar
+>>> dump $stuff->getAll()
HELP
);
}
@@ -70,7 +70,7 @@ HELP
protected function execute(InputInterface $input, OutputInterface $output)
{
$depth = $input->getOption('depth');
- $target = $this->resolveTarget($input->getArgument('target'));
+ $target = $this->resolveCode($input->getArgument('target'));
$output->page($this->presenter->present($target, $depth, $input->getOption('all') ? Presenter::VERBOSE : 0));
if (is_object($target)) {
@@ -79,27 +79,16 @@ HELP
}
/**
- * Resolve dump target name.
+ * @deprecated Use `resolveCode` instead
*
- * @throws RuntimeException if target name does not exist in the current scope
- *
- * @param string $target
+ * @param string $name
*
* @return mixed
*/
- protected function resolveTarget($target)
+ protected function resolveTarget($name)
{
- $matches = array();
- if (preg_match(self::SUPERGLOBAL, $target, $matches)) {
- if (!array_key_exists($matches[1], $GLOBALS)) {
- throw new RuntimeException('Unknown target: ' . $target);
- }
+ @trigger_error('`resolveTarget` is deprecated; use `resolveCode` instead.', E_USER_DEPRECATED);
- return $GLOBALS[$matches[1]];
- } elseif (preg_match(self::INSTANCE, $target, $matches)) {
- return $this->getScopeVariable($matches[1]);
- } else {
- throw new RuntimeException('Unknown target: ' . $target);
- }
+ return $this->resolveCode($name);
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/EditCommand.php b/vendor/psy/psysh/src/Command/EditCommand.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Command/EditCommand.php
rename to vendor/psy/psysh/src/Command/EditCommand.php
index a1c6ee43..7d955692 100644
--- a/vendor/psy/psysh/src/Psy/Command/EditCommand.php
+++ b/vendor/psy/psysh/src/Command/EditCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -49,7 +49,7 @@ class EditCommand extends Command implements ContextAware
{
$this
->setName('edit')
- ->setDefinition(array(
+ ->setDefinition([
new InputArgument('file', InputArgument::OPTIONAL, 'The file to open for editing. If this is not given, edits a temporary file.', null),
new InputOption(
'exec',
@@ -65,7 +65,7 @@ class EditCommand extends Command implements ContextAware
'Do not execute the file content after editing. This is the default when a file name argument is given.',
null
),
- ))
+ ])
->setDescription('Open an external editor. Afterwards, get produced code in input buffer.')
->setHelp('Set the EDITOR environment variable to something you\'d like to use.');
}
@@ -81,7 +81,7 @@ class EditCommand extends Command implements ContextAware
{
if ($input->getOption('exec') &&
$input->getOption('no-exec')) {
- throw new \InvalidArgumentException('The --exec and --no-exec flags are mutually exclusive.');
+ throw new \InvalidArgumentException('The --exec and --no-exec flags are mutually exclusive');
}
$filePath = $this->extractFilePath($input->getArgument('file'));
@@ -158,8 +158,8 @@ class EditCommand extends Command implements ContextAware
{
$escapedFilePath = escapeshellarg($filePath);
- $pipes = array();
- $proc = proc_open((getenv('EDITOR') ?: 'nano') . " {$escapedFilePath}", array(STDIN, STDOUT, STDERR), $pipes);
+ $pipes = [];
+ $proc = proc_open((getenv('EDITOR') ?: 'nano') . " {$escapedFilePath}", [STDIN, STDOUT, STDERR], $pipes);
proc_close($proc);
$editedContent = @file_get_contents($filePath);
diff --git a/vendor/psy/psysh/src/Psy/Command/ExitCommand.php b/vendor/psy/psysh/src/Command/ExitCommand.php
similarity index 85%
rename from vendor/psy/psysh/src/Psy/Command/ExitCommand.php
rename to vendor/psy/psysh/src/Command/ExitCommand.php
index 10c64b47..43398861 100644
--- a/vendor/psy/psysh/src/Psy/Command/ExitCommand.php
+++ b/vendor/psy/psysh/src/Command/ExitCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -29,8 +29,8 @@ class ExitCommand extends Command
{
$this
->setName('exit')
- ->setAliases(array('quit', 'q'))
- ->setDefinition(array())
+ ->setAliases(['quit', 'q'])
+ ->setDefinition([])
->setDescription('End the current session and return to caller.')
->setHelp(
<<<'HELP'
@@ -47,6 +47,6 @@ HELP
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- throw new BreakException('Goodbye.');
+ throw new BreakException('Goodbye');
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/HelpCommand.php b/vendor/psy/psysh/src/Command/HelpCommand.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Command/HelpCommand.php
rename to vendor/psy/psysh/src/Command/HelpCommand.php
index fd32ddef..a50f2562 100644
--- a/vendor/psy/psysh/src/Psy/Command/HelpCommand.php
+++ b/vendor/psy/psysh/src/Command/HelpCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -32,10 +32,10 @@ class HelpCommand extends Command
{
$this
->setName('help')
- ->setAliases(array('?'))
- ->setDefinition(array(
- new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', null),
- ))
+ ->setAliases(['?'])
+ ->setDefinition([
+ new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name.', null),
+ ])
->setDescription('Show a list of commands. Type `help [foo]` for information about [foo].')
->setHelp('My. How meta.');
}
@@ -79,11 +79,11 @@ class HelpCommand extends Command
$aliases = '';
}
- $table->addRow(array(
+ $table->addRow([
sprintf('%s ', $name),
$command->getDescription(),
$aliases,
- ));
+ ]);
}
$output->startPaging();
diff --git a/vendor/psy/psysh/src/Psy/Command/HistoryCommand.php b/vendor/psy/psysh/src/Command/HistoryCommand.php
similarity index 90%
rename from vendor/psy/psysh/src/Psy/Command/HistoryCommand.php
rename to vendor/psy/psysh/src/Command/HistoryCommand.php
index da2d3274..eef8ef9d 100644
--- a/vendor/psy/psysh/src/Psy/Command/HistoryCommand.php
+++ b/vendor/psy/psysh/src/Command/HistoryCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -27,6 +27,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class HistoryCommand extends Command
{
private $filter;
+ private $readline;
/**
* {@inheritdoc}
@@ -57,9 +58,9 @@ class HistoryCommand extends Command
$this
->setName('history')
- ->setAliases(array('hist'))
- ->setDefinition(array(
- new InputOption('show', 's', InputOption::VALUE_REQUIRED, 'Show the given range of lines'),
+ ->setAliases(['hist'])
+ ->setDefinition([
+ new InputOption('show', 's', InputOption::VALUE_REQUIRED, 'Show the given range of lines.'),
new InputOption('head', 'H', InputOption::VALUE_REQUIRED, 'Display the first N items.'),
new InputOption('tail', 'T', InputOption::VALUE_REQUIRED, 'Display the last N items.'),
@@ -70,9 +71,9 @@ class HistoryCommand extends Command
new InputOption('no-numbers', 'N', InputOption::VALUE_NONE, 'Omit line numbers.'),
new InputOption('save', '', InputOption::VALUE_REQUIRED, 'Save history to a file.'),
- new InputOption('replay', '', InputOption::VALUE_NONE, 'Replay'),
+ new InputOption('replay', '', InputOption::VALUE_NONE, 'Replay.'),
new InputOption('clear', '', InputOption::VALUE_NONE, 'Clear the history.'),
- ))
+ ])
->setDescription('Show the Psy Shell history.')
->setHelp(
<<<'HELP'
@@ -92,8 +93,8 @@ HELP
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $this->validateOnlyOne($input, array('show', 'head', 'tail'));
- $this->validateOnlyOne($input, array('save', 'replay', 'clear'));
+ $this->validateOnlyOne($input, ['show', 'head', 'tail']);
+ $this->validateOnlyOne($input, ['save', 'replay', 'clear']);
$history = $this->getHistorySlice(
$input->getOption('show'),
@@ -104,13 +105,13 @@ HELP
$this->filter->bind($input);
if ($this->filter->hasFilter()) {
- $matches = array();
- $highlighted = array();
+ $matches = [];
+ $highlighted = [];
foreach ($history as $i => $line) {
if ($this->filter->match($line, $matches)) {
if (isset($matches[0])) {
$chunks = explode($matches[0], $history[$i]);
- $chunks = array_map(array(__CLASS__, 'escape'), $chunks);
+ $chunks = array_map([__CLASS__, 'escape'], $chunks);
$glue = sprintf('%s ', self::escape($matches[0]));
$highlighted[$i] = implode($glue, $chunks);
@@ -127,7 +128,7 @@ HELP
$output->writeln('History saved. ');
} elseif ($input->getOption('replay')) {
if (!($input->getOption('show') || $input->getOption('head') || $input->getOption('tail'))) {
- throw new \InvalidArgumentException('You must limit history via --head, --tail or --show before replaying.');
+ throw new \InvalidArgumentException('You must limit history via --head, --tail or --show before replaying');
}
$count = count($history);
@@ -156,15 +157,15 @@ HELP
private function extractRange($range)
{
if (preg_match('/^\d+$/', $range)) {
- return array($range, $range + 1);
+ return [$range, $range + 1];
}
- $matches = array();
+ $matches = [];
if ($range !== '..' && preg_match('/^(\d*)\.\.(\d*)$/', $range, $matches)) {
$start = $matches[1] ? intval($matches[1]) : 0;
$end = $matches[2] ? intval($matches[2]) + 1 : PHP_INT_MAX;
- return array($start, $end);
+ return [$start, $end];
}
throw new \InvalidArgumentException('Unexpected range: ' . $range);
@@ -191,14 +192,14 @@ HELP
$length = $end - $start;
} elseif ($head) {
if (!preg_match('/^\d+$/', $head)) {
- throw new \InvalidArgumentException('Please specify an integer argument for --head.');
+ throw new \InvalidArgumentException('Please specify an integer argument for --head');
}
$start = 0;
$length = intval($head);
} elseif ($tail) {
if (!preg_match('/^\d+$/', $tail)) {
- throw new \InvalidArgumentException('Please specify an integer argument for --tail.');
+ throw new \InvalidArgumentException('Please specify an integer argument for --tail');
}
$start = count($history) - $tail;
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand.php b/vendor/psy/psysh/src/Command/ListCommand.php
similarity index 89%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand.php
rename to vendor/psy/psysh/src/Command/ListCommand.php
index 8ce02275..2e65895e 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand.php
+++ b/vendor/psy/psysh/src/Command/ListCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,12 +20,12 @@ use Psy\Command\ListCommand\MethodEnumerator;
use Psy\Command\ListCommand\PropertyEnumerator;
use Psy\Command\ListCommand\VariableEnumerator;
use Psy\Exception\RuntimeException;
+use Psy\Input\CodeArgument;
use Psy\Input\FilterOptions;
use Psy\VarDumper\Presenter;
use Psy\VarDumper\PresenterAware;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\TableHelper;
-use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -41,7 +41,7 @@ class ListCommand extends ReflectingCommand implements PresenterAware
/**
* PresenterAware interface.
*
- * @param Presenter $manager
+ * @param Presenter $presenter
*/
public function setPresenter(Presenter $presenter)
{
@@ -57,9 +57,9 @@ class ListCommand extends ReflectingCommand implements PresenterAware
$this
->setName('ls')
- ->setAliases(array('list', 'dir'))
- ->setDefinition(array(
- new InputArgument('target', InputArgument::OPTIONAL, 'A target class or object to list.', null),
+ ->setAliases(['list', 'dir'])
+ ->setDefinition([
+ new CodeArgument('target', CodeArgument::OPTIONAL, 'A target class or object to list.'),
new InputOption('vars', '', InputOption::VALUE_NONE, 'Display variables.'),
new InputOption('constants', 'c', InputOption::VALUE_NONE, 'Display defined constants.'),
@@ -84,7 +84,7 @@ class ListCommand extends ReflectingCommand implements PresenterAware
new InputOption('all', 'a', InputOption::VALUE_NONE, 'Include private and protected methods and properties.'),
new InputOption('long', 'l', InputOption::VALUE_NONE, 'List in long format: includes class names and method signatures.'),
- ))
+ ])
->setDescription('List local, instance or class variables, methods and constants.')
->setHelp(
<<<'HELP'
@@ -104,6 +104,7 @@ e.g.
>>> ls -al ReflectionClass
>>> ls --constants --category date
>>> ls -l --functions --grep /^array_.*/
+>>> ls -l --properties new DateTime()
HELP
);
}
@@ -119,7 +120,7 @@ HELP
$method = $input->getOption('long') ? 'writeLong' : 'write';
if ($target = $input->getArgument('target')) {
- list($target, $reflector) = $this->getTargetAndReflector($target, true);
+ list($target, $reflector) = $this->getTargetAndReflector($target);
} else {
$reflector = null;
}
@@ -151,7 +152,7 @@ HELP
if (!isset($this->enumerators)) {
$mgr = $this->presenter;
- $this->enumerators = array(
+ $this->enumerators = [
new ClassConstantEnumerator($mgr),
new ClassEnumerator($mgr),
new ConstantEnumerator($mgr),
@@ -160,7 +161,7 @@ HELP
new PropertyEnumerator($mgr),
new MethodEnumerator($mgr),
new VariableEnumerator($mgr, $this->context),
- );
+ ];
}
}
@@ -177,7 +178,7 @@ HELP
}
foreach ($result as $label => $items) {
- $names = array_map(array($this, 'formatItemName'), $items);
+ $names = array_map([$this, 'formatItemName'], $items);
$output->writeln(sprintf('%s: %s', $label, implode(', ', $names)));
}
}
@@ -202,9 +203,9 @@ HELP
$output->writeln('');
$output->writeln(sprintf('%s:', $label));
- $table->setRows(array());
+ $table->setRows([]);
foreach ($items as $item) {
- $table->addRow(array($this->formatItemName($item), $item['value']));
+ $table->addRow([$this->formatItemName($item), $item['value']]);
}
if ($table instanceof TableHelper) {
@@ -238,13 +239,13 @@ HELP
{
if (!$input->getArgument('target')) {
// if no target is passed, there can be no properties or methods
- foreach (array('properties', 'methods', 'no-inherit') as $option) {
+ foreach (['properties', 'methods', 'no-inherit'] as $option) {
if ($input->getOption($option)) {
- throw new RuntimeException('--' . $option . ' does not make sense without a specified target.');
+ throw new RuntimeException('--' . $option . ' does not make sense without a specified target');
}
}
- foreach (array('globals', 'vars', 'constants', 'functions', 'classes', 'interfaces', 'traits') as $option) {
+ foreach (['globals', 'vars', 'constants', 'functions', 'classes', 'interfaces', 'traits'] as $option) {
if ($input->getOption($option)) {
return;
}
@@ -254,13 +255,13 @@ HELP
$input->setOption('vars', true);
} else {
// if a target is passed, classes, functions, etc don't make sense
- foreach (array('vars', 'globals', 'functions', 'classes', 'interfaces', 'traits') as $option) {
+ foreach (['vars', 'globals', 'functions', 'classes', 'interfaces', 'traits'] as $option) {
if ($input->getOption($option)) {
- throw new RuntimeException('--' . $option . ' does not make sense with a specified target.');
+ throw new RuntimeException('--' . $option . ' does not make sense with a specified target');
}
}
- foreach (array('constants', 'properties', 'methods') as $option) {
+ foreach (['constants', 'properties', 'methods'] as $option) {
if ($input->getOption($option)) {
return;
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php
index fc974b2d..0b099270 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,7 +11,7 @@
namespace Psy\Command\ListCommand;
-use Psy\Reflection\ReflectionConstant;
+use Psy\Reflection\ReflectionClassConstant;
use Symfony\Component\Console\Input\InputInterface;
/**
@@ -48,7 +48,7 @@ class ClassConstantEnumerator extends Enumerator
return;
}
- $ret = array();
+ $ret = [];
$ret[$this->getKindLabel($reflector)] = $constants;
return $ret;
@@ -66,9 +66,9 @@ class ClassConstantEnumerator extends Enumerator
{
$className = $reflector->getName();
- $constants = array();
+ $constants = [];
foreach ($reflector->getConstants() as $name => $constant) {
- $constReflector = new ReflectionConstant($reflector, $name);
+ $constReflector = ReflectionClassConstant::create($reflector, $name);
if ($noInherit && $constReflector->getDeclaringClass()->getName() !== $className) {
continue;
@@ -77,9 +77,7 @@ class ClassConstantEnumerator extends Enumerator
$constants[$name] = $constReflector;
}
- // @todo switch to ksort after we drop support for 5.3:
- // ksort($constants, SORT_NATURAL | SORT_FLAG_CASE);
- uksort($constants, 'strnatcasecmp');
+ ksort($constants, SORT_NATURAL | SORT_FLAG_CASE);
return $constants;
}
@@ -94,15 +92,15 @@ class ClassConstantEnumerator extends Enumerator
protected function prepareConstants(array $constants)
{
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($constants as $name => $constant) {
if ($this->showItem($name)) {
- $ret[$name] = array(
+ $ret[$name] = [
'name' => $name,
'style' => self::IS_CONSTANT,
'value' => $this->presentRef($constant->getValue()),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php
similarity index 89%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php
index 6dcabe28..858f5a2e 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -38,7 +38,7 @@ class ClassEnumerator extends Enumerator
$user = $input->getOption('user');
$internal = $input->getOption('internal');
- $ret = array();
+ $ret = [];
// only list classes, interfaces and traits if we are specifically asked
@@ -50,11 +50,11 @@ class ClassEnumerator extends Enumerator
$ret = array_merge($ret, $this->filterClasses('Interfaces', get_declared_interfaces(), $internal, $user));
}
- if (function_exists('get_declared_traits') && $input->getOption('traits')) {
+ if ($input->getOption('traits')) {
$ret = array_merge($ret, $this->filterClasses('Traits', get_declared_traits(), $internal, $user));
}
- return array_map(array($this, 'prepareClasses'), array_filter($ret));
+ return array_map([$this, 'prepareClasses'], array_filter($ret));
}
/**
@@ -72,7 +72,7 @@ class ClassEnumerator extends Enumerator
*/
protected function filterClasses($key, $classes, $internal, $user)
{
- $ret = array();
+ $ret = [];
if ($internal) {
$ret['Internal ' . $key] = array_filter($classes, function ($class) {
@@ -100,7 +100,7 @@ class ClassEnumerator extends Enumerator
/**
* Prepare formatted class array.
*
- * @param array $class
+ * @param array $classes
*
* @return array
*/
@@ -109,15 +109,15 @@ class ClassEnumerator extends Enumerator
natcasesort($classes);
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($classes as $name) {
if ($this->showItem($name)) {
- $ret[$name] = array(
+ $ret[$name] = [
'name' => $name,
'style' => self::IS_CLASS,
'value' => $this->presentSignature($name),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php
index 88d348d0..e17d42a0 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/ConstantEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -43,7 +43,7 @@ class ConstantEnumerator extends Enumerator
$internal = $input->getOption('internal');
$category = $input->getOption('category');
- $ret = array();
+ $ret = [];
if ($user) {
$ret['User Constants'] = $this->getConstants('user');
@@ -62,7 +62,7 @@ class ConstantEnumerator extends Enumerator
$ret['Constants'] = $this->getConstants();
}
- return array_map(array($this, 'prepareConstants'), array_filter($ret));
+ return array_map([$this, 'prepareConstants'], array_filter($ret));
}
/**
@@ -89,7 +89,7 @@ class ConstantEnumerator extends Enumerator
return call_user_func_array('array_merge', $consts);
}
- return isset($consts[$category]) ? $consts[$category] : array();
+ return isset($consts[$category]) ? $consts[$category] : [];
}
/**
@@ -102,18 +102,18 @@ class ConstantEnumerator extends Enumerator
protected function prepareConstants(array $constants)
{
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
$names = array_keys($constants);
natcasesort($names);
foreach ($names as $name) {
if ($this->showItem($name)) {
- $ret[$name] = array(
+ $ret[$name] = [
'name' => $name,
'style' => self::IS_CONSTANT,
'value' => $this->presentRef($constants[$name]),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/Enumerator.php b/vendor/psy/psysh/src/Command/ListCommand/Enumerator.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/Enumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/Enumerator.php
index 2508f96f..616543d0 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/Enumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/Enumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -49,7 +49,7 @@ abstract class Enumerator
* Return a list of categorized things with the given input options and target.
*
* @param InputInterface $input
- * @param Reflector $reflector
+ * @param \Reflector $reflector
* @param mixed $target
*
* @return array
@@ -77,7 +77,7 @@ abstract class Enumerator
* ]
*
* @param InputInterface $input
- * @param Reflector $reflector
+ * @param \Reflector $reflector
* @param mixed $target
*
* @return array
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php
index 40ba71c9..733055a6 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/FunctionEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -57,7 +57,7 @@ class FunctionEnumerator extends Enumerator
return;
}
- $ret = array();
+ $ret = [];
$ret[$label] = $functions;
return $ret;
@@ -95,15 +95,15 @@ class FunctionEnumerator extends Enumerator
natcasesort($functions);
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($functions as $name) {
if ($this->showItem($name)) {
- $ret[$name] = array(
+ $ret[$name] = [
'name' => $name,
'style' => self::IS_FUNCTION,
'value' => $this->presentSignature($name),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/GlobalVariableEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/GlobalVariableEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php
index d957e9f5..8e58af8b 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/GlobalVariableEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -39,9 +39,9 @@ class GlobalVariableEnumerator extends Enumerator
return;
}
- return array(
+ return [
'Global Variables' => $globals,
- );
+ ];
}
/**
@@ -56,7 +56,7 @@ class GlobalVariableEnumerator extends Enumerator
$names = array_keys($GLOBALS);
natcasesort($names);
- $ret = array();
+ $ret = [];
foreach ($names as $name) {
$ret[$name] = $GLOBALS[$name];
}
@@ -74,16 +74,16 @@ class GlobalVariableEnumerator extends Enumerator
protected function prepareGlobals($globals)
{
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($globals as $name => $value) {
if ($this->showItem($name)) {
$fname = '$' . $name;
- $ret[$fname] = array(
+ $ret[$fname] = [
'name' => $fname,
'style' => self::IS_GLOBAL,
'value' => $this->presentRef($value),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/InterfaceEnumerator.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/InterfaceEnumerator.php
index 91ba985d..dae0dace 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/InterfaceEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/InterfaceEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,6 +24,7 @@ class InterfaceEnumerator extends Enumerator
public function __construct(Presenter $presenter)
{
@trigger_error('InterfaceEnumerator is no longer used', E_USER_DEPRECATED);
+ parent::__construct($presenter);
}
/**
@@ -54,9 +55,9 @@ class InterfaceEnumerator extends Enumerator
return;
}
- return array(
+ return [
'Interfaces' => $interfaces,
- );
+ ];
}
/**
@@ -71,15 +72,15 @@ class InterfaceEnumerator extends Enumerator
natcasesort($interfaces);
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($interfaces as $name) {
if ($this->showItem($name)) {
- $ret[$name] = array(
+ $ret[$name] = [
'name' => $name,
'style' => self::IS_CLASS,
'value' => $this->presentSignature($name),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/MethodEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/MethodEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php
index 963761cf..ebe43afa 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/MethodEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -47,7 +47,7 @@ class MethodEnumerator extends Enumerator
return;
}
- $ret = array();
+ $ret = [];
$ret[$this->getKindLabel($reflector)] = $methods;
return $ret;
@@ -66,7 +66,7 @@ class MethodEnumerator extends Enumerator
{
$className = $reflector->getName();
- $methods = array();
+ $methods = [];
foreach ($reflector->getMethods() as $name => $method) {
if ($noInherit && $method->getDeclaringClass()->getName() !== $className) {
continue;
@@ -77,9 +77,7 @@ class MethodEnumerator extends Enumerator
}
}
- // @todo switch to ksort after we drop support for 5.3:
- // ksort($methods, SORT_NATURAL | SORT_FLAG_CASE);
- uksort($methods, 'strnatcasecmp');
+ ksort($methods, SORT_NATURAL | SORT_FLAG_CASE);
return $methods;
}
@@ -94,15 +92,15 @@ class MethodEnumerator extends Enumerator
protected function prepareMethods(array $methods)
{
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($methods as $name => $method) {
if ($this->showItem($name)) {
- $ret[$name] = array(
+ $ret[$name] = [
'name' => $name,
'style' => $this->getVisibilityStyle($method),
'value' => $this->presentSignature($method),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/PropertyEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/PropertyEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php
index db18d2ba..15ce45db 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/PropertyEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -47,7 +47,7 @@ class PropertyEnumerator extends Enumerator
return;
}
- $ret = array();
+ $ret = [];
$ret[$this->getKindLabel($reflector)] = $properties;
return $ret;
@@ -66,7 +66,7 @@ class PropertyEnumerator extends Enumerator
{
$className = $reflector->getName();
- $properties = array();
+ $properties = [];
foreach ($reflector->getProperties() as $property) {
if ($noInherit && $property->getDeclaringClass()->getName() !== $className) {
continue;
@@ -77,9 +77,7 @@ class PropertyEnumerator extends Enumerator
}
}
- // @todo switch to ksort after we drop support for 5.3:
- // ksort($properties, SORT_NATURAL | SORT_FLAG_CASE);
- uksort($properties, 'strnatcasecmp');
+ ksort($properties, SORT_NATURAL | SORT_FLAG_CASE);
return $properties;
}
@@ -94,16 +92,16 @@ class PropertyEnumerator extends Enumerator
protected function prepareProperties(array $properties, $target = null)
{
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($properties as $name => $property) {
if ($this->showItem($name)) {
$fname = '$' . $name;
- $ret[$fname] = array(
+ $ret[$fname] = [
'name' => $fname,
'style' => $this->getVisibilityStyle($property),
'value' => $this->presentValue($property, $target),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/TraitEnumerator.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/TraitEnumerator.php
index 12941f4f..c4c74da7 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/TraitEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/TraitEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,6 +24,7 @@ class TraitEnumerator extends Enumerator
public function __construct(Presenter $presenter)
{
@trigger_error('TraitEnumerator is no longer used', E_USER_DEPRECATED);
+ parent::__construct($presenter);
}
/**
@@ -31,11 +32,6 @@ class TraitEnumerator extends Enumerator
*/
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{
- // bail early if current PHP doesn't know about traits.
- if (!function_exists('trait_exists')) {
- return;
- }
-
// only list traits when no Reflector is present.
//
// @todo make a NamespaceReflector and pass that in for commands like:
@@ -59,9 +55,9 @@ class TraitEnumerator extends Enumerator
return;
}
- return array(
+ return [
'Traits' => $traits,
- );
+ ];
}
/**
@@ -76,15 +72,15 @@ class TraitEnumerator extends Enumerator
natcasesort($traits);
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($traits as $name) {
if ($this->showItem($name)) {
- $ret[$name] = array(
+ $ret[$name] = [
'name' => $name,
'style' => self::IS_CLASS,
'value' => $this->presentSignature($name),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/VariableEnumerator.php b/vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/Command/ListCommand/VariableEnumerator.php
rename to vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php
index 55b5afcd..257ceac5 100644
--- a/vendor/psy/psysh/src/Psy/Command/ListCommand/VariableEnumerator.php
+++ b/vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,9 +21,9 @@ use Symfony\Component\Console\Input\InputInterface;
class VariableEnumerator extends Enumerator
{
// n.b. this array is the order in which special variables will be listed
- private static $specialNames = array(
+ private static $specialNames = [
'_', '_e', '__out', '__function', '__method', '__class', '__namespace', '__file', '__line', '__dir',
- );
+ ];
private $context;
@@ -64,9 +64,9 @@ class VariableEnumerator extends Enumerator
return;
}
- return array(
+ return [
'Variables' => $variables,
- );
+ ];
}
/**
@@ -78,13 +78,10 @@ class VariableEnumerator extends Enumerator
*/
protected function getVariables($showAll)
{
- // self:: doesn't work inside closures in PHP 5.3 :-/
- $specialNames = self::$specialNames;
-
$scopeVars = $this->context->getAll();
- uksort($scopeVars, function ($a, $b) use ($specialNames) {
- $aIndex = array_search($a, $specialNames);
- $bIndex = array_search($b, $specialNames);
+ uksort($scopeVars, function ($a, $b) {
+ $aIndex = array_search($a, self::$specialNames);
+ $bIndex = array_search($b, self::$specialNames);
if ($aIndex !== false) {
if ($bIndex !== false) {
@@ -101,7 +98,7 @@ class VariableEnumerator extends Enumerator
return strnatcasecmp($a, $b);
});
- $ret = array();
+ $ret = [];
foreach ($scopeVars as $name => $val) {
if (!$showAll && in_array($name, self::$specialNames)) {
continue;
@@ -123,15 +120,15 @@ class VariableEnumerator extends Enumerator
protected function prepareVariables(array $variables)
{
// My kingdom for a generator.
- $ret = array();
+ $ret = [];
foreach ($variables as $name => $val) {
if ($this->showItem($name)) {
$fname = '$' . $name;
- $ret[$fname] = array(
+ $ret[$fname] = [
'name' => $fname,
'style' => in_array($name, self::$specialNames) ? self::IS_PRIVATE : self::IS_PUBLIC,
'value' => $this->presentRef($val),
- );
+ ];
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ParseCommand.php b/vendor/psy/psysh/src/Command/ParseCommand.php
similarity index 84%
rename from vendor/psy/psysh/src/Psy/Command/ParseCommand.php
rename to vendor/psy/psysh/src/Command/ParseCommand.php
index 301bb614..5fe36d12 100644
--- a/vendor/psy/psysh/src/Psy/Command/ParseCommand.php
+++ b/vendor/psy/psysh/src/Command/ParseCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,11 +13,12 @@ namespace Psy\Command;
use PhpParser\Node;
use PhpParser\Parser;
+use Psy\Context;
+use Psy\ContextAware;
use Psy\Input\CodeArgument;
use Psy\ParserFactory;
use Psy\VarDumper\Presenter;
use Psy\VarDumper\PresenterAware;
-use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -26,8 +27,15 @@ use Symfony\Component\VarDumper\Caster\Caster;
/**
* Parse PHP code and show the abstract syntax tree.
*/
-class ParseCommand extends Command implements PresenterAware
+class ParseCommand extends Command implements ContextAware, PresenterAware
{
+ /**
+ * Context instance (for ContextAware interface).
+ *
+ * @var Context
+ */
+ protected $context;
+
private $presenter;
private $parserFactory;
private $parsers;
@@ -38,11 +46,21 @@ class ParseCommand extends Command implements PresenterAware
public function __construct($name = null)
{
$this->parserFactory = new ParserFactory();
- $this->parsers = array();
+ $this->parsers = [];
parent::__construct($name);
}
+ /**
+ * ContextAware interface.
+ *
+ * @param Context $context
+ */
+ public function setContext(Context $context)
+ {
+ $this->context = $context;
+ }
+
/**
* PresenterAware interface.
*
@@ -51,12 +69,12 @@ class ParseCommand extends Command implements PresenterAware
public function setPresenter(Presenter $presenter)
{
$this->presenter = clone $presenter;
- $this->presenter->addCasters(array(
+ $this->presenter->addCasters([
'PhpParser\Node' => function (Node $node, array $a) {
- $a = array(
+ $a = [
Caster::PREFIX_VIRTUAL . 'type' => $node->getType(),
Caster::PREFIX_VIRTUAL . 'attributes' => $node->getAttributes(),
- );
+ ];
foreach ($node->getSubNodeNames() as $name) {
$a[Caster::PREFIX_VIRTUAL . $name] = $node->$name;
@@ -64,7 +82,7 @@ class ParseCommand extends Command implements PresenterAware
return $a;
},
- ));
+ ]);
}
/**
@@ -72,15 +90,15 @@ class ParseCommand extends Command implements PresenterAware
*/
protected function configure()
{
- $definition = array(
- new CodeArgument('code', InputArgument::REQUIRED, 'PHP code to parse.'),
- new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse', 10),
- );
+ $definition = [
+ new CodeArgument('code', CodeArgument::REQUIRED, 'PHP code to parse.'),
+ new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse.', 10),
+ ];
if ($this->parserFactory->hasKindsSupport()) {
$msg = 'One of PhpParser\\ParserFactory constants: '
. implode(', ', ParserFactory::getPossibleKinds())
- . " (default is based on current interpreter's version)";
+ . " (default is based on current interpreter's version).";
$defaultKind = $this->parserFactory->getDefaultKind();
$definition[] = new InputOption('kind', '', InputOption::VALUE_REQUIRED, $msg, $defaultKind);
@@ -118,6 +136,8 @@ HELP
$depth = $input->getOption('depth');
$nodes = $this->parse($this->getParser($parserKind), $code);
$output->page($this->presenter->present($nodes, $depth));
+
+ $this->context->setReturnValue($nodes);
}
/**
diff --git a/vendor/psy/psysh/src/Psy/Command/PsyVersionCommand.php b/vendor/psy/psysh/src/Command/PsyVersionCommand.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Command/PsyVersionCommand.php
rename to vendor/psy/psysh/src/Command/PsyVersionCommand.php
index c245e0c5..7d0846c1 100644
--- a/vendor/psy/psysh/src/Psy/Command/PsyVersionCommand.php
+++ b/vendor/psy/psysh/src/Command/PsyVersionCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,7 +26,7 @@ class PsyVersionCommand extends Command
{
$this
->setName('version')
- ->setDefinition(array())
+ ->setDefinition([])
->setDescription('Show Psy Shell version.')
->setHelp('Show Psy Shell version.');
}
diff --git a/vendor/psy/psysh/src/Psy/Command/ReflectingCommand.php b/vendor/psy/psysh/src/Command/ReflectingCommand.php
similarity index 66%
rename from vendor/psy/psysh/src/Psy/Command/ReflectingCommand.php
rename to vendor/psy/psysh/src/Command/ReflectingCommand.php
index ad142d07..8bc56f6f 100644
--- a/vendor/psy/psysh/src/Psy/Command/ReflectingCommand.php
+++ b/vendor/psy/psysh/src/Command/ReflectingCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,8 +11,10 @@
namespace Psy\Command;
+use Psy\CodeCleaner\NoReturnValue;
use Psy\Context;
use Psy\ContextAware;
+use Psy\Exception\ErrorException;
use Psy\Exception\RuntimeException;
use Psy\Util\Mirror;
@@ -22,12 +24,9 @@ use Psy\Util\Mirror;
abstract class ReflectingCommand extends Command implements ContextAware
{
const CLASS_OR_FUNC = '/^[\\\\\w]+$/';
- const INSTANCE = '/^\$(\w+)$/';
const CLASS_MEMBER = '/^([\\\\\w]+)::(\w+)$/';
const CLASS_STATIC = '/^([\\\\\w]+)::\$(\w+)$/';
- const INSTANCE_MEMBER = '/^\$(\w+)(::|->)(\w+)$/';
- const INSTANCE_STATIC = '/^\$(\w+)::\$(\w+)$/';
- const SUPERGLOBAL = '/^\$(GLOBALS|_(?:SERVER|ENV|FILES|COOKIE|POST|GET|SESSION))$/';
+ const INSTANCE_MEMBER = '/^(\$\w+)(::|->)(\w+)$/';
/**
* Context instance (for ContextAware interface).
@@ -52,54 +51,42 @@ abstract class ReflectingCommand extends Command implements ContextAware
* @throws \InvalidArgumentException when the value specified can't be resolved
*
* @param string $valueName Function, class, variable, constant, method or property name
- * @param bool $classOnly True if the name should only refer to a class, function or instance
*
* @return array (class or instance name, member name, kind)
*/
- protected function getTarget($valueName, $classOnly = false)
+ protected function getTarget($valueName)
{
$valueName = trim($valueName);
- $matches = array();
+ $matches = [];
switch (true) {
- case preg_match(self::SUPERGLOBAL, $valueName, $matches):
- // @todo maybe do something interesting with these at some point?
- if (array_key_exists($matches[1], $GLOBALS)) {
- throw new RuntimeException('Unable to inspect a non-object');
- }
-
- throw new RuntimeException('Unknown target: ' . $valueName);
case preg_match(self::CLASS_OR_FUNC, $valueName, $matches):
- return array($this->resolveName($matches[0], true), null, 0);
+ return [$this->resolveName($matches[0], true), null, 0];
- case preg_match(self::INSTANCE, $valueName, $matches):
- return array($this->resolveInstance($matches[1]), null, 0);
+ case preg_match(self::CLASS_MEMBER, $valueName, $matches):
+ return [$this->resolveName($matches[1]), $matches[2], Mirror::CONSTANT | Mirror::METHOD];
- case !$classOnly && preg_match(self::CLASS_MEMBER, $valueName, $matches):
- return array($this->resolveName($matches[1]), $matches[2], Mirror::CONSTANT | Mirror::METHOD);
+ case preg_match(self::CLASS_STATIC, $valueName, $matches):
+ return [$this->resolveName($matches[1]), $matches[2], Mirror::STATIC_PROPERTY | Mirror::PROPERTY];
- case !$classOnly && preg_match(self::CLASS_STATIC, $valueName, $matches):
- return array($this->resolveName($matches[1]), $matches[2], Mirror::STATIC_PROPERTY | Mirror::PROPERTY);
-
- case !$classOnly && preg_match(self::INSTANCE_MEMBER, $valueName, $matches):
+ case preg_match(self::INSTANCE_MEMBER, $valueName, $matches):
if ($matches[2] === '->') {
$kind = Mirror::METHOD | Mirror::PROPERTY;
} else {
$kind = Mirror::CONSTANT | Mirror::METHOD;
}
- return array($this->resolveInstance($matches[1]), $matches[3], $kind);
-
- case !$classOnly && preg_match(self::INSTANCE_STATIC, $valueName, $matches):
- return array($this->resolveInstance($matches[1]), $matches[2], Mirror::STATIC_PROPERTY);
+ return [$this->resolveObject($matches[1]), $matches[3], $kind];
default:
- throw new RuntimeException('Unknown target: ' . $valueName);
+ return [$this->resolveObject($valueName), null, 0];
}
}
/**
* Resolve a class or function name (with the current shell namespace).
*
+ * @throws ErrorException when `self` or `static` is used in a non-class scope
+ *
* @param string $name
* @param bool $includeFunctions (default: false)
*
@@ -107,11 +94,27 @@ abstract class ReflectingCommand extends Command implements ContextAware
*/
protected function resolveName($name, $includeFunctions = false)
{
+ $shell = $this->getApplication();
+
+ // While not *technically* 100% accurate, let's treat `self` and `static` as equivalent.
+ if (in_array(strtolower($name), ['self', 'static'])) {
+ if ($boundClass = $shell->getBoundClass()) {
+ return $boundClass;
+ }
+
+ if ($boundObject = $shell->getBoundObject()) {
+ return get_class($boundObject);
+ }
+
+ $msg = sprintf('Cannot use "%s" when no class scope is active', strtolower($name));
+ throw new ErrorException($msg, 0, E_USER_ERROR, "eval()'d code", 1);
+ }
+
if (substr($name, 0, 1) === '\\') {
return $name;
}
- if ($namespace = $this->getApplication()->getNamespace()) {
+ if ($namespace = $shell->getNamespace()) {
$fullName = $namespace . '\\' . $name;
if (class_exists($fullName) || interface_exists($fullName) || ($includeFunctions && function_exists($fullName))) {
@@ -126,21 +129,62 @@ abstract class ReflectingCommand extends Command implements ContextAware
* Get a Reflector and documentation for a function, class or instance, constant, method or property.
*
* @param string $valueName Function, class, variable, constant, method or property name
- * @param bool $classOnly True if the name should only refer to a class, function or instance
*
* @return array (value, Reflector)
*/
- protected function getTargetAndReflector($valueName, $classOnly = false)
+ protected function getTargetAndReflector($valueName)
{
- list($value, $member, $kind) = $this->getTarget($valueName, $classOnly);
+ list($value, $member, $kind) = $this->getTarget($valueName);
- return array($value, Mirror::get($value, $member, $kind));
+ return [$value, Mirror::get($value, $member, $kind)];
}
/**
- * Return a variable instance from the current scope.
+ * Resolve code to a value in the current scope.
*
- * @throws \InvalidArgumentException when the requested variable does not exist in the current scope
+ * @throws RuntimeException when the code does not return a value in the current scope
+ *
+ * @param string $code
+ *
+ * @return mixed Variable value
+ */
+ protected function resolveCode($code)
+ {
+ try {
+ $value = $this->getApplication()->execute($code, true);
+ } catch (\Exception $e) {
+ // Swallow all exceptions?
+ }
+
+ if (!isset($value) || $value instanceof NoReturnValue) {
+ throw new RuntimeException('Unknown target: ' . $code);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Resolve code to an object in the current scope.
+ *
+ * @throws RuntimeException when the code resolves to a non-object value
+ *
+ * @param string $code
+ *
+ * @return object Variable instance
+ */
+ private function resolveObject($code)
+ {
+ $value = $this->resolveCode($code);
+
+ if (!is_object($value)) {
+ throw new RuntimeException('Unable to inspect a non-object');
+ }
+
+ return $value;
+ }
+
+ /**
+ * @deprecated Use `resolveCode` instead
*
* @param string $name
*
@@ -148,12 +192,9 @@ abstract class ReflectingCommand extends Command implements ContextAware
*/
protected function resolveInstance($name)
{
- $value = $this->getScopeVariable($name);
- if (!is_object($value)) {
- throw new RuntimeException('Unable to inspect a non-object');
- }
+ @trigger_error('`resolveInstance` is deprecated; use `resolveCode` instead.', E_USER_DEPRECATED);
- return $value;
+ return $this->resolveCode($name);
}
/**
@@ -187,7 +228,7 @@ abstract class ReflectingCommand extends Command implements ContextAware
*/
protected function setCommandScopeVariables(\Reflector $reflector)
{
- $vars = array();
+ $vars = [];
switch (get_class($reflector)) {
case 'ReflectionClass':
@@ -228,7 +269,8 @@ abstract class ReflectingCommand extends Command implements ContextAware
break;
case 'ReflectionProperty':
- case 'Psy\Reflection\ReflectionConstant':
+ case 'ReflectionClassConstant':
+ case 'Psy\Reflection\ReflectionClassConstant':
$classReflector = $reflector->getDeclaringClass();
$vars['__class'] = $classReflector->name;
if ($classReflector->inNamespace()) {
@@ -240,6 +282,12 @@ abstract class ReflectingCommand extends Command implements ContextAware
$vars['__dir'] = dirname($fileName);
}
break;
+
+ case 'Psy\Reflection\ReflectionConstant_':
+ if ($reflector->inNamespace()) {
+ $vars['__namespace'] = $reflector->getNamespaceName();
+ }
+ break;
}
if ($reflector instanceof \ReflectionClass || $reflector instanceof \ReflectionFunctionAbstract) {
diff --git a/vendor/psy/psysh/src/Psy/Command/ShowCommand.php b/vendor/psy/psysh/src/Command/ShowCommand.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/Command/ShowCommand.php
rename to vendor/psy/psysh/src/Command/ShowCommand.php
index c4dab43d..cae86e59 100644
--- a/vendor/psy/psysh/src/Psy/Command/ShowCommand.php
+++ b/vendor/psy/psysh/src/Command/ShowCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -17,9 +17,9 @@ use Psy\ConsoleColorFactory;
use Psy\Exception\RuntimeException;
use Psy\Formatter\CodeFormatter;
use Psy\Formatter\SignatureFormatter;
+use Psy\Input\CodeArgument;
use Psy\Output\ShellOutput;
use Symfony\Component\Console\Formatter\OutputFormatter;
-use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -41,7 +41,7 @@ class ShowCommand extends ReflectingCommand
{
$this->colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO;
- return parent::__construct();
+ parent::__construct();
}
/**
@@ -51,10 +51,10 @@ class ShowCommand extends ReflectingCommand
{
$this
->setName('show')
- ->setDefinition(array(
- new InputArgument('value', InputArgument::OPTIONAL, 'Function, class, instance, constant, method or property to show.'),
+ ->setDefinition([
+ new CodeArgument('target', CodeArgument::OPTIONAL, 'Function, class, instance, constant, method or property to show.'),
new InputOption('ex', null, InputOption::VALUE_OPTIONAL, 'Show last exception context. Optionally specify a stack index.', 1),
- ))
+ ])
->setDescription('Show the code for an object, class, constant, method or property.')
->setHelp(
<<getArgument('value')) {
- throw new \InvalidArgumentException('Too many arguments (supply either "value" or "--ex")');
+ if ($input->getArgument('target')) {
+ throw new \InvalidArgumentException('Too many arguments (supply either "target" or "--ex")');
}
return $this->writeExceptionContext($input, $output);
}
- if ($input->getArgument('value')) {
+ if ($input->getArgument('target')) {
return $this->writeCodeContext($input, $output);
}
- throw new RuntimeException('Not enough arguments (missing: "value").');
+ throw new RuntimeException('Not enough arguments (missing: "target")');
}
private function writeCodeContext(InputInterface $input, OutputInterface $output)
{
- list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value'));
+ list($target, $reflector) = $this->getTargetAndReflector($input->getArgument('target'));
// Set some magic local variables
$this->setCommandScopeVariables($reflector);
@@ -144,10 +144,10 @@ HELP
}
$trace = $exception->getTrace();
- array_unshift($trace, array(
+ array_unshift($trace, [
'file' => $exception->getFile(),
'line' => $exception->getLine(),
- ));
+ ]);
if ($index >= count($trace)) {
$index = 0;
@@ -231,16 +231,33 @@ HELP
private function setCommandScopeVariablesFromContext(array $context)
{
- $vars = array();
+ $vars = [];
- // @todo __namespace?
if (isset($context['class'])) {
$vars['__class'] = $context['class'];
if (isset($context['function'])) {
$vars['__method'] = $context['function'];
}
+
+ try {
+ $refl = new \ReflectionClass($context['class']);
+ if ($namespace = $refl->getNamespaceName()) {
+ $vars['__namespace'] = $namespace;
+ }
+ } catch (\Exception $e) {
+ // oh well
+ }
} elseif (isset($context['function'])) {
$vars['__function'] = $context['function'];
+
+ try {
+ $refl = new \ReflectionFunction($context['function']);
+ if ($namespace = $refl->getNamespaceName()) {
+ $vars['__namespace'] = $namespace;
+ }
+ } catch (\Exception $e) {
+ // oh well
+ }
}
if (isset($context['file'])) {
@@ -266,7 +283,7 @@ HELP
private function extractEvalFileAndLine($file)
{
if (preg_match('/(.*)\\((\\d+)\\) : eval\\(\\)\'d code$/', $file, $matches)) {
- return array($matches[1], $matches[2]);
+ return [$matches[1], $matches[2]];
}
}
}
diff --git a/vendor/psy/psysh/src/Psy/Command/SudoCommand.php b/vendor/psy/psysh/src/Command/SudoCommand.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Command/SudoCommand.php
rename to vendor/psy/psysh/src/Command/SudoCommand.php
index 1a0a6552..44cc2c0e 100644
--- a/vendor/psy/psysh/src/Psy/Command/SudoCommand.php
+++ b/vendor/psy/psysh/src/Command/SudoCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -17,7 +17,6 @@ use Psy\Input\CodeArgument;
use Psy\ParserFactory;
use Psy\Readline\Readline;
use Psy\Sudo\SudoVisitor;
-use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -64,9 +63,9 @@ class SudoCommand extends Command
{
$this
->setName('sudo')
- ->setDefinition(array(
- new CodeArgument('code', InputArgument::REQUIRED, 'Code to execute.'),
- ))
+ ->setDefinition([
+ new CodeArgument('code', CodeArgument::REQUIRED, 'Code to execute.'),
+ ])
->setDescription('Evaluate PHP code, bypassing visibility restrictions.')
->setHelp(
<<<'HELP'
@@ -117,7 +116,8 @@ HELP
$nodes = $this->traverser->traverse($this->parse($code));
$sudoCode = $this->printer->prettyPrint($nodes);
- $this->getApplication()->addInput($sudoCode, true);
+ $shell = $this->getApplication();
+ $shell->addCode($sudoCode, !$shell->hasCode());
}
/**
diff --git a/vendor/psy/psysh/src/Command/ThrowUpCommand.php b/vendor/psy/psysh/src/Command/ThrowUpCommand.php
new file mode 100644
index 00000000..99af9a8a
--- /dev/null
+++ b/vendor/psy/psysh/src/Command/ThrowUpCommand.php
@@ -0,0 +1,172 @@
+parser = $parserFactory->createParser();
+ $this->printer = new Printer();
+
+ parent::__construct($name);
+ }
+
+ /**
+ * ContextAware interface.
+ *
+ * @param Context $context
+ */
+ public function setContext(Context $context)
+ {
+ $this->context = $context;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('throw-up')
+ ->setDefinition([
+ new CodeArgument('exception', CodeArgument::OPTIONAL, 'Exception or Error to throw.'),
+ ])
+ ->setDescription('Throw an exception or error out of the Psy Shell.')
+ ->setHelp(
+ <<<'HELP'
+Throws an exception or error out of the current the Psy Shell instance.
+
+By default it throws the most recent exception.
+
+e.g.
+>>> throw-up
+>>> throw-up $e
+>>> throw-up new Exception('WHEEEEEE!')
+>>> throw-up "bye!"
+HELP
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @throws InvalidArgumentException if there is no exception to throw
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $args = $this->prepareArgs($input->getArgument('exception'));
+ $throwStmt = new Throw_(new StaticCall(new FullyQualifiedName(self::THROW_CLASS), 'fromThrowable', $args));
+ $throwCode = $this->printer->prettyPrint([$throwStmt]);
+
+ $shell = $this->getApplication();
+ $shell->addCode($throwCode, !$shell->hasCode());
+ }
+
+ /**
+ * Parse the supplied command argument.
+ *
+ * If no argument was given, this falls back to `$_e`
+ *
+ * @throws InvalidArgumentException if there is no exception to throw
+ *
+ * @param string $code
+ *
+ * @return Arg[]
+ */
+ private function prepareArgs($code = null)
+ {
+ if (!$code) {
+ // Default to last exception if nothing else was supplied
+ return [new Arg(new Variable('_e'))];
+ }
+
+ if (strpos('', $code) === false) {
+ $code = 'parse($code);
+ if (count($nodes) !== 1) {
+ throw new \InvalidArgumentException('No idea how to throw this');
+ }
+
+ $node = $nodes[0];
+
+ // Make this work for PHP Parser v3.x
+ $expr = isset($node->expr) ? $node->expr : $node;
+
+ $args = [new Arg($expr, false, false, $node->getAttributes())];
+
+ // Allow throwing via a string, e.g. `throw-up "SUP"`
+ if ($expr instanceof String_) {
+ return [new New_(new FullyQualifiedName('Exception'), $args)];
+ }
+
+ return $args;
+ }
+
+ /**
+ * Lex and parse a string of code into statements.
+ *
+ * @param string $code
+ *
+ * @return array Statements
+ */
+ private function parse($code)
+ {
+ try {
+ return $this->parser->parse($code);
+ } catch (\PhpParser\Error $e) {
+ if (strpos($e->getMessage(), 'unexpected EOF') === false) {
+ throw $e;
+ }
+
+ // If we got an unexpected EOF, let's try it again with a semicolon.
+ return $this->parser->parse($code . ';');
+ }
+ }
+}
diff --git a/vendor/psy/psysh/src/Command/TimeitCommand.php b/vendor/psy/psysh/src/Command/TimeitCommand.php
new file mode 100644
index 00000000..70d70c0e
--- /dev/null
+++ b/vendor/psy/psysh/src/Command/TimeitCommand.php
@@ -0,0 +1,196 @@
+Command took %.6f seconds to complete. ';
+ const AVG_RESULT_MSG = 'Command took %.6f seconds on average (%.6f median; %.6f total) to complete. ';
+
+ private static $start = null;
+ private static $times = [];
+
+ private $parser;
+ private $traverser;
+ private $printer;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function __construct($name = null)
+ {
+ $parserFactory = new ParserFactory();
+ $this->parser = $parserFactory->createParser();
+
+ $this->traverser = new NodeTraverser();
+ $this->traverser->addVisitor(new TimeitVisitor());
+
+ $this->printer = new Printer();
+
+ parent::__construct($name);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function configure()
+ {
+ $this
+ ->setName('timeit')
+ ->setDefinition([
+ new InputOption('num', 'n', InputOption::VALUE_REQUIRED, 'Number of iterations.'),
+ new CodeArgument('code', CodeArgument::REQUIRED, 'Code to execute.'),
+ ])
+ ->setDescription('Profiles with a timer.')
+ ->setHelp(
+ <<<'HELP'
+Time profiling for functions and commands.
+
+e.g.
+>>> timeit sleep(1)
+>>> timeit -n1000 $closure()
+HELP
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $code = $input->getArgument('code');
+ $num = $input->getOption('num') ?: 1;
+ $shell = $this->getApplication();
+
+ $instrumentedCode = $this->instrumentCode($code);
+
+ self::$times = [];
+
+ for ($i = 0; $i < $num; $i++) {
+ $_ = $shell->execute($instrumentedCode);
+ $this->ensureEndMarked();
+ }
+
+ $shell->writeReturnValue($_);
+
+ $times = self::$times;
+ self::$times = [];
+
+ if ($num === 1) {
+ $output->writeln(sprintf(self::RESULT_MSG, $times[0]));
+ } else {
+ $total = array_sum($times);
+ rsort($times);
+ $median = $times[round($num / 2)];
+
+ $output->writeln(sprintf(self::AVG_RESULT_MSG, $total / $num, $median, $total));
+ }
+ }
+
+ /**
+ * Internal method for marking the start of timeit execution.
+ *
+ * A static call to this method will be injected at the start of the timeit
+ * input code to instrument the call. We will use the saved start time to
+ * more accurately calculate time elapsed during execution.
+ */
+ public static function markStart()
+ {
+ self::$start = microtime(true);
+ }
+
+ /**
+ * Internal method for marking the end of timeit execution.
+ *
+ * A static call to this method is injected by TimeitVisitor at the end
+ * of the timeit input code to instrument the call.
+ *
+ * Note that this accepts an optional $ret parameter, which is used to pass
+ * the return value of the last statement back out of timeit. This saves us
+ * a bunch of code rewriting shenanigans.
+ *
+ * @param mixed $ret
+ *
+ * @return mixed it just passes $ret right back
+ */
+ public static function markEnd($ret = null)
+ {
+ self::$times[] = microtime(true) - self::$start;
+ self::$start = null;
+
+ return $ret;
+ }
+
+ /**
+ * Ensure that the end of code execution was marked.
+ *
+ * The end *should* be marked in the instrumented code, but just in case
+ * we'll add a fallback here.
+ */
+ private function ensureEndMarked()
+ {
+ if (self::$start !== null) {
+ self::markEnd();
+ }
+ }
+
+ /**
+ * Instrument code for timeit execution.
+ *
+ * This inserts `markStart` and `markEnd` calls to ensure that (reasonably)
+ * accurate times are recorded for just the code being executed.
+ *
+ * @param string $code
+ *
+ * @return string
+ */
+ private function instrumentCode($code)
+ {
+ return $this->printer->prettyPrint($this->traverser->traverse($this->parse($code)));
+ }
+
+ /**
+ * Lex and parse a string of code into statements.
+ *
+ * @param string $code
+ *
+ * @return array Statements
+ */
+ private function parse($code)
+ {
+ $code = 'parser->parse($code);
+ } catch (\PhpParser\Error $e) {
+ if (strpos($e->getMessage(), 'unexpected EOF') === false) {
+ throw $e;
+ }
+
+ // If we got an unexpected EOF, let's try it again with a semicolon.
+ return $this->parser->parse($code . ';');
+ }
+ }
+}
diff --git a/vendor/psy/psysh/src/Command/TimeitCommand/TimeitVisitor.php b/vendor/psy/psysh/src/Command/TimeitCommand/TimeitVisitor.php
new file mode 100644
index 00000000..6ee66994
--- /dev/null
+++ b/vendor/psy/psysh/src/Command/TimeitCommand/TimeitVisitor.php
@@ -0,0 +1,139 @@
+functionDepth = 0;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function enterNode(Node $node)
+ {
+ // keep track of nested function-like nodes, because they can have
+ // returns statements... and we don't want to call markEnd for those.
+ if ($node instanceof FunctionLike) {
+ $this->functionDepth++;
+
+ return;
+ }
+
+ // replace any top-level `return` statements with a `markEnd` call
+ if ($this->functionDepth === 0 && $node instanceof Return_) {
+ return new Return_($this->getEndCall($node->expr), $node->getAttributes());
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function leaveNode(Node $node)
+ {
+ if ($node instanceof FunctionLike) {
+ $this->functionDepth--;
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function afterTraverse(array $nodes)
+ {
+ // prepend a `markStart` call
+ array_unshift($nodes, $this->maybeExpression($this->getStartCall()));
+
+ // append a `markEnd` call (wrapping the final node, if it's an expression)
+ $last = $nodes[count($nodes) - 1];
+ if ($last instanceof Expr) {
+ array_pop($nodes);
+ $nodes[] = $this->getEndCall($last);
+ } elseif ($last instanceof Expression) {
+ array_pop($nodes);
+ $nodes[] = new Expression($this->getEndCall($last->expr), $last->getAttributes());
+ } elseif ($last instanceof Return_) {
+ // nothing to do here, we're already ending with a return call
+ } else {
+ $nodes[] = $this->maybeExpression($this->getEndCall());
+ }
+
+ return $nodes;
+ }
+
+ /**
+ * Get PhpParser AST nodes for a `markStart` call.
+ *
+ * @return PhpParser\Node\Expr\StaticCall
+ */
+ private function getStartCall()
+ {
+ return new StaticCall(new FullyQualifiedName('Psy\Command\TimeitCommand'), 'markStart');
+ }
+
+ /**
+ * Get PhpParser AST nodes for a `markEnd` call.
+ *
+ * Optionally pass in a return value.
+ *
+ * @param Expr|null $arg
+ *
+ * @return PhpParser\Node\Expr\StaticCall
+ */
+ private function getEndCall(Expr $arg = null)
+ {
+ if ($arg === null) {
+ $arg = NoReturnValue::create();
+ }
+
+ return new StaticCall(new FullyQualifiedName('Psy\Command\TimeitCommand'), 'markEnd', [new Arg($arg)]);
+ }
+
+ /**
+ * Compatibility shim for PHP Parser 3.x.
+ *
+ * Wrap $expr in a PhpParser\Node\Stmt\Expression if the class exists.
+ *
+ * @param PhpParser\Node $expr
+ * @param array $attrs
+ *
+ * @return PhpParser\Node\Expr|PhpParser\Node\Stmt\Expression
+ */
+ private function maybeExpression($expr, $attrs = [])
+ {
+ return class_exists('PhpParser\Node\Stmt\Expression') ? new Expression($expr, $attrs) : $expr;
+ }
+}
diff --git a/vendor/psy/psysh/src/Psy/Command/TraceCommand.php b/vendor/psy/psysh/src/Command/TraceCommand.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/Command/TraceCommand.php
rename to vendor/psy/psysh/src/Command/TraceCommand.php
index 00e5903f..becc5831 100644
--- a/vendor/psy/psysh/src/Psy/Command/TraceCommand.php
+++ b/vendor/psy/psysh/src/Command/TraceCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -44,14 +44,14 @@ class TraceCommand extends Command
$this
->setName('trace')
- ->setDefinition(array(
+ ->setDefinition([
new InputOption('include-psy', 'p', InputOption::VALUE_NONE, 'Include Psy in the call stack.'),
new InputOption('num', 'n', InputOption::VALUE_REQUIRED, 'Only include NUM lines.'),
$grep,
$insensitive,
$invert,
- ))
+ ])
->setDescription('Show the current call stack.')
->setHelp(
<<<'HELP'
@@ -98,15 +98,15 @@ HELP
$count = PHP_INT_MAX;
}
- $lines = array();
+ $lines = [];
$trace = $e->getTrace();
- array_unshift($trace, array(
+ array_unshift($trace, [
'function' => '',
'file' => $e->getFile() !== null ? $e->getFile() : 'n/a',
'line' => $e->getLine() !== null ? $e->getLine() : 'n/a',
- 'args' => array(),
- ));
+ 'args' => [],
+ ]);
if (!$includePsy) {
for ($i = count($trace) - 1; $i >= 0; $i--) {
@@ -126,7 +126,7 @@ HELP
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
// Leave execution loop out of the `eval()'d code` lines
- if (preg_match("#/Psy/ExecutionLoop/Loop.php\(\d+\) : eval\(\)'d code$#", $file)) {
+ if (preg_match("#/src/Execution(?:Loop)?Closure.php\(\d+\) : eval\(\)'d code$#", str_replace('\\', '/', $file))) {
$file = "eval()'d code";
}
diff --git a/vendor/psy/psysh/src/Psy/Command/WhereamiCommand.php b/vendor/psy/psysh/src/Command/WhereamiCommand.php
similarity index 90%
rename from vendor/psy/psysh/src/Psy/Command/WhereamiCommand.php
rename to vendor/psy/psysh/src/Command/WhereamiCommand.php
index 065399bb..c2b27843 100644
--- a/vendor/psy/psysh/src/Psy/Command/WhereamiCommand.php
+++ b/vendor/psy/psysh/src/Command/WhereamiCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -25,6 +25,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class WhereamiCommand extends Command
{
private $colorMode;
+ private $backtrace;
/**
* @param null|string $colorMode (default: null)
@@ -32,14 +33,9 @@ class WhereamiCommand extends Command
public function __construct($colorMode = null)
{
$this->colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO;
+ $this->backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- if (version_compare(PHP_VERSION, '5.3.6', '>=')) {
- $this->backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- } else {
- $this->backtrace = debug_backtrace();
- }
-
- return parent::__construct();
+ parent::__construct();
}
/**
@@ -49,9 +45,9 @@ class WhereamiCommand extends Command
{
$this
->setName('whereami')
- ->setDefinition(array(
+ ->setDefinition([
new InputOption('num', 'n', InputOption::VALUE_OPTIONAL, 'Number of lines before and after.', '5'),
- ))
+ ])
->setDescription('Show where you are in the code.')
->setHelp(
<<<'HELP'
@@ -88,7 +84,7 @@ HELP
$function = isset($stackFrame['function']) ? $stackFrame['function'] : null;
return ($class === null && $function === 'Psy\debug') ||
- ($class === 'Psy\Shell' && in_array($function, array('__construct', 'debug')));
+ ($class === 'Psy\Shell' && in_array($function, ['__construct', 'debug']));
}
/**
diff --git a/vendor/psy/psysh/src/Psy/Command/WtfCommand.php b/vendor/psy/psysh/src/Command/WtfCommand.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Command/WtfCommand.php
rename to vendor/psy/psysh/src/Command/WtfCommand.php
index af3bcd14..68ba0f3f 100644
--- a/vendor/psy/psysh/src/Psy/Command/WtfCommand.php
+++ b/vendor/psy/psysh/src/Command/WtfCommand.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -51,15 +51,15 @@ class WtfCommand extends TraceCommand implements ContextAware
$this
->setName('wtf')
- ->setAliases(array('last-exception', 'wtf?'))
- ->setDefinition(array(
- new InputArgument('incredulity', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Number of lines to show'),
+ ->setAliases(['last-exception', 'wtf?'])
+ ->setDefinition([
+ new InputArgument('incredulity', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Number of lines to show.'),
new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show entire backtrace.'),
$grep,
$insensitive,
$invert,
- ))
+ ])
->setDescription('Show the backtrace of the most recent exception.')
->setHelp(
<<<'HELP'
@@ -74,7 +74,7 @@ e.g.
To see the entire backtrace, pass the -a/--all flag:
e.g.
->>> wtf -v
+>>> wtf -a
HELP
);
}
@@ -88,7 +88,7 @@ HELP
$incredulity = implode('', $input->getArgument('incredulity'));
if (strlen(preg_replace('/[\\?!]/', '', $incredulity))) {
- throw new \InvalidArgumentException('Incredulity must include only "?" and "!".');
+ throw new \InvalidArgumentException('Incredulity must include only "?" and "!"');
}
$exception = $this->context->getLastException();
diff --git a/vendor/psy/psysh/src/Psy/ConfigPaths.php b/vendor/psy/psysh/src/ConfigPaths.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/ConfigPaths.php
rename to vendor/psy/psysh/src/ConfigPaths.php
index 66724919..0c9c78a4 100644
--- a/vendor/psy/psysh/src/Psy/ConfigPaths.php
+++ b/vendor/psy/psysh/src/ConfigPaths.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -49,7 +49,7 @@ class ConfigPaths
{
$xdg = new Xdg();
- return self::getDirNames(array($xdg->getHomeConfigDir()));
+ return self::getDirNames([$xdg->getHomeConfigDir()]);
}
/**
@@ -86,7 +86,7 @@ class ConfigPaths
*/
public static function getConfigFiles(array $names, $configDir = null)
{
- $dirs = ($configDir === null) ? self::getConfigDirs() : array($configDir);
+ $dirs = ($configDir === null) ? self::getConfigDirs() : [$configDir];
return self::getRealFiles($dirs, $names);
}
@@ -120,7 +120,7 @@ class ConfigPaths
*/
public static function getDataFiles(array $names, $dataDir = null)
{
- $dirs = ($dataDir === null) ? self::getDataDirs() : array($dataDir);
+ $dirs = ($dataDir === null) ? self::getDataDirs() : [$dataDir];
return self::getRealFiles($dirs, $names);
}
@@ -136,7 +136,7 @@ class ConfigPaths
{
$xdg = new Xdg();
- set_error_handler(array('Psy\Exception\ErrorException', 'throwException'));
+ set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
try {
// XDG doesn't really work on Windows, sometimes complains about
@@ -183,7 +183,7 @@ class ConfigPaths
private static function getRealFiles(array $dirNames, array $fileNames)
{
- $files = array();
+ $files = [];
foreach ($dirNames as $dir) {
foreach ($fileNames as $name) {
$file = $dir . '/' . $name;
diff --git a/vendor/psy/psysh/src/Psy/Configuration.php b/vendor/psy/psysh/src/Configuration.php
similarity index 89%
rename from vendor/psy/psysh/src/Psy/Configuration.php
rename to vendor/psy/psysh/src/Configuration.php
index b0953fab..b37f2e57 100644
--- a/vendor/psy/psysh/src/Psy/Configuration.php
+++ b/vendor/psy/psysh/src/Configuration.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,8 +13,6 @@ namespace Psy;
use Psy\Exception\DeprecatedException;
use Psy\Exception\RuntimeException;
-use Psy\ExecutionLoop\ForkingLoop;
-use Psy\ExecutionLoop\Loop;
use Psy\Output\OutputPager;
use Psy\Output\ShellOutput;
use Psy\Readline\GNUReadline;
@@ -28,7 +26,6 @@ use Psy\VersionUpdater\Checker;
use Psy\VersionUpdater\GitHubChecker;
use Psy\VersionUpdater\IntervalChecker;
use Psy\VersionUpdater\NoopChecker;
-use XdgBaseDir\Xdg;
/**
* The Psy Shell configuration.
@@ -39,7 +36,7 @@ class Configuration
const COLOR_MODE_FORCED = 'forced';
const COLOR_MODE_DISABLED = 'disabled';
- private static $AVAILABLE_OPTIONS = array(
+ private static $AVAILABLE_OPTIONS = [
'codeCleaner',
'colorMode',
'configDir',
@@ -49,21 +46,20 @@ class Configuration
'errorLoggingLevel',
'forceArrayIndexes',
'historySize',
- 'loop',
'manualDbFile',
'pager',
'prompt',
'requireSemicolons',
'runtimeDir',
'startupMessage',
- 'tabCompletion',
'updateCheck',
'useBracketedPaste',
'usePcntl',
'useReadline',
+ 'useTabCompletion',
'useUnicode',
'warnOnMultipleConfigs',
- );
+ ];
private $defaultIncludes;
private $configDir;
@@ -80,12 +76,12 @@ class Configuration
private $useBracketedPaste;
private $hasPcntl;
private $usePcntl;
- private $newCommands = array();
+ private $newCommands = [];
private $requireSemicolons = false;
private $useUnicode;
- private $tabCompletion;
- private $tabCompletionMatchers = array();
- private $errorLoggingLevel = E_ALL;
+ private $useTabCompletion;
+ private $newMatchers = [];
+ private $errorLoggingLevel = E_ALL;
private $warnOnMultipleConfigs = false;
private $colorMode;
private $updateCheck;
@@ -98,10 +94,9 @@ class Configuration
private $shell;
private $cleaner;
private $pager;
- private $loop;
private $manualDb;
private $presenter;
- private $completer;
+ private $autoCompleter;
private $checker;
private $prompt;
@@ -112,7 +107,7 @@ class Configuration
*
* @param array $config Optional array of configuration values
*/
- public function __construct(array $config = array())
+ public function __construct(array $config = [])
{
$this->setColorMode(self::COLOR_MODE_AUTO);
@@ -125,8 +120,8 @@ class Configuration
// legacy baseDir option
if (isset($config['baseDir'])) {
- $msg = "The 'baseDir' configuration option is deprecated. " .
- "Please specify 'configDir' and 'dataDir' options instead.";
+ $msg = "The 'baseDir' configuration option is deprecated; " .
+ "please specify 'configDir' and 'dataDir' options instead";
throw new DeprecatedException($msg);
}
@@ -182,7 +177,7 @@ class Configuration
return $this->configFile;
}
- $files = ConfigPaths::getConfigFiles(array('config.php', 'rc.php'), $this->configDir);
+ $files = ConfigPaths::getConfigFiles(['config.php', 'rc.php'], $this->configDir);
if (!empty($files)) {
if ($this->warnOnMultipleConfigs && count($files) > 1) {
@@ -225,12 +220,28 @@ class Configuration
}
}
- foreach (array('commands', 'tabCompletionMatchers', 'casters') as $option) {
+ // legacy `tabCompletion` option
+ if (isset($options['tabCompletion'])) {
+ $msg = '`tabCompletion` is deprecated; use `useTabCompletion` instead.';
+ @trigger_error($msg, E_USER_DEPRECATED);
+
+ $this->setUseTabCompletion($options['tabCompletion']);
+ }
+
+ foreach (['commands', 'matchers', 'casters'] as $option) {
if (isset($options[$option])) {
$method = 'add' . ucfirst($option);
$this->$method($options[$option]);
}
}
+
+ // legacy `tabCompletionMatchers` option
+ if (isset($options['tabCompletionMatchers'])) {
+ $msg = '`tabCompletionMatchers` is deprecated; use `matchers` instead.';
+ @trigger_error($msg, E_USER_DEPRECATED);
+
+ $this->addMatchers($options['tabCompletionMatchers']);
+ }
}
/**
@@ -269,7 +280,7 @@ class Configuration
*
* @param array $includes
*/
- public function setDefaultIncludes(array $includes = array())
+ public function setDefaultIncludes(array $includes = [])
{
$this->defaultIncludes = $includes;
}
@@ -281,7 +292,7 @@ class Configuration
*/
public function getDefaultIncludes()
{
- return $this->defaultIncludes ?: array();
+ return $this->defaultIncludes ?: [];
}
/**
@@ -379,26 +390,7 @@ class Configuration
return $this->historyFile;
}
- // Deprecation warning for incorrect psysh_history path.
- // @todo remove this before v0.9.0
- $xdg = new Xdg();
- $oldHistory = $xdg->getHomeConfigDir() . '/psysh_history';
- if (@is_file($oldHistory)) {
- $dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir();
- $newHistory = $dir . '/psysh_history';
-
- $msg = sprintf(
- "PsySH history file found at '%s'. Please delete it or move it to '%s'.",
- strtr($oldHistory, '\\', '/'),
- $newHistory
- );
- @trigger_error($msg, E_USER_DEPRECATED);
- $this->setHistoryFile($oldHistory);
-
- return $this->historyFile;
- }
-
- $files = ConfigPaths::getConfigFiles(array('psysh_history', 'history'), $this->configDir);
+ $files = ConfigPaths::getConfigFiles(['psysh_history', 'history'], $this->configDir);
if (!empty($files)) {
if ($this->warnOnMultipleConfigs && count($files) > 1) {
@@ -767,24 +759,44 @@ class Configuration
/**
* Enable or disable tab completion.
*
- * @param bool $tabCompletion
+ * @param bool $useTabCompletion
*/
- public function setTabCompletion($tabCompletion)
+ public function setUseTabCompletion($useTabCompletion)
{
- $this->tabCompletion = (bool) $tabCompletion;
+ $this->useTabCompletion = (bool) $useTabCompletion;
+ }
+
+ /**
+ * @deprecated Call `setUseTabCompletion` instead
+ *
+ * @param bool $useTabCompletion
+ */
+ public function setTabCompletion($useTabCompletion)
+ {
+ $this->setUseTabCompletion($useTabCompletion);
}
/**
* Check whether to use tab completion.
*
- * If `setTabCompletion` has been set to true, but readline is not actually
- * available, this will return false.
+ * If `setUseTabCompletion` has been set to true, but readline is not
+ * actually available, this will return false.
*
* @return bool True if the current Shell should use tab completion
*/
+ public function useTabCompletion()
+ {
+ return isset($this->useTabCompletion) ? ($this->hasReadline && $this->useTabCompletion) : $this->hasReadline;
+ }
+
+ /**
+ * @deprecated Call `useTabCompletion` instead
+ *
+ * @return bool
+ */
public function getTabCompletion()
{
- return isset($this->tabCompletion) ? ($this->hasReadline && $this->tabCompletion) : $this->hasReadline;
+ return $this->useTabCompletion();
}
/**
@@ -850,7 +862,7 @@ class Configuration
public function setPager($pager)
{
if ($pager && !is_string($pager) && !$pager instanceof OutputPager) {
- throw new \InvalidArgumentException('Unexpected pager instance.');
+ throw new \InvalidArgumentException('Unexpected pager instance');
}
$this->pager = $pager;
@@ -868,7 +880,7 @@ class Configuration
{
if (!isset($this->pager) && $this->usePcntl()) {
if ($pager = ini_get('cli.pager')) {
- // use the default pager (5.4+)
+ // use the default pager
$this->pager = $pager;
} elseif ($less = exec('which less 2>/dev/null')) {
// check for the presence of less...
@@ -880,44 +892,13 @@ class Configuration
}
/**
- * Set the Shell evaluation Loop service.
+ * Set the Shell AutoCompleter service.
*
- * @param Loop $loop
+ * @param AutoCompleter $autoCompleter
*/
- public function setLoop(Loop $loop)
+ public function setAutoCompleter(AutoCompleter $autoCompleter)
{
- $this->loop = $loop;
- }
-
- /**
- * Get a Shell evaluation Loop service instance.
- *
- * If none has been explicitly defined, this will create a new instance.
- * If Pcntl is available and enabled, the new instance will be a ForkingLoop.
- *
- * @return Loop
- */
- public function getLoop()
- {
- if (!isset($this->loop)) {
- if ($this->usePcntl()) {
- $this->loop = new ForkingLoop($this);
- } else {
- $this->loop = new Loop($this);
- }
- }
-
- return $this->loop;
- }
-
- /**
- * Set the Shell autocompleter service.
- *
- * @param AutoCompleter $completer
- */
- public function setAutoCompleter(AutoCompleter $completer)
- {
- $this->completer = $completer;
+ $this->autoCompleter = $autoCompleter;
}
/**
@@ -927,34 +908,61 @@ class Configuration
*/
public function getAutoCompleter()
{
- if (!isset($this->completer)) {
- $this->completer = new AutoCompleter();
+ if (!isset($this->autoCompleter)) {
+ $this->autoCompleter = new AutoCompleter();
}
- return $this->completer;
+ return $this->autoCompleter;
}
/**
- * Get user specified tab completion matchers for the AutoCompleter.
+ * @deprecated Nothing should be using this anymore
*
* @return array
*/
public function getTabCompletionMatchers()
{
- return $this->tabCompletionMatchers;
+ return [];
}
/**
- * Add additional tab completion matchers to the AutoCompleter.
+ * Add tab completion matchers to the AutoCompleter.
+ *
+ * This will buffer new matchers in the event that the Shell has not yet
+ * been instantiated. This allows the user to specify matchers in their
+ * config rc file, despite the fact that their file is needed in the Shell
+ * constructor.
+ *
+ * @param array $matchers
+ */
+ public function addMatchers(array $matchers)
+ {
+ $this->newMatchers = array_merge($this->newMatchers, $matchers);
+ if (isset($this->shell)) {
+ $this->doAddMatchers();
+ }
+ }
+
+ /**
+ * Internal method for adding tab completion matchers. This will set any new
+ * matchers once a Shell is available.
+ */
+ private function doAddMatchers()
+ {
+ if (!empty($this->newMatchers)) {
+ $this->shell->addMatchers($this->newMatchers);
+ $this->newMatchers = [];
+ }
+ }
+
+ /**
+ * @deprecated Use `addMatchers` instead
*
* @param array $matchers
*/
public function addTabCompletionMatchers(array $matchers)
{
- $this->tabCompletionMatchers = array_merge($this->tabCompletionMatchers, $matchers);
- if (isset($this->shell)) {
- $this->shell->addTabCompletionMatchers($this->tabCompletionMatchers);
- }
+ $this->addMatchers($matchers);
}
/**
@@ -983,7 +991,7 @@ class Configuration
{
if (!empty($this->newCommands)) {
$this->shell->addCommands($this->newCommands);
- $this->newCommands = array();
+ $this->newCommands = [];
}
}
@@ -996,6 +1004,7 @@ class Configuration
{
$this->shell = $shell;
$this->doAddCommands();
+ $this->doAddMatchers();
}
/**
@@ -1022,7 +1031,7 @@ class Configuration
return $this->manualDbFile;
}
- $files = ConfigPaths::getDataFiles(array('php_manual.sqlite'), $this->dataDir);
+ $files = ConfigPaths::getDataFiles(['php_manual.sqlite'], $this->dataDir);
if (!empty($files)) {
if ($this->warnOnMultipleConfigs && count($files) > 1) {
$msg = sprintf('Multiple manual database files found: %s. Using %s', implode($files, ', '), $files[0]);
@@ -1118,11 +1127,11 @@ class Configuration
*/
public function setColorMode($colorMode)
{
- $validColorModes = array(
+ $validColorModes = [
self::COLOR_MODE_AUTO,
self::COLOR_MODE_FORCED,
self::COLOR_MODE_DISABLED,
- );
+ ];
if (in_array($colorMode, $validColorModes)) {
$this->colorMode = $colorMode;
@@ -1209,13 +1218,13 @@ class Configuration
*/
public function setUpdateCheck($interval)
{
- $validIntervals = array(
+ $validIntervals = [
Checker::ALWAYS,
Checker::DAILY,
Checker::WEEKLY,
Checker::MONTHLY,
Checker::NEVER,
- );
+ ];
if (!in_array($interval, $validIntervals)) {
throw new \InvalidArgumentException('invalid update check interval: ' . $interval);
diff --git a/vendor/psy/psysh/src/Psy/ConsoleColorFactory.php b/vendor/psy/psysh/src/ConsoleColorFactory.php
similarity index 66%
rename from vendor/psy/psysh/src/Psy/ConsoleColorFactory.php
rename to vendor/psy/psysh/src/ConsoleColorFactory.php
index b3bcb53d..76ad3b51 100644
--- a/vendor/psy/psysh/src/Psy/ConsoleColorFactory.php
+++ b/vendor/psy/psysh/src/ConsoleColorFactory.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -49,10 +49,10 @@ class ConsoleColorFactory
private function getDefaultConsoleColor()
{
$color = new ConsoleColor();
- $color->addTheme(Highlighter::LINE_NUMBER, array('blue'));
- $color->addTheme(Highlighter::TOKEN_KEYWORD, array('yellow'));
- $color->addTheme(Highlighter::TOKEN_STRING, array('green'));
- $color->addTheme(Highlighter::TOKEN_COMMENT, array('dark_gray'));
+ $color->addTheme(Highlighter::LINE_NUMBER, ['blue']);
+ $color->addTheme(Highlighter::TOKEN_KEYWORD, ['yellow']);
+ $color->addTheme(Highlighter::TOKEN_STRING, ['green']);
+ $color->addTheme(Highlighter::TOKEN_COMMENT, ['dark_gray']);
return $color;
}
@@ -69,13 +69,13 @@ class ConsoleColorFactory
{
$color = new ConsoleColor();
- $color->addTheme(Highlighter::TOKEN_STRING, array('none'));
- $color->addTheme(Highlighter::TOKEN_COMMENT, array('none'));
- $color->addTheme(Highlighter::TOKEN_KEYWORD, array('none'));
- $color->addTheme(Highlighter::TOKEN_DEFAULT, array('none'));
- $color->addTheme(Highlighter::TOKEN_HTML, array('none'));
- $color->addTheme(Highlighter::ACTUAL_LINE_MARK, array('none'));
- $color->addTheme(Highlighter::LINE_NUMBER, array('none'));
+ $color->addTheme(Highlighter::TOKEN_STRING, ['none']);
+ $color->addTheme(Highlighter::TOKEN_COMMENT, ['none']);
+ $color->addTheme(Highlighter::TOKEN_KEYWORD, ['none']);
+ $color->addTheme(Highlighter::TOKEN_DEFAULT, ['none']);
+ $color->addTheme(Highlighter::TOKEN_HTML, ['none']);
+ $color->addTheme(Highlighter::ACTUAL_LINE_MARK, ['none']);
+ $color->addTheme(Highlighter::LINE_NUMBER, ['none']);
return $color;
}
diff --git a/vendor/psy/psysh/src/Psy/Context.php b/vendor/psy/psysh/src/Context.php
similarity index 85%
rename from vendor/psy/psysh/src/Psy/Context.php
rename to vendor/psy/psysh/src/Context.php
index 663f986b..c0e58e89 100644
--- a/vendor/psy/psysh/src/Psy/Context.php
+++ b/vendor/psy/psysh/src/Context.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -19,20 +19,21 @@ namespace Psy;
*/
class Context
{
- private static $specialNames = array('_', '_e', '__out', '__psysh__', 'this');
+ private static $specialNames = ['_', '_e', '__out', '__psysh__', 'this'];
// Whitelist a very limited number of command-scope magic variable names.
// This might be a bad idea, but future me can sort it out.
- private static $commandScopeNames = array(
+ private static $commandScopeNames = [
'__function', '__method', '__class', '__namespace', '__file', '__line', '__dir',
- );
+ ];
- private $scopeVariables = array();
- private $commandScopeVariables = array();
+ private $scopeVariables = [];
+ private $commandScopeVariables = [];
private $returnValue;
private $lastException;
private $lastStdout;
private $boundObject;
+ private $boundClass;
/**
* Get a context variable.
@@ -106,9 +107,9 @@ class Context
*/
public function getSpecialVariables()
{
- $vars = array(
+ $vars = [
'_' => $this->returnValue,
- );
+ ];
if (isset($this->lastException)) {
$vars['_e'] = $this->lastException;
@@ -179,9 +180,9 @@ class Context
/**
* Get the most recent Exception.
*
- * @throws InvalidArgumentException If no Exception has been caught
+ * @throws \InvalidArgumentException If no Exception has been caught
*
- * @return null|Exception
+ * @return null|\Exception
*/
public function getLastException()
{
@@ -205,7 +206,7 @@ class Context
/**
* Get the most recent output from evaluated code.
*
- * @throws InvalidArgumentException If no output has happened yet
+ * @throws \InvalidArgumentException If no output has happened yet
*
* @return null|string
*/
@@ -221,11 +222,14 @@ class Context
/**
* Set the bound object ($this variable) for the interactive shell.
*
+ * Note that this unsets the bound class, if any exists.
+ *
* @param object|null $boundObject
*/
public function setBoundObject($boundObject)
{
$this->boundObject = is_object($boundObject) ? $boundObject : null;
+ $this->boundClass = null;
}
/**
@@ -238,6 +242,29 @@ class Context
return $this->boundObject;
}
+ /**
+ * Set the bound class (self) for the interactive shell.
+ *
+ * Note that this unsets the bound object, if any exists.
+ *
+ * @param string|null $boundClass
+ */
+ public function setBoundClass($boundClass)
+ {
+ $this->boundClass = (is_string($boundClass) && $boundClass !== '') ? $boundClass : null;
+ $this->boundObject = null;
+ }
+
+ /**
+ * Get the bound class (self) for the interactive shell.
+ *
+ * @return string|null
+ */
+ public function getBoundClass()
+ {
+ return $this->boundClass;
+ }
+
/**
* Set command-scope magic variables: $__class, $__file, etc.
*
@@ -245,7 +272,7 @@ class Context
*/
public function setCommandScopeVariables(array $commandScopeVariables)
{
- $vars = array();
+ $vars = [];
foreach ($commandScopeVariables as $key => $value) {
// kind of type check
if (is_scalar($value) && in_array($key, self::$commandScopeNames)) {
diff --git a/vendor/psy/psysh/src/Psy/ContextAware.php b/vendor/psy/psysh/src/ContextAware.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/ContextAware.php
rename to vendor/psy/psysh/src/ContextAware.php
index d68caba6..748f13aa 100644
--- a/vendor/psy/psysh/src/Psy/ContextAware.php
+++ b/vendor/psy/psysh/src/ContextAware.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/BreakException.php b/vendor/psy/psysh/src/Exception/BreakException.php
similarity index 97%
rename from vendor/psy/psysh/src/Psy/Exception/BreakException.php
rename to vendor/psy/psysh/src/Exception/BreakException.php
index 4592c51f..1436d56a 100644
--- a/vendor/psy/psysh/src/Psy/Exception/BreakException.php
+++ b/vendor/psy/psysh/src/Exception/BreakException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/DeprecatedException.php b/vendor/psy/psysh/src/Exception/DeprecatedException.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/Exception/DeprecatedException.php
rename to vendor/psy/psysh/src/Exception/DeprecatedException.php
index cd0185f1..8ac0104b 100644
--- a/vendor/psy/psysh/src/Psy/Exception/DeprecatedException.php
+++ b/vendor/psy/psysh/src/Exception/DeprecatedException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/ErrorException.php b/vendor/psy/psysh/src/Exception/ErrorException.php
similarity index 98%
rename from vendor/psy/psysh/src/Psy/Exception/ErrorException.php
rename to vendor/psy/psysh/src/Exception/ErrorException.php
index 85820ac8..2cd7e95f 100644
--- a/vendor/psy/psysh/src/Psy/Exception/ErrorException.php
+++ b/vendor/psy/psysh/src/Exception/ErrorException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/Exception.php b/vendor/psy/psysh/src/Exception/Exception.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/Exception/Exception.php
rename to vendor/psy/psysh/src/Exception/Exception.php
index 80206f6f..de689547 100644
--- a/vendor/psy/psysh/src/Psy/Exception/Exception.php
+++ b/vendor/psy/psysh/src/Exception/Exception.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/FatalErrorException.php b/vendor/psy/psysh/src/Exception/FatalErrorException.php
similarity index 97%
rename from vendor/psy/psysh/src/Psy/Exception/FatalErrorException.php
rename to vendor/psy/psysh/src/Exception/FatalErrorException.php
index 5fe7fc61..08b56c0b 100644
--- a/vendor/psy/psysh/src/Psy/Exception/FatalErrorException.php
+++ b/vendor/psy/psysh/src/Exception/FatalErrorException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/ParseErrorException.php b/vendor/psy/psysh/src/Exception/ParseErrorException.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Exception/ParseErrorException.php
rename to vendor/psy/psysh/src/Exception/ParseErrorException.php
index 0fb397dc..93d0d3c9 100644
--- a/vendor/psy/psysh/src/Psy/Exception/ParseErrorException.php
+++ b/vendor/psy/psysh/src/Exception/ParseErrorException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/RuntimeException.php b/vendor/psy/psysh/src/Exception/RuntimeException.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Exception/RuntimeException.php
rename to vendor/psy/psysh/src/Exception/RuntimeException.php
index 1e767af0..09e68483 100644
--- a/vendor/psy/psysh/src/Psy/Exception/RuntimeException.php
+++ b/vendor/psy/psysh/src/Exception/RuntimeException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Exception/ThrowUpException.php b/vendor/psy/psysh/src/Exception/ThrowUpException.php
similarity index 60%
rename from vendor/psy/psysh/src/Psy/Exception/ThrowUpException.php
rename to vendor/psy/psysh/src/Exception/ThrowUpException.php
index acc87c23..8c3eb06c 100644
--- a/vendor/psy/psysh/src/Psy/Exception/ThrowUpException.php
+++ b/vendor/psy/psysh/src/Exception/ThrowUpException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -34,4 +34,24 @@ class ThrowUpException extends \Exception implements Exception
{
return $this->getPrevious()->getMessage();
}
+
+ /**
+ * Create a ThrowUpException from a Throwable.
+ *
+ * @param \Throwable $throwable
+ *
+ * @return ThrowUpException
+ */
+ public static function fromThrowable($throwable)
+ {
+ if ($throwable instanceof \Error) {
+ $throwable = ErrorException::fromError($throwable);
+ }
+
+ if (!$throwable instanceof \Exception) {
+ throw new \InvalidArgumentException('throw-up can only throw Exceptions and Errors');
+ }
+
+ return new self($throwable);
+ }
}
diff --git a/vendor/psy/psysh/src/Psy/Exception/TypeErrorException.php b/vendor/psy/psysh/src/Exception/TypeErrorException.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Exception/TypeErrorException.php
rename to vendor/psy/psysh/src/Exception/TypeErrorException.php
index 756b06a9..9dbdb936 100644
--- a/vendor/psy/psysh/src/Psy/Exception/TypeErrorException.php
+++ b/vendor/psy/psysh/src/Exception/TypeErrorException.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -50,6 +50,6 @@ class TypeErrorException extends \Exception implements Exception
*/
public static function fromTypeError(\TypeError $e)
{
- return new self($e->getMessage(), $e->getLine());
+ return new self($e->getMessage(), $e->getCode());
}
}
diff --git a/vendor/psy/psysh/src/ExecutionClosure.php b/vendor/psy/psysh/src/ExecutionClosure.php
new file mode 100644
index 00000000..29a3bcc6
--- /dev/null
+++ b/vendor/psy/psysh/src/ExecutionClosure.php
@@ -0,0 +1,119 @@
+setClosure($__psysh__, function () use ($__psysh__) {
+ try {
+ // Restore execution scope variables
+ extract($__psysh__->getScopeVariables(false));
+
+ // Buffer stdout; we'll need it later
+ ob_start([$__psysh__, 'writeStdout'], 1);
+
+ // Convert all errors to exceptions
+ set_error_handler([$__psysh__, 'handleError']);
+
+ // Evaluate the current code buffer
+ $_ = eval($__psysh__->onExecute($__psysh__->flushCode() ?: ExecutionClosure::NOOP_INPUT));
+ } catch (\Throwable $_e) {
+ // Clean up on our way out.
+ restore_error_handler();
+ if (ob_get_level() > 0) {
+ ob_end_clean();
+ }
+
+ throw $_e;
+ } catch (\Exception $_e) {
+ // Clean up on our way out.
+ restore_error_handler();
+ if (ob_get_level() > 0) {
+ ob_end_clean();
+ }
+
+ throw $_e;
+ }
+
+ // Won't be needing this anymore
+ restore_error_handler();
+
+ // Flush stdout (write to shell output, plus save to magic variable)
+ ob_end_flush();
+
+ // Save execution scope variables for next time
+ $__psysh__->setScopeVariables(get_defined_vars());
+
+ return $_;
+ });
+ }
+
+ /**
+ * Set the closure instance.
+ *
+ * @param Shell $psysh
+ * @param \Closure $closure
+ */
+ protected function setClosure(Shell $shell, \Closure $closure)
+ {
+ if (self::shouldBindClosure()) {
+ $that = $shell->getBoundObject();
+ if (is_object($that)) {
+ $closure = $closure->bindTo($that, get_class($that));
+ } else {
+ $closure = $closure->bindTo(null, $shell->getBoundClass());
+ }
+ }
+
+ $this->closure = $closure;
+ }
+
+ /**
+ * Go go gadget closure.
+ *
+ * @return mixed
+ */
+ public function execute()
+ {
+ $closure = $this->closure;
+
+ return $closure();
+ }
+
+ /**
+ * Decide whether to bind the execution closure.
+ *
+ * @return bool
+ */
+ protected static function shouldBindClosure()
+ {
+ // skip binding on HHVM < 3.5.0
+ // see https://github.com/facebook/hhvm/issues/1203
+ if (defined('HHVM_VERSION')) {
+ return version_compare(HHVM_VERSION, '3.5.0', '>=');
+ }
+
+ return true;
+ }
+}
diff --git a/vendor/psy/psysh/src/ExecutionLoop.php b/vendor/psy/psysh/src/ExecutionLoop.php
new file mode 100644
index 00000000..eacd1d3c
--- /dev/null
+++ b/vendor/psy/psysh/src/ExecutionLoop.php
@@ -0,0 +1,67 @@
+loadIncludes($shell);
+
+ $closure = new ExecutionLoopClosure($shell);
+ $closure->execute();
+ }
+
+ /**
+ * Load user-defined includes.
+ *
+ * @param Shell $shell
+ */
+ protected function loadIncludes(Shell $shell)
+ {
+ // Load user-defined includes
+ $load = function (Shell $__psysh__) {
+ set_error_handler([$__psysh__, 'handleError']);
+ foreach ($__psysh__->getIncludes() as $__psysh_include__) {
+ try {
+ include $__psysh_include__;
+ } catch (\Error $_e) {
+ $__psysh__->writeException(ErrorException::fromError($_e));
+ } catch (\Exception $_e) {
+ $__psysh__->writeException($_e);
+ }
+ }
+ restore_error_handler();
+ unset($__psysh_include__);
+
+ // Override any new local variables with pre-defined scope variables
+ extract($__psysh__->getScopeVariables(false));
+
+ // ... then add the whole mess of variables back.
+ $__psysh__->setScopeVariables(get_defined_vars());
+ };
+
+ $load($shell);
+ }
+}
diff --git a/vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php b/vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php
new file mode 100644
index 00000000..3617fa24
--- /dev/null
+++ b/vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php
@@ -0,0 +1,62 @@
+ 0) {
// This is the main thread. We'll just wait for a while.
@@ -51,12 +62,27 @@ class ForkingLoop extends Loop
fclose($up);
// Wait for a return value from the loop process.
- $read = array($down);
+ $read = [$down];
$write = null;
$except = null;
- if (stream_select($read, $write, $except, null) === false) {
- throw new \RuntimeException('Error waiting for execution loop.');
- }
+
+ do {
+ $n = @stream_select($read, $write, $except, null);
+
+ if ($n === 0) {
+ throw new \RuntimeException('Process timed out waiting for execution loop');
+ }
+
+ if ($n === false) {
+ $err = error_get_last();
+ if (!isset($err['message']) || stripos($err['message'], 'interrupted system call') === false) {
+ $msg = $err['message'] ?
+ sprintf('Error waiting for execution loop: %s', $err['message']) :
+ 'Error waiting for execution loop';
+ throw new \RuntimeException($msg);
+ }
+ }
+ } while ($n < 1);
$content = stream_get_contents($down);
fclose($down);
@@ -65,7 +91,7 @@ class ForkingLoop extends Loop
$shell->setScopeVariables(@unserialize($content));
}
- return;
+ throw new BreakException('Exiting main thread');
}
// This is the child process. It's going to do all the work.
@@ -76,28 +102,26 @@ class ForkingLoop extends Loop
// We won't be needing this one.
fclose($down);
- // Let's do some processing.
- parent::run($shell);
-
- // Send the scope variables back up to the main thread
- fwrite($up, $this->serializeReturn($shell->getScopeVariables(false)));
- fclose($up);
-
- posix_kill(posix_getpid(), SIGKILL);
+ // Save this; we'll need to close it in `afterRun`
+ $this->up = $up;
}
/**
* Create a savegame at the start of each loop iteration.
+ *
+ * @param Shell $shell
*/
- public function beforeLoop()
+ public function beforeLoop(Shell $shell)
{
$this->createSavegame();
}
/**
* Clean up old savegames at the end of each loop iteration.
+ *
+ * @param Shell $shell
*/
- public function afterLoop()
+ public function afterLoop(Shell $shell)
{
// if there's an old savegame hanging around, let's kill it.
if (isset($this->savegame)) {
@@ -106,6 +130,23 @@ class ForkingLoop extends Loop
}
}
+ /**
+ * After the REPL session ends, send the scope variables back up to the main
+ * thread (if this is a child thread).
+ *
+ * @param Shell $shell
+ */
+ public function afterRun(Shell $shell)
+ {
+ // We're a child thread. Send the scope variables back up to the main thread.
+ if (isset($this->up)) {
+ fwrite($this->up, $this->serializeReturn($shell->getScopeVariables(false)));
+ fclose($this->up);
+
+ posix_kill(posix_getpid(), SIGKILL);
+ }
+ }
+
/**
* Create a savegame fork.
*
@@ -120,7 +161,7 @@ class ForkingLoop extends Loop
$pid = pcntl_fork();
if ($pid < 0) {
- throw new \RuntimeException('Unable to create savegame fork.');
+ throw new \RuntimeException('Unable to create savegame fork');
} elseif ($pid > 0) {
// we're the savegame now... let's wait and see what happens
pcntl_waitpid($pid, $status);
@@ -149,7 +190,7 @@ class ForkingLoop extends Loop
*/
private function serializeReturn(array $return)
{
- $serializable = array();
+ $serializable = [];
foreach ($return as $key => $value) {
// No need to return magic variables
@@ -165,10 +206,11 @@ class ForkingLoop extends Loop
try {
@serialize($value);
$serializable[$key] = $value;
- } catch (\Exception $e) {
- // we'll just ignore this one...
} catch (\Throwable $e) {
+ // we'll just ignore this one...
+ } catch (\Exception $e) {
// and this one too...
+ // @todo remove this once we don't support PHP 5.x anymore :)
}
}
diff --git a/vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php b/vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php
new file mode 100644
index 00000000..5706b79a
--- /dev/null
+++ b/vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php
@@ -0,0 +1,135 @@
+parser = $parserFactory->createParser();
+ }
+
+ /**
+ * Reload code on input.
+ *
+ * @param Shell $shell
+ * @param string $input
+ */
+ public function onInput(Shell $shell, $input)
+ {
+ $this->reload($shell);
+ }
+
+ /**
+ * Look through included files and update anything with a new timestamp.
+ *
+ * @param Shell $shell
+ */
+ private function reload(Shell $shell)
+ {
+ clearstatcache();
+ $modified = [];
+
+ foreach (get_included_files() as $file) {
+ $timestamp = filemtime($file);
+
+ if (!isset($this->timestamps[$file])) {
+ $this->timestamps[$file] = $timestamp;
+ continue;
+ }
+
+ if ($this->timestamps[$file] === $timestamp) {
+ continue;
+ }
+
+ if (!$this->lintFile($file)) {
+ $msg = sprintf('Modified file "%s" could not be reloaded', $file);
+ $shell->writeException(new ParseErrorException($msg));
+ continue;
+ }
+
+ $modified[] = $file;
+ $this->timestamps[$file] = $timestamp;
+ }
+
+ // switch (count($modified)) {
+ // case 0:
+ // return;
+
+ // case 1:
+ // printf("Reloading modified file: \"%s\"\n", str_replace(getcwd(), '.', $file));
+ // break;
+
+ // default:
+ // printf("Reloading %d modified files\n", count($modified));
+ // break;
+ // }
+
+ foreach ($modified as $file) {
+ runkit_import($file, (
+ RUNKIT_IMPORT_FUNCTIONS |
+ RUNKIT_IMPORT_CLASSES |
+ RUNKIT_IMPORT_CLASS_METHODS |
+ RUNKIT_IMPORT_CLASS_CONSTS |
+ RUNKIT_IMPORT_CLASS_PROPS |
+ RUNKIT_IMPORT_OVERRIDE
+ ));
+ }
+ }
+
+ /**
+ * Should this file be re-imported?
+ *
+ * Use PHP-Parser to ensure that the file is valid PHP.
+ *
+ * @param string $file
+ *
+ * @return bool
+ */
+ private function lintFile($file)
+ {
+ // first try to parse it
+ try {
+ $this->parser->parse(file_get_contents($file));
+ } catch (\Exception $e) {
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/vendor/psy/psysh/src/ExecutionLoopClosure.php b/vendor/psy/psysh/src/ExecutionLoopClosure.php
new file mode 100644
index 00000000..e34848ed
--- /dev/null
+++ b/vendor/psy/psysh/src/ExecutionLoopClosure.php
@@ -0,0 +1,99 @@
+setClosure($__psysh__, function () use ($__psysh__) {
+ // Restore execution scope variables
+ extract($__psysh__->getScopeVariables(false));
+
+ do {
+ $__psysh__->beforeLoop();
+
+ try {
+ $__psysh__->getInput();
+
+ try {
+ // Buffer stdout; we'll need it later
+ ob_start([$__psysh__, 'writeStdout'], 1);
+
+ // Convert all errors to exceptions
+ set_error_handler([$__psysh__, 'handleError']);
+
+ // Evaluate the current code buffer
+ $_ = eval($__psysh__->onExecute($__psysh__->flushCode() ?: ExecutionClosure::NOOP_INPUT));
+ } catch (\Throwable $_e) {
+ // Clean up on our way out.
+ restore_error_handler();
+ if (ob_get_level() > 0) {
+ ob_end_clean();
+ }
+
+ throw $_e;
+ } catch (\Exception $_e) {
+ // Clean up on our way out.
+ restore_error_handler();
+ if (ob_get_level() > 0) {
+ ob_end_clean();
+ }
+
+ throw $_e;
+ }
+
+ // Won't be needing this anymore
+ restore_error_handler();
+
+ // Flush stdout (write to shell output, plus save to magic variable)
+ ob_end_flush();
+
+ // Save execution scope variables for next time
+ $__psysh__->setScopeVariables(get_defined_vars());
+
+ $__psysh__->writeReturnValue($_);
+ } catch (BreakException $_e) {
+ $__psysh__->writeException($_e);
+
+ return;
+ } catch (ThrowUpException $_e) {
+ $__psysh__->writeException($_e);
+
+ throw $_e;
+ } catch (\TypeError $_e) {
+ $__psysh__->writeException(TypeErrorException::fromTypeError($_e));
+ } catch (\Error $_e) {
+ $__psysh__->writeException(ErrorException::fromError($_e));
+ } catch (\Exception $_e) {
+ $__psysh__->writeException($_e);
+ }
+
+ $__psysh__->afterLoop();
+ } while (true);
+ });
+ }
+}
diff --git a/vendor/psy/psysh/src/Psy/Formatter/CodeFormatter.php b/vendor/psy/psysh/src/Formatter/CodeFormatter.php
similarity index 80%
rename from vendor/psy/psysh/src/Psy/Formatter/CodeFormatter.php
rename to vendor/psy/psysh/src/Formatter/CodeFormatter.php
index 45ad4919..5ef195df 100644
--- a/vendor/psy/psysh/src/Psy/Formatter/CodeFormatter.php
+++ b/vendor/psy/psysh/src/Formatter/CodeFormatter.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -32,18 +32,14 @@ class CodeFormatter implements Formatter
public static function format(\Reflector $reflector, $colorMode = null)
{
if (!self::isReflectable($reflector)) {
- throw new RuntimeException('Source code unavailable.');
+ throw new RuntimeException('Source code unavailable');
}
$colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO;
- if ($reflector instanceof \ReflectionGenerator) {
- $reflector = $reflector->getFunction();
- }
-
if ($fileName = $reflector->getFileName()) {
if (!is_file($fileName)) {
- throw new RuntimeException('Source code unavailable.');
+ throw new RuntimeException('Source code unavailable');
}
$file = file_get_contents($fileName);
@@ -56,7 +52,7 @@ class CodeFormatter implements Formatter
return $highlighter->getCodeSnippet($file, $start, 0, $end);
} else {
- throw new RuntimeException('Source code unavailable.');
+ throw new RuntimeException('Source code unavailable');
}
}
@@ -70,7 +66,6 @@ class CodeFormatter implements Formatter
private static function isReflectable(\Reflector $reflector)
{
return $reflector instanceof \ReflectionClass ||
- $reflector instanceof \ReflectionFunctionAbstract ||
- $reflector instanceof \ReflectionGenerator;
+ $reflector instanceof \ReflectionFunctionAbstract;
}
}
diff --git a/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php b/vendor/psy/psysh/src/Formatter/DocblockFormatter.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php
rename to vendor/psy/psysh/src/Formatter/DocblockFormatter.php
index c1e8af9c..33f450e1 100644
--- a/vendor/psy/psysh/src/Psy/Formatter/DocblockFormatter.php
+++ b/vendor/psy/psysh/src/Formatter/DocblockFormatter.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -19,10 +19,10 @@ use Symfony\Component\Console\Formatter\OutputFormatter;
*/
class DocblockFormatter implements Formatter
{
- private static $vectorParamTemplates = array(
+ private static $vectorParamTemplates = [
'type' => 'info',
'var' => 'strong',
- );
+ ];
/**
* Format a docblock.
@@ -34,7 +34,7 @@ class DocblockFormatter implements Formatter
public static function format(\Reflector $reflector)
{
$docblock = new Docblock($reflector);
- $chunks = array();
+ $chunks = [];
if (!empty($docblock->desc)) {
$chunks[] = 'Description: ';
@@ -73,7 +73,7 @@ class DocblockFormatter implements Formatter
*/
private static function formatVector(array $vector, array $lines)
{
- $template = array(' ');
+ $template = [' '];
foreach ($vector as $type) {
$max = 0;
foreach ($lines as $line) {
@@ -89,7 +89,7 @@ class DocblockFormatter implements Formatter
$template = implode(' ', $template);
return implode("\n", array_map(function ($line) use ($template) {
- $escaped = array_map(array('Symfony\Component\Console\Formatter\OutputFormatter', 'escape'), $line);
+ $escaped = array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $line);
return rtrim(vsprintf($template, $escaped));
}, $lines));
@@ -105,7 +105,7 @@ class DocblockFormatter implements Formatter
*/
private static function formatTags(array $skip, array $tags)
{
- $chunks = array();
+ $chunks = [];
foreach ($tags as $name => $values) {
if (in_array($name, $skip)) {
diff --git a/vendor/psy/psysh/src/Psy/Formatter/Formatter.php b/vendor/psy/psysh/src/Formatter/Formatter.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Formatter/Formatter.php
rename to vendor/psy/psysh/src/Formatter/Formatter.php
index fe11bce0..08a8e4c1 100644
--- a/vendor/psy/psysh/src/Psy/Formatter/Formatter.php
+++ b/vendor/psy/psysh/src/Formatter/Formatter.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Formatter/SignatureFormatter.php b/vendor/psy/psysh/src/Formatter/SignatureFormatter.php
similarity index 82%
rename from vendor/psy/psysh/src/Psy/Formatter/SignatureFormatter.php
rename to vendor/psy/psysh/src/Formatter/SignatureFormatter.php
index b3ef2eac..2a83ad1c 100644
--- a/vendor/psy/psysh/src/Psy/Formatter/SignatureFormatter.php
+++ b/vendor/psy/psysh/src/Formatter/SignatureFormatter.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,7 +11,8 @@
namespace Psy\Formatter;
-use Psy\Reflection\ReflectionConstant;
+use Psy\Reflection\ReflectionClassConstant;
+use Psy\Reflection\ReflectionConstant_;
use Psy\Reflection\ReflectionLanguageConstruct;
use Psy\Util\Json;
use Symfony\Component\Console\Formatter\OutputFormatter;
@@ -41,8 +42,9 @@ class SignatureFormatter implements Formatter
case $reflector instanceof \ReflectionClass:
return self::formatClass($reflector);
- case $reflector instanceof ReflectionConstant:
- return self::formatConstant($reflector);
+ case $reflector instanceof ReflectionClassConstant:
+ case $reflector instanceof \ReflectionClassConstant:
+ return self::formatClassConstant($reflector);
case $reflector instanceof \ReflectionMethod:
return self::formatMethod($reflector);
@@ -50,6 +52,9 @@ class SignatureFormatter implements Formatter
case $reflector instanceof \ReflectionProperty:
return self::formatProperty($reflector);
+ case $reflector instanceof ReflectionConstant_:
+ return self::formatConstant($reflector);
+
default:
throw new \InvalidArgumentException('Unexpected Reflector class: ' . get_class($reflector));
}
@@ -70,14 +75,20 @@ class SignatureFormatter implements Formatter
/**
* Print the method, property or class modifiers.
*
- * Technically this should be a trait. Can't wait for 5.4 :)
- *
* @param \Reflector $reflector
*
* @return string Formatted modifiers
*/
private static function formatModifiers(\Reflector $reflector)
{
+ if ($reflector instanceof \ReflectionClass && $reflector->isTrait()) {
+ // For some reason, PHP 5.x returns `abstract public` modifiers for
+ // traits. Let's just ignore that business entirely.
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ return [];
+ }
+ }
+
return implode(' ', array_map(function ($modifier) {
return sprintf('%s ', $modifier);
}, \Reflection::getModifierNames($reflector->getModifiers())));
@@ -92,13 +103,13 @@ class SignatureFormatter implements Formatter
*/
private static function formatClass(\ReflectionClass $reflector)
{
- $chunks = array();
+ $chunks = [];
if ($modifiers = self::formatModifiers($reflector)) {
$chunks[] = $modifiers;
}
- if (version_compare(PHP_VERSION, '5.4', '>=') && $reflector->isTrait()) {
+ if ($reflector->isTrait()) {
$chunks[] = 'trait';
} else {
$chunks[] = $reflector->isInterface() ? 'interface' : 'class';
@@ -127,11 +138,11 @@ class SignatureFormatter implements Formatter
/**
* Format a constant signature.
*
- * @param ReflectionConstant $reflector
+ * @param ReflectionClassConstant|\ReflectionClassConstant $reflector
*
* @return string Formatted signature
*/
- private static function formatConstant(ReflectionConstant $reflector)
+ private static function formatClassConstant($reflector)
{
$value = $reflector->getValue();
$style = self::getTypeStyle($value);
@@ -145,6 +156,27 @@ class SignatureFormatter implements Formatter
);
}
+ /**
+ * Format a constant signature.
+ *
+ * @param ReflectionConstant_ $reflector
+ *
+ * @return string Formatted signature
+ */
+ private static function formatConstant($reflector)
+ {
+ $value = $reflector->getValue();
+ $style = self::getTypeStyle($value);
+
+ return sprintf(
+ 'define (%s , <%s>%s%s>)',
+ OutputFormatter::escape(Json::encode($reflector->getName())),
+ $style,
+ OutputFormatter::escape(Json::encode($value)),
+ $style
+ );
+ }
+
/**
* Helper for getting output style for a given value's type.
*
@@ -161,7 +193,7 @@ class SignatureFormatter implements Formatter
} elseif (is_bool($value) || is_null($value)) {
return 'bool';
} else {
- return 'strong';
+ return 'strong'; // @codeCoverageIgnore
}
}
@@ -219,11 +251,11 @@ class SignatureFormatter implements Formatter
*
* @param \ReflectionFunctionAbstract $reflector
*
- * @return string
+ * @return array
*/
private static function formatFunctionParams(\ReflectionFunctionAbstract $reflector)
{
- $params = array();
+ $params = [];
foreach ($reflector->getParameters() as $param) {
$hint = '';
try {
@@ -238,11 +270,14 @@ class SignatureFormatter implements Formatter
// come to think of it, the only time I've seen this is with the intl extension.
// Hax: we'll try to extract it :P
+
+ // @codeCoverageIgnoreStart
$chunks = explode('$' . $param->getName(), (string) $param);
$chunks = explode(' ', trim($chunks[0]));
$guess = end($chunks);
$hint = sprintf('%s ', $guess);
+ // @codeCoverageIgnoreEnd
}
if ($param->isOptional()) {
diff --git a/vendor/psy/psysh/src/Psy/Input/CodeArgument.php b/vendor/psy/psysh/src/Input/CodeArgument.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Input/CodeArgument.php
rename to vendor/psy/psysh/src/Input/CodeArgument.php
index 4e50754e..cfeb9e16 100644
--- a/vendor/psy/psysh/src/Psy/Input/CodeArgument.php
+++ b/vendor/psy/psysh/src/Input/CodeArgument.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -42,7 +42,7 @@ class CodeArgument extends InputArgument
public function __construct($name, $mode = null, $description = '', $default = null)
{
if ($mode & InputArgument::IS_ARRAY) {
- throw new \InvalidArgumentException('Argument mode IS_ARRAY is not valid.');
+ throw new \InvalidArgumentException('Argument mode IS_ARRAY is not valid');
}
parent::__construct($name, $mode, $description, $default);
diff --git a/vendor/psy/psysh/src/Psy/Input/FilterOptions.php b/vendor/psy/psysh/src/Input/FilterOptions.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/Input/FilterOptions.php
rename to vendor/psy/psysh/src/Input/FilterOptions.php
index 46017d22..a2ed49d0 100644
--- a/vendor/psy/psysh/src/Psy/Input/FilterOptions.php
+++ b/vendor/psy/psysh/src/Input/FilterOptions.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,6 +11,7 @@
namespace Psy\Input;
+use Psy\Exception\ErrorException;
use Psy\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -32,11 +33,11 @@ class FilterOptions
*/
public static function getOptions()
{
- return array(
+ return [
new InputOption('grep', 'G', InputOption::VALUE_REQUIRED, 'Limit to items matching the given pattern (string or regex).'),
new InputOption('insensitive', 'i', InputOption::VALUE_NONE, 'Case-insensitive search (requires --grep).'),
new InputOption('invert', 'v', InputOption::VALUE_NONE, 'Inverted search (requires --grep).'),
- );
+ ];
}
/**
@@ -103,7 +104,7 @@ class FilterOptions
private function validateInput(InputInterface $input)
{
if (!$input->getOption('grep')) {
- foreach (array('invert', 'insensitive') as $option) {
+ foreach (['invert', 'insensitive'] as $option) {
if ($input->getOption($option)) {
throw new RuntimeException('--' . $option . ' does not make sense without --grep');
}
@@ -132,10 +133,11 @@ class FilterOptions
*/
private function validateRegex($pattern)
{
- set_error_handler(array('Psy\Exception\ErrorException', 'throwException'));
+ set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
try {
preg_match($pattern, '');
} catch (ErrorException $e) {
+ restore_error_handler();
throw new RuntimeException(str_replace('preg_match(): ', 'Invalid regular expression: ', $e->getRawMessage()));
}
restore_error_handler();
diff --git a/vendor/psy/psysh/src/Psy/Input/ShellInput.php b/vendor/psy/psysh/src/Input/ShellInput.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/Input/ShellInput.php
rename to vendor/psy/psysh/src/Input/ShellInput.php
index 68a4252a..7141d2d4 100644
--- a/vendor/psy/psysh/src/Psy/Input/ShellInput.php
+++ b/vendor/psy/psysh/src/Input/ShellInput.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -83,29 +83,31 @@ class ShellInput extends StringInput
*/
private function tokenize($input)
{
- $tokens = array();
+ $tokens = [];
$length = strlen($input);
$cursor = 0;
while ($cursor < $length) {
if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
} elseif (preg_match('/([^="\'\s]+?)(=?)(' . StringInput::REGEX_QUOTED_STRING . '+)/A', $input, $match, null, $cursor)) {
- $tokens[] = array(
- $match[1] . $match[2] . stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))),
- substr($input, $cursor),
- );
+ $tokens[] = [
+ $match[1] . $match[2] . stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, strlen($match[3]) - 2))),
+ stripcslashes(substr($input, $cursor)),
+ ];
} elseif (preg_match('/' . StringInput::REGEX_QUOTED_STRING . '/A', $input, $match, null, $cursor)) {
- $tokens[] = array(
+ $tokens[] = [
stripcslashes(substr($match[0], 1, strlen($match[0]) - 2)),
- substr($input, $cursor),
- );
+ stripcslashes(substr($input, $cursor)),
+ ];
} elseif (preg_match('/' . StringInput::REGEX_STRING . '/A', $input, $match, null, $cursor)) {
- $tokens[] = array(
+ $tokens[] = [
stripcslashes($match[1]),
- substr($input, $cursor),
- );
+ stripcslashes(substr($input, $cursor)),
+ ];
} else {
// should never happen
+ // @codeCoverageIgnoreStart
throw new \InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
+ // @codeCoverageIgnoreEnd
}
$cursor += strlen($match[0]);
@@ -159,15 +161,19 @@ class ShellInput extends StringInput
if ($arg instanceof CodeArgument) {
// When we find a code argument, we're done parsing. Add the
// remaining input to the current argument and call it a day.
- $this->parsed = array();
+ $this->parsed = [];
$this->arguments[$arg->getName()] = $rest;
} else {
- $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
+ $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
}
return;
}
+ // (copypasta)
+ //
+ // @codeCoverageIgnoreStart
+
// if last argument isArray(), append token to last argument
if ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
$arg = $this->definition->getArgument($c - 1);
@@ -183,9 +189,11 @@ class ShellInput extends StringInput
}
throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token));
+ // @codeCoverageIgnoreEnd
}
// Everything below this is copypasta from ArgvInput private methods
+ // @codeCoverageIgnoreStart
/**
* Parses a short option.
@@ -250,7 +258,7 @@ class ShellInput extends StringInput
if (PHP_VERSION_ID < 70000 && false === $value) {
$value = '';
}
- array_unshift($this->parsed, array($value, null));
+ array_unshift($this->parsed, [$value, null]);
}
$this->addLongOption(substr($name, 0, $pos), $value);
} else {
@@ -295,12 +303,12 @@ class ShellInput extends StringInput
throw new \RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
}
- if (in_array($value, array('', null), true) && $option->acceptValue() && count($this->parsed)) {
+ if (in_array($value, ['', null], true) && $option->acceptValue() && count($this->parsed)) {
// if option accepts an optional or mandatory argument
// let's see if there is one provided
$next = array_shift($this->parsed);
$nextToken = $next[0];
- if ((isset($nextToken[0]) && '-' !== $nextToken[0]) || in_array($nextToken, array('', null), true)) {
+ if ((isset($nextToken[0]) && '-' !== $nextToken[0]) || in_array($nextToken, ['', null], true)) {
$value = $nextToken;
} else {
array_unshift($this->parsed, $next);
@@ -323,4 +331,6 @@ class ShellInput extends StringInput
$this->options[$name] = $value;
}
}
+
+ // @codeCoverageIgnoreEnd
}
diff --git a/vendor/psy/psysh/src/Psy/Input/SilentInput.php b/vendor/psy/psysh/src/Input/SilentInput.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Input/SilentInput.php
rename to vendor/psy/psysh/src/Input/SilentInput.php
index 0da750d6..c6f234ba 100644
--- a/vendor/psy/psysh/src/Psy/Input/SilentInput.php
+++ b/vendor/psy/psysh/src/Input/SilentInput.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Output/OutputPager.php b/vendor/psy/psysh/src/Output/OutputPager.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/Output/OutputPager.php
rename to vendor/psy/psysh/src/Output/OutputPager.php
index 03f049f6..a2f12aea 100644
--- a/vendor/psy/psysh/src/Psy/Output/OutputPager.php
+++ b/vendor/psy/psysh/src/Output/OutputPager.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Output/PassthruPager.php b/vendor/psy/psysh/src/Output/PassthruPager.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Output/PassthruPager.php
rename to vendor/psy/psysh/src/Output/PassthruPager.php
index 5bcbf796..2dcb7439 100644
--- a/vendor/psy/psysh/src/Psy/Output/PassthruPager.php
+++ b/vendor/psy/psysh/src/Output/PassthruPager.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Output/ProcOutputPager.php b/vendor/psy/psysh/src/Output/ProcOutputPager.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/Output/ProcOutputPager.php
rename to vendor/psy/psysh/src/Output/ProcOutputPager.php
index bb41c6cc..d8c03028 100644
--- a/vendor/psy/psysh/src/Psy/Output/ProcOutputPager.php
+++ b/vendor/psy/psysh/src/Output/ProcOutputPager.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -54,7 +54,7 @@ class ProcOutputPager extends StreamOutput implements OutputPager
if (false === @fwrite($pipe, $message . ($newline ? PHP_EOL : ''))) {
// @codeCoverageIgnoreStart
// should never happen
- throw new \RuntimeException('Unable to write output.');
+ throw new \RuntimeException('Unable to write output');
// @codeCoverageIgnoreEnd
}
@@ -88,7 +88,7 @@ class ProcOutputPager extends StreamOutput implements OutputPager
private function getPipe()
{
if (!isset($this->pipe) || !isset($this->proc)) {
- $desc = array(array('pipe', 'r'), $this->stream, fopen('php://stderr', 'w'));
+ $desc = [['pipe', 'r'], $this->stream, fopen('php://stderr', 'w')];
$this->proc = proc_open($this->cmd, $desc, $pipes);
if (!is_resource($this->proc)) {
diff --git a/vendor/psy/psysh/src/Psy/Output/ShellOutput.php b/vendor/psy/psysh/src/Output/ShellOutput.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/Output/ShellOutput.php
rename to vendor/psy/psysh/src/Output/ShellOutput.php
index f390db13..e980d387 100644
--- a/vendor/psy/psysh/src/Psy/Output/ShellOutput.php
+++ b/vendor/psy/psysh/src/Output/ShellOutput.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -70,7 +70,7 @@ class ShellOutput extends ConsoleOutput
}
if (!is_array($messages) && !is_callable($messages)) {
- throw new \InvalidArgumentException('Paged output requires a string, array or callback.');
+ throw new \InvalidArgumentException('Paged output requires a string, array or callback');
}
$this->startPaging();
@@ -126,7 +126,7 @@ class ShellOutput extends ConsoleOutput
$template = $this->isDecorated() ? ": %s" : "%{$pad}s: %s";
if ($type & self::OUTPUT_RAW) {
- $messages = array_map(array('Symfony\Component\Console\Formatter\OutputFormatter', 'escape'), $messages);
+ $messages = array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $messages);
}
foreach ($messages as $i => $line) {
@@ -175,20 +175,20 @@ class ShellOutput extends ConsoleOutput
$formatter = $this->getFormatter();
$formatter->setStyle('warning', new OutputFormatterStyle('black', 'yellow'));
- $formatter->setStyle('error', new OutputFormatterStyle('black', 'red', array('bold')));
+ $formatter->setStyle('error', new OutputFormatterStyle('black', 'red', ['bold']));
$formatter->setStyle('aside', new OutputFormatterStyle('blue'));
- $formatter->setStyle('strong', new OutputFormatterStyle(null, null, array('bold')));
+ $formatter->setStyle('strong', new OutputFormatterStyle(null, null, ['bold']));
$formatter->setStyle('return', new OutputFormatterStyle('cyan'));
$formatter->setStyle('urgent', new OutputFormatterStyle('red'));
$formatter->setStyle('hidden', new OutputFormatterStyle('black'));
// Visibility
- $formatter->setStyle('public', new OutputFormatterStyle(null, null, array('bold')));
+ $formatter->setStyle('public', new OutputFormatterStyle(null, null, ['bold']));
$formatter->setStyle('protected', new OutputFormatterStyle('yellow'));
$formatter->setStyle('private', new OutputFormatterStyle('red'));
- $formatter->setStyle('global', new OutputFormatterStyle('cyan', null, array('bold')));
+ $formatter->setStyle('global', new OutputFormatterStyle('cyan', null, ['bold']));
$formatter->setStyle('const', new OutputFormatterStyle('cyan'));
- $formatter->setStyle('class', new OutputFormatterStyle('blue', null, array('underscore')));
+ $formatter->setStyle('class', new OutputFormatterStyle('blue', null, ['underscore']));
$formatter->setStyle('function', new OutputFormatterStyle(null));
$formatter->setStyle('default', new OutputFormatterStyle(null));
diff --git a/vendor/psy/psysh/src/Psy/ParserFactory.php b/vendor/psy/psysh/src/ParserFactory.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/ParserFactory.php
rename to vendor/psy/psysh/src/ParserFactory.php
index 83f15398..21427483 100644
--- a/vendor/psy/psysh/src/Psy/ParserFactory.php
+++ b/vendor/psy/psysh/src/ParserFactory.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -32,7 +32,7 @@ class ParserFactory
*/
public static function getPossibleKinds()
{
- return array('ONLY_PHP5', 'ONLY_PHP7', 'PREFER_PHP5', 'PREFER_PHP7');
+ return ['ONLY_PHP5', 'ONLY_PHP7', 'PREFER_PHP5', 'PREFER_PHP7'];
}
/**
diff --git a/vendor/psy/psysh/src/Psy/Autoloader.php b/vendor/psy/psysh/src/Psy/Autoloader.php
deleted file mode 100644
index df2e45b4..00000000
--- a/vendor/psy/psysh/src/Psy/Autoloader.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
- */
-class StaticConstructorPass extends CodeCleanerPass
-{
- private $isPHP533;
- private $namespace;
-
- public function __construct()
- {
- $this->isPHP533 = version_compare(PHP_VERSION, '5.3.3', '>=');
- }
-
- public function beforeTraverse(array $nodes)
- {
- $this->namespace = array();
- }
-
- /**
- * Validate that the old-style constructor function is not static.
- *
- * @throws FatalErrorException if the old-style constructor function is static
- *
- * @param Node $node
- */
- public function enterNode(Node $node)
- {
- if ($node instanceof Namespace_) {
- $this->namespace = isset($node->name) ? $node->name->parts : array();
- } elseif ($node instanceof Class_) {
- // Bail early if this is PHP 5.3.3 and we have a namespaced class
- if (!empty($this->namespace) && $this->isPHP533) {
- return;
- }
-
- $constructor = null;
- foreach ($node->stmts as $stmt) {
- if ($stmt instanceof ClassMethod) {
- // Bail early if we find a new-style constructor
- if ('__construct' === strtolower($stmt->name)) {
- return;
- }
-
- // We found a possible old-style constructor
- // (unless there is also a __construct method)
- if (strtolower($node->name) === strtolower($stmt->name)) {
- $constructor = $stmt;
- }
- }
- }
-
- if ($constructor && $constructor->isStatic()) {
- $msg = sprintf(
- 'Constructor %s::%s() cannot be static',
- implode('\\', array_merge($this->namespace, (array) $node->name)),
- $constructor->name
- );
- throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
- }
- }
- }
-}
diff --git a/vendor/psy/psysh/src/Psy/Command/ThrowUpCommand.php b/vendor/psy/psysh/src/Psy/Command/ThrowUpCommand.php
deleted file mode 100644
index 34bf425f..00000000
--- a/vendor/psy/psysh/src/Psy/Command/ThrowUpCommand.php
+++ /dev/null
@@ -1,87 +0,0 @@
-context = $context;
- }
-
- /**
- * {@inheritdoc}
- */
- protected function configure()
- {
- $this
- ->setName('throw-up')
- ->setDefinition(array(
- new InputArgument('exception', InputArgument::OPTIONAL, 'Exception to throw'),
- ))
- ->setDescription('Throw an exception out of the Psy Shell.')
- ->setHelp(
- <<<'HELP'
-Throws an exception out of the current the Psy Shell instance.
-
-By default it throws the most recent exception.
-
-e.g.
->>> throw-up
->>> throw-up $e
-HELP
- );
- }
-
- /**
- * {@inheritdoc}
- *
- * @throws InvalidArgumentException if there is no exception to throw
- * @throws ThrowUpException because what else do you expect it to do?
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- if ($name = $input->getArgument('exception')) {
- $orig = $this->context->get(preg_replace('/^\$/', '', $name));
- } else {
- $orig = $this->context->getLastException();
- }
-
- if (!$orig instanceof \Exception) {
- throw new \InvalidArgumentException('throw-up can only throw Exceptions');
- }
-
- throw new ThrowUpException($orig);
- }
-}
diff --git a/vendor/psy/psysh/src/Psy/Compiler.php b/vendor/psy/psysh/src/Psy/Compiler.php
deleted file mode 100644
index 4ec7bf6b..00000000
--- a/vendor/psy/psysh/src/Psy/Compiler.php
+++ /dev/null
@@ -1,163 +0,0 @@
-version = Shell::VERSION;
-
- $phar = new \Phar($pharFile, 0, 'psysh.phar');
- $phar->setSignatureAlgorithm(\Phar::SHA1);
-
- $phar->startBuffering();
-
- $finder = Finder::create()
- ->files()
- ->ignoreVCS(true)
- ->name('*.php')
- ->notName('Compiler.php')
- ->notName('Autoloader.php')
- ->in(__DIR__ . '/..');
-
- foreach ($finder as $file) {
- $this->addFile($phar, $file);
- }
-
- $finder = Finder::create()
- ->files()
- ->ignoreVCS(true)
- ->name('*.php')
- ->exclude('Tests')
- ->exclude('tests')
- ->exclude('Test')
- ->exclude('test')
- ->in(__DIR__ . '/../../build-vendor');
-
- foreach ($finder as $file) {
- $this->addFile($phar, $file);
- }
-
- // Stubs
- $phar->setStub($this->getStub());
-
- $phar->stopBuffering();
-
- unset($phar);
- }
-
- /**
- * Add a file to the psysh Phar.
- *
- * @param \Phar $phar
- * @param \SplFileInfo $file
- * @param bool $strip (default: true)
- */
- private function addFile($phar, $file, $strip = true)
- {
- $path = str_replace(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR, '', $file->getRealPath());
-
- $content = file_get_contents($file);
- if ($strip) {
- $content = $this->stripWhitespace($content);
- } elseif ('LICENSE' === basename($file)) {
- $content = "\n" . $content . "\n";
- }
-
- $phar->addFromString($path, $content);
- }
-
- /**
- * Removes whitespace from a PHP source string while preserving line numbers.
- *
- * @param string $source A PHP string
- *
- * @return string The PHP string with the whitespace removed
- */
- private function stripWhitespace($source)
- {
- if (!function_exists('token_get_all')) {
- return $source;
- }
-
- $output = '';
- foreach (token_get_all($source) as $token) {
- if (is_string($token)) {
- $output .= $token;
- } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
- $output .= str_repeat("\n", substr_count($token[1], "\n"));
- } elseif (T_WHITESPACE === $token[0]) {
- // reduce wide spaces
- $whitespace = preg_replace('{[ \t]+}', ' ', $token[1]);
- // normalize newlines to \n
- $whitespace = preg_replace('{(?:\r\n|\r|\n)}', "\n", $whitespace);
- // trim leading spaces
- $whitespace = preg_replace('{\n +}', "\n", $whitespace);
- $output .= $whitespace;
- } else {
- $output .= $token[1];
- }
- }
-
- return $output;
- }
-
- private static function getStubLicense()
- {
- $license = file_get_contents(__DIR__ . '/../../LICENSE');
- $license = str_replace('The MIT License (MIT)', '', $license);
- $license = str_replace("\n", "\n * ", trim($license));
-
- return $license;
- }
-
- const STUB_AUTOLOAD = <<<'EOS'
- Phar::mapPhar('psysh.phar');
- require 'phar://psysh.phar/build-vendor/autoload.php';
-EOS;
-
- /**
- * Get a Phar stub for psysh.
- *
- * This is basically the psysh bin, with the autoload require statements swapped out.
- *
- * @return string
- */
- private function getStub()
- {
- $content = file_get_contents(__DIR__ . '/../../bin/psysh');
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- $content = str_replace('#!/usr/bin/env php', '#!/usr/bin/env php -d detect_unicode=Off', $content);
- }
- $content = preg_replace('{/\* <<<.*?>>> \*/}sm', self::STUB_AUTOLOAD, $content);
- $content = preg_replace('/\\(c\\) .*?with this source code./sm', self::getStubLicense(), $content);
-
- $content .= '__HALT_COMPILER();';
-
- return $content;
- }
-}
diff --git a/vendor/psy/psysh/src/Psy/ExecutionLoop/Loop.php b/vendor/psy/psysh/src/Psy/ExecutionLoop/Loop.php
deleted file mode 100644
index 79c31095..00000000
--- a/vendor/psy/psysh/src/Psy/ExecutionLoop/Loop.php
+++ /dev/null
@@ -1,186 +0,0 @@
-getIncludes() as $__psysh_include__) {
- include $__psysh_include__;
- }
- } catch (\Exception $_e) {
- $__psysh__->writeException($_e);
- }
- restore_error_handler();
- unset($__psysh_include__);
-
- extract($__psysh__->getScopeVariables(false));
-
- do {
- $__psysh__->beforeLoop();
- $__psysh__->setScopeVariables(get_defined_vars());
-
- try {
- // read a line, see if we should eval
- $__psysh__->getInput();
-
- // evaluate the current code buffer
- ob_start(
- array($__psysh__, 'writeStdout'),
- version_compare(PHP_VERSION, '5.4', '>=') ? 1 : 2
- );
-
- // Let PsySH inject some magic variables back into the
- // shell scope... things like $__class, and $__file set by
- // reflection commands
- extract($__psysh__->getSpecialScopeVariables(false));
-
- // And unset any magic variables which are no longer needed
- foreach ($__psysh__->getUnusedCommandScopeVariableNames() as $__psysh_var_name__) {
- unset($$__psysh_var_name__, $__psysh_var_name__);
- }
-
- set_error_handler(array($__psysh__, 'handleError'));
- $_ = eval($__psysh__->flushCode() ?: Loop::NOOP_INPUT);
- restore_error_handler();
-
- ob_end_flush();
-
- $__psysh__->writeReturnValue($_);
- } catch (BreakException $_e) {
- restore_error_handler();
- if (ob_get_level() > 0) {
- ob_end_clean();
- }
- $__psysh__->writeException($_e);
-
- return;
- } catch (ThrowUpException $_e) {
- restore_error_handler();
- if (ob_get_level() > 0) {
- ob_end_clean();
- }
- $__psysh__->writeException($_e);
-
- throw $_e;
- } catch (\TypeError $_e) {
- restore_error_handler();
- if (ob_get_level() > 0) {
- ob_end_clean();
- }
- $__psysh__->writeException(TypeErrorException::fromTypeError($_e));
- } catch (\Error $_e) {
- restore_error_handler();
- if (ob_get_level() > 0) {
- ob_end_clean();
- }
- $__psysh__->writeException(ErrorException::fromError($_e));
- } catch (\Exception $_e) {
- restore_error_handler();
- if (ob_get_level() > 0) {
- ob_end_clean();
- }
- $__psysh__->writeException($_e);
- }
-
- $__psysh__->afterLoop();
- } while (true);
- };
-
- // bind the closure to $this from the shell scope variables...
- if (self::bindLoop()) {
- $that = $shell->getBoundObject();
- if (is_object($that)) {
- $loop = $loop->bindTo($that, get_class($that));
- } else {
- $loop = $loop->bindTo(null, null);
- }
- }
-
- $loop($shell);
- }
-
- /**
- * A beforeLoop callback.
- *
- * This is executed at the start of each loop iteration. In the default
- * (non-forking) loop implementation, this is a no-op.
- */
- public function beforeLoop()
- {
- // no-op
- }
-
- /**
- * A afterLoop callback.
- *
- * This is executed at the end of each loop iteration. In the default
- * (non-forking) loop implementation, this is a no-op.
- */
- public function afterLoop()
- {
- // no-op
- }
-
- /**
- * Decide whether to bind the execution loop.
- *
- * @return bool
- */
- protected static function bindLoop()
- {
- // skip binding on HHVM <= 3.5.0
- // see https://github.com/facebook/hhvm/issues/1203
- if (defined('HHVM_VERSION')) {
- return version_compare(HHVM_VERSION, '3.5.0', '>=');
- }
-
- return version_compare(PHP_VERSION, '5.4', '>=');
- }
-}
diff --git a/vendor/psy/psysh/src/Psy/Readline/GNUReadline.php b/vendor/psy/psysh/src/Readline/GNUReadline.php
similarity index 99%
rename from vendor/psy/psysh/src/Psy/Readline/GNUReadline.php
rename to vendor/psy/psysh/src/Readline/GNUReadline.php
index 859b4228..e1041220 100644
--- a/vendor/psy/psysh/src/Psy/Readline/GNUReadline.php
+++ b/vendor/psy/psysh/src/Readline/GNUReadline.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Readline/HoaConsole.php b/vendor/psy/psysh/src/Readline/HoaConsole.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/Readline/HoaConsole.php
rename to vendor/psy/psysh/src/Readline/HoaConsole.php
index 1ef7ac99..9330d259 100644
--- a/vendor/psy/psysh/src/Psy/Readline/HoaConsole.php
+++ b/vendor/psy/psysh/src/Readline/HoaConsole.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -61,7 +61,7 @@ class HoaConsole implements Readline
public function listHistory()
{
$i = 0;
- $list = array();
+ $list = [];
while (($item = $this->hoaReadline->getHistory($i++)) !== null) {
$list[] = $item;
}
diff --git a/vendor/psy/psysh/src/Psy/Readline/Libedit.php b/vendor/psy/psysh/src/Readline/Libedit.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/Readline/Libedit.php
rename to vendor/psy/psysh/src/Readline/Libedit.php
index 43b31a87..008affea 100644
--- a/vendor/psy/psysh/src/Psy/Readline/Libedit.php
+++ b/vendor/psy/psysh/src/Readline/Libedit.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -39,7 +39,7 @@ class Libedit extends GNUReadline
{
$history = file_get_contents($this->historyFile);
if (!$history) {
- return array();
+ return [];
}
// libedit doesn't seem to support non-unix line separators.
@@ -47,11 +47,11 @@ class Libedit extends GNUReadline
// shift the history signature, ensure it's valid
if (array_shift($history) !== '_HiStOrY_V2_') {
- return array();
+ return [];
}
// decode the line
- $history = array_map(array($this, 'parseHistoryLine'), $history);
+ $history = array_map([$this, 'parseHistoryLine'], $history);
// filter empty lines & comments
return array_values(array_filter($history));
}
diff --git a/vendor/psy/psysh/src/Psy/Readline/Readline.php b/vendor/psy/psysh/src/Readline/Readline.php
similarity index 97%
rename from vendor/psy/psysh/src/Psy/Readline/Readline.php
rename to vendor/psy/psysh/src/Readline/Readline.php
index 487ac81f..6d0cb6e6 100644
--- a/vendor/psy/psysh/src/Psy/Readline/Readline.php
+++ b/vendor/psy/psysh/src/Readline/Readline.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Readline/Transient.php b/vendor/psy/psysh/src/Readline/Transient.php
similarity index 95%
rename from vendor/psy/psysh/src/Psy/Readline/Transient.php
rename to vendor/psy/psysh/src/Readline/Transient.php
index 102eaf78..58518947 100644
--- a/vendor/psy/psysh/src/Psy/Readline/Transient.php
+++ b/vendor/psy/psysh/src/Readline/Transient.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,6 +21,7 @@ class Transient implements Readline
private $history;
private $historySize;
private $eraseDups;
+ private $stdin;
/**
* Transient Readline is always supported.
@@ -38,7 +39,7 @@ class Transient implements Readline
public function __construct($historyFile = null, $historySize = 0, $eraseDups = false)
{
// don't do anything with the history file...
- $this->history = array();
+ $this->history = [];
$this->historySize = $historySize;
$this->eraseDups = $eraseDups;
}
@@ -73,7 +74,7 @@ class Transient implements Readline
*/
public function clearHistory()
{
- $this->history = array();
+ $this->history = [];
return true;
}
diff --git a/vendor/psy/psysh/src/Psy/Reflection/ReflectionConstant.php b/vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php
similarity index 52%
rename from vendor/psy/psysh/src/Psy/Reflection/ReflectionConstant.php
rename to vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php
index 4aa21613..ab686bbe 100644
--- a/vendor/psy/psysh/src/Psy/Reflection/ReflectionConstant.php
+++ b/vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -12,21 +12,21 @@
namespace Psy\Reflection;
/**
- * Somehow the standard reflection library doesn't include constants.
+ * Somehow the standard reflection library didn't include class constants until 7.1.
*
- * ReflectionConstant corrects that omission.
+ * ReflectionClassConstant corrects that omission.
*/
-class ReflectionConstant implements \Reflector
+class ReflectionClassConstant implements \Reflector
{
- private $class;
- private $name;
+ public $class;
+ public $name;
private $value;
/**
- * Construct a ReflectionConstant object.
+ * Construct a ReflectionClassConstant object.
*
- * @param mixed $class
- * @param string $name
+ * @param string|object $class
+ * @param string $name
*/
public function __construct($class, $name)
{
@@ -45,10 +45,33 @@ class ReflectionConstant implements \Reflector
$this->value = $constants[$name];
}
+ /**
+ * Exports a reflection.
+ *
+ * @param string|object $class
+ * @param string $name
+ * @param bool $return pass true to return the export, as opposed to emitting it
+ *
+ * @return null|string
+ */
+ public static function export($class, $name, $return = false)
+ {
+ $refl = new self($class, $name);
+ $value = $refl->getValue();
+
+ $str = sprintf('Constant [ public %s %s ] { %s }', gettype($value), $refl->getName(), $value);
+
+ if ($return) {
+ return $str;
+ }
+
+ echo $str . "\n";
+ }
+
/**
* Gets the declaring class.
*
- * @return string
+ * @return \ReflectionClass
*/
public function getDeclaringClass()
{
@@ -67,6 +90,30 @@ class ReflectionConstant implements \Reflector
return $class;
}
+ /**
+ * Get the constant's docblock.
+ *
+ * @return false
+ */
+ public function getDocComment()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the class constant modifiers.
+ *
+ * Since this is only used for PHP < 7.1, we can just return "public". All
+ * the fancier modifiers are only available on PHP versions which have their
+ * own ReflectionClassConstant class :)
+ *
+ * @return int
+ */
+ public function getModifiers()
+ {
+ return \ReflectionMethod::IS_PUBLIC;
+ }
+
/**
* Gets the constant name.
*
@@ -87,6 +134,46 @@ class ReflectionConstant implements \Reflector
return $this->value;
}
+ /**
+ * Checks if class constant is private.
+ *
+ * @return bool false
+ */
+ public function isPrivate()
+ {
+ return false;
+ }
+
+ /**
+ * Checks if class constant is protected.
+ *
+ * @return bool false
+ */
+ public function isProtected()
+ {
+ return false;
+ }
+
+ /**
+ * Checks if class constant is public.
+ *
+ * @return bool true
+ */
+ public function isPublic()
+ {
+ return true;
+ }
+
+ /**
+ * To string.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->getName();
+ }
+
/**
* Gets the constant's file name.
*
@@ -120,32 +207,22 @@ class ReflectionConstant implements \Reflector
}
/**
- * Get the constant's docblock.
+ * Get a ReflectionClassConstant instance.
*
- * @return false
+ * In PHP >= 7.1, this will return a \ReflectionClassConstant from the
+ * standard reflection library. For older PHP, it will return this polyfill.
+ *
+ * @param string|object $class
+ * @param string $name
+ *
+ * @return ReflectionClassConstant|\ReflectionClassConstant
*/
- public function getDocComment()
+ public static function create($class, $name)
{
- return false;
- }
+ if (class_exists('\\ReflectionClassConstant')) {
+ return new \ReflectionClassConstant($class, $name);
+ }
- /**
- * Export the constant? I don't think this is possible.
- *
- * @throws \RuntimeException
- */
- public static function export()
- {
- throw new \RuntimeException('Not yet implemented because it\'s unclear what I should do here :)');
- }
-
- /**
- * To string.
- *
- * @return string
- */
- public function __toString()
- {
- return $this->getName();
+ return new self($class, $name);
}
}
diff --git a/vendor/psy/psysh/src/Reflection/ReflectionConstant.php b/vendor/psy/psysh/src/Reflection/ReflectionConstant.php
new file mode 100644
index 00000000..7fa9b8a6
--- /dev/null
+++ b/vendor/psy/psysh/src/Reflection/ReflectionConstant.php
@@ -0,0 +1,30 @@
+name = $name;
+
+ if (!defined($name) && !self::isMagicConstant($name)) {
+ throw new \InvalidArgumentException('Unknown constant: ' . $name);
+ }
+
+ if (!self::isMagicConstant($name)) {
+ $this->value = @constant($name);
+ }
+ }
+
+ /**
+ * Exports a reflection.
+ *
+ * @param string $name
+ * @param bool $return pass true to return the export, as opposed to emitting it
+ *
+ * @return null|string
+ */
+ public static function export($name, $return = false)
+ {
+ $refl = new self($name);
+ $value = $refl->getValue();
+
+ $str = sprintf('Constant [ %s %s ] { %s }', gettype($value), $refl->getName(), $value);
+
+ if ($return) {
+ return $str;
+ }
+
+ echo $str . "\n";
+ }
+
+ public static function isMagicConstant($name)
+ {
+ return in_array($name, self::$magicConstants);
+ }
+
+ /**
+ * Get the constant's docblock.
+ *
+ * @return false
+ */
+ public function getDocComment()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the constant name.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Gets the namespace name.
+ *
+ * Returns '' when the constant is not namespaced.
+ *
+ * @return string
+ */
+ public function getNamespaceName()
+ {
+ if (!$this->inNamespace()) {
+ return '';
+ }
+
+ return preg_replace('/\\\\[^\\\\]+$/', '', $this->name);
+ }
+
+ /**
+ * Gets the value of the constant.
+ *
+ * @return mixed
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * Checks if this constant is defined in a namespace.
+ *
+ * @return bool
+ */
+ public function inNamespace()
+ {
+ return strpos($this->name, '\\') !== false;
+ }
+
+ /**
+ * To string.
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->getName();
+ }
+
+ /**
+ * Gets the constant's file name.
+ *
+ * Currently returns null, because if it returns a file name the signature
+ * formatter will barf.
+ */
+ public function getFileName()
+ {
+ return;
+ // return $this->class->getFileName();
+ }
+
+ /**
+ * Get the code start line.
+ *
+ * @throws \RuntimeException
+ */
+ public function getStartLine()
+ {
+ throw new \RuntimeException('Not yet implemented because it\'s unclear what I should do here :)');
+ }
+
+ /**
+ * Get the code end line.
+ *
+ * @throws \RuntimeException
+ */
+ public function getEndLine()
+ {
+ return $this->getStartLine();
+ }
+}
diff --git a/vendor/psy/psysh/src/Psy/Reflection/ReflectionLanguageConstruct.php b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php
similarity index 70%
rename from vendor/psy/psysh/src/Psy/Reflection/ReflectionLanguageConstruct.php
rename to vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php
index defa684b..bda08194 100644
--- a/vendor/psy/psysh/src/Psy/Reflection/ReflectionLanguageConstruct.php
+++ b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,62 +21,62 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract
/**
* Language construct parameter definitions.
*/
- private static $languageConstructs = array(
- 'isset' => array(
- 'var' => array(),
- '...' => array(
+ private static $languageConstructs = [
+ 'isset' => [
+ 'var' => [],
+ '...' => [
'isOptional' => true,
'defaultValue' => null,
- ),
- ),
+ ],
+ ],
- 'unset' => array(
- 'var' => array(),
- '...' => array(
+ 'unset' => [
+ 'var' => [],
+ '...' => [
'isOptional' => true,
'defaultValue' => null,
- ),
- ),
+ ],
+ ],
- 'empty' => array(
- 'var' => array(),
- ),
+ 'empty' => [
+ 'var' => [],
+ ],
- 'echo' => array(
- 'arg1' => array(),
- '...' => array(
+ 'echo' => [
+ 'arg1' => [],
+ '...' => [
'isOptional' => true,
'defaultValue' => null,
- ),
- ),
+ ],
+ ],
- 'print' => array(
- 'arg' => array(),
- ),
+ 'print' => [
+ 'arg' => [],
+ ],
- 'die' => array(
- 'status' => array(
+ 'die' => [
+ 'status' => [
'isOptional' => true,
'defaultValue' => 0,
- ),
- ),
+ ],
+ ],
- 'exit' => array(
- 'status' => array(
+ 'exit' => [
+ 'status' => [
'isOptional' => true,
'defaultValue' => 0,
- ),
- ),
- );
+ ],
+ ],
+ ];
/**
* Construct a ReflectionLanguageConstruct object.
*
- * @param string $name
+ * @param string $keyword
*/
public function __construct($keyword)
{
- if (self::isLanguageConstruct($keyword)) {
+ if (!self::isLanguageConstruct($keyword)) {
throw new \InvalidArgumentException('Unknown language construct: ' . $keyword);
}
@@ -116,11 +116,11 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract
/**
* Get language construct params.
*
- * @return
+ * @return array
*/
public function getParameters()
{
- $params = array();
+ $params = [];
foreach (self::$languageConstructs[$this->keyword] as $parameter => $opts) {
array_push($params, new ReflectionLanguageConstructParameter($this->keyword, $parameter, $opts));
}
@@ -128,6 +128,18 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract
return $params;
}
+ /**
+ * Gets the file name from a language construct.
+ *
+ * (Hint: it always returns false)
+ *
+ * @return bool false
+ */
+ public function getFileName()
+ {
+ return false;
+ }
+
/**
* To string.
*
@@ -141,7 +153,7 @@ class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract
/**
* Check whether keyword is a (known) language construct.
*
- * @param $keyword
+ * @param string $keyword
*
* @return bool
*/
diff --git a/vendor/psy/psysh/src/Psy/Reflection/ReflectionLanguageConstructParameter.php b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php
similarity index 98%
rename from vendor/psy/psysh/src/Psy/Reflection/ReflectionLanguageConstructParameter.php
rename to vendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php
index 7d1b0dbd..af1f4cb4 100644
--- a/vendor/psy/psysh/src/Psy/Reflection/ReflectionLanguageConstructParameter.php
+++ b/vendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Shell.php b/vendor/psy/psysh/src/Shell.php
similarity index 68%
rename from vendor/psy/psysh/src/Psy/Shell.php
rename to vendor/psy/psysh/src/Shell.php
index e002bee1..3fe0b761 100644
--- a/vendor/psy/psysh/src/Psy/Shell.php
+++ b/vendor/psy/psysh/src/Shell.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -16,6 +16,9 @@ use Psy\Exception\BreakException;
use Psy\Exception\ErrorException;
use Psy\Exception\Exception as PsyException;
use Psy\Exception\ThrowUpException;
+use Psy\Exception\TypeErrorException;
+use Psy\ExecutionLoop\ProcessForker;
+use Psy\ExecutionLoop\RunkitReloader;
use Psy\Input\ShellInput;
use Psy\Input\SilentInput;
use Psy\Output\ShellOutput;
@@ -44,7 +47,7 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
class Shell extends Application
{
- const VERSION = 'v0.8.17';
+ const VERSION = 'v0.9.6';
const PROMPT = '>>> ';
const BUFF_PROMPT = '... ';
@@ -59,14 +62,17 @@ class Shell extends Application
private $code;
private $codeBuffer;
private $codeBufferOpen;
+ private $codeStack;
+ private $stdoutBuffer;
private $context;
private $includes;
private $loop;
private $outputWantsNewline = false;
- private $completion;
- private $tabCompletionMatchers = array();
- private $stdoutBuffer;
private $prompt;
+ private $loopListeners;
+ private $autoCompleter;
+ private $matchers = [];
+ private $commandsMatcher;
/**
* Create a new Psy Shell.
@@ -75,14 +81,16 @@ class Shell extends Application
*/
public function __construct(Configuration $config = null)
{
- $this->config = $config ?: new Configuration();
- $this->cleaner = $this->config->getCodeCleaner();
- $this->loop = $this->config->getLoop();
- $this->context = new Context();
- $this->includes = array();
- $this->readline = $this->config->getReadline();
- $this->inputBuffer = array();
- $this->stdoutBuffer = '';
+ $this->config = $config ?: new Configuration();
+ $this->cleaner = $this->config->getCodeCleaner();
+ $this->loop = new ExecutionLoop();
+ $this->context = new Context();
+ $this->includes = [];
+ $this->readline = $this->config->getReadline();
+ $this->inputBuffer = [];
+ $this->codeStack = [];
+ $this->stdoutBuffer = '';
+ $this->loopListeners = $this->getDefaultLoopListeners();
parent::__construct('Psy Shell', self::VERSION);
@@ -101,7 +109,7 @@ class Shell extends Application
public static function isIncluded(array $trace)
{
return isset($trace[0]['function']) &&
- in_array($trace[0]['function'], array('require', 'include', 'require_once', 'include_once'));
+ in_array($trace[0]['function'], ['require', 'include', 'require_once', 'include_once']);
}
/**
@@ -110,14 +118,14 @@ class Shell extends Application
* @see Psy\debug
* @deprecated will be removed in 1.0. Use \Psy\debug instead
*
- * @param array $vars Scope variables from the calling context (default: array())
- * @param object $boundObject Bound object ($this) value for the shell
+ * @param array $vars Scope variables from the calling context (default: array())
+ * @param object|string $bindTo Bound object ($this) or class (self) value for the shell
*
* @return array Scope variables from the debugger session
*/
- public static function debug(array $vars = array(), $boundObject = null)
+ public static function debug(array $vars = [], $bindTo = null)
{
- return \Psy\debug($vars, $boundObject);
+ return \Psy\debug($vars, $bindTo);
}
/**
@@ -139,6 +147,10 @@ class Shell extends Application
if ($ret instanceof PresenterAware) {
$ret->setPresenter($this->config->getPresenter());
}
+
+ if (isset($this->commandsMatcher)) {
+ $this->commandsMatcher->setCommands($this->all());
+ }
}
return $ret;
@@ -151,10 +163,10 @@ class Shell extends Application
*/
protected function getDefaultInputDefinition()
{
- return new InputDefinition(array(
+ return new InputDefinition([
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
- ));
+ ]);
}
/**
@@ -170,7 +182,7 @@ class Shell extends Application
$hist = new Command\HistoryCommand();
$hist->setReadline($this->readline);
- return array(
+ return [
new Command\HelpCommand(),
new Command\ListCommand(),
new Command\DumpCommand(),
@@ -179,6 +191,7 @@ class Shell extends Application
new Command\WtfCommand($this->config->colorMode()),
new Command\WhereamiCommand($this->config->colorMode()),
new Command\ThrowUpCommand(),
+ new Command\TimeitCommand(),
new Command\TraceCommand(),
new Command\BufferCommand(),
new Command\ClearCommand(),
@@ -187,41 +200,85 @@ class Shell extends Application
$sudo,
$hist,
new Command\ExitCommand(),
- );
+ ];
}
/**
* @return array
*/
- protected function getTabCompletionMatchers()
+ protected function getDefaultMatchers()
{
- if (empty($this->tabCompletionMatchers)) {
- $this->tabCompletionMatchers = array(
- new Matcher\CommandsMatcher($this->all()),
- new Matcher\KeywordsMatcher(),
- new Matcher\VariablesMatcher(),
- new Matcher\ConstantsMatcher(),
- new Matcher\FunctionsMatcher(),
- new Matcher\ClassNamesMatcher(),
- new Matcher\ClassMethodsMatcher(),
- new Matcher\ClassAttributesMatcher(),
- new Matcher\ObjectMethodsMatcher(),
- new Matcher\ObjectAttributesMatcher(),
- new Matcher\ClassMethodDefaultParametersMatcher(),
- new Matcher\ObjectMethodDefaultParametersMatcher(),
- new Matcher\FunctionDefaultParametersMatcher(),
- );
- }
+ // Store the Commands Matcher for later. If more commands are added,
+ // we'll update the Commands Matcher too.
+ $this->commandsMatcher = new Matcher\CommandsMatcher($this->all());
- return $this->tabCompletionMatchers;
+ return [
+ $this->commandsMatcher,
+ new Matcher\KeywordsMatcher(),
+ new Matcher\VariablesMatcher(),
+ new Matcher\ConstantsMatcher(),
+ new Matcher\FunctionsMatcher(),
+ new Matcher\ClassNamesMatcher(),
+ new Matcher\ClassMethodsMatcher(),
+ new Matcher\ClassAttributesMatcher(),
+ new Matcher\ObjectMethodsMatcher(),
+ new Matcher\ObjectAttributesMatcher(),
+ new Matcher\ClassMethodDefaultParametersMatcher(),
+ new Matcher\ObjectMethodDefaultParametersMatcher(),
+ new Matcher\FunctionDefaultParametersMatcher(),
+ ];
}
/**
+ * @deprecated Nothing should use this anymore
+ */
+ protected function getTabCompletionMatchers()
+ {
+ @trigger_error('getTabCompletionMatchers is no longer used', E_USER_DEPRECATED);
+ }
+
+ /**
+ * Gets the default command loop listeners.
+ *
+ * @return array An array of Execution Loop Listener instances
+ */
+ protected function getDefaultLoopListeners()
+ {
+ $listeners = [];
+
+ if (ProcessForker::isSupported() && $this->config->usePcntl()) {
+ $listeners[] = new ProcessForker();
+ }
+
+ if (RunkitReloader::isSupported()) {
+ $listeners[] = new RunkitReloader();
+ }
+
+ return $listeners;
+ }
+
+ /**
+ * Add tab completion matchers.
+ *
+ * @param array $matchers
+ */
+ public function addMatchers(array $matchers)
+ {
+ $this->matchers = array_merge($this->matchers, $matchers);
+
+ if (isset($this->autoCompleter)) {
+ $this->addMatchersToAutoCompleter($matchers);
+ }
+ }
+
+ /**
+ * @deprecated Call `addMatchers` instead
+ *
* @param array $matchers
*/
public function addTabCompletionMatchers(array $matchers)
{
- $this->tabCompletionMatchers = array_merge($matchers, $this->getTabCompletionMatchers());
+ $this->addMatchers($matchers);
}
/**
@@ -247,7 +304,7 @@ class Shell extends Application
$this->initializeTabCompletion();
if ($input === null && !isset($_SERVER['argv'])) {
- $input = new ArgvInput(array());
+ $input = new ArgvInput([]);
}
if ($output === null) {
@@ -259,6 +316,8 @@ class Shell extends Application
} catch (\Exception $e) {
$this->writeException($e);
}
+
+ return 1;
}
/**
@@ -282,18 +341,19 @@ class Shell extends Application
$this->readline->readHistory();
- // if ($this->config->useReadline()) {
- // readline_completion_function(array($this, 'autocomplete'));
- // }
-
$this->output->writeln($this->getHeader());
$this->writeVersionInfo();
$this->writeStartupMessage();
try {
+ $this->beforeRun();
$this->loop->run($this);
+ $this->afterRun();
} catch (ThrowUpException $e) {
throw $e->getPrevious();
+ } catch (BreakException $e) {
+ // The ProcessForker throws a BreakException to finish the main thread.
+ return;
}
}
@@ -332,12 +392,15 @@ class Shell extends Application
}
// handle empty input
- if (trim($input) === '') {
+ if (trim($input) === '' && !$this->codeBufferOpen) {
continue;
}
- if ($this->hasCommand($input)) {
- $this->readline->addHistory($input);
+ $input = $this->onInput($input);
+
+ // If the input isn't in an open string or comment, check for commands to run.
+ if ($this->hasCommand($input) && !$this->inputInOpenStringOrComment($input)) {
+ $this->addHistory($input);
$this->runCommand($input);
continue;
@@ -348,23 +411,101 @@ class Shell extends Application
}
/**
- * Pass the beforeLoop callback through to the Loop instance.
+ * Check whether the code buffer (plus current input) is in an open string or comment.
*
- * @see Loop::beforeLoop
+ * @param string $input current line of input
+ *
+ * @return bool true if the input is in an open string or comment
*/
- public function beforeLoop()
+ private function inputInOpenStringOrComment($input)
{
- $this->loop->beforeLoop();
+ if (!$this->hasCode()) {
+ return;
+ }
+
+ $code = $this->codeBuffer;
+ array_push($code, $input);
+ $tokens = @token_get_all('loopListeners as $listener) {
+ $listener->beforeRun($this);
+ }
+ }
+
+ /**
+ * Run execution loop listeners at the start of each loop.
+ */
+ public function beforeLoop()
+ {
+ foreach ($this->loopListeners as $listener) {
+ $listener->beforeLoop($this);
+ }
+ }
+
+ /**
+ * Run execution loop listeners on user input.
*
- * @see Loop::afterLoop
+ * @param string $input
+ *
+ * @return string
+ */
+ public function onInput($input)
+ {
+ foreach ($this->loopListeners as $listeners) {
+ if (($return = $listeners->onInput($this, $input)) !== null) {
+ $input = $return;
+ }
+ }
+
+ return $input;
+ }
+
+ /**
+ * Run execution loop listeners on code to be executed.
+ *
+ * @param string $code
+ *
+ * @return string
+ */
+ public function onExecute($code)
+ {
+ foreach ($this->loopListeners as $listener) {
+ if (($return = $listener->onExecute($this, $code)) !== null) {
+ $code = $return;
+ }
+ }
+
+ return $code;
+ }
+
+ /**
+ * Run execution loop listeners after each loop.
*/
public function afterLoop()
{
- $this->loop->afterLoop();
+ foreach ($this->loopListeners as $listener) {
+ $listener->afterLoop($this);
+ }
+ }
+
+ /**
+ * Run execution loop listers after the shell session.
+ */
+ protected function afterRun()
+ {
+ foreach ($this->loopListeners as $listener) {
+ $listener->afterRun($this);
+ }
}
/**
@@ -469,12 +610,32 @@ class Shell extends Application
return $this->context->getBoundObject();
}
+ /**
+ * Set the bound class (self) for the interactive shell.
+ *
+ * @param string|null $boundClass
+ */
+ public function setBoundClass($boundClass)
+ {
+ $this->context->setBoundClass($boundClass);
+ }
+
+ /**
+ * Get the bound class (self) for the interactive shell.
+ *
+ * @return string|null
+ */
+ public function getBoundClass()
+ {
+ return $this->context->getBoundClass();
+ }
+
/**
* Add includes, to be parsed and executed before running the interactive shell.
*
* @param array $includes
*/
- public function setIncludes(array $includes = array())
+ public function setIncludes(array $includes = [])
{
$this->includes = $includes;
}
@@ -515,8 +676,9 @@ class Shell extends Application
* Add code to the code buffer.
*
* @param string $code
+ * @param bool $silent
*/
- public function addCode($code)
+ public function addCode($code, $silent = false)
{
try {
// Code lines ending in \ keep the buffer open
@@ -527,7 +689,7 @@ class Shell extends Application
$this->codeBufferOpen = false;
}
- $this->codeBuffer[] = $code;
+ $this->codeBuffer[] = $silent ? new SilentInput($code) : $code;
$this->code = $this->cleaner->clean($this->codeBuffer, $this->config->requireSemicolons());
} catch (\Exception $e) {
// Add failed code blocks to the readline history.
@@ -537,6 +699,44 @@ class Shell extends Application
}
}
+ /**
+ * Set the code buffer.
+ *
+ * This is mostly used by `Shell::execute`. Any existing code in the input
+ * buffer is pushed onto a stack and will come back after this new code is
+ * executed.
+ *
+ * @throws \InvalidArgumentException if $code isn't a complete statement
+ *
+ * @param string $code
+ * @param bool $silent
+ */
+ private function setCode($code, $silent = false)
+ {
+ if ($this->hasCode()) {
+ $this->codeStack[] = [$this->codeBuffer, $this->codeBufferOpen, $this->code];
+ }
+
+ $this->resetCodeBuffer();
+ try {
+ $this->addCode($code, $silent);
+ } catch (\Throwable $e) {
+ $this->popCodeStack();
+
+ throw $e;
+ } catch (\Exception $e) {
+ $this->popCodeStack();
+
+ throw $e;
+ }
+
+ if (!$this->hasValidCode()) {
+ $this->popCodeStack();
+
+ throw new \InvalidArgumentException('Unexpected end of input');
+ }
+ }
+
/**
* Get the current code buffer.
*
@@ -568,7 +768,7 @@ class Shell extends Application
$input = new ShellInput(str_replace('\\', '\\\\', rtrim($input, " \t\n\r\0\x0B;")));
- if ($input->hasParameterOption(array('--help', '-h'))) {
+ if ($input->hasParameterOption(['--help', '-h'])) {
$helpCommand = $this->get('help');
$helpCommand->setCommand($command);
@@ -586,7 +786,7 @@ class Shell extends Application
*/
public function resetCodeBuffer()
{
- $this->codeBuffer = array();
+ $this->codeBuffer = [];
$this->code = false;
}
@@ -618,12 +818,54 @@ class Shell extends Application
if ($this->hasValidCode()) {
$this->addCodeBufferToHistory();
$code = $this->code;
- $this->resetCodeBuffer();
+ $this->popCodeStack();
return $code;
}
}
+ /**
+ * Reset the code buffer and restore any code pushed during `execute` calls.
+ */
+ private function popCodeStack()
+ {
+ $this->resetCodeBuffer();
+
+ if (empty($this->codeStack)) {
+ return;
+ }
+
+ list($codeBuffer, $codeBufferOpen, $code) = array_pop($this->codeStack);
+
+ $this->codeBuffer = $codeBuffer;
+ $this->codeBufferOpen = $codeBufferOpen;
+ $this->code = $code;
+ }
+
+ /**
+ * (Possibly) add a line to the readline history.
+ *
+ * Like Bash, if the line starts with a space character, it will be omitted
+ * from history. Note that an entire block multi-line code input will be
+ * omitted iff the first line begins with a space.
+ *
+ * Additionally, if a line is "silent", i.e. it was initially added with the
+ * silent flag, it will also be omitted.
+ *
+ * @param string|SilentInput $line
+ */
+ private function addHistory($line)
+ {
+ if ($line instanceof SilentInput) {
+ return;
+ }
+
+ // Skip empty lines and lines starting with a space
+ if (trim($line) !== '' && substr($line, 0, 1) !== ' ') {
+ $this->readline->addHistory($line);
+ }
+ }
+
/**
* Filter silent input from code buffer, write the rest to readline history.
*/
@@ -633,11 +875,7 @@ class Shell extends Application
return !$line instanceof SilentInput;
});
- $code = implode("\n", $codeBuffer);
-
- if (trim($code) !== '') {
- $this->readline->addHistory($code);
- }
+ $this->addHistory(implode("\n", $codeBuffer));
}
/**
@@ -664,10 +902,7 @@ class Shell extends Application
*/
public function writeStdout($out, $phase = PHP_OUTPUT_HANDLER_END)
{
- $isCleaning = false;
- if (version_compare(PHP_VERSION, '5.4', '>=')) {
- $isCleaning = $phase & PHP_OUTPUT_HANDLER_CLEAN;
- }
+ $isCleaning = $phase & PHP_OUTPUT_HANDLER_CLEAN;
// Incremental flush
if ($out !== '' && !$isCleaning) {
@@ -723,8 +958,7 @@ class Shell extends Application
*
* Stores $e as the last Exception in the Shell Context.
*
- * @param \Exception $e An exception instance
- * @param OutputInterface $output An OutputInterface instance
+ * @param \Exception $e An exception instance
*/
public function writeException(\Exception $e)
{
@@ -753,6 +987,14 @@ class Shell extends Application
}
}
+ $message = preg_replace(
+ "#(\\w:)?(/\\w+)*/src/Execution(?:Loop)?Closure.php\(\d+\) : eval\(\)'d code#",
+ "eval()'d code",
+ str_replace('\\', '/', $message)
+ );
+
+ $message = str_replace(" in eval()'d code", ' in Psy Shell code', $message);
+
$severity = ($e instanceof \ErrorException) ? $this->getSeverity($e) : 'error';
return sprintf('<%s>%s%s>', $severity, OutputFormatter::escape($message), $severity);
@@ -788,6 +1030,34 @@ class Shell extends Application
}
}
+ /**
+ * Execute code in the shell execution context.
+ *
+ * @param string $code
+ * @param bool $throwExceptions
+ *
+ * @return mixed
+ */
+ public function execute($code, $throwExceptions = false)
+ {
+ $this->setCode($code, true);
+ $closure = new ExecutionClosure($this);
+
+ if ($throwExceptions) {
+ return $closure->execute();
+ }
+
+ try {
+ return $closure->execute();
+ } catch (\TypeError $_e) {
+ $this->writeException(TypeErrorException::fromTypeError($_e));
+ } catch (\Error $_e) {
+ $this->writeException(ErrorException::fromError($_e));
+ } catch (\Exception $_e) {
+ $this->writeException($_e);
+ }
+ }
+
/**
* Helper for throwing an ErrorException.
*
@@ -862,9 +1132,8 @@ class Shell extends Application
*/
protected function hasCommand($input)
{
- $input = new StringInput($input);
- if ($name = $input->getFirstArgument()) {
- return $this->has($name);
+ if (preg_match('/([^\s]+?)(?:\s|$)/A', ltrim($input), $match)) {
+ return $this->has($match[1]);
}
return false;
@@ -952,28 +1221,11 @@ class Shell extends Application
}
/**
- * Autocomplete variable names.
- *
- * This is used by `readline` for tab completion.
- *
- * @param string $text
- *
- * @return mixed Array possible completions for the given input, if any
+ * @deprecated Tab completion is provided by the AutoCompleter service
*/
protected function autocomplete($text)
{
- $info = readline_info();
- // $line = substr($info['line_buffer'], 0, $info['end']);
-
- // Check whether there's a command for this
- // $words = explode(' ', $line);
- // $firstWord = reset($words);
-
- // check whether this is a variable...
- $firstChar = substr($info['line_buffer'], max(0, $info['end'] - strlen($text) - 1), 1);
- if ($firstChar === '$') {
- return $this->getScopeVariableNames();
- }
+ @trigger_error('Tab completion is provided by the AutoCompleter service', E_USER_DEPRECATED);
}
/**
@@ -984,17 +1236,32 @@ class Shell extends Application
*/
protected function initializeTabCompletion()
{
- // auto completer needs shell to be linked to configuration because of the context aware matchers
- if ($this->config->getTabCompletion()) {
- $this->completion = $this->config->getAutoCompleter();
- $this->addTabCompletionMatchers($this->config->getTabCompletionMatchers());
- foreach ($this->getTabCompletionMatchers() as $matcher) {
- if ($matcher instanceof ContextAware) {
- $matcher->setContext($this->context);
- }
- $this->completion->addMatcher($matcher);
+ if (!$this->config->useTabCompletion()) {
+ return;
+ }
+
+ $this->autoCompleter = $this->config->getAutoCompleter();
+
+ // auto completer needs shell to be linked to configuration because of
+ // the context aware matchers
+ $this->addMatchersToAutoCompleter($this->getDefaultMatchers());
+ $this->addMatchersToAutoCompleter($this->matchers);
+
+ $this->autoCompleter->activate();
+ }
+
+ /**
+ * Add matchers to the auto completer, setting context if needed.
+ *
+ * @param array $matchers
+ */
+ private function addMatchersToAutoCompleter(array $matchers)
+ {
+ foreach ($matchers as $matcher) {
+ if ($matcher instanceof ContextAware) {
+ $matcher->setContext($this->context);
}
- $this->completion->activate();
+ $this->autoCompleter->addMatcher($matcher);
}
}
diff --git a/vendor/psy/psysh/src/Psy/Sudo.php b/vendor/psy/psysh/src/Sudo.php
similarity index 99%
rename from vendor/psy/psysh/src/Psy/Sudo.php
rename to vendor/psy/psysh/src/Sudo.php
index 2ba55728..3c085239 100644
--- a/vendor/psy/psysh/src/Psy/Sudo.php
+++ b/vendor/psy/psysh/src/Sudo.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/Sudo/SudoVisitor.php b/vendor/psy/psysh/src/Sudo/SudoVisitor.php
similarity index 64%
rename from vendor/psy/psysh/src/Psy/Sudo/SudoVisitor.php
rename to vendor/psy/psysh/src/Sudo/SudoVisitor.php
index 77ed7e02..31fe6bfb 100644
--- a/vendor/psy/psysh/src/Psy/Sudo/SudoVisitor.php
+++ b/vendor/psy/psysh/src/Sudo/SudoVisitor.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -19,6 +19,8 @@ use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\StaticPropertyFetch;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Scalar\String_;
use PhpParser\NodeVisitorAbstract;
@@ -47,60 +49,67 @@ class SudoVisitor extends NodeVisitorAbstract
public function enterNode(Node $node)
{
if ($node instanceof PropertyFetch) {
- $args = array(
+ $name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
+ $args = [
$node->var,
- is_string($node->name) ? new String_($node->name) : $node->name,
- );
+ is_string($name) ? new String_($name) : $name,
+ ];
return $this->prepareCall(self::PROPERTY_FETCH, $args);
} elseif ($node instanceof Assign && $node->var instanceof PropertyFetch) {
$target = $node->var;
- $args = array(
+ $name = $target->name instanceof Identifier ? $target->name->toString() : $target->name;
+ $args = [
$target->var,
- is_string($target->name) ? new String_($target->name) : $target->name,
+ is_string($name) ? new String_($name) : $name,
$node->expr,
- );
+ ];
return $this->prepareCall(self::PROPERTY_ASSIGN, $args);
} elseif ($node instanceof MethodCall) {
+ $name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
$args = $node->args;
- array_unshift($args, new Arg(is_string($node->name) ? new String_($node->name) : $node->name));
+ array_unshift($args, new Arg(is_string($name) ? new String_($name) : $name));
array_unshift($args, new Arg($node->var));
// not using prepareCall because the $node->args we started with are already Arg instances
return new StaticCall(new FullyQualifiedName(self::SUDO_CLASS), self::METHOD_CALL, $args);
} elseif ($node instanceof StaticPropertyFetch) {
- $class = $node->class instanceof Name ? (string) $node->class : $node->class;
- $args = array(
+ $class = $node->class instanceof Name ? $node->class->toString() : $node->class;
+ $name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
+ $args = [
is_string($class) ? new String_($class) : $class,
- is_string($node->name) ? new String_($node->name) : $node->name,
- );
+ is_string($name) ? new String_($name) : $name,
+ ];
return $this->prepareCall(self::STATIC_PROPERTY_FETCH, $args);
} elseif ($node instanceof Assign && $node->var instanceof StaticPropertyFetch) {
$target = $node->var;
- $class = $target->class instanceof Name ? (string) $target->class : $target->class;
- $args = array(
+ $class = $target->class instanceof Name ? $target->class->toString() : $target->class;
+ $name = $target->name instanceof Identifier ? $target->name->toString() : $target->name;
+ $args = [
is_string($class) ? new String_($class) : $class,
- is_string($target->name) ? new String_($target->name) : $target->name,
+ is_string($name) ? new String_($name) : $name,
$node->expr,
- );
+ ];
return $this->prepareCall(self::STATIC_PROPERTY_ASSIGN, $args);
} elseif ($node instanceof StaticCall) {
$args = $node->args;
- $class = $node->class instanceof Name ? (string) $node->class : $node->class;
- array_unshift($args, new Arg(is_string($node->name) ? new String_($node->name) : $node->name));
+ $class = $node->class instanceof Name ? $node->class->toString() : $node->class;
+ $name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
+ array_unshift($args, new Arg(is_string($name) ? new String_($name) : $name));
array_unshift($args, new Arg(is_string($class) ? new String_($class) : $class));
// not using prepareCall because the $node->args we started with are already Arg instances
return new StaticCall(new FullyQualifiedName(self::SUDO_CLASS), self::STATIC_CALL, $args);
} elseif ($node instanceof ClassConstFetch) {
- $class = $node->class instanceof Name ? (string) $node->class : $node->class;
- $args = array(
+ $class = $node->class instanceof Name ? $node->class->toString() : $node->class;
+ $name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
+ $args = [
is_string($class) ? new String_($class) : $class,
- is_string($node->name) ? new String_($node->name) : $node->name,
- );
+ is_string($name) ? new String_($name) : $name,
+ ];
return $this->prepareCall(self::CLASS_CONST_FETCH, $args);
}
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php b/vendor/psy/psysh/src/TabCompletion/AutoCompleter.php
similarity index 87%
rename from vendor/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php
rename to vendor/psy/psysh/src/TabCompletion/AutoCompleter.php
index 86cd1663..8b316445 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/AutoCompleter.php
+++ b/vendor/psy/psysh/src/TabCompletion/AutoCompleter.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -38,7 +38,7 @@ class AutoCompleter
*/
public function activate()
{
- readline_completion_function(array(&$this, 'callback'));
+ readline_completion_function([&$this, 'callback']);
}
/**
@@ -50,7 +50,7 @@ class AutoCompleter
*
* @return array
*/
- public function processCallback($input, $index, $info = array())
+ public function processCallback($input, $index, $info = [])
{
// Some (Windows?) systems provide incomplete `readline_info`, so let's
// try to work around it.
@@ -69,7 +69,7 @@ class AutoCompleter
return !AbstractMatcher::tokenIs($token, AbstractMatcher::T_WHITESPACE);
});
- $matches = array();
+ $matches = [];
foreach ($this->matchers as $matcher) {
if ($matcher->hasMatched($tokens)) {
$matches = array_merge($matcher->getMatches($tokens), $matches);
@@ -78,7 +78,7 @@ class AutoCompleter
$matches = array_unique($matches);
- return !empty($matches) ? $matches : array('');
+ return !empty($matches) ? $matches : [''];
}
/**
@@ -86,8 +86,8 @@ class AutoCompleter
*
* @see processCallback
*
- * @param $input
- * @param $index
+ * @param string $input
+ * @param int $index
*
* @return array
*/
@@ -103,8 +103,6 @@ class AutoCompleter
{
// PHP didn't implement the whole readline API when they first switched
// to libedit. And they still haven't.
- //
- // So this is a thing to make PsySH work on 5.3.x:
if (function_exists('readline_callback_handler_remove')) {
readline_callback_handler_remove();
}
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractContextAwareMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractContextAwareMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php
index ad4d74ff..91816b20 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractContextAwareMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -44,7 +44,7 @@ abstract class AbstractContextAwareMatcher extends AbstractMatcher implements Co
/**
* Get a Context variable by name.
*
- * @param $var Variable name
+ * @param string $var Variable name
*
* @return mixed
*/
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php
similarity index 87%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php
index 3d7b4214..1dc0765a 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,11 +20,11 @@ abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatc
*/
public function getDefaultParameterCompletion(array $reflectionParameters)
{
- $parametersProcessed = array();
+ $parametersProcessed = [];
foreach ($reflectionParameters as $parameter) {
if (!$parameter->isDefaultValueAvailable()) {
- return array();
+ return [];
}
$defaultValue = $this->valueToShortString($parameter->getDefaultValue());
@@ -33,10 +33,10 @@ abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatc
}
if (empty($parametersProcessed)) {
- return array();
+ return [];
}
- return array(implode(', ', $parametersProcessed) . ')');
+ return [implode(', ', $parametersProcessed) . ')'];
}
/**
@@ -54,8 +54,8 @@ abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatc
return json_encode($value);
}
- $chunks = array();
- $chunksSequential = array();
+ $chunks = [];
+ $chunksSequential = [];
$allSequential = true;
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php
index 016c3219..efa9e57e 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/AbstractMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -83,9 +83,13 @@ abstract class AbstractMatcher
{
$class = '';
while (self::hasToken(
- array(self::T_NS_SEPARATOR, self::T_STRING),
+ [self::T_NS_SEPARATOR, self::T_STRING],
$token = array_pop($tokens)
)) {
+ if (self::needCompleteClass($token)) {
+ continue;
+ }
+
$class = $token[1] . $class;
}
@@ -100,7 +104,7 @@ abstract class AbstractMatcher
*
* @return array The matches resulting from the query
*/
- abstract public function getMatches(array $tokens, array $info = array());
+ abstract public function getMatches(array $tokens, array $info = []);
/**
* Check whether $word starts with $prefix.
@@ -167,6 +171,11 @@ abstract class AbstractMatcher
return strpos(self::MISC_OPERATORS, $token) !== false;
}
+ public static function needCompleteClass($token)
+ {
+ return in_array($token[1], ['doc', 'ls', 'show']);
+ }
+
/**
* Check whether $token type is present in $coll.
*
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php
similarity index 88%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php
index 2635b10d..b26df778 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassAttributesMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,7 +24,7 @@ class ClassAttributesMatcher extends AbstractMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
@@ -39,7 +39,7 @@ class ClassAttributesMatcher extends AbstractMatcher
try {
$reflection = new \ReflectionClass($class);
} catch (\ReflectionException $re) {
- return array();
+ return [];
}
$vars = array_merge(
@@ -54,7 +54,10 @@ class ClassAttributesMatcher extends AbstractMatcher
return array_map(
function ($name) use ($class) {
- return $class . '::' . $name;
+ $chunks = explode('\\', $class);
+ $className = array_pop($chunks);
+
+ return $className . '::' . $name;
},
array_filter(
$vars,
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php
similarity index 90%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php
index 9b97e8b2..4e6025bb 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,7 +13,7 @@ namespace Psy\TabCompletion\Matcher;
class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher
{
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$openBracket = array_pop($tokens);
$functionName = array_pop($tokens);
@@ -25,7 +25,7 @@ class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatch
$reflection = new \ReflectionClass($class);
} catch (\ReflectionException $e) {
// In this case the class apparently does not exist, so we can do nothing
- return array();
+ return [];
}
$methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
@@ -36,7 +36,7 @@ class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatch
}
}
- return array();
+ return [];
}
public function hasMatched(array $tokens)
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php
similarity index 78%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php
index fa734fde..2aba6dc1 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassMethodsMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,7 +24,7 @@ class ClassMethodsMatcher extends AbstractMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
@@ -39,17 +39,25 @@ class ClassMethodsMatcher extends AbstractMatcher
try {
$reflection = new \ReflectionClass($class);
} catch (\ReflectionException $re) {
- return array();
+ return [];
+ }
+
+ if (self::needCompleteClass($tokens[1])) {
+ $methods = $reflection->getMethods();
+ } else {
+ $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
}
- $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
$methods = array_map(function (\ReflectionMethod $method) {
return $method->getName();
}, $methods);
return array_map(
function ($name) use ($class) {
- return $class . '::' . $name;
+ $chunks = explode('\\', $class);
+ $className = array_pop($chunks);
+
+ return $className . '::' . $name;
},
array_filter($methods, function ($method) use ($input) {
return AbstractMatcher::startsWith($input, $method);
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassNamesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php
similarity index 75%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassNamesMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php
index aa6be0c6..8c35094f 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ClassNamesMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -23,7 +23,7 @@ class ClassNamesMatcher extends AbstractMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$class = $this->getNamespaceAndClass($tokens);
if (strlen($class) > 0 && $class[0] === '\\') {
@@ -56,18 +56,18 @@ class ClassNamesMatcher extends AbstractMatcher
$token = array_pop($tokens);
$prevToken = array_pop($tokens);
- $blacklistedTokens = array(
+ $blacklistedTokens = [
self::T_INCLUDE, self::T_INCLUDE_ONCE, self::T_REQUIRE, self::T_REQUIRE_ONCE,
- );
+ ];
switch (true) {
- case self::hasToken(array($blacklistedTokens), $token):
- case self::hasToken(array($blacklistedTokens), $prevToken):
+ case self::hasToken([$blacklistedTokens], $token):
+ case self::hasToken([$blacklistedTokens], $prevToken):
case is_string($token) && $token === '$':
return false;
- case self::hasToken(array(self::T_NEW, self::T_OPEN_TAG, self::T_NS_SEPARATOR), $prevToken):
- case self::hasToken(array(self::T_NEW, self::T_OPEN_TAG, self::T_NS_SEPARATOR), $token):
- case self::hasToken(array(self::T_OPEN_TAG, self::T_VARIABLE), $token):
+ case self::hasToken([self::T_NEW, self::T_OPEN_TAG, self::T_NS_SEPARATOR, self::T_STRING], $prevToken):
+ case self::hasToken([self::T_NEW, self::T_OPEN_TAG, self::T_NS_SEPARATOR], $token):
+ case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $token):
case self::isOperator($token):
return true;
}
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/CommandsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php
similarity index 90%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/CommandsMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php
index 330d4dbf..eddcef98 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/CommandsMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,7 +24,7 @@ use Psy\Command\Command;
class CommandsMatcher extends AbstractMatcher
{
/** @var string[] */
- protected $commands = array();
+ protected $commands = [];
/**
* CommandsMatcher constructor.
@@ -43,9 +43,9 @@ class CommandsMatcher extends AbstractMatcher
*/
public function setCommands(array $commands)
{
- $names = array();
+ $names = [];
foreach ($commands as $command) {
- $names = array_merge(array($command->getName()), $names);
+ $names = array_merge([$command->getName()], $names);
$names = array_merge($command->getAliases(), $names);
}
$this->commands = $names;
@@ -84,7 +84,7 @@ class CommandsMatcher extends AbstractMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ConstantsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php
similarity index 86%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ConstantsMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php
index 885941e5..ddd8bcb0 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ConstantsMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -23,7 +23,7 @@ class ConstantsMatcher extends AbstractMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$const = $this->getInput($tokens);
@@ -44,7 +44,7 @@ class ConstantsMatcher extends AbstractMatcher
case self::tokenIs($prevToken, self::T_NEW):
case self::tokenIs($prevToken, self::T_NS_SEPARATOR):
return false;
- case self::hasToken(array(self::T_OPEN_TAG, self::T_STRING), $token):
+ case self::hasToken([self::T_OPEN_TAG, self::T_STRING], $token):
case self::isOperator($token):
return true;
}
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php
similarity index 89%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php
index 47be34b6..14c568e1 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,7 +13,7 @@ namespace Psy\TabCompletion\Matcher;
class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher
{
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
array_pop($tokens); // open bracket
@@ -22,7 +22,7 @@ class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher
try {
$reflection = new \ReflectionFunction($functionName[1]);
} catch (\ReflectionException $e) {
- return array();
+ return [];
}
$parameters = $reflection->getParameters();
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php
similarity index 87%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionsMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php
index aa37f883..8bf16856 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/FunctionsMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -23,7 +23,7 @@ class FunctionsMatcher extends AbstractMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$func = $this->getInput($tokens);
@@ -46,7 +46,7 @@ class FunctionsMatcher extends AbstractMatcher
switch (true) {
case self::tokenIs($prevToken, self::T_NEW):
return false;
- case self::hasToken(array(self::T_OPEN_TAG, self::T_STRING), $token):
+ case self::hasToken([self::T_OPEN_TAG, self::T_STRING], $token):
case self::isOperator($token):
return true;
}
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/KeywordsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php
similarity index 82%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/KeywordsMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php
index 329271cf..b576f82b 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/KeywordsMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,14 +20,14 @@ namespace Psy\TabCompletion\Matcher;
*/
class KeywordsMatcher extends AbstractMatcher
{
- protected $keywords = array(
+ protected $keywords = [
'array', 'clone', 'declare', 'die', 'echo', 'empty', 'eval', 'exit', 'include',
'include_once', 'isset', 'list', 'print', 'require', 'require_once', 'unset',
- );
+ ];
- protected $mandatoryStartKeywords = array(
+ protected $mandatoryStartKeywords = [
'die', 'echo', 'print', 'unset',
- );
+ ];
/**
* Get all (completable) PHP keywords.
@@ -54,7 +54,7 @@ class KeywordsMatcher extends AbstractMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
@@ -72,9 +72,9 @@ class KeywordsMatcher extends AbstractMatcher
$prevToken = array_pop($tokens);
switch (true) {
- case self::hasToken(array(self::T_OPEN_TAG, self::T_VARIABLE), $token):
+ case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $token):
// case is_string($token) && $token === '$':
- case self::hasToken(array(self::T_OPEN_TAG, self::T_VARIABLE), $prevToken) &&
+ case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $prevToken) &&
self::tokenIs($token, self::T_STRING):
case self::isOperator($token):
return true;
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/MongoClientMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/MongoClientMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php
index d08442e7..eb15f15c 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/MongoClientMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -23,7 +23,7 @@ class MongoClientMatcher extends AbstractContextAwareMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
@@ -37,7 +37,7 @@ class MongoClientMatcher extends AbstractContextAwareMatcher
$object = $this->getVariable($objectName);
if (!$object instanceof \MongoClient) {
- return array();
+ return [];
}
$list = $object->listDBs();
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/MongoDatabaseMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php
similarity index 92%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/MongoDatabaseMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php
index 8494067b..26e2337a 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/MongoDatabaseMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -23,7 +23,7 @@ class MongoDatabaseMatcher extends AbstractContextAwareMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
@@ -37,7 +37,7 @@ class MongoDatabaseMatcher extends AbstractContextAwareMatcher
$object = $this->getVariable($objectName);
if (!$object instanceof \MongoDB) {
- return array();
+ return [];
}
return array_filter(
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php
similarity index 90%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php
index 668f3685..bed365a8 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectAttributesMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,7 +26,7 @@ class ObjectAttributesMatcher extends AbstractContextAwareMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
@@ -37,18 +37,18 @@ class ObjectAttributesMatcher extends AbstractContextAwareMatcher
}
$objectToken = array_pop($tokens);
if (!is_array($objectToken)) {
- return array();
+ return [];
}
$objectName = str_replace('$', '', $objectToken[1]);
try {
$object = $this->getVariable($objectName);
} catch (InvalidArgumentException $e) {
- return array();
+ return [];
}
if (!is_object($object)) {
- return array();
+ return [];
}
return array_filter(
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php
similarity index 85%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php
index 69873a0f..cb95ae7e 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,7 +13,7 @@ namespace Psy\TabCompletion\Matcher;
class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher
{
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$openBracket = array_pop($tokens);
$functionName = array_pop($tokens);
@@ -21,7 +21,7 @@ class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatc
$objectToken = array_pop($tokens);
if (!is_array($objectToken)) {
- return array();
+ return [];
}
$objectName = str_replace('$', '', $objectToken[1]);
@@ -29,10 +29,10 @@ class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatc
try {
$object = $this->getVariable($objectName);
$reflection = new \ReflectionObject($object);
- } catch (InvalidArgumentException $e) {
- return array();
+ } catch (\InvalidArgumentException $e) {
+ return [];
} catch (\ReflectionException $e) {
- return array();
+ return [];
}
$methods = $reflection->getMethods();
@@ -43,7 +43,7 @@ class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatc
}
}
- return array();
+ return [];
}
public function hasMatched(array $tokens)
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php
similarity index 91%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php
index dfb1d305..cc45b1d9 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,7 +26,7 @@ class ObjectMethodsMatcher extends AbstractContextAwareMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);
@@ -37,18 +37,18 @@ class ObjectMethodsMatcher extends AbstractContextAwareMatcher
}
$objectToken = array_pop($tokens);
if (!is_array($objectToken)) {
- return array();
+ return [];
}
$objectName = str_replace('$', '', $objectToken[1]);
try {
$object = $this->getVariable($objectName);
} catch (InvalidArgumentException $e) {
- return array();
+ return [];
}
if (!is_object($object)) {
- return array();
+ return [];
}
return array_filter(
diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php b/vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php
similarity index 85%
rename from vendor/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php
rename to vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php
index ee3b27cd..28685259 100644
--- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/VariablesMatcher.php
+++ b/vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -23,7 +23,7 @@ class VariablesMatcher extends AbstractContextAwareMatcher
/**
* {@inheritdoc}
*/
- public function getMatches(array $tokens, array $info = array())
+ public function getMatches(array $tokens, array $info = [])
{
$var = str_replace('$', '', $this->getInput($tokens));
@@ -40,7 +40,7 @@ class VariablesMatcher extends AbstractContextAwareMatcher
$token = array_pop($tokens);
switch (true) {
- case self::hasToken(array(self::T_OPEN_TAG, self::T_VARIABLE), $token):
+ case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $token):
case is_string($token) && $token === '$':
case self::isOperator($token):
return true;
diff --git a/vendor/psy/psysh/src/Psy/Util/Docblock.php b/vendor/psy/psysh/src/Util/Docblock.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/Util/Docblock.php
rename to vendor/psy/psysh/src/Util/Docblock.php
index 381c2b20..c7989471 100644
--- a/vendor/psy/psysh/src/Psy/Util/Docblock.php
+++ b/vendor/psy/psysh/src/Util/Docblock.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -30,11 +30,11 @@ class Docblock
*
* @var array
*/
- public static $vectors = array(
- 'throws' => array('type', 'desc'),
- 'param' => array('type', 'var', 'desc'),
- 'return' => array('type', 'desc'),
- );
+ public static $vectors = [
+ 'throws' => ['type', 'desc'],
+ 'param' => ['type', 'var', 'desc'],
+ 'return' => ['type', 'desc'],
+ ];
protected $reflector;
@@ -85,7 +85,7 @@ class Docblock
protected function setComment($comment)
{
$this->desc = '';
- $this->tags = array();
+ $this->tags = [];
$this->comment = $comment;
$this->parseComment($comment);
@@ -142,15 +142,15 @@ class Docblock
}, $comment);
// Group the lines together by @tags
- $blocks = array();
+ $blocks = [];
$b = -1;
foreach ($comment as $line) {
if (self::isTagged($line)) {
$b++;
- $blocks[] = array();
+ $blocks[] = [];
} elseif ($b === -1) {
$b = 0;
- $blocks[] = array();
+ $blocks[] = [];
}
$blocks[$b][] = $line;
}
@@ -173,7 +173,7 @@ class Docblock
if ($body) {
$parts = preg_split('/\s+/', $body, $count);
} else {
- $parts = array();
+ $parts = [];
}
// Default the trailing values
diff --git a/vendor/psy/psysh/src/Psy/Util/Json.php b/vendor/psy/psysh/src/Util/Json.php
similarity index 76%
rename from vendor/psy/psysh/src/Psy/Util/Json.php
rename to vendor/psy/psysh/src/Util/Json.php
index 352e8456..54ccf313 100644
--- a/vendor/psy/psysh/src/Psy/Util/Json.php
+++ b/vendor/psy/psysh/src/Util/Json.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,9 +26,7 @@ class Json
*/
public static function encode($val, $opt = 0)
{
- if (version_compare(PHP_VERSION, '5.4', '>=')) {
- $opt |= JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
- }
+ $opt |= JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
return json_encode($val, $opt);
}
diff --git a/vendor/psy/psysh/src/Psy/Util/Mirror.php b/vendor/psy/psysh/src/Util/Mirror.php
similarity index 83%
rename from vendor/psy/psysh/src/Psy/Util/Mirror.php
rename to vendor/psy/psysh/src/Util/Mirror.php
index 4a3b061e..862d0bed 100644
--- a/vendor/psy/psysh/src/Psy/Util/Mirror.php
+++ b/vendor/psy/psysh/src/Util/Mirror.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -12,7 +12,8 @@
namespace Psy\Util;
use Psy\Exception\RuntimeException;
-use Psy\Reflection\ReflectionConstant;
+use Psy\Reflection\ReflectionClassConstant;
+use Psy\Reflection\ReflectionConstant_;
/**
* A utility class for getting Reflectors.
@@ -39,12 +40,16 @@ class Mirror
* @param string $member Optional: property, constant or method name (default: null)
* @param int $filter (default: CONSTANT | METHOD | PROPERTY | STATIC_PROPERTY)
*
- * @return Reflector
+ * @return \Reflector
*/
public static function get($value, $member = null, $filter = 15)
{
- if ($member === null && is_string($value) && function_exists($value)) {
- return new \ReflectionFunction($value);
+ if ($member === null && is_string($value)) {
+ if (function_exists($value)) {
+ return new \ReflectionFunction($value);
+ } elseif (defined($value) || ReflectionConstant_::isMagicConstant($value)) {
+ return new ReflectionConstant_($value);
+ }
}
$class = self::getClass($value);
@@ -52,7 +57,7 @@ class Mirror
if ($member === null) {
return $class;
} elseif ($filter & self::CONSTANT && $class->hasConstant($member)) {
- return new ReflectionConstant($class, $member);
+ return ReflectionClassConstant::create($value, $member);
} elseif ($filter & self::METHOD && $class->hasMethod($member)) {
return $class->getMethod($member);
} elseif ($filter & self::PROPERTY && $class->hasProperty($member)) {
@@ -85,7 +90,7 @@ class Mirror
if (!is_string($value)) {
throw new \InvalidArgumentException('Mirror expects an object or class');
- } elseif (!class_exists($value) && !interface_exists($value) && !(function_exists('trait_exists') && trait_exists($value))) {
+ } elseif (!class_exists($value) && !interface_exists($value) && !trait_exists($value)) {
throw new \InvalidArgumentException('Unknown class or function: ' . $value);
}
diff --git a/vendor/psy/psysh/src/Psy/Util/Str.php b/vendor/psy/psysh/src/Util/Str.php
similarity index 98%
rename from vendor/psy/psysh/src/Psy/Util/Str.php
rename to vendor/psy/psysh/src/Util/Str.php
index e3a34cb7..88c052af 100644
--- a/vendor/psy/psysh/src/Psy/Util/Str.php
+++ b/vendor/psy/psysh/src/Util/Str.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/VarDumper/Cloner.php b/vendor/psy/psysh/src/VarDumper/Cloner.php
similarity index 84%
rename from vendor/psy/psysh/src/Psy/VarDumper/Cloner.php
rename to vendor/psy/psysh/src/VarDumper/Cloner.php
index 4685007b..eb6c65e1 100644
--- a/vendor/psy/psysh/src/Psy/VarDumper/Cloner.php
+++ b/vendor/psy/psysh/src/VarDumper/Cloner.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -37,6 +37,6 @@ class Cloner extends VarCloner
*/
protected function castResource(Stub $stub, $isNested)
{
- return Caster::EXCLUDE_VERBOSE & $this->filter ? array() : parent::castResource($stub, $isNested);
+ return Caster::EXCLUDE_VERBOSE & $this->filter ? [] : parent::castResource($stub, $isNested);
}
}
diff --git a/vendor/psy/psysh/src/Psy/VarDumper/Dumper.php b/vendor/psy/psysh/src/VarDumper/Dumper.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/VarDumper/Dumper.php
rename to vendor/psy/psysh/src/VarDumper/Dumper.php
index 42c8832c..a6e9e875 100644
--- a/vendor/psy/psysh/src/Psy/VarDumper/Dumper.php
+++ b/vendor/psy/psysh/src/VarDumper/Dumper.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -25,7 +25,7 @@ class Dumper extends CliDumper
protected static $onlyControlCharsRx = '/^[\x00-\x1F\x7F]+$/';
protected static $controlCharsRx = '/([\x00-\x1F\x7F]+)/';
- protected static $controlCharsMap = array(
+ protected static $controlCharsMap = [
"\0" => '\0',
"\t" => '\t',
"\n" => '\n',
@@ -33,7 +33,7 @@ class Dumper extends CliDumper
"\f" => '\f',
"\r" => '\r',
"\033" => '\e',
- );
+ ];
public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
{
@@ -64,7 +64,7 @@ class Dumper extends CliDumper
}
}
- protected function style($style, $value, $attr = array())
+ protected function style($style, $value, $attr = [])
{
if ('ref' === $style) {
$value = strtr($value, '@', '#');
diff --git a/vendor/psy/psysh/src/Psy/VarDumper/Presenter.php b/vendor/psy/psysh/src/VarDumper/Presenter.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/VarDumper/Presenter.php
rename to vendor/psy/psysh/src/VarDumper/Presenter.php
index b48ca9dd..400778ab 100644
--- a/vendor/psy/psysh/src/Psy/VarDumper/Presenter.php
+++ b/vendor/psy/psysh/src/VarDumper/Presenter.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,14 +24,14 @@ class Presenter
private $cloner;
private $dumper;
- private $exceptionsImportants = array(
+ private $exceptionsImportants = [
"\0*\0message",
"\0*\0code",
"\0*\0file",
"\0*\0line",
"\0Exception\0previous",
- );
- private $styles = array(
+ ];
+ private $styles = [
'num' => 'number',
'const' => 'const',
'str' => 'string',
@@ -44,7 +44,7 @@ class Presenter
'meta' => 'comment',
'key' => 'comment',
'index' => 'number',
- );
+ ];
public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
{
@@ -59,7 +59,7 @@ class Presenter
setlocale(LC_NUMERIC, $oldLocale);
$this->cloner = new Cloner();
- $this->cloner->addCasters(array('*' => function ($obj, array $a, Stub $stub, $isNested, $filter = 0) {
+ $this->cloner->addCasters(['*' => function ($obj, array $a, Stub $stub, $isNested, $filter = 0) {
if ($filter || $isNested) {
if ($obj instanceof \Exception) {
$a = Caster::filter($a, Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY, $this->exceptionsImportants);
@@ -69,7 +69,7 @@ class Presenter
}
return $a;
- }));
+ }]);
}
/**
diff --git a/vendor/psy/psysh/src/Psy/VarDumper/PresenterAware.php b/vendor/psy/psysh/src/VarDumper/PresenterAware.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/VarDumper/PresenterAware.php
rename to vendor/psy/psysh/src/VarDumper/PresenterAware.php
index 8406b8ae..1645c604 100644
--- a/vendor/psy/psysh/src/Psy/VarDumper/PresenterAware.php
+++ b/vendor/psy/psysh/src/VarDumper/PresenterAware.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/VersionUpdater/Checker.php b/vendor/psy/psysh/src/VersionUpdater/Checker.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/VersionUpdater/Checker.php
rename to vendor/psy/psysh/src/VersionUpdater/Checker.php
index 97763dbd..c4044870 100644
--- a/vendor/psy/psysh/src/Psy/VersionUpdater/Checker.php
+++ b/vendor/psy/psysh/src/VersionUpdater/Checker.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php b/vendor/psy/psysh/src/VersionUpdater/GitHubChecker.php
similarity index 93%
rename from vendor/psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php
rename to vendor/psy/psysh/src/VersionUpdater/GitHubChecker.php
index 5ac6969d..e62a4d27 100644
--- a/vendor/psy/psysh/src/Psy/VersionUpdater/GitHubChecker.php
+++ b/vendor/psy/psysh/src/VersionUpdater/GitHubChecker.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -68,12 +68,12 @@ class GitHubChecker implements Checker
*/
public function fetchLatestRelease()
{
- $context = stream_context_create(array(
- 'http' => array(
+ $context = stream_context_create([
+ 'http' => [
'user_agent' => 'PsySH/' . Shell::VERSION,
'timeout' => 3,
- ),
- ));
+ ],
+ ]);
set_error_handler(function () {
// Just ignore all errors with this. The checker will throw an exception
diff --git a/vendor/psy/psysh/src/Psy/VersionUpdater/IntervalChecker.php b/vendor/psy/psysh/src/VersionUpdater/IntervalChecker.php
similarity index 96%
rename from vendor/psy/psysh/src/Psy/VersionUpdater/IntervalChecker.php
rename to vendor/psy/psysh/src/VersionUpdater/IntervalChecker.php
index 968a2857..712f2758 100644
--- a/vendor/psy/psysh/src/Psy/VersionUpdater/IntervalChecker.php
+++ b/vendor/psy/psysh/src/VersionUpdater/IntervalChecker.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -59,10 +59,10 @@ class IntervalChecker extends GitHubChecker
private function updateCache($release)
{
- $data = array(
+ $data = [
'last_check' => date(DATE_ATOM),
'release' => $release,
- );
+ ];
file_put_contents($this->cacheFile, json_encode($data));
}
diff --git a/vendor/psy/psysh/src/Psy/VersionUpdater/NoopChecker.php b/vendor/psy/psysh/src/VersionUpdater/NoopChecker.php
similarity index 94%
rename from vendor/psy/psysh/src/Psy/VersionUpdater/NoopChecker.php
rename to vendor/psy/psysh/src/VersionUpdater/NoopChecker.php
index 5edbe00d..c5c9bcb4 100644
--- a/vendor/psy/psysh/src/Psy/VersionUpdater/NoopChecker.php
+++ b/vendor/psy/psysh/src/VersionUpdater/NoopChecker.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/src/Psy/functions.php b/vendor/psy/psysh/src/functions.php
similarity index 82%
rename from vendor/psy/psysh/src/Psy/functions.php
rename to vendor/psy/psysh/src/functions.php
index dc77e121..b07c4920 100644
--- a/vendor/psy/psysh/src/Psy/functions.php
+++ b/vendor/psy/psysh/src/functions.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -28,7 +28,7 @@ if (!function_exists('Psy\sh')) {
*/
function sh()
{
- return 'extract(\Psy\debug(get_defined_vars(), isset($this) ? $this : null));';
+ return 'extract(\Psy\debug(get_defined_vars(), isset($this) ? $this : @get_called_class()));';
}
}
@@ -50,9 +50,9 @@ if (!function_exists('Psy\debug')) {
* var_dump($item); // will be whatever you set $item to in Psy Shell
* }
*
- * Optionally, supply an object as the `$boundObject` parameter. This
- * determines the value `$this` will have in the shell, and sets up class
- * scope so that private and protected members are accessible:
+ * Optionally, supply an object as the `$bindTo` parameter. This determines
+ * the value `$this` will have in the shell, and sets up class scope so that
+ * private and protected members are accessible:
*
* class Foo {
* function bar() {
@@ -60,14 +60,22 @@ if (!function_exists('Psy\debug')) {
* }
* }
*
- * This only really works in PHP 5.4+ and HHVM 3.5+, so upgrade already.
+ * For the static equivalent, pass a class name as the `$bindTo` parameter.
+ * This makes `self` work in the shell, and sets up static scope so that
+ * private and protected static members are accessible:
*
- * @param array $vars Scope variables from the calling context (default: array())
- * @param object $boundObject Bound object ($this) value for the shell
+ * class Foo {
+ * static function bar() {
+ * \Psy\debug(get_defined_vars(), get_called_class());
+ * }
+ * }
+ *
+ * @param array $vars Scope variables from the calling context (default: array())
+ * @param object|string $bindTo Bound object ($this) or class (self) value for the shell
*
* @return array Scope variables from the debugger session
*/
- function debug(array $vars = array(), $boundObject = null)
+ function debug(array $vars = [], $bindTo = null)
{
echo PHP_EOL;
@@ -81,8 +89,10 @@ if (!function_exists('Psy\debug')) {
$sh->addInput('whereami -n2', true);
}
- if ($boundObject !== null) {
- $sh->setBoundObject($boundObject);
+ if (is_string($bindTo)) {
+ $sh->setBoundClass($bindTo);
+ } elseif ($bindTo !== null) {
+ $sh->setBoundObject($bindTo);
}
$sh->run();
@@ -126,21 +136,22 @@ if (!function_exists('Psy\info')) {
$config = $lastConfig ?: new Configuration();
- $core = array(
+ $core = [
'PsySH version' => Shell::VERSION,
'PHP version' => PHP_VERSION,
+ 'OS' => PHP_OS,
'default includes' => $config->getDefaultIncludes(),
'require semicolons' => $config->requireSemicolons(),
'error logging level' => $config->errorLoggingLevel(),
- 'config file' => array(
+ 'config file' => [
'default config file' => $prettyPath($config->getConfigFile()),
'local config file' => $prettyPath($config->getLocalConfigFile()),
'PSYSH_CONFIG env' => $prettyPath(getenv('PSYSH_CONFIG')),
- ),
+ ],
// 'config dir' => $config->getConfigDir(),
// 'data dir' => $config->getDataDir(),
// 'runtime dir' => $config->getRuntimeDir(),
- );
+ ];
// Use an explicit, fresh update check here, rather than relying on whatever is in $config.
$checker = new GitHubChecker();
@@ -152,21 +163,21 @@ if (!function_exists('Psy\info')) {
} catch (\Exception $e) {
}
- $updates = array(
+ $updates = [
'update available' => $updateAvailable,
'latest release version' => $latest,
'update check interval' => $config->getUpdateCheck(),
'update cache file' => $prettyPath($config->getUpdateCheckCacheFile()),
- );
+ ];
if ($config->hasReadline()) {
$info = readline_info();
- $readline = array(
+ $readline = [
'readline available' => true,
'readline enabled' => $config->useReadline(),
'readline service' => get_class($config->getReadline()),
- );
+ ];
if (isset($info['library_version'])) {
$readline['readline library'] = $info['library_version'];
@@ -176,31 +187,31 @@ if (!function_exists('Psy\info')) {
$readline['readline name'] = $info['readline_name'];
}
} else {
- $readline = array(
+ $readline = [
'readline available' => false,
- );
+ ];
}
- $pcntl = array(
+ $pcntl = [
'pcntl available' => function_exists('pcntl_signal'),
'posix available' => function_exists('posix_getpid'),
- );
+ ];
$disabledFuncs = array_map('trim', explode(',', ini_get('disable_functions')));
if (in_array('pcntl_signal', $disabledFuncs) || in_array('pcntl_fork', $disabledFuncs)) {
$pcntl['pcntl disabled'] = true;
}
- $history = array(
+ $history = [
'history file' => $prettyPath($config->getHistoryFile()),
'history size' => $config->getHistorySize(),
'erase duplicates' => $config->getEraseDuplicates(),
- );
+ ];
- $docs = array(
+ $docs = [
'manual db file' => $prettyPath($config->getManualDbFile()),
'sqlite available' => true,
- );
+ ];
try {
if ($db = $config->getManualDb()) {
@@ -230,11 +241,21 @@ if (!function_exists('Psy\info')) {
}
}
- $autocomplete = array(
- 'tab completion enabled' => $config->getTabCompletion(),
+ $autocomplete = [
+ 'tab completion enabled' => $config->useTabCompletion(),
'custom matchers' => array_map('get_class', $config->getTabCompletionMatchers()),
'bracketed paste' => $config->useBracketedPaste(),
- );
+ ];
+
+ // Shenanigans, but totally justified.
+ if ($shell = Sudo::fetchProperty($config, 'shell')) {
+ $core['loop listeners'] = array_map('get_class', Sudo::fetchProperty($shell, 'loopListeners'));
+ $core['commands'] = array_map('get_class', $shell->all());
+
+ $autocomplete['custom matchers'] = array_map('get_class', Sudo::fetchProperty($shell, 'matchers'));
+ }
+
+ // @todo Show Presenter / custom casters.
return array_merge($core, compact('updates', 'pcntl', 'readline', 'history', 'docs', 'autocomplete'));
}
@@ -244,7 +265,7 @@ if (!function_exists('Psy\bin')) {
/**
* `psysh` command line executable.
*
- * @return Closure
+ * @return \Closure
*/
function bin()
{
@@ -253,7 +274,7 @@ if (!function_exists('Psy\bin')) {
$input = new ArgvInput();
try {
- $input->bind(new InputDefinition(array(
+ $input->bind(new InputDefinition([
new InputOption('help', 'h', InputOption::VALUE_NONE),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED),
new InputOption('version', 'v', InputOption::VALUE_NONE),
@@ -262,12 +283,12 @@ if (!function_exists('Psy\bin')) {
new InputOption('no-color', null, InputOption::VALUE_NONE),
new InputArgument('include', InputArgument::IS_ARRAY),
- )));
+ ]));
} catch (\RuntimeException $e) {
$usageException = $e;
}
- $config = array();
+ $config = [];
// Handle --config
if ($configFile = $input->getOption('config')) {
@@ -276,7 +297,7 @@ if (!function_exists('Psy\bin')) {
// Handle --color and --no-color
if ($input->getOption('color') && $input->getOption('no-color')) {
- $usageException = new \RuntimeException('Using both "--color" and "--no-color" options is invalid.');
+ $usageException = new \RuntimeException('Using both "--color" and "--no-color" options is invalid');
} elseif ($input->getOption('color')) {
$config['colorMode'] = Configuration::COLOR_MODE_FORCED;
} elseif ($input->getOption('no-color')) {
@@ -323,7 +344,7 @@ EOL;
try {
// And go!
$shell->run();
- } catch (Exception $e) {
+ } catch (\Exception $e) {
echo $e->getMessage() . PHP_EOL;
// @todo this triggers the "exited unexpectedly" logic in the
diff --git a/vendor/psy/psysh/test/ClassWithSecrets.php b/vendor/psy/psysh/test/ClassWithSecrets.php
new file mode 100644
index 00000000..92eaf76d
--- /dev/null
+++ b/vendor/psy/psysh/test/ClassWithSecrets.php
@@ -0,0 +1,37 @@
+setPass(new AbstractClassPass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\FatalErrorException
+ */
+ public function testProcessStatementFails($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidStatements()
+ {
+ return [
+ ['class A { abstract function a(); }'],
+ ['abstract class B { abstract function b() {} }'],
+ ['abstract class B { abstract function b() { echo "yep"; } }'],
+ ];
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessStatementPasses($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ return [
+ ['abstract class C { function c() {} }'],
+ ['abstract class D { abstract function d(); }'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/AssignThisVariablePassTest.php b/vendor/psy/psysh/test/CodeCleaner/AssignThisVariablePassTest.php
similarity index 52%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/AssignThisVariablePassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/AssignThisVariablePassTest.php
index 1a975f4b..1ff15c57 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/AssignThisVariablePassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/AssignThisVariablePassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,16 +11,13 @@
namespace Psy\Test\CodeCleaner;
-use PhpParser\NodeTraverser;
use Psy\CodeCleaner\AssignThisVariablePass;
class AssignThisVariablePassTest extends CodeCleanerTestCase
{
public function setUp()
{
- $this->pass = new AssignThisVariablePass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
+ $this->setPass(new AssignThisVariablePass());
}
/**
@@ -29,16 +26,15 @@ class AssignThisVariablePassTest extends CodeCleanerTestCase
*/
public function testProcessStatementFails($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function invalidStatements()
{
- return array(
- array('$this = 3'),
- array('strtolower($this = "this")'),
- );
+ return [
+ ['$this = 3'],
+ ['strtolower($this = "this")'],
+ ];
}
/**
@@ -46,20 +42,17 @@ class AssignThisVariablePassTest extends CodeCleanerTestCase
*/
public function testProcessStatementPasses($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function validStatements()
{
- return array(
- array('$this'),
- array('$a = $this'),
- array('$a = "this"; $$a = 3'),
- array('$$this = "b"'),
- );
+ return [
+ ['$this'],
+ ['$a = $this'],
+ ['$a = "this"; $$a = 3'],
+ ['$$this = "b"'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/CodeCleaner/CallTimePassByReferencePassTest.php b/vendor/psy/psysh/test/CodeCleaner/CallTimePassByReferencePassTest.php
new file mode 100644
index 00000000..cd321b5d
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/CallTimePassByReferencePassTest.php
@@ -0,0 +1,59 @@
+setPass(new CallTimePassByReferencePass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\FatalErrorException
+ */
+ public function testProcessStatementFails($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidStatements()
+ {
+ return [
+ ['f(&$arg)'],
+ ['$object->method($first, &$arg)'],
+ ['$closure($first, &$arg, $last)'],
+ ['A::b(&$arg)'],
+ ];
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessStatementPasses($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ return [
+ ['array(&$var)'],
+ ['$a = &$b'],
+ ['f(array(&$b))'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/CodeCleaner/CalledClassPassTest.php b/vendor/psy/psysh/test/CodeCleaner/CalledClassPassTest.php
new file mode 100644
index 00000000..c80f257a
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/CalledClassPassTest.php
@@ -0,0 +1,90 @@
+setPass(new CalledClassPass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\ErrorException
+ */
+ public function testProcessStatementFails($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidStatements()
+ {
+ return [
+ ['get_class()'],
+ ['get_class(null)'],
+ ['get_called_class()'],
+ ['get_called_class(null)'],
+ ['function foo() { return get_class(); }'],
+ ['function foo() { return get_class(null); }'],
+ ['function foo() { return get_called_class(); }'],
+ ['function foo() { return get_called_class(null); }'],
+ ];
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessStatementPasses($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ return [
+ ['get_class($foo)'],
+ ['get_class(bar())'],
+ ['get_called_class($foo)'],
+ ['get_called_class(bar())'],
+ ['function foo($bar) { return get_class($bar); }'],
+ ['function foo($bar) { return get_called_class($bar); }'],
+ ['class Foo { function bar() { return get_class(); } }'],
+ ['class Foo { function bar() { return get_class(null); } }'],
+ ['class Foo { function bar() { return get_called_class(); } }'],
+ ['class Foo { function bar() { return get_called_class(null); } }'],
+ ['$foo = function () {}; $foo()'],
+ ];
+ }
+
+ /**
+ * @dataProvider validTraitStatements
+ */
+ public function testProcessTraitStatementPasses($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validTraitStatements()
+ {
+ return [
+ ['trait Foo { function bar() { return get_class(); } }'],
+ ['trait Foo { function bar() { return get_class(null); } }'],
+ ['trait Foo { function bar() { return get_called_class(); } }'],
+ ['trait Foo { function bar() { return get_called_class(null); } }'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/CodeCleaner/CodeCleanerTestCase.php b/vendor/psy/psysh/test/CodeCleaner/CodeCleanerTestCase.php
new file mode 100644
index 00000000..6962c114
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/CodeCleanerTestCase.php
@@ -0,0 +1,41 @@
+pass = null;
+ parent::tearDown();
+ }
+
+ protected function setPass(CodeCleanerPass $pass)
+ {
+ $this->pass = $pass;
+ if (!isset($this->traverser)) {
+ $this->traverser = new NodeTraverser();
+ }
+ $this->traverser->addVisitor($this->pass);
+ }
+
+ protected function parseAndTraverse($code, $prefix = 'traverse($this->parse($code, $prefix));
+ }
+}
diff --git a/vendor/psy/psysh/test/CodeCleaner/ExitPassTest.php b/vendor/psy/psysh/test/CodeCleaner/ExitPassTest.php
new file mode 100644
index 00000000..b22766c7
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/ExitPassTest.php
@@ -0,0 +1,59 @@
+setPass(new ExitPass());
+ }
+
+ /**
+ * @dataProvider dataProviderExitStatement
+ */
+ public function testExitStatement($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ /**
+ * Data provider for testExitStatement.
+ *
+ * @return array
+ */
+ public function dataProviderExitStatement()
+ {
+ return [
+ ['exit;', "{$this->expectedExceptionString};"],
+ ['exit();', "{$this->expectedExceptionString};"],
+ ['die;', "{$this->expectedExceptionString};"],
+ ['exit(die(die));', "{$this->expectedExceptionString};"],
+ ['if (true) { exit; }', "if (true) {\n {$this->expectedExceptionString};\n}"],
+ ['if (false) { exit; }', "if (false) {\n {$this->expectedExceptionString};\n}"],
+ ['1 and exit();', "1 and {$this->expectedExceptionString};"],
+ ['foo() or die', "foo() or {$this->expectedExceptionString};"],
+ ['exit and 1;', "{$this->expectedExceptionString} and 1;"],
+ ['if (exit) { echo $wat; }', "if ({$this->expectedExceptionString}) {\n echo \$wat;\n}"],
+ ['exit or die;', "{$this->expectedExceptionString} or {$this->expectedExceptionString};"],
+ ['switch (die) { }', "switch ({$this->expectedExceptionString}) {\n}"],
+ ['for ($i = 1; $i < 10; die) {}', "for (\$i = 1; \$i < 10; {$this->expectedExceptionString}) {\n}"],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/FinalClassPassTest.php b/vendor/psy/psysh/test/CodeCleaner/FinalClassPassTest.php
similarity index 53%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/FinalClassPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/FinalClassPassTest.php
index 02b892d4..ef6eae66 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/FinalClassPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/FinalClassPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,16 +11,13 @@
namespace Psy\Test\CodeCleaner;
-use PhpParser\NodeTraverser;
use Psy\CodeCleaner\FinalClassPass;
class FinalClassPassTest extends CodeCleanerTestCase
{
public function setUp()
{
- $this->pass = new FinalClassPass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
+ $this->setPass(new FinalClassPass());
}
/**
@@ -29,24 +26,23 @@ class FinalClassPassTest extends CodeCleanerTestCase
*/
public function testProcessStatementFails($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function invalidStatements()
{
- $stmts = array(
- array('final class A {} class B extends A {}'),
- array('class A {} final class B extends A {} class C extends B {}'),
+ $data = [
+ ['final class A {} class B extends A {}'],
+ ['class A {} final class B extends A {} class C extends B {}'],
// array('namespace A { final class B {} } namespace C { class D extends \\A\\B {} }'),
- );
+ ];
if (!defined('HHVM_VERSION')) {
// For some reason Closure isn't final in HHVM?
- $stmts[] = array('class A extends \\Closure {}');
+ $data[] = ['class A extends \\Closure {}'];
}
- return $stmts;
+ return $data;
}
/**
@@ -54,19 +50,16 @@ class FinalClassPassTest extends CodeCleanerTestCase
*/
public function testProcessStatementPasses($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function validStatements()
{
- return array(
- array('class A extends \\stdClass {}'),
- array('final class A extends \\stdClass {}'),
- array('class A {} class B extends A {}'),
- );
+ return [
+ ['class A extends \\stdClass {}'],
+ ['final class A extends \\stdClass {}'],
+ ['class A {} class B extends A {}'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithCallStatic.php b/vendor/psy/psysh/test/CodeCleaner/Fixtures/ClassWithCallStatic.php
similarity index 91%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithCallStatic.php
rename to vendor/psy/psysh/test/CodeCleaner/Fixtures/ClassWithCallStatic.php
index f576ebf6..0c674c0e 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithCallStatic.php
+++ b/vendor/psy/psysh/test/CodeCleaner/Fixtures/ClassWithCallStatic.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithStatic.php b/vendor/psy/psysh/test/CodeCleaner/Fixtures/ClassWithStatic.php
similarity index 91%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithStatic.php
rename to vendor/psy/psysh/test/CodeCleaner/Fixtures/ClassWithStatic.php
index 9686392a..64c64c76 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/Fixtures/ClassWithStatic.php
+++ b/vendor/psy/psysh/test/CodeCleaner/Fixtures/ClassWithStatic.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/FunctionContextPassTest.php b/vendor/psy/psysh/test/CodeCleaner/FunctionContextPassTest.php
similarity index 51%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/FunctionContextPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/FunctionContextPassTest.php
index 2dd89043..851eb228 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/FunctionContextPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/FunctionContextPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,16 +11,13 @@
namespace Psy\Test\CodeCleaner;
-use PhpParser\NodeTraverser;
use Psy\CodeCleaner\FunctionContextPass;
class FunctionContextPassTest extends CodeCleanerTestCase
{
public function setUp()
{
- $this->pass = new FunctionContextPass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
+ $this->setPass(new FunctionContextPass());
}
/**
@@ -28,19 +25,16 @@ class FunctionContextPassTest extends CodeCleanerTestCase
*/
public function testProcessStatementPasses($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function validStatements()
{
- return array(
- array('function foo() { yield; }'),
- array('if (function(){ yield; })'),
- );
+ return [
+ ['function foo() { yield; }'],
+ ['if (function(){ yield; })'],
+ ];
}
/**
@@ -49,19 +43,14 @@ class FunctionContextPassTest extends CodeCleanerTestCase
*/
public function testInvalidYield($code)
{
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- $this->markTestSkipped();
- }
-
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function invalidYieldStatements()
{
- return array(
- array('yield'),
- array('if (yield)'),
- );
+ return [
+ ['yield'],
+ ['if (yield)'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php b/vendor/psy/psysh/test/CodeCleaner/FunctionReturnInWriteContextPassTest.php
similarity index 72%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/FunctionReturnInWriteContextPassTest.php
index 04034951..fb323ab5 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/FunctionReturnInWriteContextPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/FunctionReturnInWriteContextPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,7 +11,6 @@
namespace Psy\Test\CodeCleaner;
-use PhpParser\NodeTraverser;
use Psy\CodeCleaner\FunctionReturnInWriteContextPass;
use Psy\Exception\FatalErrorException;
@@ -19,9 +18,7 @@ class FunctionReturnInWriteContextPassTest extends CodeCleanerTestCase
{
public function setUp()
{
- $this->pass = new FunctionReturnInWriteContextPass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
+ $this->setPass(new FunctionReturnInWriteContextPass());
}
/**
@@ -31,20 +28,19 @@ class FunctionReturnInWriteContextPassTest extends CodeCleanerTestCase
*/
public function testProcessStatementFails($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function invalidStatements()
{
- return array(
- array('f(&g())'),
- array('array(& $object->method())'),
- array('$a->method(& $closure())'),
- array('array(& A::b())'),
- array('f() = 5'),
- array('unset(h())'),
- );
+ return [
+ ['f(&g())'],
+ ['array(& $object->method())'],
+ ['$a->method(& $closure())'],
+ ['array(& A::b())'],
+ ['f() = 5'],
+ ['unset(h())'],
+ ];
}
public function testIsset()
@@ -76,4 +72,20 @@ class FunctionReturnInWriteContextPassTest extends CodeCleanerTestCase
$this->traverser->traverse($this->parse('empty(strtolower("A"))'));
}
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testValidStatements($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ return [
+ ['isset($foo)'],
+ ];
+ }
}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ImplicitReturnPassTest.php b/vendor/psy/psysh/test/CodeCleaner/ImplicitReturnPassTest.php
similarity index 64%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/ImplicitReturnPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/ImplicitReturnPassTest.php
index b9912c39..1c28b4a8 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ImplicitReturnPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/ImplicitReturnPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -30,11 +30,19 @@ class ImplicitReturnPassTest extends CodeCleanerTestCase
public function implicitReturns()
{
- $values = array(
- array('4', 'return 4;'),
- array('foo()', 'return foo();'),
- array('return 1', 'return 1;'),
- );
+ $data = [
+ ['4', 'return 4;'],
+ ['foo()', 'return foo();'],
+ ['return 1', 'return 1;'],
+ ['', 'return new \Psy\CodeCleaner\NoReturnValue();'],
+ ];
+
+ $from = 'echo "foo";';
+ $to = <<<'EOS'
+echo "foo";
+return new \Psy\CodeCleaner\NoReturnValue();
+EOS;
+ $data[] = [$from, $to];
$from = 'if (true) { 1; } elseif (true) { 2; } else { 3; }';
$to = <<<'EOS'
@@ -47,7 +55,7 @@ if (true) {
}
return new \Psy\CodeCleaner\NoReturnValue();
EOS;
- $values[] = array($from, $to);
+ $data[] = [$from, $to];
$from = 'class A {}';
$to = <<<'EOS'
@@ -56,7 +64,7 @@ class A
}
return new \Psy\CodeCleaner\NoReturnValue();
EOS;
- $values[] = array($from, $to);
+ $data[] = [$from, $to];
$from = <<<'EOS'
switch (false) {
@@ -83,14 +91,22 @@ switch (false) {
}
return new \Psy\CodeCleaner\NoReturnValue();
EOS;
- $values[] = array($from, $to);
+ $data[] = [$from, $to];
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- $values[] = array('exit()', 'die;');
- } else {
- $values[] = array('exit()', 'exit;');
- }
+ $from = <<<'EOS'
+namespace Foo {
+ 1 + 1;
+}
+EOS;
+ $to = <<<'EOS'
+namespace Foo;
- return $values;
+return 1 + 1;
+EOS;
+ $data[] = [$from, $to];
+
+ $data[] = ['exit()', 'exit;'];
+
+ return $data;
}
}
diff --git a/vendor/psy/psysh/test/CodeCleaner/InstanceOfPassTest.php b/vendor/psy/psysh/test/CodeCleaner/InstanceOfPassTest.php
new file mode 100644
index 00000000..b8c63313
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/InstanceOfPassTest.php
@@ -0,0 +1,72 @@
+setPass(new InstanceOfPass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\FatalErrorException
+ */
+ public function testProcessInvalidStatement($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidStatements()
+ {
+ return [
+ ['null instanceof stdClass'],
+ ['true instanceof stdClass'],
+ ['9 instanceof stdClass'],
+ ['1.0 instanceof stdClass'],
+ ['"foo" instanceof stdClass'],
+ ['__DIR__ instanceof stdClass'],
+ ['PHP_SAPI instanceof stdClass'],
+ ['1+1 instanceof stdClass'],
+ ['true && false instanceof stdClass'],
+ ['"a"."b" instanceof stdClass'],
+ ['!5 instanceof stdClass'],
+ ];
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessValidStatement($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ $data = [
+ ['$a instanceof stdClass'],
+ ['strtolower("foo") instanceof stdClass'],
+ ['array(1) instanceof stdClass'],
+ ['(string) "foo" instanceof stdClass'],
+ ['(1+1) instanceof stdClass'],
+ ['"foo ${foo} $bar" instanceof stdClass'],
+ ['DateTime::ISO8601 instanceof stdClass'],
+ ];
+
+ return $data;
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/LeavePsyshAlonePassTest.php b/vendor/psy/psysh/test/CodeCleaner/LeavePsyshAlonePassTest.php
similarity index 59%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/LeavePsyshAlonePassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/LeavePsyshAlonePassTest.php
index 10fce3e2..9df633e8 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/LeavePsyshAlonePassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/LeavePsyshAlonePassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,8 +24,6 @@ class LeavePsyshAlonePassTest extends CodeCleanerTestCase
{
$inline = $this->parse('not php at all!', '');
$this->traverse($inline);
-
- // @todo a better thing to assert here?
$this->assertTrue(true);
}
@@ -34,23 +32,20 @@ class LeavePsyshAlonePassTest extends CodeCleanerTestCase
*/
public function testProcessStatementPasses($code)
{
- $stmts = $this->parse($code);
- $this->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function validStatements()
{
- return array(
- array('array_merge()'),
- array('__psysh__()'),
- array('$this'),
- array('$psysh'),
- array('$__psysh'),
- array('$banana'),
- );
+ return [
+ ['array_merge()'],
+ ['__psysh__()'],
+ ['$this'],
+ ['$psysh'],
+ ['$__psysh'],
+ ['$banana'],
+ ];
}
/**
@@ -59,17 +54,16 @@ class LeavePsyshAlonePassTest extends CodeCleanerTestCase
*/
public function testProcessStatementFails($code)
{
- $stmts = $this->parse($code);
- $this->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function invalidStatements()
{
- return array(
- array('$__psysh__'),
- array('var_dump($__psysh__)'),
- array('$__psysh__ = "your mom"'),
- array('$__psysh__->fakeFunctionCall()'),
- );
+ return [
+ ['$__psysh__'],
+ ['var_dump($__psysh__)'],
+ ['$__psysh__ = "your mom"'],
+ ['$__psysh__->fakeFunctionCall()'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/LegacyEmptyPassTest.php b/vendor/psy/psysh/test/CodeCleaner/LegacyEmptyPassTest.php
similarity index 52%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/LegacyEmptyPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/LegacyEmptyPassTest.php
index d4fbd8b7..5afb5759 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/LegacyEmptyPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/LegacyEmptyPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,26 +26,25 @@ class LegacyEmptyPassTest extends CodeCleanerTestCase
*/
public function testProcessInvalidStatement($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function invalidStatements()
{
if (version_compare(PHP_VERSION, '5.5', '>=')) {
- return array(
- array('empty()'),
- );
+ return [
+ ['empty()'],
+ ];
}
- return array(
- array('empty()'),
- array('empty(null)'),
- array('empty(PHP_EOL)'),
- array('empty("wat")'),
- array('empty(1.1)'),
- array('empty(Foo::$bar)'),
- );
+ return [
+ ['empty()'],
+ ['empty(null)'],
+ ['empty(PHP_EOL)'],
+ ['empty("wat")'],
+ ['empty(1.1)'],
+ ['empty(Foo::$bar)'],
+ ];
}
/**
@@ -53,28 +52,25 @@ class LegacyEmptyPassTest extends CodeCleanerTestCase
*/
public function testProcessValidStatement($code)
{
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function validStatements()
{
if (version_compare(PHP_VERSION, '5.5', '<')) {
- return array(
- array('empty($foo)'),
- );
+ return [
+ ['empty($foo)'],
+ ];
}
- return array(
- array('empty($foo)'),
- array('empty(null)'),
- array('empty(PHP_EOL)'),
- array('empty("wat")'),
- array('empty(1.1)'),
- array('empty(Foo::$bar)'),
- );
+ return [
+ ['empty($foo)'],
+ ['empty(null)'],
+ ['empty(PHP_EOL)'],
+ ['empty("wat")'],
+ ['empty(1.1)'],
+ ['empty(Foo::$bar)'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/CodeCleaner/ListPassTest.php b/vendor/psy/psysh/test/CodeCleaner/ListPassTest.php
new file mode 100644
index 00000000..95cf3a74
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/ListPassTest.php
@@ -0,0 +1,104 @@
+setPass(new ListPass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\ParseErrorException
+ */
+ public function testProcessInvalidStatement($code, $expectedMessage)
+ {
+ if (method_exists($this, 'setExpectedException')) {
+ $this->setExpectedException('Psy\Exception\ParseErrorException', $expectedMessage);
+ } else {
+ $this->expectExceptionMessage($expectedMessage);
+ }
+
+ $stmts = $this->parse($code);
+ $this->traverser->traverse($stmts);
+ }
+
+ public function invalidStatements()
+ {
+ // Not typo. It is ambiguous whether "Syntax" or "syntax".
+ $errorShortListAssign = "yntax error, unexpected '='";
+ $errorEmptyList = 'Cannot use empty list';
+ $errorAssocListAssign = 'Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \',\' or \')\'';
+ $errorNonVariableAssign = 'Assignments can only happen to writable values';
+ $errorPhpParserSyntax = 'PHP Parse error: Syntax error, unexpected';
+
+ $invalidExpr = [
+ ['list() = array()', $errorEmptyList],
+ ['list("a") = array(1)', $errorPhpParserSyntax],
+ ];
+
+ if (version_compare(PHP_VERSION, '7.1', '<')) {
+ return array_merge($invalidExpr, [
+ ['list("a" => _) = array("a" => 1)', $errorPhpParserSyntax],
+ ['[] = []', $errorShortListAssign],
+ ['[$a] = [1]', $errorShortListAssign],
+ ['list("a" => $a) = array("a" => 1)', $errorAssocListAssign],
+ ]);
+ }
+
+ return array_merge($invalidExpr, [
+ ['list("a" => _) = array("a" => 1)', $errorPhpParserSyntax],
+ ['["a"] = [1]', $errorNonVariableAssign],
+ ['[] = []', $errorEmptyList],
+ ['[,] = [1,2]', $errorEmptyList],
+ ]);
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessValidStatement($code)
+ {
+ $stmts = $this->parse($code);
+ $this->traverser->traverse($stmts);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ $validExpr = [
+ ['list($a) = array(1)'],
+ ['list($x, $y) = array(1, 2)'],
+ ];
+
+ if (version_compare(PHP_VERSION, '7.1', '>=')) {
+ return array_merge($validExpr, [
+ ['[$a] = array(1)'],
+ ['list($b) = [2]'],
+ ['[$x, $y] = array(1, 2)'],
+ ['[$a] = [1]'],
+ ['[$x, $y] = [1, 2]'],
+ ['["_" => $v] = ["_" => 1]'],
+ ['[$a,] = [1,2,3]'],
+ ['[,$b] = [1,2,3]'],
+ ['[$a,,$c] = [1,2,3]'],
+ ['[$a,,,] = [1,2,3]'],
+ ]);
+ }
+
+ return $validExpr;
+ }
+}
diff --git a/vendor/psy/psysh/test/CodeCleaner/LoopContextPassTest.php b/vendor/psy/psysh/test/CodeCleaner/LoopContextPassTest.php
new file mode 100644
index 00000000..3b363068
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/LoopContextPassTest.php
@@ -0,0 +1,108 @@
+setPass(new LoopContextPass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\FatalErrorException
+ */
+ public function testProcessStatementFails($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidStatements()
+ {
+ return [
+ ['continue'],
+ ['break'],
+ ['if (true) { continue; }'],
+ ['if (true) { break; }'],
+ ['if (false) { continue; }'],
+ ['if (false) { break; }'],
+ ['function foo() { break; }'],
+ ['function foo() { continue; }'],
+
+ // actually enforce break/continue depth argument
+ ['do { break 2; } while (true)'],
+ ['do { continue 2; } while (true)'],
+ ['for ($a; $b; $c) { break 2; }'],
+ ['for ($a; $b; $c) { continue 2; }'],
+ ['foreach ($a as $b) { break 2; }'],
+ ['foreach ($a as $b) { continue 2; }'],
+ ['switch (true) { default: break 2; }'],
+ ['switch (true) { default: continue 2; }'],
+ ['while (true) { break 2; }'],
+ ['while (true) { continue 2; }'],
+
+ // In PHP 5.4+, only positive literal integers are allowed
+ ['while (true) { break $n; }'],
+ ['while (true) { continue $n; }'],
+ ['while (true) { break N; }'],
+ ['while (true) { continue N; }'],
+ ['while (true) { break 0; }'],
+ ['while (true) { continue 0; }'],
+ ['while (true) { break -1; }'],
+ ['while (true) { continue -1; }'],
+ ['while (true) { break 1.0; }'],
+ ['while (true) { continue 1.0; }'],
+ ['while (true) { break 2.0; }'],
+ ['while (true) { continue 2.0; }'],
+
+ // and once with nested loops, just for good measure
+ ['while (true) { while (true) { break 3; } }'],
+ ['while (true) { while (true) { continue 3; } }'],
+ ];
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessStatementPasses($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ return [
+ ['do { break; } while (true)'],
+ ['do { continue; } while (true)'],
+ ['for ($a; $b; $c) { break; }'],
+ ['for ($a; $b; $c) { continue; }'],
+ ['foreach ($a as $b) { break; }'],
+ ['foreach ($a as $b) { continue; }'],
+ ['switch (true) { default: break; }'],
+ ['switch (true) { default: continue; }'],
+ ['while (true) { break; }'],
+ ['while (true) { continue; }'],
+
+ // `break 1` is redundant, but not invalid
+ ['while (true) { break 1; }'],
+ ['while (true) { continue 1; }'],
+
+ // and once with nested loops just for good measure
+ ['while (true) { while (true) { break 2; } }'],
+ ['while (true) { while (true) { continue 2; } }'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/MagicConstantsPassTest.php b/vendor/psy/psysh/test/CodeCleaner/MagicConstantsPassTest.php
similarity index 75%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/MagicConstantsPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/MagicConstantsPassTest.php
index 1f78e12d..321ac6ff 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/MagicConstantsPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/MagicConstantsPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -30,10 +30,10 @@ class MagicConstantsPassTest extends CodeCleanerTestCase
public function magicConstants()
{
- return array(
- array('__DIR__;', 'getcwd();'),
- array('__FILE__;', "'';"),
- array('___FILE___;', '___FILE___;'),
- );
+ return [
+ ['__DIR__;', 'getcwd();'],
+ ['__FILE__;', "'';"],
+ ['___FILE___;', '___FILE___;'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/CodeCleaner/NamespacePassTest.php b/vendor/psy/psysh/test/CodeCleaner/NamespacePassTest.php
new file mode 100644
index 00000000..0c28dc6e
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/NamespacePassTest.php
@@ -0,0 +1,59 @@
+cleaner = new CodeCleaner();
+ $this->setPass(new NamespacePass($this->cleaner));
+ }
+
+ public function testProcess()
+ {
+ $this->parseAndTraverse('');
+ $this->assertNull($this->cleaner->getNamespace());
+
+ $this->parseAndTraverse('array_merge()');
+ $this->assertNull($this->cleaner->getNamespace());
+
+ // A non-block namespace statement should set the current namespace.
+ $this->parseAndTraverse('namespace Alpha');
+ $this->assertSame(['Alpha'], $this->cleaner->getNamespace());
+
+ // A new non-block namespace statement should override the current namespace.
+ $this->parseAndTraverse('namespace Beta; class B {}');
+ $this->assertSame(['Beta'], $this->cleaner->getNamespace());
+
+ // A new block namespace clears out the current namespace...
+ $this->parseAndTraverse('namespace Gamma { array_merge(); }');
+
+ if (defined('PhpParser\\Node\\Stmt\\Namespace_::KIND_SEMICOLON')) {
+ $this->assertNull($this->cleaner->getNamespace());
+ } else {
+ // But not for PHP-Parser < v3.1.2 :(
+ $this->assertSame(['Gamma'], $this->cleaner->getNamespace());
+ }
+
+ $this->parseAndTraverse('namespace Delta');
+
+ // A null namespace clears out the current namespace.
+ $this->parseAndTraverse('namespace { array_merge(); }');
+ $this->assertNull($this->cleaner->getNamespace());
+ }
+}
diff --git a/vendor/psy/psysh/test/CodeCleaner/NoReturnValueTest.php b/vendor/psy/psysh/test/CodeCleaner/NoReturnValueTest.php
new file mode 100644
index 00000000..6a7d009a
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/NoReturnValueTest.php
@@ -0,0 +1,32 @@
+assertSame(
+ $this->prettyPrint($this->parse('new \\Psy\CodeCleaner\\NoReturnValue()')),
+ $this->prettyPrint([$stmt])
+ );
+ }
+}
diff --git a/vendor/psy/psysh/test/CodeCleaner/PassableByReferencePassTest.php b/vendor/psy/psysh/test/CodeCleaner/PassableByReferencePassTest.php
new file mode 100644
index 00000000..a73ad471
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/PassableByReferencePassTest.php
@@ -0,0 +1,104 @@
+setPass(new PassableByReferencePass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\FatalErrorException
+ */
+ public function testProcessStatementFails($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidStatements()
+ {
+ return [
+ ['array_pop(array())'],
+ ['array_pop(array($foo))'],
+ ['array_shift(array())'],
+ ];
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessStatementPasses($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ return [
+ ['array_pop(json_decode("[]"))'],
+ ['array_pop($foo)'],
+ ['array_pop($foo->bar)'],
+ ['array_pop($foo::baz)'],
+ ['array_pop(Foo::qux)'],
+ ];
+ }
+
+ /**
+ * @dataProvider validArrayMultisort
+ */
+ public function testArrayMultisort($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validArrayMultisort()
+ {
+ return [
+ ['array_multisort($a)'],
+ ['array_multisort($a, $b)'],
+ ['array_multisort($a, SORT_NATURAL, $b)'],
+ ['array_multisort($a, SORT_NATURAL | SORT_FLAG_CASE, $b)'],
+ ['array_multisort($a, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $b)'],
+ ['array_multisort($a, SORT_NATURAL | SORT_FLAG_CASE, SORT_ASC, $b)'],
+ ['array_multisort($a, $b, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE)'],
+ ['array_multisort($a, SORT_NATURAL | SORT_FLAG_CASE, $b, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE)'],
+ ['array_multisort($a, 1, $b)'],
+ ['array_multisort($a, 1 + 2, $b)'],
+ ['array_multisort($a, getMultisortFlags(), $b)'],
+ ];
+ }
+
+ /**
+ * @dataProvider invalidArrayMultisort
+ * @expectedException \Psy\Exception\FatalErrorException
+ */
+ public function testInvalidArrayMultisort($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidArrayMultisort()
+ {
+ return [
+ ['array_multisort(1)'],
+ ['array_multisort(array(1, 2, 3))'],
+ ['array_multisort($a, SORT_NATURAL, SORT_ASC, SORT_NATURAL, $b)'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/RequirePassTest.php b/vendor/psy/psysh/test/CodeCleaner/RequirePassTest.php
similarity index 50%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/RequirePassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/RequirePassTest.php
index c7a68f24..0b7b3bc3 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/RequirePassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/RequirePassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -32,32 +32,25 @@ class RequirePassTest extends CodeCleanerTestCase
{
$resolve = '\\Psy\\CodeCleaner\\RequirePass::resolve';
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- return array(
- array('require $foo', "require $resolve(\$foo, 1);"),
- array('$bar = require $baz', "\$bar = (require $resolve(\$baz, 1));"),
- );
- }
-
- return array(
+ return [
// The basics
- array('require "a"', "require $resolve(\"a\", 1);"),
- array('require "b.php"', "require $resolve(\"b.php\", 1);"),
- array('require_once "c"', "require_once $resolve(\"c\", 1);"),
- array('require_once "d.php"', "require_once $resolve(\"d.php\", 1);"),
+ ['require "a"', "require $resolve(\"a\", 1);"],
+ ['require "b.php"', "require $resolve(\"b.php\", 1);"],
+ ['require_once "c"', "require_once $resolve(\"c\", 1);"],
+ ['require_once "d.php"', "require_once $resolve(\"d.php\", 1);"],
// Ensure that line numbers work correctly
- array("null;\nrequire \"e.php\"", "null;\nrequire $resolve(\"e.php\", 2);"),
- array("null;\nrequire_once \"f.php\"", "null;\nrequire_once $resolve(\"f.php\", 2);"),
+ ["null;\nrequire \"e.php\"", "null;\nrequire $resolve(\"e.php\", 2);"],
+ ["null;\nrequire_once \"f.php\"", "null;\nrequire_once $resolve(\"f.php\", 2);"],
// Things with expressions
- array('require $foo', "require $resolve(\$foo, 1);"),
- array('require_once $foo', "require_once $resolve(\$foo, 1);"),
- array('require ($bar = "g.php")', "require $resolve(\$bar = \"g.php\", 1);"),
- array('require_once ($bar = "h.php")', "require_once $resolve(\$bar = \"h.php\", 1);"),
- array('$bar = require ($baz = "i.php")', "\$bar = (require $resolve(\$baz = \"i.php\", 1));"),
- array('$bar = require_once ($baz = "j.php")', "\$bar = (require_once $resolve(\$baz = \"j.php\", 1));"),
- );
+ ['require $foo', "require $resolve(\$foo, 1);"],
+ ['require_once $foo', "require_once $resolve(\$foo, 1);"],
+ ['require ($bar = "g.php")', "require $resolve(\$bar = \"g.php\", 1);"],
+ ['require_once ($bar = "h.php")', "require_once $resolve(\$bar = \"h.php\", 1);"],
+ ['$bar = require ($baz = "i.php")', "\$bar = (require $resolve(\$baz = \"i.php\", 1));"],
+ ['$bar = require_once ($baz = "j.php")', "\$bar = (require_once $resolve(\$baz = \"j.php\", 1));"],
+ ];
}
/**
@@ -86,10 +79,15 @@ class RequirePassTest extends CodeCleanerTestCase
public function emptyWarnings()
{
- return array(
- array(null),
- array(false),
- array(''),
- );
+ return [
+ [null],
+ [false],
+ [''],
+ ];
+ }
+
+ public function testResolveWorks()
+ {
+ $this->assertEquals(__FILE__, RequirePass::resolve(__FILE__, 3));
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/StrictTypesPassTest.php b/vendor/psy/psysh/test/CodeCleaner/StrictTypesPassTest.php
similarity index 74%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/StrictTypesPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/StrictTypesPassTest.php
index 8458fc01..ee147824 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/StrictTypesPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/StrictTypesPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -36,18 +36,17 @@ class StrictTypesPassTest extends CodeCleanerTestCase
* @dataProvider invalidDeclarations
* @expectedException \Psy\Exception\FatalErrorException
*/
- public function testInvalidDeclarations($declaration)
+ public function testInvalidDeclarations($code)
{
- $stmts = $this->parse($declaration);
- $this->traverser->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function invalidDeclarations()
{
- return array(
- array('declare(strict_types=-1)'),
- array('declare(strict_types=2)'),
- array('declare(strict_types="foo")'),
- );
+ return [
+ ['declare(strict_types=-1)'],
+ ['declare(strict_types=2)'],
+ ['declare(strict_types="foo")'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/CodeCleaner/UseStatementPassTest.php b/vendor/psy/psysh/test/CodeCleaner/UseStatementPassTest.php
new file mode 100644
index 00000000..aedfd499
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/UseStatementPassTest.php
@@ -0,0 +1,102 @@
+setPass(new UseStatementPass());
+ }
+
+ /**
+ * @dataProvider useStatements
+ */
+ public function testProcess($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function useStatements()
+ {
+ return [
+ [
+ "use StdClass as NotSoStd;\n\$std = new NotSoStd();",
+ '$std = new \\StdClass();',
+ ],
+ [
+ "namespace Foo;\n\nuse StdClass as S;\n\$std = new S();",
+ "namespace Foo;\n\n\$std = new \\StdClass();",
+ ],
+ [
+ "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();",
+ "namespace Foo;\n\n\$std = new \\StdClass();",
+ ],
+ [
+ "use Foo\\Bar as fb;\n\$baz = new fb\\Baz();",
+ '$baz = new \\Foo\\Bar\\Baz();',
+ ],
+ [
+ "use Foo\\Bar;\n\$baz = new Bar\\Baz();",
+ '$baz = new \\Foo\\Bar\\Baz();',
+ ],
+ [
+ "namespace Foo;\nuse Bar;\n\$baz = new Bar\\Baz();",
+ "namespace Foo;\n\n\$baz = new \\Bar\\Baz();",
+ ],
+ [
+ "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();\nnamespace Foo;\n\n\$std = new S();",
+ "namespace Foo;\n\n\$std = new \\StdClass();\nnamespace Foo;\n\n\$std = new \\StdClass();",
+ ],
+ [
+ "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();\nnamespace Bar;\n\n\$std = new S();",
+ "namespace Foo;\n\n\$std = new \\StdClass();\nnamespace Bar;\n\n\$std = new S();",
+ ],
+ [
+ "use Foo\\Bar as fb, Qux as Q;\n\$baz = new fb\\Baz();\n\$qux = new Q();",
+ "\$baz = new \\Foo\\Bar\\Baz();\n\$qux = new \\Qux();",
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider groupUseStatements
+ */
+ public function testGroupUseProcess($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function groupUseStatements()
+ {
+ if (version_compare(PHP_VERSION, '7.0', '<')) {
+ $this->markTestSkipped();
+ }
+
+ return [
+ [
+ "use Foo\\{Bar, Baz, Qux as Q};\n\$bar = new Bar();\n\$baz = new Baz();\n\$qux = new Q();",
+ "\$bar = new \\Foo\\Bar();\n\$baz = new \\Foo\\Baz();\n\$qux = new \\Foo\\Qux();",
+ ],
+ [
+ "use X\\{Foo, Bar as B};\n\$foo = new Foo();\n\$baz = new B\\Baz();",
+ "\$foo = new \\X\\Foo();\n\$baz = new \\X\\Bar\\Baz();",
+ ],
+ [
+ "use X\\{Foo, Bar as B};\n\$foo = new Foo();\n\$bar = new Bar();\n\$baz = new B\\Baz();",
+ "\$foo = new \\X\\Foo();\n\$bar = new Bar();\n\$baz = new \\X\\Bar\\Baz();",
+ ],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidClassNamePassTest.php b/vendor/psy/psysh/test/CodeCleaner/ValidClassNamePassTest.php
similarity index 64%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidClassNamePassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/ValidClassNamePassTest.php
index 6be71072..67b15750 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidClassNamePassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/ValidClassNamePassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -12,7 +12,6 @@
namespace Psy\Test\CodeCleaner;
use Psy\CodeCleaner\ValidClassNamePass;
-use Psy\Exception\Exception;
class ValidClassNamePassTest extends CodeCleanerTestCase
{
@@ -23,103 +22,95 @@ class ValidClassNamePassTest extends CodeCleanerTestCase
/**
* @dataProvider getInvalid
+ * @expectedException \Psy\Exception\FatalErrorException
*/
- public function testProcessInvalid($code, $php54 = false)
+ public function testProcessInvalid($code)
{
- try {
- $stmts = $this->parse($code);
- $this->traverse($stmts);
- $this->fail();
- } catch (Exception $e) {
- if ($php54 && version_compare(PHP_VERSION, '5.4', '<')) {
- $this->assertInstanceOf('Psy\Exception\ParseErrorException', $e);
- } else {
- $this->assertInstanceOf('Psy\Exception\FatalErrorException', $e);
- }
- }
+ $this->parseAndTraverse($code);
}
public function getInvalid()
{
// class declarations
- return array(
+ return [
// core class
- array('class stdClass {}'),
+ ['class stdClass {}'],
// capitalization
- array('class stdClass {}'),
+ ['class stdClass {}'],
// collisions with interfaces and traits
- array('interface stdClass {}'),
- array('trait stdClass {}', true),
+ ['interface stdClass {}'],
+ ['trait stdClass {}'],
// collisions inside the same code snippet
- array('
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
class Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
trait Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
- ', true),
- array('
+ '],
+ ['
trait Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
class Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
- ', true),
- array('
+ '],
+ ['
trait Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
interface Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
- ', true),
- array('
+ '],
+ ['
interface Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
trait Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
- ', true),
- array('
+ '],
+ ['
interface Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
class Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
interface Psy_Test_CodeCleaner_ValidClassNamePass_Alpha {}
- '),
+ '],
// namespaced collisions
- array('
+ ['
namespace Psy\\Test\\CodeCleaner {
class ValidClassNamePassTest {}
}
- '),
- array('
+ '],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
class Beta {}
}
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
class Beta {}
}
- '),
+ '],
// extends and implements
- array('class ValidClassNamePassTest extends NotAClass {}'),
- array('class ValidClassNamePassTest extends ArrayAccess {}'),
- array('class ValidClassNamePassTest implements stdClass {}'),
- array('class ValidClassNamePassTest implements ArrayAccess, stdClass {}'),
- array('interface ValidClassNamePassTest extends stdClass {}'),
- array('interface ValidClassNamePassTest extends ArrayAccess, stdClass {}'),
+ ['class ValidClassNamePassTest extends NotAClass {}'],
+ ['class ValidClassNamePassTest extends ArrayAccess {}'],
+ ['class ValidClassNamePassTest implements stdClass {}'],
+ ['class ValidClassNamePassTest implements ArrayAccess, stdClass {}'],
+ ['interface ValidClassNamePassTest extends stdClass {}'],
+ ['interface ValidClassNamePassTest extends ArrayAccess, stdClass {}'],
// class instantiations
- array('new Psy_Test_CodeCleaner_ValidClassNamePass_Gamma();'),
- array('
+ ['new Psy_Test_CodeCleaner_ValidClassNamePass_Gamma();'],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
new Psy_Test_CodeCleaner_ValidClassNamePass_Delta();
}
- '),
+ '],
// class constant fetch
- array('Psy\\Test\\CodeCleaner\\ValidClassNamePass\\NotAClass::FOO'),
+ ['Psy\\Test\\CodeCleaner\\ValidClassNamePass\\NotAClass::FOO'],
// static call
- array('Psy\\Test\\CodeCleaner\\ValidClassNamePass\\NotAClass::foo()'),
- array('Psy\\Test\\CodeCleaner\\ValidClassNamePass\\NotAClass::$foo()'),
- );
+ ['Psy\\Test\\CodeCleaner\\ValidClassNamePass\\NotAClass::foo()'],
+ ['Psy\\Test\\CodeCleaner\\ValidClassNamePass\\NotAClass::$foo()'],
+ ['Psy\\Test\\CodeCleaner\\ValidClassNamePassTest::notAMethod()'],
+ ];
}
/**
@@ -127,151 +118,148 @@ class ValidClassNamePassTest extends CodeCleanerTestCase
*/
public function testProcessValid($code)
{
- $stmts = $this->parse($code);
- $this->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function getValid()
{
- $valid = array(
+ $valid = [
// class declarations
- array('class Psy_Test_CodeCleaner_ValidClassNamePass_Epsilon {}'),
- array('namespace Psy\Test\CodeCleaner\ValidClassNamePass; class Zeta {}'),
- array('
+ ['class Psy_Test_CodeCleaner_ValidClassNamePass_Epsilon {}'],
+ ['namespace Psy\Test\CodeCleaner\ValidClassNamePass; class Zeta {}'],
+ ['
namespace { class Psy_Test_CodeCleaner_ValidClassNamePass_Eta {}; }
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
class Psy_Test_CodeCleaner_ValidClassNamePass_Eta {}
}
- '),
- array('namespace Psy\Test\CodeCleaner\ValidClassNamePass { class stdClass {} }'),
+ '],
+ ['namespace Psy\Test\CodeCleaner\ValidClassNamePass { class stdClass {} }'],
// class instantiations
- array('new stdClass();'),
- array('new stdClass();'),
- array('
+ ['new stdClass();'],
+ ['new stdClass();'],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
class Theta {}
}
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
new Theta();
}
- '),
- array('
+ '],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
class Iota {}
new Iota();
}
- '),
- array('
+ '],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidClassNamePass {
class Kappa {}
}
namespace {
new \\Psy\\Test\\CodeCleaner\\ValidClassNamePass\\Kappa();
}
- '),
+ '],
// Class constant fetch (ValidConstantPassTest validates the actual constant)
- array('class A {} A::FOO'),
- array('$a = new DateTime; $a::ATOM'),
- array('interface A { const B = 1; } A::B'),
+ ['class A {} A::FOO'],
+ ['$a = new DateTime; $a::ATOM'],
+ ['interface A { const B = 1; } A::B'],
// static call
- array('DateTime::createFromFormat()'),
- array('DateTime::$someMethod()'),
- array('Psy\Test\CodeCleaner\Fixtures\ClassWithStatic::doStuff()'),
- array('Psy\Test\CodeCleaner\Fixtures\ClassWithCallStatic::doStuff()'),
+ ['DateTime::createFromFormat()'],
+ ['DateTime::$someMethod()'],
+ ['Psy\Test\CodeCleaner\Fixtures\ClassWithStatic::doStuff()'],
+ ['Psy\Test\CodeCleaner\Fixtures\ClassWithCallStatic::doStuff()'],
// Allow `self` and `static` as class names.
- array('
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function getInstance() {
return new self();
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function getInstance() {
return new SELF();
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function getInstance() {
return new self;
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function getInstance() {
return new static();
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function getInstance() {
return new Static();
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function getInstance() {
return new static;
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function foo() {
return parent::bar();
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function foo() {
return self::bar();
}
}
- '),
- array('
+ '],
+ ['
class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
public static function foo() {
return static::bar();
}
}
- '),
+ '],
- array('class A { static function b() { return new A; } }'),
- array('
+ ['class A { static function b() { return new A; } }'],
+ ['
class A {
const B = 123;
function c() {
return A::B;
}
}
- '),
- array('class A {} class B { function c() { return new A; } }'),
+ '],
+ ['class A {} class B { function c() { return new A; } }'],
// recursion
- array('class A { function a() { A::a(); } }'),
+ ['class A { function a() { A::a(); } }'],
// conditionally defined classes
- array('
+ ['
class A {}
if (false) {
class A {}
}
- '),
- array('
+ '],
+ ['
class A {}
if (true) {
class A {}
@@ -280,9 +268,9 @@ class ValidClassNamePassTest extends CodeCleanerTestCase
} else {
class A {}
}
- '),
+ '],
// ewww
- array('
+ ['
class A {}
if (true):
class A {}
@@ -291,16 +279,16 @@ class ValidClassNamePassTest extends CodeCleanerTestCase
else:
class A {}
endif;
- '),
- array('
+ '],
+ ['
class A {}
while (false) { class A {} }
- '),
- array('
+ '],
+ ['
class A {}
do { class A {} } while (false);
- '),
- array('
+ '],
+ ['
class A {}
switch (1) {
case 0:
@@ -313,22 +301,22 @@ class ValidClassNamePassTest extends CodeCleanerTestCase
class A {}
break;
}
- '),
- );
+ '],
+ ];
// Ugh. There's gotta be a better way to test for this.
if (class_exists('PhpParser\ParserFactory')) {
// PHP 7.0 anonymous classes, only supported by PHP Parser v2.x
- $valid[] = array('$obj = new class() {}');
+ $valid[] = ['$obj = new class() {}'];
}
if (version_compare(PHP_VERSION, '5.5', '>=')) {
- $valid[] = array('interface A {} A::class');
- $valid[] = array('interface A {} A::CLASS');
- $valid[] = array('class A {} A::class');
- $valid[] = array('class A {} A::CLASS');
- $valid[] = array('A::class');
- $valid[] = array('A::CLASS');
+ $valid[] = ['interface A {} A::class'];
+ $valid[] = ['interface A {} A::CLASS'];
+ $valid[] = ['class A {} A::class'];
+ $valid[] = ['class A {} A::CLASS'];
+ $valid[] = ['A::class'];
+ $valid[] = ['A::CLASS'];
}
return $valid;
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidConstantPassTest.php b/vendor/psy/psysh/test/CodeCleaner/ValidConstantPassTest.php
similarity index 58%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidConstantPassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/ValidConstantPassTest.php
index c06139c7..a6c52e04 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidConstantPassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/ValidConstantPassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,19 +26,18 @@ class ValidConstantPassTest extends CodeCleanerTestCase
*/
public function testProcessInvalidConstantReferences($code)
{
- $stmts = $this->parse($code);
- $this->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function getInvalidReferences()
{
- return array(
- array('Foo\BAR'),
+ return [
+ ['Foo\BAR'],
// class constant fetch
- array('Psy\Test\CodeCleaner\ValidConstantPassTest::FOO'),
- array('DateTime::BACON'),
- );
+ ['Psy\Test\CodeCleaner\ValidConstantPassTest::FOO'],
+ ['DateTime::BACON'],
+ ];
}
/**
@@ -46,24 +45,21 @@ class ValidConstantPassTest extends CodeCleanerTestCase
*/
public function testProcessValidConstantReferences($code)
{
- $stmts = $this->parse($code);
- $this->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function getValidReferences()
{
- return array(
- array('PHP_EOL'),
+ return [
+ ['PHP_EOL'],
// class constant fetch
- array('NotAClass::FOO'),
- array('DateTime::ATOM'),
- array('$a = new DateTime; $a::ATOM'),
- array('DateTime::class'),
- array('$a = new DateTime; $a::class'),
- );
+ ['NotAClass::FOO'],
+ ['DateTime::ATOM'],
+ ['$a = new DateTime; $a::ATOM'],
+ ['DateTime::class'],
+ ['$a = new DateTime; $a::class'],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/CodeCleaner/ValidConstructorPassTest.php b/vendor/psy/psysh/test/CodeCleaner/ValidConstructorPassTest.php
new file mode 100644
index 00000000..c0379b26
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleaner/ValidConstructorPassTest.php
@@ -0,0 +1,93 @@
+setPass(new ValidConstructorPass());
+ }
+
+ /**
+ * @dataProvider invalidStatements
+ * @expectedException \Psy\Exception\FatalErrorException
+ */
+ public function testProcessInvalidStatement($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ /**
+ * @dataProvider invalidParserStatements
+ * @expectedException \Psy\Exception\ParseErrorException
+ */
+ public function testProcessInvalidStatementCatchedByParser($code)
+ {
+ $this->parseAndTraverse($code);
+ }
+
+ public function invalidStatements()
+ {
+ $data = [
+ ['class A { public static function A() {}}'],
+ ['class A { public static function a() {}}'],
+ ['class A { private static function A() {}}'],
+ ['class A { private static function a() {}}'],
+ ];
+
+ if (version_compare(PHP_VERSION, '7.0', '>=')) {
+ $data[] = ['class A { public function A(): ?array {}}'];
+ $data[] = ['class A { public function a(): ?array {}}'];
+ }
+
+ return $data;
+ }
+
+ public function invalidParserStatements()
+ {
+ return [
+ ['class A { public static function __construct() {}}'],
+ ['class A { private static function __construct() {}}'],
+ ['class A { private static function __construct() {} public function A() {}}'],
+ ['namespace B; class A { private static function __construct() {}}'],
+ ];
+ }
+
+ /**
+ * @dataProvider validStatements
+ */
+ public function testProcessValidStatement($code)
+ {
+ $this->parseAndTraverse($code);
+ $this->assertTrue(true);
+ }
+
+ public function validStatements()
+ {
+ $data = [
+ ['class A { public static function A() {} public function __construct() {}}'],
+ ['class A { private function __construct() {} public static function A() {}}'],
+ ['namespace B; class A { private static function A() {}}'],
+ ];
+
+ if (version_compare(PHP_VERSION, '7.0', '>=')) {
+ $data[] = ['class A { public static function A() {} public function __construct() {}}'];
+ $data[] = ['class A { private function __construct() {} public static function A(): ?array {}}'];
+ $data[] = ['namespace B; class A { private static function A(): ?array {}}'];
+ }
+
+ return $data;
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidFunctionNamePassTest.php b/vendor/psy/psysh/test/CodeCleaner/ValidFunctionNamePassTest.php
similarity index 76%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidFunctionNamePassTest.php
rename to vendor/psy/psysh/test/CodeCleaner/ValidFunctionNamePassTest.php
index 79b51cf2..70a17315 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ValidFunctionNamePassTest.php
+++ b/vendor/psy/psysh/test/CodeCleaner/ValidFunctionNamePassTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -26,40 +26,39 @@ class ValidFunctionNamePassTest extends CodeCleanerTestCase
*/
public function testProcessInvalidFunctionCallsAndDeclarations($code)
{
- $stmts = $this->parse($code);
- $this->traverse($stmts);
+ $this->parseAndTraverse($code);
}
public function getInvalidFunctions()
{
- return array(
+ return [
// function declarations
- array('function array_merge() {}'),
- array('function Array_Merge() {}'),
- array('
+ ['function array_merge() {}'],
+ ['function Array_Merge() {}'],
+ ['
function psy_test_codecleaner_validfunctionnamepass_alpha() {}
function psy_test_codecleaner_validfunctionnamepass_alpha() {}
- '),
- array('
+ '],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function beta() {}
}
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function beta() {}
}
- '),
+ '],
// function calls
- array('psy_test_codecleaner_validfunctionnamepass_gamma()'),
- array('
+ ['psy_test_codecleaner_validfunctionnamepass_gamma()'],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
delta();
}
- '),
+ '],
// recursion
- array('function a() { a(); } function a() {}'),
- );
+ ['function a() { a(); } function a() {}'],
+ ];
}
/**
@@ -67,76 +66,73 @@ class ValidFunctionNamePassTest extends CodeCleanerTestCase
*/
public function testProcessValidFunctionCallsAndDeclarations($code)
{
- $stmts = $this->parse($code);
- $this->traverse($stmts);
-
- // @todo a better thing to assert here?
+ $this->parseAndTraverse($code);
$this->assertTrue(true);
}
public function getValidFunctions()
{
- return array(
- array('function psy_test_codecleaner_validfunctionnamepass_epsilon() {}'),
- array('
+ return [
+ ['function psy_test_codecleaner_validfunctionnamepass_epsilon() {}'],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function zeta() {}
}
- '),
- array('
+ '],
+ ['
namespace {
function psy_test_codecleaner_validfunctionnamepass_eta() {}
}
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function psy_test_codecleaner_validfunctionnamepass_eta() {}
}
- '),
- array('
+ '],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function psy_test_codecleaner_validfunctionnamepass_eta() {}
}
namespace {
function psy_test_codecleaner_validfunctionnamepass_eta() {}
}
- '),
- array('
+ '],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function array_merge() {}
}
- '),
+ '],
// function calls
- array('array_merge();'),
- array('
+ ['array_merge();'],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function theta() {}
}
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
theta();
}
- '),
+ '],
// closures
- array('$test = function(){};$test()'),
- array('
+ ['$test = function(){};$test()'],
+ ['
namespace Psy\\Test\\CodeCleaner\\ValidFunctionNamePass {
function theta() {}
}
namespace {
Psy\\Test\\CodeCleaner\\ValidFunctionNamePass\\theta();
}
- '),
+ '],
// recursion
- array('function a() { a(); }'),
+ ['function a() { a(); }'],
// conditionally defined functions
- array('
+ ['
function a() {}
if (false) {
function a() {}
}
- '),
- array('
+ '],
+ ['
function a() {}
if (true) {
function a() {}
@@ -145,9 +141,9 @@ class ValidFunctionNamePassTest extends CodeCleanerTestCase
} else {
function a() {}
}
- '),
+ '],
// ewww
- array('
+ ['
function a() {}
if (true):
function a() {}
@@ -156,16 +152,16 @@ class ValidFunctionNamePassTest extends CodeCleanerTestCase
else:
function a() {}
endif;
- '),
- array('
+ '],
+ ['
function a() {}
while (false) { function a() {} }
- '),
- array('
+ '],
+ ['
function a() {}
do { function a() {} } while (false);
- '),
- array('
+ '],
+ ['
function a() {}
switch (1) {
case 0:
@@ -178,7 +174,7 @@ class ValidFunctionNamePassTest extends CodeCleanerTestCase
function a() {}
break;
}
- '),
- );
+ '],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/CodeCleanerTest.php b/vendor/psy/psysh/test/CodeCleanerTest.php
new file mode 100644
index 00000000..40ec6b42
--- /dev/null
+++ b/vendor/psy/psysh/test/CodeCleanerTest.php
@@ -0,0 +1,131 @@
+assertSame($expected, $cc->clean($lines, $requireSemicolons));
+ }
+
+ public function semicolonCodeProvider()
+ {
+ return [
+ [['true'], false, 'return true;'],
+ [['true;'], false, 'return true;'],
+ [['true;'], true, 'return true;'],
+ [['true'], true, false],
+
+ [['echo "foo";', 'true'], true, false],
+
+ [['echo "foo";', 'true'], false, "echo \"foo\";\nreturn true;"],
+ ];
+ }
+
+ /**
+ * @dataProvider unclosedStatementsProvider
+ */
+ public function testUnclosedStatements(array $lines, $isUnclosed)
+ {
+ $cc = new CodeCleaner();
+ $res = $cc->clean($lines);
+
+ if ($isUnclosed) {
+ $this->assertFalse($res);
+ } else {
+ $this->assertNotFalse($res);
+ }
+ }
+
+ public function unclosedStatementsProvider()
+ {
+ return [
+ [['echo "'], true],
+ [['echo \''], true],
+ [['if (1) {'], true],
+
+ [['echo "foo",'], true],
+
+ [['echo ""'], false],
+ [["echo ''"], false],
+ [['if (1) {}'], false],
+
+ [['// closed comment'], false],
+ [['function foo() { /**'], true],
+
+ [['var_dump(1, 2,'], true],
+ [['var_dump(1, 2,', '3)'], false],
+ ];
+ }
+
+ /**
+ * @dataProvider moreUnclosedStatementsProvider
+ */
+ public function testMoreUnclosedStatements(array $lines)
+ {
+ if (defined('HHVM_VERSION')) {
+ $this->markTestSkipped('HHVM not supported.');
+ }
+
+ $cc = new CodeCleaner();
+ $res = $cc->clean($lines);
+
+ $this->assertFalse($res);
+ }
+
+ public function moreUnclosedStatementsProvider()
+ {
+ return [
+ [["\$content = <<clean([$code]);
+ }
+
+ public function invalidStatementsProvider()
+ {
+ // n.b. We used to check that `var_dump(1,2,)` failed, but PHP Parser
+ // 4.x backported trailing comma function calls from PHP 7.3 for free!
+ // so we're not going to spend too much time worrying about it :)
+
+ return [
+ ['function "what'],
+ ["function 'what"],
+ ['echo }'],
+ ['echo {'],
+ ['if (1) }'],
+ ['echo """'],
+ ["echo '''"],
+ ['$foo "bar'],
+ ['$foo \'bar'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Command/ExitCommandTest.php b/vendor/psy/psysh/test/Command/ExitCommandTest.php
new file mode 100644
index 00000000..45626be2
--- /dev/null
+++ b/vendor/psy/psysh/test/Command/ExitCommandTest.php
@@ -0,0 +1,29 @@
+execute([]);
+ }
+}
diff --git a/vendor/psy/psysh/test/Command/ThrowUpCommandTest.php b/vendor/psy/psysh/test/Command/ThrowUpCommandTest.php
new file mode 100644
index 00000000..511c5809
--- /dev/null
+++ b/vendor/psy/psysh/test/Command/ThrowUpCommandTest.php
@@ -0,0 +1,89 @@
+getMockBuilder('Psy\\Shell')
+ ->setMethods(['hasCode', 'addCode'])
+ ->getMock();
+
+ $shell->expects($this->once())->method('hasCode')->willReturn($hasCode);
+ $shell->expects($this->once())
+ ->method('addCode')
+ ->with($this->equalTo($expect), $this->equalTo($addSilent));
+
+ $command = new ThrowUpCommand();
+ $command->setApplication($shell);
+ $tester = new CommandTester($command);
+ $tester->execute($args);
+ $this->assertEquals('', $tester->getDisplay());
+ }
+
+ public function executeThis()
+ {
+ $throw = 'throw \Psy\Exception\ThrowUpException::fromThrowable';
+
+ return [
+ [[], false, $throw . '($_e);'],
+
+ [['exception' => '$ex'], false, $throw . '($ex);'],
+ [['exception' => 'getException()'], false, $throw . '(getException());'],
+ [['exception' => 'new \\Exception("WAT")'], false, $throw . '(new \\Exception("WAT"));'],
+
+ [['exception' => '\'some string\''], false, $throw . '(new \\Exception(\'some string\'));'],
+ [['exception' => '"WHEEEEEEE!"'], false, $throw . '(new \\Exception("WHEEEEEEE!"));'],
+
+ // Everything should work with or without semicolons.
+ [['exception' => '$ex;'], false, $throw . '($ex);'],
+ [['exception' => '"WHEEEEEEE!";'], false, $throw . '(new \\Exception("WHEEEEEEE!"));'],
+
+ // Don't add as silent code if we've already got code.
+ [[], true, $throw . '($_e);', false],
+ [['exception' => 'getException()'], true, $throw . '(getException());', false],
+ [['exception' => '\'some string\''], true, $throw . '(new \\Exception(\'some string\'));', false],
+ ];
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage No idea how to throw this
+ */
+ public function testMultipleArgsThrowsException()
+ {
+ $command = new ThrowUpCommand();
+ $command->setApplication(new Shell());
+ $tester = new CommandTester($command);
+ $tester->execute(['exception' => 'foo(); bar()']);
+ }
+
+ /**
+ * @expectedException \PhpParser\Error
+ * @expectedExceptionMessage Syntax error, unexpected ')' on line 1
+ */
+ public function testParseErrorThrowsException()
+ {
+ $command = new ThrowUpCommand();
+ $command->setApplication(new Shell());
+ $tester = new CommandTester($command);
+ $tester->execute(['exception' => 'foo)']);
+ }
+}
diff --git a/vendor/psy/psysh/test/Command/TimeitCommand/TimeitVisitorTest.php b/vendor/psy/psysh/test/Command/TimeitCommand/TimeitVisitorTest.php
new file mode 100644
index 00000000..1f317350
--- /dev/null
+++ b/vendor/psy/psysh/test/Command/TimeitCommand/TimeitVisitorTest.php
@@ -0,0 +1,52 @@
+traverser = new NodeTraverser();
+ $this->traverser->addVisitor(new TimeitVisitor());
+ }
+
+ /**
+ * @dataProvider codez
+ */
+ public function testProcess($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function codez()
+ {
+ $start = '\Psy\Command\TimeitCommand::markStart';
+ $end = '\Psy\Command\TimeitCommand::markEnd';
+ $noReturn = 'new \Psy\CodeCleaner\NoReturnValue()';
+
+ return [
+ ['', "$end($start());"], // heh
+ ['a()', "$start(); $end(a());"],
+ ['$b()', "$start(); $end(\$b());"],
+ ['$c->d()', "$start(); $end(\$c->d());"],
+ ['e(); f()', "$start(); e(); $end(f());"],
+ ['function g() { return 1; }', "$start(); function g() {return 1;} $end($noReturn);"],
+ ['return 1', "$start(); return $end(1);"],
+ ['return 1; 2', "$start(); return $end(1); $end(2);"],
+ ['return 1; function h() {}', "$start(); return $end(1); function h() {} $end($noReturn);"],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/ConfigurationTest.php b/vendor/psy/psysh/test/ConfigurationTest.php
similarity index 67%
rename from vendor/psy/psysh/test/Psy/Test/ConfigurationTest.php
rename to vendor/psy/psysh/test/ConfigurationTest.php
index e4d9936d..a250d834 100644
--- a/vendor/psy/psysh/test/Psy/Test/ConfigurationTest.php
+++ b/vendor/psy/psysh/test/ConfigurationTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -13,7 +13,6 @@ namespace Psy\Test;
use Psy\CodeCleaner;
use Psy\Configuration;
-use Psy\ExecutionLoop\Loop;
use Psy\Output\PassthruPager;
use Psy\VersionUpdater\GitHubChecker;
use Symfony\Component\Console\Output\ConsoleOutput;
@@ -22,19 +21,19 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
{
private function getConfig($configFile = null)
{
- return new Configuration(array(
- 'configFile' => $configFile ?: __DIR__ . '/../../fixtures/empty.php',
- ));
+ return new Configuration([
+ 'configFile' => $configFile ?: __DIR__ . '/fixtures/empty.php',
+ ]);
}
public function testDefaults()
{
$config = $this->getConfig();
- $this->assertEquals(function_exists('readline'), $config->hasReadline());
- $this->assertEquals(function_exists('readline'), $config->useReadline());
- $this->assertEquals(function_exists('pcntl_signal'), $config->hasPcntl());
- $this->assertEquals(function_exists('pcntl_signal'), $config->usePcntl());
+ $this->assertSame(function_exists('readline'), $config->hasReadline());
+ $this->assertSame(function_exists('readline'), $config->useReadline());
+ $this->assertSame(function_exists('pcntl_signal'), $config->hasPcntl());
+ $this->assertSame(function_exists('pcntl_signal'), $config->usePcntl());
$this->assertFalse($config->requireSemicolons());
$this->assertSame(Configuration::COLOR_MODE_AUTO, $config->colorMode());
$this->assertNull($config->getStartupMessage());
@@ -46,11 +45,11 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
$this->assertNull($config->getDataDir());
$config->setDataDir('wheee');
- $this->assertEquals('wheee', $config->getDataDir());
+ $this->assertSame('wheee', $config->getDataDir());
$this->assertNull($config->getConfigDir());
$config->setConfigDir('wheee');
- $this->assertEquals('wheee', $config->getConfigDir());
+ $this->assertSame('wheee', $config->getConfigDir());
}
/**
@@ -62,37 +61,37 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
putenv("HOME=$home");
$config = new Configuration();
- $this->assertEquals(realpath($configFile), realpath($config->getConfigFile()));
- $this->assertEquals(realpath($historyFile), realpath($config->getHistoryFile()));
- $this->assertEquals(realpath($manualDbFile), realpath($config->getManualDbFile()));
+ $this->assertSame(realpath($configFile), realpath($config->getConfigFile()));
+ $this->assertSame(realpath($historyFile), realpath($config->getHistoryFile()));
+ $this->assertSame(realpath($manualDbFile), realpath($config->getManualDbFile()));
putenv("HOME=$oldHome");
}
public function directories()
{
- $base = realpath(__DIR__ . '/../../fixtures');
+ $base = realpath(__DIR__ . '/fixtures');
- return array(
- array(
+ return [
+ [
$base . '/default',
$base . '/default/.config/psysh/config.php',
$base . '/default/.config/psysh/psysh_history',
$base . '/default/.local/share/psysh/php_manual.sqlite',
- ),
- array(
+ ],
+ [
$base . '/legacy',
$base . '/legacy/.psysh/rc.php',
$base . '/legacy/.psysh/history',
$base . '/legacy/.psysh/php_manual.sqlite',
- ),
- array(
+ ],
+ [
$base . '/mixed',
$base . '/mixed/.psysh/config.php',
$base . '/mixed/.psysh/psysh_history',
null,
- ),
- );
+ ],
+ ];
}
public function testLoadConfig()
@@ -100,34 +99,31 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
$config = $this->getConfig();
$cleaner = new CodeCleaner();
$pager = new PassthruPager(new ConsoleOutput());
- $loop = new Loop($config);
- $config->loadConfig(array(
+ $config->loadConfig([
'useReadline' => false,
'usePcntl' => false,
'codeCleaner' => $cleaner,
'pager' => $pager,
- 'loop' => $loop,
'requireSemicolons' => true,
'errorLoggingLevel' => E_ERROR | E_WARNING,
'colorMode' => Configuration::COLOR_MODE_FORCED,
'startupMessage' => 'Psysh is awesome!',
- ));
+ ]);
$this->assertFalse($config->useReadline());
$this->assertFalse($config->usePcntl());
$this->assertSame($cleaner, $config->getCodeCleaner());
$this->assertSame($pager, $config->getPager());
- $this->assertSame($loop, $config->getLoop());
$this->assertTrue($config->requireSemicolons());
- $this->assertEquals(E_ERROR | E_WARNING, $config->errorLoggingLevel());
+ $this->assertSame(E_ERROR | E_WARNING, $config->errorLoggingLevel());
$this->assertSame(Configuration::COLOR_MODE_FORCED, $config->colorMode());
$this->assertSame('Psysh is awesome!', $config->getStartupMessage());
}
public function testLoadConfigFile()
{
- $config = $this->getConfig(__DIR__ . '/../../fixtures/config.php');
+ $config = $this->getConfig(__DIR__ . '/fixtures/config.php');
$runtimeDir = $this->joinPath(realpath(sys_get_temp_dir()), 'psysh_test', 'withconfig', 'temp');
@@ -135,27 +131,27 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
$this->assertStringStartsWith($runtimeDir, realpath(dirname($config->getPipe('pipe', 123))));
$this->assertStringStartsWith($runtimeDir, realpath($config->getRuntimeDir()));
- $this->assertEquals(function_exists('readline'), $config->useReadline());
+ $this->assertSame(function_exists('readline'), $config->useReadline());
$this->assertFalse($config->usePcntl());
- $this->assertEquals(E_ALL & ~E_NOTICE, $config->errorLoggingLevel());
+ $this->assertSame(E_ALL & ~E_NOTICE, $config->errorLoggingLevel());
}
public function testLoadLocalConfigFile()
{
$oldPwd = getcwd();
- chdir(realpath(__DIR__ . '/../../fixtures/project/'));
+ chdir(realpath(__DIR__ . '/fixtures/project/'));
$config = new Configuration();
// When no configuration file is specified local project config is merged
- $this->assertFalse($config->useReadline());
- $this->assertTrue($config->usePcntl());
+ $this->assertTrue($config->requireSemicolons());
+ $this->assertFalse($config->useUnicode());
- $config = new Configuration(array('configFile' => __DIR__ . '/../../fixtures/config.php'));
+ $config = new Configuration(['configFile' => __DIR__ . '/fixtures/config.php']);
// Defining a configuration file skips loading local project config
- $this->assertTrue($config->useReadline());
- $this->assertFalse($config->usePcntl());
+ $this->assertFalse($config->requireSemicolons());
+ $this->assertTrue($config->useUnicode());
chdir($oldPwd);
}
@@ -165,7 +161,7 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
*/
public function testBaseDirConfigIsDeprecated()
{
- $config = new Configuration(array('baseDir' => 'fake'));
+ $config = new Configuration(['baseDir' => 'fake']);
}
private function joinPath()
@@ -175,14 +171,14 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
public function testConfigIncludes()
{
- $config = new Configuration(array(
- 'defaultIncludes' => array('/file.php'),
- 'configFile' => __DIR__ . '/../../fixtures/empty.php',
- ));
+ $config = new Configuration([
+ 'defaultIncludes' => ['/file.php'],
+ 'configFile' => __DIR__ . '/fixtures/empty.php',
+ ]);
$includes = $config->getDefaultIncludes();
$this->assertCount(1, $includes);
- $this->assertEquals('/file.php', $includes[0]);
+ $this->assertSame('/file.php', $includes[0]);
}
public function testGetOutput()
@@ -190,25 +186,25 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
$config = $this->getConfig();
$output = $config->getOutput();
- $this->assertInstanceOf('\Psy\Output\ShellOutput', $output);
+ $this->assertInstanceOf('Psy\Output\ShellOutput', $output);
}
public function getOutputDecoratedProvider()
{
- return array(
- 'auto' => array(
+ return [
+ 'auto' => [
null,
Configuration::COLOR_MODE_AUTO,
- ),
- 'forced' => array(
+ ],
+ 'forced' => [
true,
Configuration::COLOR_MODE_FORCED,
- ),
- 'disabled' => array(
+ ],
+ 'disabled' => [
false,
Configuration::COLOR_MODE_DISABLED,
- ),
- );
+ ],
+ ];
}
/** @dataProvider getOutputDecoratedProvider */
@@ -222,11 +218,11 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
public function setColorModeValidProvider()
{
- return array(
- 'auto' => array(Configuration::COLOR_MODE_AUTO),
- 'forced' => array(Configuration::COLOR_MODE_FORCED),
- 'disabled' => array(Configuration::COLOR_MODE_DISABLED),
- );
+ return [
+ 'auto' => [Configuration::COLOR_MODE_AUTO],
+ 'forced' => [Configuration::COLOR_MODE_FORCED],
+ 'disabled' => [Configuration::COLOR_MODE_DISABLED],
+ ];
}
/** @dataProvider setColorModeValidProvider */
@@ -235,7 +231,7 @@ class ConfigurationTest extends \PHPUnit\Framework\TestCase
$config = $this->getConfig();
$config->setColorMode($colorMode);
- $this->assertEquals($colorMode, $config->colorMode());
+ $this->assertSame($colorMode, $config->colorMode());
}
/**
diff --git a/vendor/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php b/vendor/psy/psysh/test/ConsoleColorFactoryTest.php
similarity index 84%
rename from vendor/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php
rename to vendor/psy/psysh/test/ConsoleColorFactoryTest.php
index 3da13c7b..d58a48d3 100644
--- a/vendor/psy/psysh/test/Psy/Test/ConsoleColorFactoryTest.php
+++ b/vendor/psy/psysh/test/ConsoleColorFactoryTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -24,7 +24,7 @@ class ConsoleColorFactoryTest extends \PHPUnit\Framework\TestCase
$themes = $colors->getThemes();
$this->assertFalse($colors->isStyleForced());
- $this->assertEquals(array('blue'), $themes['line_number']);
+ $this->assertSame(['blue'], $themes['line_number']);
}
public function testGetConsoleColorForced()
@@ -35,7 +35,7 @@ class ConsoleColorFactoryTest extends \PHPUnit\Framework\TestCase
$themes = $colors->getThemes();
$this->assertTrue($colors->isStyleForced());
- $this->assertEquals(array('blue'), $themes['line_number']);
+ $this->assertSame(['blue'], $themes['line_number']);
}
public function testGetConsoleColorDisabled()
@@ -46,6 +46,6 @@ class ConsoleColorFactoryTest extends \PHPUnit\Framework\TestCase
$themes = $colors->getThemes();
$this->assertFalse($colors->isStyleForced());
- $this->assertEquals(array('none'), $themes['line_number']);
+ $this->assertSame(['none'], $themes['line_number']);
}
}
diff --git a/vendor/psy/psysh/test/ContextTest.php b/vendor/psy/psysh/test/ContextTest.php
new file mode 100644
index 00000000..0b8b6dc8
--- /dev/null
+++ b/vendor/psy/psysh/test/ContextTest.php
@@ -0,0 +1,325 @@
+assertTrue(true);
+ }
+
+ public function testGetAll()
+ {
+ $this->assertTrue(true);
+ }
+
+ public function testGetSpecialVariables()
+ {
+ $context = new Context();
+
+ $this->assertNull($context->get('_'));
+ $this->assertNull($context->getReturnValue());
+
+ $this->assertEquals(['_' => null], $context->getAll());
+
+ $e = new \Exception('eeeeeee');
+ $obj = new \StdClass();
+ $context->setLastException($e);
+ $context->setLastStdout('out');
+ $context->setBoundObject($obj);
+
+ $context->setCommandScopeVariables([
+ '__function' => 'function',
+ '__method' => 'method',
+ '__class' => 'class',
+ '__namespace' => 'namespace',
+ '__file' => 'file',
+ '__line' => 'line',
+ '__dir' => 'dir',
+ ]);
+
+ $expected = [
+ '_' => null,
+ '_e' => $e,
+ '__out' => 'out',
+ 'this' => $obj,
+ '__function' => 'function',
+ '__method' => 'method',
+ '__class' => 'class',
+ '__namespace' => 'namespace',
+ '__file' => 'file',
+ '__line' => 'line',
+ '__dir' => 'dir',
+ ];
+
+ $this->assertEquals($expected, $context->getAll());
+ }
+
+ public function testSetAll()
+ {
+ $context = new Context();
+
+ $baz = new \StdClass();
+ $vars = [
+ 'foo' => 'Foo',
+ 'bar' => 123,
+ 'baz' => $baz,
+
+ '_' => 'fail',
+ '_e' => 'fail',
+ '__out' => 'fail',
+ 'this' => 'fail',
+ '__psysh__' => 'fail',
+
+ '__function' => 'fail',
+ '__method' => 'fail',
+ '__class' => 'fail',
+ '__namespace' => 'fail',
+ '__file' => 'fail',
+ '__line' => 'fail',
+ '__dir' => 'fail',
+ ];
+
+ $context->setAll($vars);
+
+ $this->assertEquals('Foo', $context->get('foo'));
+ $this->assertEquals(123, $context->get('bar'));
+ $this->assertSame($baz, $context->get('baz'));
+
+ $this->assertEquals(['foo' => 'Foo', 'bar' => 123, 'baz' => $baz, '_' => null], $context->getAll());
+ }
+
+ /**
+ * @dataProvider specialNames
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessageRegEx /Unknown variable: \$\w+/
+ */
+ public function testSetAllDoesNotSetSpecial($name)
+ {
+ $context = new Context();
+ $context->setAll([$name => 'fail']);
+ $context->get($name);
+ }
+
+ public function specialNames()
+ {
+ return [
+ ['_e'],
+ ['__out'],
+ ['this'],
+ ['__psysh__'],
+ ['__function'],
+ ['__method'],
+ ['__class'],
+ ['__namespace'],
+ ['__file'],
+ ['__line'],
+ ['__dir'],
+ ];
+ }
+
+ public function testReturnValue()
+ {
+ $context = new Context();
+ $this->assertNull($context->getReturnValue());
+
+ $val = 'some string';
+ $context->setReturnValue($val);
+ $this->assertEquals($val, $context->getReturnValue());
+ $this->assertEquals($val, $context->get('_'));
+
+ $obj = new \StdClass();
+ $context->setReturnValue($obj);
+ $this->assertSame($obj, $context->getReturnValue());
+ $this->assertSame($obj, $context->get('_'));
+
+ $context->setReturnValue(null);
+ $this->assertNull($context->getReturnValue());
+ }
+
+ public function testLastException()
+ {
+ $context = new Context();
+ $e = new \Exception('wat');
+ $context->setLastException($e);
+ $this->assertSame($e, $context->getLastException());
+ $this->assertSame($e, $context->get('_e'));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage No most-recent exception
+ */
+ public function testLastExceptionThrowsSometimes()
+ {
+ $context = new Context();
+ $context->getLastException();
+ }
+
+ public function testLastStdout()
+ {
+ $context = new Context();
+ $context->setLastStdout('ouuuuut');
+ $this->assertEquals('ouuuuut', $context->getLastStdout());
+ $this->assertEquals('ouuuuut', $context->get('__out'));
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage No most-recent output
+ */
+ public function testLastStdoutThrowsSometimes()
+ {
+ $context = new Context();
+ $context->getLastStdout();
+ }
+
+ public function testBoundObject()
+ {
+ $context = new Context();
+ $this->assertNull($context->getBoundObject());
+
+ $obj = new \StdClass();
+ $context->setBoundObject($obj);
+ $this->assertSame($obj, $context->getBoundObject());
+ $this->assertSame($obj, $context->get('this'));
+
+ $context->setBoundObject(null);
+ $this->assertNull($context->getBoundObject());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage Unknown variable: $this
+ */
+ public function testBoundObjectThrowsSometimes()
+ {
+ $context = new Context();
+ $context->get('this');
+ }
+
+ public function testBoundClass()
+ {
+ $context = new Context();
+ $this->assertNull($context->getBoundClass());
+
+ $context->setBoundClass('');
+ $this->assertNull($context->getBoundClass());
+
+ $context->setBoundClass('Psy\Shell');
+ $this->assertEquals('Psy\Shell', $context->getBoundClass());
+
+ $context->setBoundObject(new \StdClass());
+ $this->assertNotNull($context->getBoundObject());
+ $this->assertNull($context->getBoundClass());
+
+ $context->setBoundClass('Psy\Shell');
+ $this->assertEquals('Psy\Shell', $context->getBoundClass());
+ $this->assertNull($context->getBoundObject());
+
+ $context->setBoundClass(null);
+ $this->assertNull($context->getBoundClass());
+ $this->assertNull($context->getBoundObject());
+ }
+
+ public function testCommandScopeVariables()
+ {
+ $__function = 'donkey';
+ $__method = 'diddy';
+ $__class = 'cranky';
+ $__namespace = 'funky';
+ $__file = 'candy';
+ $__line = 'dixie';
+ $__dir = 'wrinkly';
+
+ $vars = compact('__function', '__method', '__class', '__namespace', '__file', '__line', '__dir');
+
+ $context = new Context();
+ $context->setCommandScopeVariables($vars);
+
+ $this->assertEquals($vars, $context->getCommandScopeVariables());
+
+ $this->assertEquals($__function, $context->get('__function'));
+ $this->assertEquals($__method, $context->get('__method'));
+ $this->assertEquals($__class, $context->get('__class'));
+ $this->assertEquals($__namespace, $context->get('__namespace'));
+ $this->assertEquals($__file, $context->get('__file'));
+ $this->assertEquals($__line, $context->get('__line'));
+ $this->assertEquals($__dir, $context->get('__dir'));
+
+ $someVars = compact('__function', '__namespace', '__file', '__line', '__dir');
+ $context->setCommandScopeVariables($someVars);
+ }
+
+ public function testGetUnusedCommandScopeVariableNames()
+ {
+ $context = new Context();
+
+ $this->assertEquals(
+ ['__function', '__method', '__class', '__namespace', '__file', '__line', '__dir'],
+ $context->getUnusedCommandScopeVariableNames()
+ );
+
+ $context->setCommandScopeVariables([
+ '__function' => 'foo',
+ '__namespace' => 'bar',
+ '__file' => 'baz',
+ '__line' => 123,
+ '__dir' => 'qux',
+ ]);
+
+ $this->assertEquals(
+ ['__method', '__class'],
+ array_values($context->getUnusedCommandScopeVariableNames())
+ );
+ }
+
+ /**
+ * @dataProvider specialAndNotSpecialVariableNames
+ */
+ public function testIsSpecialVariableName($name, $isSpecial)
+ {
+ $context = new Context();
+
+ if ($isSpecial) {
+ $this->assertTrue($context->isSpecialVariableName($name));
+ } else {
+ $this->assertFalse($context->isSpecialVariableName($name));
+ }
+ }
+
+ public function specialAndNotSpecialVariableNames()
+ {
+ return [
+ ['foo', false],
+ ['psysh', false],
+ ['__psysh', false],
+
+ ['_', true],
+ ['_e', true],
+ ['__out', true],
+ ['this', true],
+ ['__psysh__', true],
+
+ ['__function', true],
+ ['__method', true],
+ ['__class', true],
+ ['__namespace', true],
+ ['__file', true],
+ ['__line', true],
+ ['__dir', true],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php b/vendor/psy/psysh/test/Exception/BreakExceptionTest.php
similarity index 56%
rename from vendor/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php
rename to vendor/psy/psysh/test/Exception/BreakExceptionTest.php
index fb094985..ae39fb1f 100644
--- a/vendor/psy/psysh/test/Psy/Test/Exception/BreakExceptionTest.php
+++ b/vendor/psy/psysh/test/Exception/BreakExceptionTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -12,7 +12,6 @@
namespace Psy\Test\Exception;
use Psy\Exception\BreakException;
-use Psy\Exception\Exception;
class BreakExceptionTest extends \PHPUnit\Framework\TestCase
{
@@ -20,8 +19,8 @@ class BreakExceptionTest extends \PHPUnit\Framework\TestCase
{
$e = new BreakException();
- $this->assertTrue($e instanceof Exception);
- $this->assertTrue($e instanceof BreakException);
+ $this->assertInstanceOf('Psy\Exception\Exception', $e);
+ $this->assertInstanceOf('Psy\Exception\BreakException', $e);
}
public function testMessage()
@@ -29,6 +28,15 @@ class BreakExceptionTest extends \PHPUnit\Framework\TestCase
$e = new BreakException('foo');
$this->assertContains('foo', $e->getMessage());
- $this->assertEquals('foo', $e->getRawMessage());
+ $this->assertSame('foo', $e->getRawMessage());
+ }
+
+ /**
+ * @expectedException \Psy\Exception\BreakException
+ * @expectedExceptionMessage Goodbye
+ */
+ public function testExitShell()
+ {
+ BreakException::exitShell();
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php b/vendor/psy/psysh/test/Exception/ErrorExceptionTest.php
similarity index 57%
rename from vendor/psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php
rename to vendor/psy/psysh/test/Exception/ErrorExceptionTest.php
index 4bc7f555..e66319b9 100644
--- a/vendor/psy/psysh/test/Psy/Test/Exception/ErrorExceptionTest.php
+++ b/vendor/psy/psysh/test/Exception/ErrorExceptionTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -12,7 +12,6 @@
namespace Psy\Test\Exception;
use Psy\Exception\ErrorException;
-use Psy\Exception\Exception;
class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
{
@@ -20,9 +19,9 @@ class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
{
$e = new ErrorException();
- $this->assertTrue($e instanceof Exception);
- $this->assertTrue($e instanceof \ErrorException);
- $this->assertTrue($e instanceof ErrorException);
+ $this->assertInstanceOf('Psy\Exception\Exception', $e);
+ $this->assertInstanceOf('ErrorException', $e);
+ $this->assertInstanceOf('Psy\Exception\ErrorException', $e);
}
public function testMessage()
@@ -30,7 +29,7 @@ class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
$e = new ErrorException('foo');
$this->assertContains('foo', $e->getMessage());
- $this->assertEquals('foo', $e->getRawMessage());
+ $this->assertSame('foo', $e->getRawMessage());
}
/**
@@ -59,14 +58,17 @@ class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
public function getLevels()
{
- return array(
- array(E_WARNING, 'Warning'),
- array(E_CORE_WARNING, 'Warning'),
- array(E_COMPILE_WARNING, 'Warning'),
- array(E_USER_WARNING, 'Warning'),
- array(E_STRICT, 'Strict error'),
- array(0, 'Error'),
- );
+ return [
+ [E_WARNING, 'Warning'],
+ [E_CORE_WARNING, 'Warning'],
+ [E_COMPILE_WARNING, 'Warning'],
+ [E_USER_WARNING, 'Warning'],
+ [E_STRICT, 'Strict error'],
+ [E_DEPRECATED, 'Deprecated'],
+ [E_USER_DEPRECATED, 'Deprecated'],
+ [E_RECOVERABLE_ERROR, 'Recoverable fatal error'],
+ [0, 'Error'],
+ ];
}
/**
@@ -74,7 +76,7 @@ class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
*/
public function testThrowExceptionAsErrorHandler($level, $type)
{
- set_error_handler(array('Psy\Exception\ErrorException', 'throwException'));
+ set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
try {
trigger_error('{whot}', $level);
} catch (ErrorException $e) {
@@ -86,23 +88,38 @@ class ErrorExceptionTest extends \PHPUnit\Framework\TestCase
public function getUserLevels()
{
- return array(
- array(E_USER_ERROR, 'Error'),
- array(E_USER_WARNING, 'Warning'),
- array(E_USER_NOTICE, 'Notice'),
- array(E_USER_DEPRECATED, 'Deprecated'),
- );
+ return [
+ [E_USER_ERROR, 'Error'],
+ [E_USER_WARNING, 'Warning'],
+ [E_USER_NOTICE, 'Notice'],
+ [E_USER_DEPRECATED, 'Deprecated'],
+ ];
}
public function testIgnoreExecutionLoopFilename()
{
- $e = new ErrorException('{{message}}', 0, 1, '/fake/path/to/Psy/ExecutionLoop/Loop.php');
+ $e = new ErrorException('{{message}}', 0, 1, '/fake/path/to/Psy/ExecutionLoop.php');
$this->assertEmpty($e->getFile());
- $e = new ErrorException('{{message}}', 0, 1, 'c:\fake\path\to\Psy\ExecutionLoop\Loop.php');
+ $e = new ErrorException('{{message}}', 0, 1, 'c:\fake\path\to\Psy\ExecutionLoop.php');
$this->assertEmpty($e->getFile());
$e = new ErrorException('{{message}}', 0, 1, '/fake/path/to/Psy/File.php');
$this->assertNotEmpty($e->getFile());
}
+
+ public function testFromError()
+ {
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ $this->markTestSkipped();
+ }
+
+ $error = new \Error('{{message}}', 0);
+ $exception = ErrorException::fromError($error);
+
+ $this->assertContains('PHP Error: {{message}}', $exception->getMessage());
+ $this->assertEquals(0, $exception->getCode());
+ $this->assertEquals($error->getFile(), $exception->getFile());
+ $this->assertSame($exception->getPrevious(), $error);
+ }
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php b/vendor/psy/psysh/test/Exception/FatalErrorExceptionTest.php
similarity index 64%
rename from vendor/psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php
rename to vendor/psy/psysh/test/Exception/FatalErrorExceptionTest.php
index 9ff66b95..36c7dd8c 100644
--- a/vendor/psy/psysh/test/Psy/Test/Exception/FatalErrorExceptionTest.php
+++ b/vendor/psy/psysh/test/Exception/FatalErrorExceptionTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,7 +11,6 @@
namespace Psy\Test\Exception;
-use Psy\Exception\Exception;
use Psy\Exception\FatalErrorException;
class FatalErrorExceptionTest extends \PHPUnit\Framework\TestCase
@@ -20,16 +19,16 @@ class FatalErrorExceptionTest extends \PHPUnit\Framework\TestCase
{
$e = new FatalErrorException();
- $this->assertTrue($e instanceof Exception);
- $this->assertTrue($e instanceof \ErrorException);
- $this->assertTrue($e instanceof FatalErrorException);
+ $this->assertInstanceOf('Psy\Exception\Exception', $e);
+ $this->assertInstanceOf('ErrorException', $e);
+ $this->assertInstanceOf('Psy\Exception\FatalErrorException', $e);
}
public function testMessage()
{
$e = new FatalErrorException('{msg}', 0, 0, '{filename}', 13);
- $this->assertEquals('{msg}', $e->getRawMessage());
+ $this->assertSame('{msg}', $e->getRawMessage());
$this->assertContains('{msg}', $e->getMessage());
$this->assertContains('{filename}', $e->getMessage());
$this->assertContains('line 13', $e->getMessage());
@@ -39,8 +38,14 @@ class FatalErrorExceptionTest extends \PHPUnit\Framework\TestCase
{
$e = new FatalErrorException('{msg}');
- $this->assertEquals('{msg}', $e->getRawMessage());
+ $this->assertSame('{msg}', $e->getRawMessage());
$this->assertContains('{msg}', $e->getMessage());
$this->assertContains('eval()\'d code', $e->getMessage());
}
+
+ public function testNegativeOneLineNumberIgnored()
+ {
+ $e = new FatalErrorException('{msg}', 0, 1, null, -1);
+ $this->assertEquals(0, $e->getLine());
+ }
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php b/vendor/psy/psysh/test/Exception/ParseErrorExceptionTest.php
similarity index 79%
rename from vendor/psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php
rename to vendor/psy/psysh/test/Exception/ParseErrorExceptionTest.php
index 9fa9750d..446b9389 100644
--- a/vendor/psy/psysh/test/Psy/Test/Exception/ParseErrorExceptionTest.php
+++ b/vendor/psy/psysh/test/Exception/ParseErrorExceptionTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,7 +11,6 @@
namespace Psy\Test\Exception;
-use Psy\Exception\Exception;
use Psy\Exception\ParseErrorException;
class ParseErrorExceptionTest extends \PHPUnit\Framework\TestCase
@@ -20,9 +19,9 @@ class ParseErrorExceptionTest extends \PHPUnit\Framework\TestCase
{
$e = new ParseErrorException();
- $this->assertTrue($e instanceof Exception);
- $this->assertTrue($e instanceof \PhpParser\Error);
- $this->assertTrue($e instanceof ParseErrorException);
+ $this->assertInstanceOf('Psy\Exception\Exception', $e);
+ $this->assertInstanceOf('PhpParser\Error', $e);
+ $this->assertInstanceOf('Psy\Exception\ParseErrorException', $e);
}
public function testMessage()
diff --git a/vendor/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php b/vendor/psy/psysh/test/Exception/RuntimeExceptionTest.php
similarity index 56%
rename from vendor/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php
rename to vendor/psy/psysh/test/Exception/RuntimeExceptionTest.php
index 8eca1348..1121ea4e 100644
--- a/vendor/psy/psysh/test/Psy/Test/Exception/RuntimeExceptionTest.php
+++ b/vendor/psy/psysh/test/Exception/RuntimeExceptionTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,7 +11,6 @@
namespace Psy\Test\Exception;
-use Psy\Exception\Exception;
use Psy\Exception\RuntimeException;
class RuntimeExceptionTest extends \PHPUnit\Framework\TestCase
@@ -21,11 +20,11 @@ class RuntimeExceptionTest extends \PHPUnit\Framework\TestCase
$msg = 'bananas';
$e = new RuntimeException($msg);
- $this->assertTrue($e instanceof Exception);
- $this->assertTrue($e instanceof \RuntimeException);
- $this->assertTrue($e instanceof RuntimeException);
+ $this->assertInstanceOf('Psy\Exception\Exception', $e);
+ $this->assertInstanceOf('RuntimeException', $e);
+ $this->assertInstanceOf('Psy\Exception\RuntimeException', $e);
- $this->assertEquals($msg, $e->getMessage());
- $this->assertEquals($msg, $e->getRawMessage());
+ $this->assertSame($msg, $e->getMessage());
+ $this->assertSame($msg, $e->getRawMessage());
}
}
diff --git a/vendor/psy/psysh/test/Exception/ThrowUpExceptionTest.php b/vendor/psy/psysh/test/Exception/ThrowUpExceptionTest.php
new file mode 100644
index 00000000..f44ab873
--- /dev/null
+++ b/vendor/psy/psysh/test/Exception/ThrowUpExceptionTest.php
@@ -0,0 +1,66 @@
+assertInstanceOf('Psy\Exception\Exception', $e);
+ $this->assertInstanceOf('Psy\Exception\ThrowUpException', $e);
+
+ $this->assertEquals("Throwing Exception with message '{{message}}'", $e->getMessage());
+ $this->assertEquals('{{message}}', $e->getRawMessage());
+ $this->assertEquals(123, $e->getCode());
+ $this->assertSame($previous, $e->getPrevious());
+ }
+
+ public function testFromThrowable()
+ {
+ $previous = new \Exception('{{message}}');
+ $e = ThrowUpException::fromThrowable($previous);
+
+ $this->assertInstanceOf('Psy\Exception\ThrowUpException', $e);
+ $this->assertSame($previous, $e->getPrevious());
+ }
+
+ public function testFromThrowableWithError()
+ {
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ $this->markTestSkipped();
+ }
+
+ $previous = new \Error('{{message}}');
+ $e = ThrowUpException::fromThrowable($previous);
+
+ $this->assertInstanceOf('Psy\Exception\ThrowUpException', $e);
+ $this->assertInstanceOf('Psy\Exception\ErrorException', $e->getPrevious());
+
+ $this->assertNotSame($previous, $e->getPrevious());
+ $this->assertSame($previous, $e->getPrevious()->getPrevious());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage throw-up can only throw Exceptions and Errors
+ */
+ public function testFromThrowableThrowsError()
+ {
+ $notThrowable = new \StdClass();
+ ThrowUpException::fromThrowable($notThrowable);
+ }
+}
diff --git a/vendor/psy/psysh/test/Exception/TypeErrorExceptionTest.php b/vendor/psy/psysh/test/Exception/TypeErrorExceptionTest.php
new file mode 100644
index 00000000..7bf27af9
--- /dev/null
+++ b/vendor/psy/psysh/test/Exception/TypeErrorExceptionTest.php
@@ -0,0 +1,52 @@
+assertInstanceOf('Psy\Exception\Exception', $e);
+ $this->assertInstanceOf('Psy\Exception\TypeErrorException', $e);
+
+ $this->assertEquals('TypeError: {{message}}', $e->getMessage());
+ $this->assertEquals('{{message}}', $e->getRawMessage());
+ $this->assertEquals(13, $e->getCode());
+ }
+
+ public function testStripsEvalFromMessage()
+ {
+ $message = 'Something or other, called in line 10: eval()\'d code';
+ $e = new TypeErrorException($message);
+ $this->assertEquals($message, $e->getRawMessage());
+ $this->assertEquals('TypeError: Something or other', $e->getMessage());
+ }
+
+ public function testFromTypeError()
+ {
+ if (version_compare(PHP_VERSION, '7.0.0', '<')) {
+ $this->markTestSkipped();
+ }
+
+ $previous = new \TypeError('{{message}}', 13);
+ $e = TypeErrorException::fromTypeError($previous);
+
+ $this->assertInstanceOf('Psy\Exception\TypeErrorException', $e);
+ $this->assertEquals('TypeError: {{message}}', $e->getMessage());
+ $this->assertEquals('{{message}}', $e->getRawMessage());
+ $this->assertEquals(13, $e->getCode());
+ }
+}
diff --git a/vendor/psy/psysh/test/FakeShell.php b/vendor/psy/psysh/test/FakeShell.php
new file mode 100644
index 00000000..9f6fa97f
--- /dev/null
+++ b/vendor/psy/psysh/test/FakeShell.php
@@ -0,0 +1,29 @@
+matchers = $matchers;
+ }
+}
diff --git a/vendor/psy/psysh/test/Formatter/CodeFormatterTest.php b/vendor/psy/psysh/test/Formatter/CodeFormatterTest.php
new file mode 100644
index 00000000..ee213f1c
--- /dev/null
+++ b/vendor/psy/psysh/test/Formatter/CodeFormatterTest.php
@@ -0,0 +1,129 @@
+assertEquals($expected, self::trimLines($formattedWithoutColors));
+ $this->assertNotEquals($expected, self::trimLines($formatted));
+ }
+
+ public function reflectors()
+ {
+ $expectClass = <<<'EOS'
+ > 14| class SomeClass
+ 15| {
+ 16| const SOME_CONST = 'some const';
+ 17| private $someProp = 'some prop';
+ 18|
+ 19| public function someMethod($someParam)
+ 20| {
+ 21| return 'some method';
+ 22| }
+ 23|
+ 24| public static function someClosure()
+ 25| {
+ 26| return function () {
+ 27| return 'some closure';
+ 28| };
+ 29| }
+ 30| }
+EOS;
+
+ $expectMethod = <<<'EOS'
+ > 19| public function someMethod($someParam)
+ 20| {
+ 21| return 'some method';
+ 22| }
+EOS;
+
+ $expectClosure = <<<'EOS'
+ > 26| return function () {
+ 27| return 'some closure';
+ 28| };
+EOS;
+
+ return [
+ [new \ReflectionClass('Psy\Test\Formatter\Fixtures\SomeClass'), $expectClass],
+ [new \ReflectionObject(new SomeClass()), $expectClass],
+ [new \ReflectionMethod('Psy\Test\Formatter\Fixtures\SomeClass', 'someMethod'), $expectMethod],
+ [new \ReflectionFunction(SomeClass::someClosure()), $expectClosure],
+ ];
+ }
+
+ /**
+ * @dataProvider invalidReflectors
+ * @expectedException \Psy\Exception\RuntimeException
+ */
+ public function testCodeFormatterThrowsExceptionForReflectorsItDoesntUnderstand($reflector)
+ {
+ CodeFormatter::format($reflector);
+ }
+
+ public function invalidReflectors()
+ {
+ $reflectors = [
+ [new \ReflectionExtension('json')],
+ [new \ReflectionParameter(['Psy\Test\Formatter\Fixtures\SomeClass', 'someMethod'], 'someParam')],
+ [new \ReflectionProperty('Psy\Test\Formatter\Fixtures\SomeClass', 'someProp')],
+ ];
+
+ if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
+ $reflectors[] = [new \ReflectionClassConstant('Psy\Test\Formatter\Fixtures\SomeClass', 'SOME_CONST')];
+ }
+
+ return $reflectors;
+ }
+
+ /**
+ * @dataProvider filenames
+ * @expectedException \Psy\Exception\RuntimeException
+ */
+ public function testCodeFormatterThrowsExceptionForMissingFile($filename)
+ {
+ $reflector = $this->getMockBuilder('ReflectionClass')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $reflector
+ ->expects($this->once())
+ ->method('getFileName')
+ ->will($this->returnValue($filename));
+
+ CodeFormatter::format($reflector);
+ }
+
+ public function filenames()
+ {
+ if (defined('HHVM_VERSION')) {
+ $this->markTestSkipped('We have issues with PHPUnit mocks on HHVM.');
+ }
+
+ return [[null], ['not a file']];
+ }
+
+ private static function trimLines($code)
+ {
+ return rtrim(implode("\n", array_map('rtrim', explode("\n", $code))));
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php b/vendor/psy/psysh/test/Formatter/DocblockFormatterTest.php
similarity index 96%
rename from vendor/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php
rename to vendor/psy/psysh/test/Formatter/DocblockFormatterTest.php
index fa742b08..134c76d0 100644
--- a/vendor/psy/psysh/test/Psy/Test/Formatter/DocblockFormatterTest.php
+++ b/vendor/psy/psysh/test/Formatter/DocblockFormatterTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -55,7 +55,7 @@ class DocblockFormatterTest extends \PHPUnit\Framework\TestCase
Author: Justin Hileman \
EOS;
- $this->assertEquals(
+ $this->assertSame(
$expected,
DocblockFormatter::format(new \ReflectionMethod($this, 'methodWithDocblock'))
);
diff --git a/vendor/psy/psysh/test/Formatter/Fixtures/BoringTrait.php b/vendor/psy/psysh/test/Formatter/Fixtures/BoringTrait.php
new file mode 100644
index 00000000..9f13ab93
--- /dev/null
+++ b/vendor/psy/psysh/test/Formatter/Fixtures/BoringTrait.php
@@ -0,0 +1,20 @@
+assertEquals($expected, strip_tags(SignatureFormatter::format($reflector)));
+ $this->assertSame($expected, strip_tags(SignatureFormatter::format($reflector)));
}
public function signatureReflectors()
{
- return array(
- array(
+ return [
+ [
new \ReflectionFunction('implode'),
defined('HHVM_VERSION') ? 'function implode($arg1, $arg2 = null)' : 'function implode($glue, $pieces)',
- ),
- array(
- new ReflectionConstant($this, 'FOO'),
+ ],
+ [
+ ReflectionClassConstant::create($this, 'FOO'),
'const FOO = "foo value"',
- ),
- array(
+ ],
+ [
new \ReflectionMethod($this, 'someFakeMethod'),
'private function someFakeMethod(array $one, $two = \'TWO\', Reflector $three = null)',
- ),
- array(
+ ],
+ [
new \ReflectionProperty($this, 'bar'),
'private static $bar',
- ),
- array(
+ ],
+ [
new \ReflectionClass('Psy\CodeCleaner\CodeCleanerPass'),
'abstract class Psy\CodeCleaner\CodeCleanerPass '
. 'extends PhpParser\NodeVisitorAbstract '
. 'implements PhpParser\NodeVisitor',
- ),
- );
+ ],
+ [
+ new \ReflectionFunction('array_chunk'),
+ 'function array_chunk($arg, $size, $preserve_keys = unknown)',
+ ],
+ [
+ new \ReflectionClass('Psy\Test\Formatter\Fixtures\BoringTrait'),
+ 'trait Psy\Test\Formatter\Fixtures\BoringTrait',
+ ],
+ [
+ new \ReflectionMethod('Psy\Test\Formatter\Fixtures\BoringTrait', 'boringMethod'),
+ 'public function boringMethod($one = 1)',
+ ],
+ [
+ new ReflectionConstant_('E_ERROR'),
+ 'define("E_ERROR", 1)',
+ ],
+ [
+ new ReflectionConstant_('PHP_VERSION'),
+ 'define("PHP_VERSION", "' . PHP_VERSION . '")',
+ ],
+ [
+ new ReflectionConstant_('__LINE__'),
+ 'define("__LINE__", null)', // @todo show this as `unknown` in red or something?
+ ],
+ ];
}
/**
diff --git a/vendor/psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php b/vendor/psy/psysh/test/Input/CodeArgumentTest.php
similarity index 67%
rename from vendor/psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php
rename to vendor/psy/psysh/test/Input/CodeArgumentTest.php
index 4329a032..c3961520 100644
--- a/vendor/psy/psysh/test/Psy/Test/Input/CodeArgumentTest.php
+++ b/vendor/psy/psysh/test/Input/CodeArgumentTest.php
@@ -3,13 +3,13 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-namespace Psy\Tests\Input;
+namespace Psy\Test\Input;
use Psy\Input\CodeArgument;
use Symfony\Component\Console\Input\InputArgument;
@@ -27,11 +27,11 @@ class CodeArgumentTest extends \PHPUnit\Framework\TestCase
public function getInvalidModes()
{
- return array(
- array(InputArgument::IS_ARRAY),
- array(InputArgument::IS_ARRAY | InputArgument::REQUIRED),
- array(InputArgument::IS_ARRAY | InputArgument::OPTIONAL),
- );
+ return [
+ [InputArgument::IS_ARRAY],
+ [InputArgument::IS_ARRAY | InputArgument::REQUIRED],
+ [InputArgument::IS_ARRAY | InputArgument::OPTIONAL],
+ ];
}
/**
@@ -44,9 +44,9 @@ class CodeArgumentTest extends \PHPUnit\Framework\TestCase
public function getValidModes()
{
- return array(
- array(InputArgument::REQUIRED),
- array(InputArgument::OPTIONAL),
- );
+ return [
+ [InputArgument::REQUIRED],
+ [InputArgument::OPTIONAL],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/Input/FilterOptionsTest.php b/vendor/psy/psysh/test/Input/FilterOptionsTest.php
new file mode 100644
index 00000000..7ed8919b
--- /dev/null
+++ b/vendor/psy/psysh/test/Input/FilterOptionsTest.php
@@ -0,0 +1,105 @@
+assertCount(3, $opts);
+ }
+
+ /**
+ * @dataProvider validInputs
+ */
+ public function testBindValidInput($input, $hasFilter = true)
+ {
+ $input = $this->getInput($input);
+ $filterOptions = new FilterOptions();
+ $filterOptions->bind($input);
+
+ $this->assertEquals($hasFilter, $filterOptions->hasFilter());
+ }
+
+ public function validInputs()
+ {
+ return [
+ ['--grep="bar"'],
+ ['--grep="bar" --invert'],
+ ['--grep="bar" --insensitive'],
+ ['--grep="bar" --invert --insensitive'],
+ ['', false],
+ ];
+ }
+
+ /**
+ * @dataProvider invalidInputs
+ * @expectedException \Psy\Exception\RuntimeException
+ */
+ public function testBindInvalidInput($input)
+ {
+ $input = $this->getInput($input);
+ $filterOptions = new FilterOptions();
+ $filterOptions->bind($input);
+ }
+
+ public function invalidInputs()
+ {
+ return [
+ ['--invert'],
+ ['--insensitive'],
+ ['--invert --insensitive'],
+
+ // invalid because regex
+ ['--grep /*/'],
+ ];
+ }
+
+ /**
+ * @dataProvider matchData
+ */
+ public function testMatch($input, $str, $matches)
+ {
+ $input = $this->getInput($input);
+ $filterOptions = new FilterOptions();
+ $filterOptions->bind($input);
+
+ $this->assertEquals($matches, $filterOptions->match($str));
+ }
+
+ public function matchData()
+ {
+ return [
+ ['', 'whatever', true],
+ ['--grep FOO', 'foo', false],
+ ['--grep foo', 'foo', true],
+ ['--grep foo', 'food', true],
+ ['--grep oo', 'Food', true],
+ ['--grep oo -i', 'FOOD', true],
+ ['--grep foo -v', 'food', false],
+ ['--grep foo -v', 'whatever', true],
+ ];
+ }
+
+ private function getInput($input)
+ {
+ $input = new StringInput($input);
+ $input->bind(new InputDefinition(FilterOptions::getOptions()));
+
+ return $input;
+ }
+}
diff --git a/vendor/psy/psysh/test/Input/ShellInputTest.php b/vendor/psy/psysh/test/Input/ShellInputTest.php
new file mode 100644
index 00000000..f19d1261
--- /dev/null
+++ b/vendor/psy/psysh/test/Input/ShellInputTest.php
@@ -0,0 +1,254 @@
+bind($definition);
+ }
+
+ public function testInputOptionWithGivenString()
+ {
+ $definition = new InputDefinition([
+ new InputOption('foo', null, InputOption::VALUE_REQUIRED),
+ new CodeArgument('code', null, CodeArgument::REQUIRED),
+ ]);
+
+ $input = new ShellInput('--foo=bar echo "baz\\\\n";');
+ $input->bind($definition);
+ $this->assertSame('bar', $input->getOption('foo'));
+ $this->assertSame('echo "baz\n";', $input->getArgument('code'));
+ }
+
+ public function testInputOptionWithoutCodeArguments()
+ {
+ $definition = new InputDefinition([
+ new InputOption('foo', null, InputOption::VALUE_REQUIRED),
+ new InputOption('qux', 'q', InputOption::VALUE_REQUIRED),
+ new InputArgument('bar', null, InputArgument::REQUIRED),
+ new InputArgument('baz', null, InputArgument::REQUIRED),
+ ]);
+
+ $input = new ShellInput('--foo=foo -q qux bar "baz\\\\n"');
+ $input->bind($definition);
+ $this->assertSame('foo', $input->getOption('foo'));
+ $this->assertSame('qux', $input->getOption('qux'));
+ $this->assertSame('bar', $input->getArgument('bar'));
+ $this->assertSame('baz\\n', $input->getArgument('baz'));
+ }
+
+ public function testInputWithDashDash()
+ {
+ $definition = new InputDefinition([
+ new InputOption('foo', null, InputOption::VALUE_REQUIRED),
+ new CodeArgument('code', null, CodeArgument::REQUIRED),
+ ]);
+
+ $input = new ShellInput('-- echo --foo::$bar');
+ $input->bind($definition);
+ $this->assertNull($input->getOption('foo'));
+ $this->assertSame('echo --foo::$bar', $input->getArgument('code'));
+ }
+
+ public function testInputWithEmptyString()
+ {
+ $definition = new InputDefinition([
+ new InputOption('foo', null, InputOption::VALUE_REQUIRED),
+ new CodeArgument('code', null, CodeArgument::REQUIRED),
+ ]);
+
+ $input = new ShellInput('"" --foo bar');
+ $input->bind($definition);
+ $this->assertSame('"" --foo bar', $input->getArgument('code'));
+ }
+
+ /**
+ * @dataProvider getTokenizeData
+ */
+ public function testTokenize($input, $tokens, $message)
+ {
+ $input = new ShellInput($input);
+ $r = new \ReflectionClass('Psy\Input\ShellInput');
+ $p = $r->getProperty('tokenPairs');
+ $p->setAccessible(true);
+ $this->assertSame($tokens, $p->getValue($input), $message);
+ }
+
+ public function getTokenizeData()
+ {
+ // Test all the cases from StringInput test, ensuring they have an appropriate $rest token.
+ return [
+ [
+ '',
+ [],
+ '->tokenize() parses an empty string',
+ ],
+ [
+ 'foo',
+ [['foo', 'foo']],
+ '->tokenize() parses arguments',
+ ],
+ [
+ ' foo bar ',
+ [['foo', 'foo bar '], ['bar', 'bar ']],
+ '->tokenize() ignores whitespaces between arguments',
+ ],
+ [
+ '"quoted"',
+ [['quoted', '"quoted"']],
+ '->tokenize() parses quoted arguments',
+ ],
+ [
+ "'quoted'",
+ [['quoted', "'quoted'"]],
+ '->tokenize() parses quoted arguments',
+ ],
+ [
+ "'a\rb\nc\td'",
+ [["a\rb\nc\td", "'a\rb\nc\td'"]],
+ '->tokenize() parses whitespace chars in strings',
+ ],
+ [
+ "'a'\r'b'\n'c'\t'd'",
+ [
+ ['a', "'a'\r'b'\n'c'\t'd'"],
+ ['b', "'b'\n'c'\t'd'"],
+ ['c', "'c'\t'd'"],
+ ['d', "'d'"],
+ ],
+ '->tokenize() parses whitespace chars between args as spaces',
+ ],
+
+ /*
+ * These don't play nice with unescaping input, but the end result
+ * is correct, so disable the tests for now.
+ *
+ * @todo Sort this out and re-enable these test cases.
+ */
+ // [
+ // '\"quoted\"',
+ // [['"quoted"', '\"quoted\"']],
+ // '->tokenize() parses escaped-quoted arguments',
+ // ],
+ // [
+ // "\'quoted\'",
+ // [['\'quoted\'', "\'quoted\'"]],
+ // '->tokenize() parses escaped-quoted arguments',
+ // ],
+
+ [
+ '-a',
+ [['-a', '-a']],
+ '->tokenize() parses short options',
+ ],
+ [
+ '-azc',
+ [['-azc', '-azc']],
+ '->tokenize() parses aggregated short options',
+ ],
+ [
+ '-awithavalue',
+ [['-awithavalue', '-awithavalue']],
+ '->tokenize() parses short options with a value',
+ ],
+ [
+ '-a"foo bar"',
+ [['-afoo bar', '-a"foo bar"']],
+ '->tokenize() parses short options with a value',
+ ],
+ [
+ '-a"foo bar""foo bar"',
+ [['-afoo barfoo bar', '-a"foo bar""foo bar"']],
+ '->tokenize() parses short options with a value',
+ ],
+ [
+ '-a\'foo bar\'',
+ [['-afoo bar', '-a\'foo bar\'']],
+ '->tokenize() parses short options with a value',
+ ],
+ [
+ '-a\'foo bar\'\'foo bar\'',
+ [['-afoo barfoo bar', '-a\'foo bar\'\'foo bar\'']],
+ '->tokenize() parses short options with a value',
+ ],
+ [
+ '-a\'foo bar\'"foo bar"',
+ [['-afoo barfoo bar', '-a\'foo bar\'"foo bar"']],
+ '->tokenize() parses short options with a value',
+ ],
+ [
+ '--long-option',
+ [['--long-option', '--long-option']],
+ '->tokenize() parses long options',
+ ],
+ [
+ '--long-option=foo',
+ [['--long-option=foo', '--long-option=foo']],
+ '->tokenize() parses long options with a value',
+ ],
+ [
+ '--long-option="foo bar"',
+ [['--long-option=foo bar', '--long-option="foo bar"']],
+ '->tokenize() parses long options with a value',
+ ],
+ [
+ '--long-option="foo bar""another"',
+ [['--long-option=foo baranother', '--long-option="foo bar""another"']],
+ '->tokenize() parses long options with a value',
+ ],
+ [
+ '--long-option=\'foo bar\'',
+ [['--long-option=foo bar', '--long-option=\'foo bar\'']],
+ '->tokenize() parses long options with a value',
+ ],
+ [
+ "--long-option='foo bar''another'",
+ [['--long-option=foo baranother', "--long-option='foo bar''another'"]],
+ '->tokenize() parses long options with a value',
+ ],
+ [
+ "--long-option='foo bar'\"another\"",
+ [['--long-option=foo baranother', "--long-option='foo bar'\"another\""]],
+ '->tokenize() parses long options with a value',
+ ],
+ [
+ 'foo -a -ffoo --long bar',
+ [
+ ['foo', 'foo -a -ffoo --long bar'],
+ ['-a', '-a -ffoo --long bar'],
+ ['-ffoo', '-ffoo --long bar'],
+ ['--long', '--long bar'],
+ ['bar', 'bar'],
+ ],
+ '->tokenize() parses when several arguments and options',
+ ],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php b/vendor/psy/psysh/test/ParserTestCase.php
similarity index 81%
rename from vendor/psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php
rename to vendor/psy/psysh/test/ParserTestCase.php
index d1a30279..78055206 100644
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CodeCleanerTestCase.php
+++ b/vendor/psy/psysh/test/ParserTestCase.php
@@ -3,34 +3,29 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-namespace Psy\Test\CodeCleaner;
+namespace Psy\Test;
-use PhpParser\NodeTraverser;
use PhpParser\PrettyPrinter\Standard as Printer;
-use Psy\CodeCleaner\CodeCleanerPass;
use Psy\Exception\ParseErrorException;
use Psy\ParserFactory;
-class CodeCleanerTestCase extends \PHPUnit\Framework\TestCase
+class ParserTestCase extends \PHPUnit\Framework\TestCase
{
- protected $pass;
protected $traverser;
private $parser;
private $printer;
- protected function setPass(CodeCleanerPass $pass)
+ public function tearDown()
{
- $this->pass = $pass;
- if (!isset($this->traverser)) {
- $this->traverser = new NodeTraverser();
- }
- $this->traverser->addVisitor($this->pass);
+ $this->traverser = null;
+ $this->parser = null;
+ $this->printer = null;
}
protected function parse($code, $prefix = 'traverser)) {
+ throw new \RuntimeException('Test cases must provide a traverser');
+ }
+
return $this->traverser->traverse($stmts);
}
@@ -66,7 +65,8 @@ class CodeCleanerTestCase extends \PHPUnit\Framework\TestCase
{
$stmts = $this->parse($from);
$stmts = $this->traverse($stmts);
- $this->assertEquals($to, $this->prettyPrint($stmts));
+ $toStmts = $this->parse($to);
+ $this->assertSame($this->prettyPrint($toStmts), $this->prettyPrint($stmts));
}
private function getParser()
diff --git a/vendor/psy/psysh/test/Psy/Test/AutoloaderTest.php b/vendor/psy/psysh/test/Psy/Test/AutoloaderTest.php
deleted file mode 100644
index fdd6d5f8..00000000
--- a/vendor/psy/psysh/test/Psy/Test/AutoloaderTest.php
+++ /dev/null
@@ -1,23 +0,0 @@
-assertTrue(spl_autoload_unregister(array('Psy\Autoloader', 'autoload')));
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/AbstractClassPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/AbstractClassPassTest.php
deleted file mode 100644
index 21d4f085..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/AbstractClassPassTest.php
+++ /dev/null
@@ -1,64 +0,0 @@
-pass = new AbstractClassPass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
- }
-
- /**
- * @dataProvider invalidStatements
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testProcessStatementFails($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidStatements()
- {
- return array(
- array('class A { abstract function a(); }'),
- array('abstract class B { abstract function b() {} }'),
- array('abstract class B { abstract function b() { echo "yep"; } }'),
- );
- }
-
- /**
- * @dataProvider validStatements
- */
- public function testProcessStatementPasses($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validStatements()
- {
- return array(
- array('abstract class C { function c() {} }'),
- array('abstract class D { abstract function d(); }'),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CallTimePassByReferencePassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CallTimePassByReferencePassTest.php
deleted file mode 100644
index ff252794..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CallTimePassByReferencePassTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
-pass = new CallTimePassByReferencePass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
- }
-
- /**
- * @dataProvider invalidStatements
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testProcessStatementFails($code)
- {
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- $this->markTestSkipped();
- }
-
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidStatements()
- {
- return array(
- array('f(&$arg)'),
- array('$object->method($first, &$arg)'),
- array('$closure($first, &$arg, $last)'),
- array('A::b(&$arg)'),
- );
- }
-
- /**
- * @dataProvider validStatements
- */
- public function testProcessStatementPasses($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validStatements()
- {
- $data = array(
- array('array(&$var)'),
- array('$a = &$b'),
- array('f(array(&$b))'),
- );
-
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- $data = array_merge($data, $this->invalidStatements());
- }
-
- return $data;
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CalledClassPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CalledClassPassTest.php
deleted file mode 100644
index a581d7f3..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/CalledClassPassTest.php
+++ /dev/null
@@ -1,104 +0,0 @@
-pass = new CalledClassPass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
- }
-
- /**
- * @dataProvider invalidStatements
- * @expectedException \Psy\Exception\ErrorException
- */
- public function testProcessStatementFails($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidStatements()
- {
- return array(
- array('get_class()'),
- array('get_class(null)'),
- array('get_called_class()'),
- array('get_called_class(null)'),
- array('function foo() { return get_class(); }'),
- array('function foo() { return get_class(null); }'),
- array('function foo() { return get_called_class(); }'),
- array('function foo() { return get_called_class(null); }'),
- );
- }
-
- /**
- * @dataProvider validStatements
- */
- public function testProcessStatementPasses($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validStatements()
- {
- return array(
- array('get_class($foo)'),
- array('get_class(bar())'),
- array('get_called_class($foo)'),
- array('get_called_class(bar())'),
- array('function foo($bar) { return get_class($bar); }'),
- array('function foo($bar) { return get_called_class($bar); }'),
- array('class Foo { function bar() { return get_class(); } }'),
- array('class Foo { function bar() { return get_class(null); } }'),
- array('class Foo { function bar() { return get_called_class(); } }'),
- array('class Foo { function bar() { return get_called_class(null); } }'),
- array('$foo = function () {}; $foo()'),
- );
- }
-
- /**
- * @dataProvider validTraitStatements
- */
- public function testProcessTraitStatementPasses($code)
- {
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- $this->markTestSkipped();
- }
-
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validTraitStatements()
- {
- return array(
- array('trait Foo { function bar() { return get_class(); } }'),
- array('trait Foo { function bar() { return get_class(null); } }'),
- array('trait Foo { function bar() { return get_called_class(); } }'),
- array('trait Foo { function bar() { return get_called_class(null); } }'),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php
deleted file mode 100644
index 43b55546..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/ExitPassTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-setPass(new ExitPass());
- }
-
- /**
- * @dataProvider dataProviderExitStatement
- */
- public function testExitStatement($from, $to)
- {
- $this->assertProcessesAs($from, $to);
- }
-
- /**
- * Data provider for testExitStatement.
- *
- * @return array
- */
- public function dataProviderExitStatement()
- {
- return array(
- array('exit;', "{$this->expectedExceptionString};"),
- array('exit();', "{$this->expectedExceptionString};"),
- array('die;', "{$this->expectedExceptionString};"),
- array('exit(die(die));', "{$this->expectedExceptionString};"),
- array('if (true) { exit; }', "if (true) {\n {$this->expectedExceptionString};\n}"),
- array('if (false) { exit; }', "if (false) {\n {$this->expectedExceptionString};\n}"),
- array('1 and exit();', "1 and {$this->expectedExceptionString};"),
- array('foo() or die', "foo() or {$this->expectedExceptionString};"),
- array('exit and 1;', "{$this->expectedExceptionString} and 1;"),
- array('if (exit) { echo $wat; }', "if ({$this->expectedExceptionString}) {\n echo \$wat;\n}"),
- array('exit or die;', "{$this->expectedExceptionString} or {$this->expectedExceptionString};"),
- array('switch (die) { }', "switch ({$this->expectedExceptionString}) {\n}"),
- array('for ($i = 1; $i < 10; die) {}', "for (\$i = 1; \$i < 10; {$this->expectedExceptionString}) {\n}"),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/InstanceOfPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/InstanceOfPassTest.php
deleted file mode 100644
index fc4a5b6a..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/InstanceOfPassTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
-setPass(new InstanceOfPass());
- }
-
- /**
- * @dataProvider invalidStatements
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testProcessInvalidStatement($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidStatements()
- {
- return array(
- array('null instanceof stdClass'),
- array('true instanceof stdClass'),
- array('9 instanceof stdClass'),
- array('1.0 instanceof stdClass'),
- array('"foo" instanceof stdClass'),
- array('__DIR__ instanceof stdClass'),
- array('PHP_SAPI instanceof stdClass'),
- array('1+1 instanceof stdClass'),
- array('true && false instanceof stdClass'),
- array('"a"."b" instanceof stdClass'),
- array('!5 instanceof stdClass'),
- );
- }
-
- /**
- * @dataProvider validStatements
- */
- public function testProcessValidStatement($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validStatements()
- {
- $data = array(
- array('$a instanceof stdClass'),
- array('strtolower("foo") instanceof stdClass'),
- array('array(1) instanceof stdClass'),
- array('(string) "foo" instanceof stdClass'),
- array('(1+1) instanceof stdClass'),
- array('"foo ${foo} $bar" instanceof stdClass'),
- array('DateTime::ISO8601 instanceof stdClass'),
- );
-
- return $data;
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/LoopContextPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/LoopContextPassTest.php
deleted file mode 100644
index 7f261dfa..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/LoopContextPassTest.php
+++ /dev/null
@@ -1,137 +0,0 @@
-pass = new LoopContextPass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
- }
-
- /**
- * @dataProvider invalidStatements
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testProcessStatementFails($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidStatements()
- {
- return array(
- array('continue'),
- array('break'),
- array('if (true) { continue; }'),
- array('if (true) { break; }'),
- array('if (false) { continue; }'),
- array('if (false) { break; }'),
- array('function foo() { break; }'),
- array('function foo() { continue; }'),
-
- // actually enforce break/continue depth argument
- array('do { break 2; } while (true)'),
- array('do { continue 2; } while (true)'),
- array('for ($a; $b; $c) { break 2; }'),
- array('for ($a; $b; $c) { continue 2; }'),
- array('foreach ($a as $b) { break 2; }'),
- array('foreach ($a as $b) { continue 2; }'),
- array('switch (true) { default: break 2; }'),
- array('switch (true) { default: continue 2; }'),
- array('while (true) { break 2; }'),
- array('while (true) { continue 2; }'),
-
- // invalid in 5.4+ because they're floats
- // ... in 5.3 because the number is too big
- array('while (true) { break 2.0; }'),
- array('while (true) { continue 2.0; }'),
-
- // and once with nested loops, just for good measure
- array('while (true) { while (true) { break 3; } }'),
- array('while (true) { while (true) { continue 3; } }'),
- );
- }
-
- /**
- * @dataProvider invalidPHP54Statements
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testPHP54ProcessStatementFails($code)
- {
- if (version_compare(PHP_VERSION, '5.4.0', '<')) {
- $this->markTestSkipped();
- }
-
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidPHP54Statements()
- {
- return array(
- // In PHP 5.4+, only positive literal integers are allowed
- array('while (true) { break $n; }'),
- array('while (true) { continue $n; }'),
- array('while (true) { break N; }'),
- array('while (true) { continue N; }'),
- array('while (true) { break 0; }'),
- array('while (true) { continue 0; }'),
- array('while (true) { break -1; }'),
- array('while (true) { continue -1; }'),
- array('while (true) { break 1.0; }'),
- array('while (true) { continue 1.0; }'),
- );
- }
-
- /**
- * @dataProvider validStatements
- */
- public function testProcessStatementPasses($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validStatements()
- {
- return array(
- array('do { break; } while (true)'),
- array('do { continue; } while (true)'),
- array('for ($a; $b; $c) { break; }'),
- array('for ($a; $b; $c) { continue; }'),
- array('foreach ($a as $b) { break; }'),
- array('foreach ($a as $b) { continue; }'),
- array('switch (true) { default: break; }'),
- array('switch (true) { default: continue; }'),
- array('while (true) { break; }'),
- array('while (true) { continue; }'),
-
- // `break 1` is redundant, but not invalid
- array('while (true) { break 1; }'),
- array('while (true) { continue 1; }'),
-
- // and once with nested loops just for good measure
- array('while (true) { while (true) { break 2; } }'),
- array('while (true) { while (true) { continue 2; } }'),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/NamespacePassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/NamespacePassTest.php
deleted file mode 100644
index 553a699a..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/NamespacePassTest.php
+++ /dev/null
@@ -1,56 +0,0 @@
-cleaner = new CodeCleaner();
- $this->setPass(new NamespacePass($this->cleaner));
- }
-
- public function testProcess()
- {
- $this->process('array_merge()');
- $this->assertNull($this->cleaner->getNamespace());
-
- // A non-block namespace statement should set the current namespace.
- $this->process('namespace Alpha');
- $this->assertEquals(array('Alpha'), $this->cleaner->getNamespace());
-
- // A new non-block namespace statement should override the current namespace.
- $this->process('namespace Beta; class B {}');
- $this->assertEquals(array('Beta'), $this->cleaner->getNamespace());
-
- // @todo Figure out if we can detect when the last namespace block is
- // bracketed or unbracketed, because this should really clear the
- // namespace at the end...
- $this->process('namespace Gamma { array_merge(); }');
- $this->assertEquals(array('Gamma'), $this->cleaner->getNamespace());
-
- // A null namespace clears out the current namespace.
- $this->process('namespace { array_merge(); }');
- $this->assertNull($this->cleaner->getNamespace());
- }
-
- private function process($code)
- {
- $stmts = $this->parse($code);
- $this->traverse($stmts);
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/PassableByReferencePassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/PassableByReferencePassTest.php
deleted file mode 100644
index 94843d99..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/PassableByReferencePassTest.php
+++ /dev/null
@@ -1,115 +0,0 @@
-pass = new PassableByReferencePass();
- $this->traverser = new NodeTraverser();
- $this->traverser->addVisitor($this->pass);
- }
-
- /**
- * @dataProvider invalidStatements
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testProcessStatementFails($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidStatements()
- {
- return array(
- array('array_pop(array())'),
- array('array_pop(array($foo))'),
- array('array_shift(array())'),
- );
- }
-
- /**
- * @dataProvider validStatements
- */
- public function testProcessStatementPasses($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validStatements()
- {
- return array(
- array('array_pop(json_decode("[]"))'),
- array('array_pop($foo)'),
- array('array_pop($foo->bar)'),
- array('array_pop($foo::baz)'),
- array('array_pop(Foo::qux)'),
- );
- }
-
- /**
- * @dataProvider validArrayMultisort
- */
- public function testArrayMultisort($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validArrayMultisort()
- {
- return array(
- array('array_multisort($a)'),
- array('array_multisort($a, $b)'),
- array('array_multisort($a, SORT_NATURAL, $b)'),
- array('array_multisort($a, SORT_NATURAL | SORT_FLAG_CASE, $b)'),
- array('array_multisort($a, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $b)'),
- array('array_multisort($a, SORT_NATURAL | SORT_FLAG_CASE, SORT_ASC, $b)'),
- array('array_multisort($a, $b, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE)'),
- array('array_multisort($a, SORT_NATURAL | SORT_FLAG_CASE, $b, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE)'),
- array('array_multisort($a, 1, $b)'),
- array('array_multisort($a, 1 + 2, $b)'),
- array('array_multisort($a, getMultisortFlags(), $b)'),
- );
- }
-
- /**
- * @dataProvider invalidArrayMultisort
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testInvalidArrayMultisort($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidArrayMultisort()
- {
- return array(
- array('array_multisort(1)'),
- array('array_multisort(array(1, 2, 3))'),
- array('array_multisort($a, SORT_NATURAL, SORT_ASC, SORT_NATURAL, $b)'),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/StaticConstructorPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/StaticConstructorPassTest.php
deleted file mode 100644
index 0ba72380..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/StaticConstructorPassTest.php
+++ /dev/null
@@ -1,94 +0,0 @@
-setPass(new StaticConstructorPass());
- }
-
- /**
- * @dataProvider invalidStatements
- * @expectedException \Psy\Exception\FatalErrorException
- */
- public function testProcessInvalidStatement($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- /**
- * @dataProvider invalidParserStatements
- * @expectedException \Psy\Exception\ParseErrorException
- */
- public function testProcessInvalidStatementCatchedByParser($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
- }
-
- public function invalidStatements()
- {
- $statements = array(
- array('class A { public static function A() {}}'),
- array('class A { private static function A() {}}'),
- );
-
- if (version_compare(PHP_VERSION, '5.3.3', '<')) {
- $statements[] = array('namespace B; class A { private static function A() {}}');
- }
-
- return $statements;
- }
-
- public function invalidParserStatements()
- {
- $statements = array(
- array('class A { public static function __construct() {}}'),
- array('class A { private static function __construct() {}}'),
- array('class A { private static function __construct() {} public function A() {}}'),
- array('namespace B; class A { private static function __construct() {}}'),
- );
-
- return $statements;
- }
-
- /**
- * @dataProvider validStatements
- */
- public function testProcessValidStatement($code)
- {
- $stmts = $this->parse($code);
- $this->traverser->traverse($stmts);
-
- // @todo a better thing to assert here?
- $this->assertTrue(true);
- }
-
- public function validStatements()
- {
- $statements = array(
- array('class A { public static function A() {} public function __construct() {}}'),
- array('class A { private function __construct() {} public static function A() {}}'),
- );
-
- if (version_compare(PHP_VERSION, '5.3.3', '>=')) {
- $statements[] = array('namespace B; class A { private static function A() {}}');
- }
-
- return $statements;
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php
deleted file mode 100644
index 9c525efe..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleaner/UseStatementPassTest.php
+++ /dev/null
@@ -1,52 +0,0 @@
-setPass(new UseStatementPass());
- }
-
- /**
- * @dataProvider useStatements
- */
- public function testProcess($from, $to)
- {
- $this->assertProcessesAs($from, $to);
- }
-
- public function useStatements()
- {
- return array(
- array(
- "use StdClass as NotSoStd;\n\$std = new NotSoStd();",
- '$std = new \\StdClass();',
- ),
- array(
- "namespace Foo;\n\nuse StdClass as S;\n\$std = new S();",
- "namespace Foo;\n\n\$std = new \\StdClass();",
- ),
- array(
- "namespace Foo;\n\nuse \\StdClass as S;\n\$std = new S();",
- "namespace Foo;\n\n\$std = new \\StdClass();",
- ),
- array(
- "use Foo\\Bar as fb;\n\$baz = new fb\\Baz();",
- '$baz = new \\Foo\\Bar\\Baz();',
- ),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/CodeCleanerTest.php b/vendor/psy/psysh/test/Psy/Test/CodeCleanerTest.php
deleted file mode 100644
index f46b6da1..00000000
--- a/vendor/psy/psysh/test/Psy/Test/CodeCleanerTest.php
+++ /dev/null
@@ -1,132 +0,0 @@
-assertEquals($expected, $cc->clean($lines, $requireSemicolons));
- }
-
- public function semicolonCodeProvider()
- {
- $values = array(
- array(array('true'), false, 'return true;'),
- array(array('true;'), false, 'return true;'),
- array(array('true;'), true, 'return true;'),
- array(array('true'), true, false),
-
- array(array('echo "foo";', 'true'), true, false),
- );
-
- if (version_compare(PHP_VERSION, '5.4', '<')) {
- $values[] = array(array('echo "foo";', 'true'), false, "echo 'foo';\nreturn true;");
- } else {
- $values[] = array(array('echo "foo";', 'true'), false, "echo \"foo\";\nreturn true;");
- }
-
- return $values;
- }
-
- /**
- * @dataProvider unclosedStatementsProvider
- */
- public function testUnclosedStatements(array $lines, $isUnclosed)
- {
- $cc = new CodeCleaner();
- $res = $cc->clean($lines);
-
- if ($isUnclosed) {
- $this->assertFalse($res);
- } else {
- $this->assertNotFalse($res);
- }
- }
-
- public function unclosedStatementsProvider()
- {
- return array(
- array(array('echo "'), true),
- array(array('echo \''), true),
- array(array('if (1) {'), true),
-
- array(array('echo ""'), false),
- array(array("echo ''"), false),
- array(array('if (1) {}'), false),
-
- array(array('// closed comment'), false),
- array(array('function foo() { /**'), true),
-
- array(array('var_dump(1, 2,'), true),
- array(array('var_dump(1, 2,', '3)'), false),
- );
- }
-
- /**
- * @dataProvider moreUnclosedStatementsProvider
- */
- public function testMoreUnclosedStatements(array $lines)
- {
- if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('HHVM not supported.');
- }
-
- $cc = new CodeCleaner();
- $res = $cc->clean($lines);
-
- $this->assertFalse($res);
- }
-
- public function moreUnclosedStatementsProvider()
- {
- return array(
- array(array("\$content = <<clean(array($code));
- }
-
- public function invalidStatementsProvider()
- {
- return array(
- array('function "what'),
- array("function 'what"),
- array('echo }'),
- array('echo {'),
- array('if (1) }'),
- array('echo """'),
- array("echo '''"),
- array('$foo "bar'),
- array('$foo \'bar'),
- array('var_dump(1,2,)'),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php b/vendor/psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php
deleted file mode 100644
index 7f1635e5..00000000
--- a/vendor/psy/psysh/test/Psy/Test/Formatter/CodeFormatterTest.php
+++ /dev/null
@@ -1,65 +0,0 @@
- 18| private function ignoreThisMethod($arg)
- 19| {
- 20| echo 'whot!';
- 21| }
-EOS;
-
- $formatted = CodeFormatter::format(new \ReflectionMethod($this, 'ignoreThisMethod'));
- $formattedWithoutColors = preg_replace('#' . chr(27) . '\[\d\d?m#', '', $formatted);
-
- $this->assertEquals($expected, rtrim($formattedWithoutColors));
- $this->assertNotEquals($expected, rtrim($formatted));
- }
-
- /**
- * @dataProvider filenames
- * @expectedException \Psy\Exception\RuntimeException
- */
- public function testCodeFormatterThrowsException($filename)
- {
- $reflector = $this->getMockBuilder('ReflectionClass')
- ->disableOriginalConstructor()
- ->getMock();
-
- $reflector
- ->expects($this->once())
- ->method('getFileName')
- ->will($this->returnValue($filename));
-
- CodeFormatter::format($reflector);
- }
-
- public function filenames()
- {
- if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('We have issues with PHPUnit mocks on HHVM.');
- }
-
- return array(array(null), array('not a file'));
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/Input/ShellInputTest.php b/vendor/psy/psysh/test/Psy/Test/Input/ShellInputTest.php
deleted file mode 100644
index 98a89779..00000000
--- a/vendor/psy/psysh/test/Psy/Test/Input/ShellInputTest.php
+++ /dev/null
@@ -1,204 +0,0 @@
-getProperty('tokenPairs');
- $p->setAccessible(true);
- $this->assertEquals($tokens, $p->getValue($input), $message);
- }
-
- public function testInputOptionWithGivenString()
- {
- $definition = new InputDefinition(array(
- new InputOption('foo', null, InputOption::VALUE_REQUIRED),
- new CodeArgument('code', null, InputOption::VALUE_REQUIRED),
- ));
-
- $input = new ShellInput('--foo=bar echo "baz\n";');
- $input->bind($definition);
- $this->assertEquals('bar', $input->getOption('foo'));
- $this->assertEquals('echo "baz\n";', $input->getArgument('code'));
- }
-
- public function testInputOptionWithoutCodeArguments()
- {
- $definition = new InputDefinition(array(
- new InputOption('foo', null, InputOption::VALUE_REQUIRED),
- new InputArgument('bar', null, InputOption::VALUE_REQUIRED),
- new InputArgument('baz', null, InputOption::VALUE_REQUIRED),
- ));
-
- $input = new ShellInput('--foo=foo bar "baz\n"');
- $input->bind($definition);
- $this->assertEquals('foo', $input->getOption('foo'));
- $this->assertEquals('bar', $input->getArgument('bar'));
- $this->assertEquals("baz\n", $input->getArgument('baz'));
- }
-
- public function getTokenizeData()
- {
- // Test all the cases from StringInput test, ensuring they have an appropriate $rest token.
- return array(
- array(
- '',
- array(),
- '->tokenize() parses an empty string',
- ),
- array(
- 'foo',
- array(array('foo', 'foo')),
- '->tokenize() parses arguments',
- ),
- array(
- ' foo bar ',
- array(array('foo', 'foo bar '), array('bar', 'bar ')),
- '->tokenize() ignores whitespaces between arguments',
- ),
- array(
- '"quoted"',
- array(array('quoted', '"quoted"')),
- '->tokenize() parses quoted arguments',
- ),
- array(
- "'quoted'",
- array(array('quoted', "'quoted'")),
- '->tokenize() parses quoted arguments',
- ),
- array(
- "'a\rb\nc\td'",
- array(array("a\rb\nc\td", "'a\rb\nc\td'")),
- '->tokenize() parses whitespace chars in strings',
- ),
- array(
- "'a'\r'b'\n'c'\t'd'",
- array(
- array('a', "'a'\r'b'\n'c'\t'd'"),
- array('b', "'b'\n'c'\t'd'"),
- array('c', "'c'\t'd'"),
- array('d', "'d'"),
- ),
- '->tokenize() parses whitespace chars between args as spaces',
- ),
- array(
- '\"quoted\"',
- array(array('"quoted"', '\"quoted\"')),
- '->tokenize() parses escaped-quoted arguments',
- ),
- array(
- "\'quoted\'",
- array(array('\'quoted\'', "\'quoted\'")),
- '->tokenize() parses escaped-quoted arguments',
- ),
- array(
- '-a',
- array(array('-a', '-a')),
- '->tokenize() parses short options',
- ),
- array(
- '-azc',
- array(array('-azc', '-azc')),
- '->tokenize() parses aggregated short options',
- ),
- array(
- '-awithavalue',
- array(array('-awithavalue', '-awithavalue')),
- '->tokenize() parses short options with a value',
- ),
- array(
- '-a"foo bar"',
- array(array('-afoo bar', '-a"foo bar"')),
- '->tokenize() parses short options with a value',
- ),
- array(
- '-a"foo bar""foo bar"',
- array(array('-afoo barfoo bar', '-a"foo bar""foo bar"')),
- '->tokenize() parses short options with a value',
- ),
- array(
- '-a\'foo bar\'',
- array(array('-afoo bar', '-a\'foo bar\'')),
- '->tokenize() parses short options with a value',
- ),
- array(
- '-a\'foo bar\'\'foo bar\'',
- array(array('-afoo barfoo bar', '-a\'foo bar\'\'foo bar\'')),
- '->tokenize() parses short options with a value',
- ),
- array(
- '-a\'foo bar\'"foo bar"',
- array(array('-afoo barfoo bar', '-a\'foo bar\'"foo bar"')),
- '->tokenize() parses short options with a value',
- ),
- array(
- '--long-option',
- array(array('--long-option', '--long-option')),
- '->tokenize() parses long options',
- ),
- array(
- '--long-option=foo',
- array(array('--long-option=foo', '--long-option=foo')),
- '->tokenize() parses long options with a value',
- ),
- array(
- '--long-option="foo bar"',
- array(array('--long-option=foo bar', '--long-option="foo bar"')),
- '->tokenize() parses long options with a value',
- ),
- array(
- '--long-option="foo bar""another"',
- array(array('--long-option=foo baranother', '--long-option="foo bar""another"')),
- '->tokenize() parses long options with a value',
- ),
- array(
- '--long-option=\'foo bar\'',
- array(array('--long-option=foo bar', '--long-option=\'foo bar\'')),
- '->tokenize() parses long options with a value',
- ),
- array(
- "--long-option='foo bar''another'",
- array(array('--long-option=foo baranother', "--long-option='foo bar''another'")),
- '->tokenize() parses long options with a value',
- ),
- array(
- "--long-option='foo bar'\"another\"",
- array(array('--long-option=foo baranother', "--long-option='foo bar'\"another\"")),
- '->tokenize() parses long options with a value',
- ),
- array(
- 'foo -a -ffoo --long bar',
- array(
- array('foo', 'foo -a -ffoo --long bar'),
- array('-a', '-a -ffoo --long bar'),
- array('-ffoo', '-ffoo --long bar'),
- array('--long', '--long bar'),
- array('bar', 'bar'),
- ),
- '->tokenize() parses when several arguments and options',
- ),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php b/vendor/psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php
deleted file mode 100644
index 60164f71..00000000
--- a/vendor/psy/psysh/test/Psy/Test/Reflection/ReflectionConstantTest.php
+++ /dev/null
@@ -1,60 +0,0 @@
-getDeclaringClass();
-
- $this->assertTrue($class instanceof \ReflectionClass);
- $this->assertEquals('Psy\Test\Reflection\ReflectionConstantTest', $class->getName());
- $this->assertEquals('CONSTANT_ONE', $refl->getName());
- $this->assertEquals('CONSTANT_ONE', (string) $refl);
- $this->assertEquals('one', $refl->getValue());
- $this->assertEquals(null, $refl->getFileName());
- $this->assertFalse($refl->getDocComment());
- }
-
- /**
- * @expectedException \InvalidArgumentException
- */
- public function testUnknownConstantThrowsException()
- {
- new ReflectionConstant($this, 'UNKNOWN_CONSTANT');
- }
-
- /**
- * @expectedException \RuntimeException
- * @dataProvider notYetImplemented
- */
- public function testNotYetImplemented($method)
- {
- $refl = new ReflectionConstant($this, 'CONSTANT_ONE');
- $refl->$method();
- }
-
- public function notYetImplemented()
- {
- return array(
- array('getStartLine'),
- array('getEndLine'),
- array('export'),
- );
- }
-}
diff --git a/vendor/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php b/vendor/psy/psysh/test/Readline/GNUReadlineTest.php
similarity index 75%
rename from vendor/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php
rename to vendor/psy/psysh/test/Readline/GNUReadlineTest.php
index 95a40e7c..7f39197e 100644
--- a/vendor/psy/psysh/test/Psy/Test/Readline/GNUReadlineTest.php
+++ b/vendor/psy/psysh/test/Readline/GNUReadlineTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -32,11 +32,11 @@ class GNUReadlineTest extends \PHPUnit\Framework\TestCase
$readline = new GNUReadline($this->historyFile);
$this->assertEmpty($readline->listHistory());
$readline->addHistory('foo');
- $this->assertEquals(array('foo'), $readline->listHistory());
+ $this->assertSame(['foo'], $readline->listHistory());
$readline->addHistory('bar');
- $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar'], $readline->listHistory());
$readline->addHistory('baz');
- $this->assertEquals(array('foo', 'bar', 'baz'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar', 'baz'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
@@ -50,11 +50,11 @@ class GNUReadlineTest extends \PHPUnit\Framework\TestCase
$this->assertEmpty($readline->listHistory());
$readline->addHistory('foo');
$readline->addHistory('bar');
- $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar'], $readline->listHistory());
$readline->addHistory('baz');
- $this->assertEquals(array('bar', 'baz'), $readline->listHistory());
+ $this->assertSame(['bar', 'baz'], $readline->listHistory());
$readline->addHistory('w00t');
- $this->assertEquals(array('baz', 'w00t'), $readline->listHistory());
+ $this->assertSame(['baz', 'w00t'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
@@ -69,11 +69,11 @@ class GNUReadlineTest extends \PHPUnit\Framework\TestCase
$readline->addHistory('foo');
$readline->addHistory('bar');
$readline->addHistory('foo');
- $this->assertEquals(array('bar', 'foo'), $readline->listHistory());
+ $this->assertSame(['bar', 'foo'], $readline->listHistory());
$readline->addHistory('baz');
$readline->addHistory('w00t');
$readline->addHistory('baz');
- $this->assertEquals(array('bar', 'foo', 'w00t', 'baz'), $readline->listHistory());
+ $this->assertSame(['bar', 'foo', 'w00t', 'baz'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php b/vendor/psy/psysh/test/Readline/HoaConsoleTest.php
similarity index 73%
rename from vendor/psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php
rename to vendor/psy/psysh/test/Readline/HoaConsoleTest.php
index 707837d8..ecf444f3 100644
--- a/vendor/psy/psysh/test/Psy/Test/Readline/HoaConsoleTest.php
+++ b/vendor/psy/psysh/test/Readline/HoaConsoleTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,11 +20,11 @@ class HoaConsoleTest extends \PHPUnit\Framework\TestCase
$readline = new HoaConsole();
$this->assertEmpty($readline->listHistory());
$readline->addHistory('foo');
- $this->assertEquals(array('foo'), $readline->listHistory());
+ $this->assertSame(['foo'], $readline->listHistory());
$readline->addHistory('bar');
- $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar'], $readline->listHistory());
$readline->addHistory('baz');
- $this->assertEquals(array('foo', 'bar', 'baz'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar', 'baz'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Readline/LibeditTest.php b/vendor/psy/psysh/test/Readline/LibeditTest.php
similarity index 80%
rename from vendor/psy/psysh/test/Psy/Test/Readline/LibeditTest.php
rename to vendor/psy/psysh/test/Readline/LibeditTest.php
index fb0aaa59..44a06c61 100644
--- a/vendor/psy/psysh/test/Psy/Test/Readline/LibeditTest.php
+++ b/vendor/psy/psysh/test/Readline/LibeditTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -45,11 +45,11 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
$readline = new Libedit($this->historyFile);
$this->assertEmpty($readline->listHistory());
$readline->addHistory('foo');
- $this->assertEquals(array('foo'), $readline->listHistory());
+ $this->assertSame(['foo'], $readline->listHistory());
$readline->addHistory('bar');
- $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar'], $readline->listHistory());
$readline->addHistory('baz');
- $this->assertEquals(array('foo', 'bar', 'baz'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar', 'baz'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
@@ -63,11 +63,11 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
$this->assertEmpty($readline->listHistory());
$readline->addHistory('foo');
$readline->addHistory('bar');
- $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar'], $readline->listHistory());
$readline->addHistory('baz');
- $this->assertEquals(array('bar', 'baz'), $readline->listHistory());
+ $this->assertSame(['bar', 'baz'], $readline->listHistory());
$readline->addHistory('w00t');
- $this->assertEquals(array('baz', 'w00t'), $readline->listHistory());
+ $this->assertSame(['baz', 'w00t'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
@@ -82,11 +82,11 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
$readline->addHistory('foo');
$readline->addHistory('bar');
$readline->addHistory('foo');
- $this->assertEquals(array('bar', 'foo'), $readline->listHistory());
+ $this->assertSame(['bar', 'foo'], $readline->listHistory());
$readline->addHistory('baz');
$readline->addHistory('w00t');
$readline->addHistory('baz');
- $this->assertEquals(array('bar', 'foo', 'w00t', 'baz'), $readline->listHistory());
+ $this->assertSame(['bar', 'foo', 'w00t', 'baz'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
@@ -99,10 +99,10 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
"This is an entry\n\0This is a comment\nThis is an entry\0With a comment\n",
FILE_APPEND
);
- $this->assertEquals(array(
+ $this->assertSame([
'This is an entry',
'This is an entry',
- ), $readline->listHistory());
+ ], $readline->listHistory());
$readline->clearHistory();
}
@@ -118,11 +118,11 @@ class LibeditTest extends \PHPUnit\Framework\TestCase
"foo\rbar\nbaz\r\nw00t",
FILE_APPEND
);
- $this->assertEquals(array(
+ $this->assertSame([
"foo\rbar",
"baz\r",
'w00t',
- ), $readline->listHistory());
+ ], $readline->listHistory());
$readline->clearHistory();
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Readline/TransientTest.php b/vendor/psy/psysh/test/Readline/TransientTest.php
similarity index 74%
rename from vendor/psy/psysh/test/Psy/Test/Readline/TransientTest.php
rename to vendor/psy/psysh/test/Readline/TransientTest.php
index 24eafbaf..24fcba0b 100644
--- a/vendor/psy/psysh/test/Psy/Test/Readline/TransientTest.php
+++ b/vendor/psy/psysh/test/Readline/TransientTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,11 +20,11 @@ class TransientTest extends \PHPUnit\Framework\TestCase
$readline = new Transient();
$this->assertEmpty($readline->listHistory());
$readline->addHistory('foo');
- $this->assertEquals(array('foo'), $readline->listHistory());
+ $this->assertSame(['foo'], $readline->listHistory());
$readline->addHistory('bar');
- $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar'], $readline->listHistory());
$readline->addHistory('baz');
- $this->assertEquals(array('foo', 'bar', 'baz'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar', 'baz'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
@@ -38,11 +38,11 @@ class TransientTest extends \PHPUnit\Framework\TestCase
$this->assertEmpty($readline->listHistory());
$readline->addHistory('foo');
$readline->addHistory('bar');
- $this->assertEquals(array('foo', 'bar'), $readline->listHistory());
+ $this->assertSame(['foo', 'bar'], $readline->listHistory());
$readline->addHistory('baz');
- $this->assertEquals(array('bar', 'baz'), $readline->listHistory());
+ $this->assertSame(['bar', 'baz'], $readline->listHistory());
$readline->addHistory('w00t');
- $this->assertEquals(array('baz', 'w00t'), $readline->listHistory());
+ $this->assertSame(['baz', 'w00t'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
@@ -57,11 +57,11 @@ class TransientTest extends \PHPUnit\Framework\TestCase
$readline->addHistory('foo');
$readline->addHistory('bar');
$readline->addHistory('foo');
- $this->assertEquals(array('bar', 'foo'), $readline->listHistory());
+ $this->assertSame(['bar', 'foo'], $readline->listHistory());
$readline->addHistory('baz');
$readline->addHistory('w00t');
$readline->addHistory('baz');
- $this->assertEquals(array('bar', 'foo', 'w00t', 'baz'), $readline->listHistory());
+ $this->assertSame(['bar', 'foo', 'w00t', 'baz'], $readline->listHistory());
$readline->clearHistory();
$this->assertEmpty($readline->listHistory());
}
diff --git a/vendor/psy/psysh/test/Reflection/ReflectionClassConstantTest.php b/vendor/psy/psysh/test/Reflection/ReflectionClassConstantTest.php
new file mode 100644
index 00000000..87d4f752
--- /dev/null
+++ b/vendor/psy/psysh/test/Reflection/ReflectionClassConstantTest.php
@@ -0,0 +1,81 @@
+getDeclaringClass();
+
+ $this->assertInstanceOf('ReflectionClass', $class);
+ $this->assertSame('Psy\Test\Reflection\ReflectionClassConstantTest', $class->getName());
+ $this->assertSame('CONSTANT_ONE', $refl->getName());
+ $this->assertSame('CONSTANT_ONE', (string) $refl);
+ $this->assertSame('one', $refl->getValue());
+ $this->assertNull($refl->getFileName());
+ $this->assertFalse($refl->getDocComment());
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testUnknownConstantThrowsException()
+ {
+ new ReflectionClassConstant($this, 'UNKNOWN_CONSTANT');
+ }
+
+ public function testExport()
+ {
+ $ret = ReflectionClassConstant::export($this, 'CONSTANT_ONE', true);
+ $this->assertEquals($ret, 'Constant [ public string CONSTANT_ONE ] { one }');
+ }
+
+ public function testExportOutput()
+ {
+ $this->expectOutputString("Constant [ public string CONSTANT_ONE ] { one }\n");
+ ReflectionClassConstant::export($this, 'CONSTANT_ONE', false);
+ }
+
+ public function testModifiers()
+ {
+ $refl = new ReflectionClassConstant($this, 'CONSTANT_ONE');
+
+ $this->assertEquals(\ReflectionMethod::IS_PUBLIC, $refl->getModifiers());
+ $this->assertFalse($refl->isPrivate());
+ $this->assertFalse($refl->isProtected());
+ $this->assertTrue($refl->isPublic());
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ * @dataProvider notYetImplemented
+ */
+ public function testNotYetImplemented($method)
+ {
+ $refl = new ReflectionClassConstant($this, 'CONSTANT_ONE');
+ $refl->$method();
+ }
+
+ public function notYetImplemented()
+ {
+ return [
+ ['getStartLine'],
+ ['getEndLine'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Reflection/ReflectionConstantBCTest.php b/vendor/psy/psysh/test/Reflection/ReflectionConstantBCTest.php
new file mode 100644
index 00000000..69d27970
--- /dev/null
+++ b/vendor/psy/psysh/test/Reflection/ReflectionConstantBCTest.php
@@ -0,0 +1,26 @@
+assertInstanceOf('Psy\Reflection\ReflectionConstant', $refl);
+ $this->assertInstanceOf('Psy\Reflection\ReflectionClassConstant', $refl);
+ }
+}
diff --git a/vendor/psy/psysh/test/Reflection/ReflectionConstantTest.php b/vendor/psy/psysh/test/Reflection/ReflectionConstantTest.php
new file mode 100644
index 00000000..95328ff8
--- /dev/null
+++ b/vendor/psy/psysh/test/Reflection/ReflectionConstantTest.php
@@ -0,0 +1,114 @@
+assertFalse($refl->getDocComment());
+ $this->assertEquals('Psy\\Test\\Reflection\\SOME_CONSTANT', $refl->getName());
+ $this->assertEquals('Psy\\Test\\Reflection', $refl->getNamespaceName());
+ $this->assertEquals('yep', $refl->getValue());
+ $this->assertTrue($refl->inNamespace());
+ $this->assertEquals('Psy\\Test\\Reflection\\SOME_CONSTANT', (string) $refl);
+ $this->assertNull($refl->getFileName());
+ }
+
+ public function testBuiltInConstant()
+ {
+ $refl = new ReflectionConstant_('PHP_VERSION');
+
+ $this->assertEquals('PHP_VERSION', $refl->getName());
+ $this->assertEquals('PHP_VERSION', (string) $refl);
+ $this->assertEquals(PHP_VERSION, $refl->getValue());
+ $this->assertFalse($refl->inNamespace());
+ $this->assertSame('', $refl->getNamespaceName());
+ }
+
+ /**
+ * @dataProvider magicConstants
+ */
+ public function testIsMagicConstant($name, $is)
+ {
+ $this->assertEquals($is, ReflectionConstant_::isMagicConstant($name));
+ }
+
+ public function magicConstants()
+ {
+ return [
+ ['__LINE__', true],
+ ['__FILE__', true],
+ ['__DIR__', true],
+ ['__FUNCTION__', true],
+ ['__CLASS__', true],
+ ['__TRAIT__', true],
+ ['__METHOD__', true],
+ ['__NAMESPACE__', true],
+ ['__COMPILER_HALT_OFFSET__', true],
+ ['PHP_VERSION', false],
+ ['PHP_EOL', false],
+ ['Psy\\Test\\Reflection\\SOME_CONSTANT', false],
+ ['What if it isn\'t even a valid constant name?', false],
+ ];
+ }
+
+ /**
+ * @expectedException \InvalidArgumentException
+ */
+ public function testUnknownConstantThrowsException()
+ {
+ new ReflectionConstant_('UNKNOWN_CONSTANT');
+ }
+
+ public function testExport()
+ {
+ $ret = ReflectionConstant_::export('Psy\\Test\\Reflection\\SOME_CONSTANT', true);
+ $this->assertEquals($ret, 'Constant [ string Psy\\Test\\Reflection\\SOME_CONSTANT ] { yep }');
+ }
+
+ public function testExportOutput()
+ {
+ $this->expectOutputString("Constant [ string Psy\\Test\\Reflection\\SOME_CONSTANT ] { yep }\n");
+ ReflectionConstant_::export('Psy\\Test\\Reflection\\SOME_CONSTANT', false);
+ }
+
+ public function testGetFileName()
+ {
+ $refl = new ReflectionConstant_('Psy\\Test\\Reflection\\SOME_CONSTANT');
+ $this->assertNull($refl->getFileName());
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ * @dataProvider notYetImplemented
+ */
+ public function testNotYetImplemented($method)
+ {
+ $refl = new ReflectionConstant_('Psy\\Test\\Reflection\\SOME_CONSTANT');
+ $refl->$method();
+ }
+
+ public function notYetImplemented()
+ {
+ return [
+ ['getStartLine'],
+ ['getEndLine'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Reflection/ReflectionLanguageConstructParameterTest.php b/vendor/psy/psysh/test/Reflection/ReflectionLanguageConstructParameterTest.php
new file mode 100644
index 00000000..223432f8
--- /dev/null
+++ b/vendor/psy/psysh/test/Reflection/ReflectionLanguageConstructParameterTest.php
@@ -0,0 +1,64 @@
+ false,
+ 'defaultValue' => null,
+ 'isOptional' => false,
+ 'isPassedByReference' => false,
+ ]);
+
+ $this->assertNull($refl->getClass());
+ $this->assertEquals('one', $refl->getName());
+ $this->assertFalse($refl->isArray());
+ $this->assertTrue($refl->isDefaultValueAvailable());
+ $this->assertNull($refl->getDefaultValue());
+ $this->assertFalse($refl->isOptional());
+ $this->assertFalse($refl->isPassedByReference());
+
+ $reflTwo = new ReflectionLanguageConstructParameter($keyword, 'two', [
+ 'isArray' => true,
+ 'isOptional' => true,
+ 'isPassedByReference' => true,
+ ]);
+
+ $this->assertNull($refl->getClass());
+ $this->assertEquals('two', $reflTwo->getName());
+ $this->assertTrue($reflTwo->isArray());
+ $this->assertFalse($reflTwo->isDefaultValueAvailable());
+ $this->assertNull($reflTwo->getDefaultValue());
+ $this->assertTrue($reflTwo->isOptional());
+ $this->assertTrue($reflTwo->isPassedByReference());
+
+ $refl = new ReflectionLanguageConstructParameter($keyword, 'three', [
+ 'defaultValue' => 3,
+ ]);
+
+ $this->assertNull($refl->getClass());
+ $this->assertEquals('three', $refl->getName());
+ $this->assertFalse($refl->isArray());
+ $this->assertTrue($refl->isDefaultValueAvailable());
+ $this->assertEquals(3, $refl->getDefaultValue());
+ $this->assertFalse($refl->isOptional());
+ $this->assertFalse($refl->isPassedByReference());
+ }
+}
diff --git a/vendor/psy/psysh/test/Reflection/ReflectionLanguageConstructTest.php b/vendor/psy/psysh/test/Reflection/ReflectionLanguageConstructTest.php
new file mode 100644
index 00000000..872a726d
--- /dev/null
+++ b/vendor/psy/psysh/test/Reflection/ReflectionLanguageConstructTest.php
@@ -0,0 +1,102 @@
+assertEquals($keyword, $refl->getName());
+ $this->assertEquals($keyword, (string) $refl);
+ }
+
+ /**
+ * @dataProvider languageConstructs
+ */
+ public function testKnownLanguageConstructs($keyword)
+ {
+ $this->assertTrue(ReflectionLanguageConstruct::isLanguageConstruct($keyword));
+ }
+
+ /**
+ * @dataProvider languageConstructs
+ */
+ public function testFileName($keyword)
+ {
+ $refl = new ReflectionLanguageConstruct($keyword);
+ $this->assertFalse($refl->getFileName());
+ }
+
+ /**
+ * @dataProvider languageConstructs
+ */
+ public function testReturnsReference($keyword)
+ {
+ $refl = new ReflectionLanguageConstruct($keyword);
+ $this->assertFalse($refl->returnsReference());
+ }
+
+ /**
+ * @dataProvider languageConstructs
+ */
+ public function testGetParameters($keyword)
+ {
+ $refl = new ReflectionLanguageConstruct($keyword);
+ $this->assertNotEmpty($refl->getParameters());
+ }
+
+ /**
+ * @dataProvider languageConstructs
+ * @expectedException \RuntimeException
+ */
+ public function testExportThrows($keyword)
+ {
+ ReflectionLanguageConstruct::export($keyword);
+ }
+
+ public function languageConstructs()
+ {
+ return [
+ ['isset'],
+ ['unset'],
+ ['empty'],
+ ['echo'],
+ ['print'],
+ ['die'],
+ ['exit'],
+ ];
+ }
+
+ /**
+ * @dataProvider unknownLanguageConstructs
+ * @expectedException \InvalidArgumentException
+ */
+ public function testUnknownLanguageConstructsThrowExceptions($keyword)
+ {
+ new ReflectionLanguageConstruct($keyword);
+ }
+
+ public function unknownLanguageConstructs()
+ {
+ return [
+ ['async'],
+ ['await'],
+ ['comefrom'],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/ShellTest.php b/vendor/psy/psysh/test/ShellTest.php
similarity index 62%
rename from vendor/psy/psysh/test/Psy/Test/ShellTest.php
rename to vendor/psy/psysh/test/ShellTest.php
index 01dddc8e..5b587d63 100644
--- a/vendor/psy/psysh/test/Psy/Test/ShellTest.php
+++ b/vendor/psy/psysh/test/ShellTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\StreamOutput;
class ShellTest extends \PHPUnit\Framework\TestCase
{
- private $streams = array();
+ private $streams = [];
public function tearDown()
{
@@ -42,20 +42,20 @@ class ShellTest extends \PHPUnit\Framework\TestCase
$shell->setScopeVariables(compact('one', 'two', 'three', '__psysh__', '_', '_e', 'this'));
$this->assertNotContains('__psysh__', $shell->getScopeVariableNames());
- $this->assertEquals(array('one', 'two', 'three', '_'), $shell->getScopeVariableNames());
- $this->assertEquals('banana', $shell->getScopeVariable('one'));
- $this->assertEquals(123, $shell->getScopeVariable('two'));
+ $this->assertSame(['one', 'two', 'three', '_'], $shell->getScopeVariableNames());
+ $this->assertSame('banana', $shell->getScopeVariable('one'));
+ $this->assertSame(123, $shell->getScopeVariable('two'));
$this->assertSame($three, $shell->getScopeVariable('three'));
$this->assertNull($shell->getScopeVariable('_'));
- $shell->setScopeVariables(array());
- $this->assertEquals(array('_'), $shell->getScopeVariableNames());
+ $shell->setScopeVariables([]);
+ $this->assertSame(['_'], $shell->getScopeVariableNames());
$shell->setBoundObject($this);
- $this->assertEquals(array('_', 'this'), $shell->getScopeVariableNames());
+ $this->assertSame(['_', 'this'], $shell->getScopeVariableNames());
$this->assertSame($this, $shell->getScopeVariable('this'));
- $this->assertEquals(array('_' => null), $shell->getScopeVariables(false));
- $this->assertEquals(array('_' => null, 'this' => $this), $shell->getScopeVariables());
+ $this->assertSame(['_' => null], $shell->getScopeVariables(false));
+ $this->assertSame(['_' => null, 'this' => $this], $shell->getScopeVariables());
}
/**
@@ -64,44 +64,82 @@ class ShellTest extends \PHPUnit\Framework\TestCase
public function testUnknownScopeVariablesThrowExceptions()
{
$shell = new Shell($this->getConfig());
- $shell->setScopeVariables(array('foo' => 'FOO', 'bar' => 1));
+ $shell->setScopeVariables(['foo' => 'FOO', 'bar' => 1]);
$shell->getScopeVariable('baz');
}
+ public function testIncludesWithScopeVariables()
+ {
+ $one = 'banana';
+ $two = 123;
+ $three = new \StdClass();
+ $__psysh__ = 'ignore this';
+ $_ = 'ignore this';
+ $_e = 'ignore this';
+
+ $config = $this->getConfig(['usePcntl' => false]);
+
+ $shell = new Shell($config);
+ $shell->setScopeVariables(compact('one', 'two', 'three', '__psysh__', '_', '_e', 'this'));
+ $shell->addInput('exit', true);
+
+ // This is super slow and we shouldn't do this :(
+ $shell->run(null, $this->getOutput());
+
+ $this->assertNotContains('__psysh__', $shell->getScopeVariableNames());
+ $this->assertSame(['one', 'two', 'three', '_', '_e'], $shell->getScopeVariableNames());
+ $this->assertSame('banana', $shell->getScopeVariable('one'));
+ $this->assertSame(123, $shell->getScopeVariable('two'));
+ $this->assertSame($three, $shell->getScopeVariable('three'));
+ $this->assertNull($shell->getScopeVariable('_'));
+ }
+
public function testIncludes()
{
- $config = $this->getConfig(array('configFile' => __DIR__ . '/../../fixtures/empty.php'));
+ $config = $this->getConfig(['configFile' => __DIR__ . '/fixtures/empty.php']);
$shell = new Shell($config);
$this->assertEmpty($shell->getIncludes());
- $shell->setIncludes(array('foo', 'bar', 'baz'));
- $this->assertEquals(array('foo', 'bar', 'baz'), $shell->getIncludes());
+ $shell->setIncludes(['foo', 'bar', 'baz']);
+ $this->assertSame(['foo', 'bar', 'baz'], $shell->getIncludes());
}
public function testIncludesConfig()
{
- $config = $this->getConfig(array(
- 'defaultIncludes' => array('/file.php'),
- 'configFile' => __DIR__ . '/../../fixtures/empty.php',
- ));
+ $config = $this->getConfig([
+ 'defaultIncludes' => ['/file.php'],
+ 'configFile' => __DIR__ . '/fixtures/empty.php',
+ ]);
$shell = new Shell($config);
$includes = $shell->getIncludes();
- $this->assertEquals('/file.php', $includes[0]);
+ $this->assertSame('/file.php', $includes[0]);
}
public function testAddMatchersViaConfig()
{
- $config = $this->getConfig(array(
- 'tabCompletionMatchers' => array(
- new ClassMethodsMatcher(),
- ),
- ));
+ $shell = new FakeShell();
+ $matcher = new ClassMethodsMatcher();
- $matchers = $config->getTabCompletionMatchers();
+ $config = $this->getConfig([
+ 'matchers' => [$matcher],
+ ]);
+ $config->setShell($shell);
- $this->assertTrue(array_pop($matchers) instanceof ClassMethodsMatcher);
+ $this->assertSame([$matcher], $shell->matchers);
+ }
+
+ public function testAddMatchersViaConfigAfterShell()
+ {
+ $shell = new FakeShell();
+ $matcher = new ClassMethodsMatcher();
+
+ $config = $this->getConfig([]);
+ $config->setShell($shell);
+ $config->addMatchers([$matcher]);
+
+ $this->assertSame([$matcher], $shell->matchers);
}
public function testRenderingExceptions()
@@ -200,7 +238,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
$this->assertFalse($shell->hasCode());
$code = preg_replace('/\s+/', ' ', $code);
$this->assertNotNull($code);
- $this->assertEquals('class a { } return new \\Psy\\CodeCleaner\\NoReturnValue();', $code);
+ $this->assertSame('class a { } return new \\Psy\\CodeCleaner\\NoReturnValue();', $code);
}
public function testKeepCodeBufferOpen()
@@ -220,7 +258,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
$this->assertFalse($shell->hasCode());
$code = preg_replace('/\s+/', ' ', $code);
$this->assertNotNull($code);
- $this->assertEquals('return 1 + 1 + 1;', $code);
+ $this->assertSame('return 1 + 1 + 1;', $code);
}
/**
@@ -241,7 +279,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
$shell->flushCode();
$code = '$test()';
$shell->addCode($code);
- $this->assertEquals($shell->flushCode(), 'return $test();');
+ $this->assertSame($shell->flushCode(), 'return $test();');
}
public function testWriteStdout()
@@ -256,7 +294,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
rewind($stream);
$streamContents = stream_get_contents($stream);
- $this->assertEquals('{{stdout}}' . PHP_EOL, $streamContents);
+ $this->assertSame('{{stdout}}' . PHP_EOL, $streamContents);
}
public function testWriteStdoutWithoutNewline()
@@ -271,7 +309,7 @@ class ShellTest extends \PHPUnit\Framework\TestCase
rewind($stream);
$streamContents = stream_get_contents($stream);
- $this->assertEquals('{{stdout}}' . PHP_EOL, $streamContents);
+ $this->assertSame('{{stdout}}' . PHP_EOL, $streamContents);
}
/**
@@ -291,10 +329,10 @@ class ShellTest extends \PHPUnit\Framework\TestCase
public function getReturnValues()
{
- return array(
- array('{{return value}}', "=> \"\033[32m{{return value}}\033[39m\"" . PHP_EOL),
- array(1, "=> \033[35m1\033[39m" . PHP_EOL),
- );
+ return [
+ ['{{return value}}', "=> \"\033[32m{{return value}}\033[39m\"" . PHP_EOL],
+ [1, "=> \033[35m1\033[39m" . PHP_EOL],
+ ];
}
/**
@@ -309,14 +347,69 @@ class ShellTest extends \PHPUnit\Framework\TestCase
$shell->writeException($exception);
rewind($stream);
- $this->assertEquals($expected, stream_get_contents($stream));
+ $this->assertSame($expected, stream_get_contents($stream));
}
public function getRenderedExceptions()
{
- return array(
- array(new \Exception('{{message}}'), "Exception with message '{{message}}'" . PHP_EOL),
- );
+ return [
+ [new \Exception('{{message}}'), "Exception with message '{{message}}'" . PHP_EOL],
+ ];
+ }
+
+ /**
+ * @dataProvider getExecuteValues
+ */
+ public function testShellExecute($input, $expected)
+ {
+ $output = $this->getOutput();
+ $stream = $output->getStream();
+ $shell = new Shell($this->getConfig());
+ $shell->setOutput($output);
+ $this->assertEquals($expected, $shell->execute($input));
+ rewind($stream);
+ $this->assertSame('', stream_get_contents($stream));
+ }
+
+ public function getExecuteValues()
+ {
+ return [
+ ['return 12', 12],
+ ['"{{return value}}"', '{{return value}}'],
+ ['1', '1'],
+ ];
+ }
+
+ /**
+ * @dataProvider commandsToHas
+ */
+ public function testHasCommand($command, $has)
+ {
+ $shell = new Shell($this->getConfig());
+
+ // :-/
+ $refl = new \ReflectionClass('Psy\\Shell');
+ $method = $refl->getMethod('hasCommand');
+ $method->setAccessible(true);
+
+ $this->assertEquals($method->invokeArgs($shell, [$command]), $has);
+ }
+
+ public function commandsToHas()
+ {
+ return [
+ ['help', true],
+ ['help help', true],
+ ['"help"', false],
+ ['"help help"', false],
+ ['ls -al ', true],
+ ['ls "-al" ', true],
+ ['ls"-al"', false],
+ [' q', true],
+ [' q --help', true],
+ ['"q"', false],
+ ['"q",', false],
+ ];
}
private function getOutput()
@@ -329,17 +422,17 @@ class ShellTest extends \PHPUnit\Framework\TestCase
return $output;
}
- private function getConfig(array $config = array())
+ private function getConfig(array $config = [])
{
// Mebbe there's a better way than this?
$dir = tempnam(sys_get_temp_dir(), 'psysh_shell_test_');
unlink($dir);
- $defaults = array(
+ $defaults = [
'configDir' => $dir,
'dataDir' => $dir,
'runtimeDir' => $dir,
- );
+ ];
return new Configuration(array_merge($defaults, $config));
}
diff --git a/vendor/psy/psysh/test/Sudo/SudoVisitorTest.php b/vendor/psy/psysh/test/Sudo/SudoVisitorTest.php
new file mode 100644
index 00000000..1f2042c8
--- /dev/null
+++ b/vendor/psy/psysh/test/Sudo/SudoVisitorTest.php
@@ -0,0 +1,142 @@
+traverser = new NodeTraverser();
+ $this->traverser->addVisitor(new SudoVisitor());
+ }
+
+ /**
+ * @dataProvider propertyFetches
+ */
+ public function testPropertyFetch($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function propertyFetches()
+ {
+ return [
+ ['$a->b', "\Psy\Sudo::fetchProperty(\$a, 'b');"],
+ ['$a->$b', '\Psy\Sudo::fetchProperty($a, $b);'],
+ ["\$a->{'b'}", "\Psy\Sudo::fetchProperty(\$a, 'b');"],
+ ];
+ }
+
+ /**
+ * @dataProvider propertyAssigns
+ */
+ public function testPropertyAssign($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function propertyAssigns()
+ {
+ return [
+ ['$a->b = $c', "\Psy\Sudo::assignProperty(\$a, 'b', \$c);"],
+ ['$a->$b = $c', '\Psy\Sudo::assignProperty($a, $b, $c);'],
+ ["\$a->{'b'} = \$c", "\Psy\Sudo::assignProperty(\$a, 'b', \$c);"],
+ ];
+ }
+
+ /**
+ * @dataProvider methodCalls
+ */
+ public function testMethodCall($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function methodCalls()
+ {
+ return [
+ ['$a->b()', "\Psy\Sudo::callMethod(\$a, 'b');"],
+ ['$a->$b()', '\Psy\Sudo::callMethod($a, $b);'],
+ ["\$a->b(\$c, 'd')", "\Psy\Sudo::callMethod(\$a, 'b', \$c, 'd');"],
+ ["\$a->\$b(\$c, 'd')", "\Psy\Sudo::callMethod(\$a, \$b, \$c, 'd');"],
+ ];
+ }
+
+ /**
+ * @dataProvider staticPropertyFetches
+ */
+ public function testStaticPropertyFetch($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function staticPropertyFetches()
+ {
+ return [
+ ['A::$b', "\Psy\Sudo::fetchStaticProperty('A', 'b');"],
+ ['$a::$b', "\Psy\Sudo::fetchStaticProperty(\$a, 'b');"],
+ ];
+ }
+
+ /**
+ * @dataProvider staticPropertyAssigns
+ */
+ public function testStaticPropertyAssign($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function staticPropertyAssigns()
+ {
+ return [
+ ['A::$b = $c', "\Psy\Sudo::assignStaticProperty('A', 'b', \$c);"],
+ ['$a::$b = $c', "\Psy\Sudo::assignStaticProperty(\$a, 'b', \$c);"],
+ ];
+ }
+
+ /**
+ * @dataProvider staticCalls
+ */
+ public function testStaticCall($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function staticCalls()
+ {
+ return [
+ ['A::b()', "\Psy\Sudo::callStatic('A', 'b');"],
+ ['A::$b()', "\Psy\Sudo::callStatic('A', \$b);"],
+ ["A::b(\$c, 'd')", "\Psy\Sudo::callStatic('A', 'b', \$c, 'd');"],
+ ["A::\$b(\$c, 'd')", "\Psy\Sudo::callStatic('A', \$b, \$c, 'd');"],
+ ];
+ }
+
+ /**
+ * @dataProvider classConstFetches
+ */
+ public function testClassConstFetch($from, $to)
+ {
+ $this->assertProcessesAs($from, $to);
+ }
+
+ public function classConstFetches()
+ {
+ return [
+ ['A::B', "\Psy\Sudo::fetchClassConst('A', 'B');"],
+ ];
+ }
+}
diff --git a/vendor/psy/psysh/test/SudoTest.php b/vendor/psy/psysh/test/SudoTest.php
new file mode 100644
index 00000000..8ac07774
--- /dev/null
+++ b/vendor/psy/psysh/test/SudoTest.php
@@ -0,0 +1,80 @@
+markTestSkipped('YOLO');
+ }
+ }
+
+ public function testFetchProperty()
+ {
+ $obj = new ClassWithSecrets();
+ $this->assertSame('private and prop', Sudo::fetchProperty($obj, 'privateProp'));
+ }
+
+ public function testAssignProperty()
+ {
+ $obj = new ClassWithSecrets();
+ $this->assertSame('private and prop', Sudo::fetchProperty($obj, 'privateProp'));
+ $this->assertSame('not so private now', Sudo::assignProperty($obj, 'privateProp', 'not so private now'));
+ $this->assertSame('not so private now', Sudo::fetchProperty($obj, 'privateProp'));
+ }
+
+ public function testCallMethod()
+ {
+ $obj = new ClassWithSecrets();
+ $this->assertSame('private and method', Sudo::callMethod($obj, 'privateMethod'));
+ $this->assertSame('private and method with 1', Sudo::callMethod($obj, 'privateMethod', 1));
+ $this->assertSame(
+ 'private and method with ["foo",2]',
+ Sudo::callMethod($obj, 'privateMethod', ['foo', 2]
+ ));
+ }
+
+ public function testFetchStaticProperty()
+ {
+ $obj = new ClassWithSecrets();
+ $this->assertSame('private and static and prop', Sudo::fetchStaticProperty($obj, 'privateStaticProp'));
+ }
+
+ public function testAssignStaticProperty()
+ {
+ $obj = new ClassWithSecrets();
+ $this->assertSame('private and static and prop', Sudo::fetchStaticProperty($obj, 'privateStaticProp'));
+ $this->assertSame('not so private now', Sudo::assignStaticProperty($obj, 'privateStaticProp', 'not so private now'));
+ $this->assertSame('not so private now', Sudo::fetchStaticProperty($obj, 'privateStaticProp'));
+ }
+
+ public function testCallStatic()
+ {
+ $obj = new ClassWithSecrets();
+ $this->assertSame('private and static and method', Sudo::callStatic($obj, 'privateStaticMethod'));
+ $this->assertSame('private and static and method with 1', Sudo::callStatic($obj, 'privateStaticMethod', 1));
+ $this->assertSame(
+ 'private and static and method with ["foo",2]',
+ Sudo::callStatic($obj, 'privateStaticMethod', ['foo', 2]
+ ));
+ }
+
+ public function testFetchClassConst()
+ {
+ $obj = new ClassWithSecrets();
+ $this->assertSame('private and const', Sudo::fetchClassConst($obj, 'PRIVATE_CONST'));
+ }
+}
diff --git a/vendor/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php b/vendor/psy/psysh/test/TabCompletion/AutoCompleterTest.php
similarity index 60%
rename from vendor/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php
rename to vendor/psy/psysh/test/TabCompletion/AutoCompleterTest.php
index 3f2fda90..25878046 100644
--- a/vendor/psy/psysh/test/Psy/Test/TabCompletion/AutoCompleterTest.php
+++ b/vendor/psy/psysh/test/TabCompletion/AutoCompleterTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,21 +21,21 @@ use Psy\TabCompletion\Matcher;
class AutoCompleterTest extends \PHPUnit\Framework\TestCase
{
/**
- * @param $line
- * @param $mustContain
- * @param $mustNotContain
+ * @param string $line
+ * @param array $mustContain
+ * @param array $mustNotContain
* @dataProvider classesInput
*/
public function testClassesCompletion($line, $mustContain, $mustNotContain)
{
$context = new Context();
- $commands = array(
+ $commands = [
new ShowCommand(),
new ListCommand(),
- );
+ ];
- $matchers = array(
+ $matchers = [
new Matcher\VariablesMatcher(),
new Matcher\ClassNamesMatcher(),
new Matcher\ConstantsMatcher(),
@@ -46,7 +46,7 @@ class AutoCompleterTest extends \PHPUnit\Framework\TestCase
new Matcher\ClassAttributesMatcher(),
new Matcher\ClassMethodsMatcher(),
new Matcher\CommandsMatcher($commands),
- );
+ ];
$config = new Configuration();
$tabCompletion = $config->getAutoCompleter();
@@ -57,13 +57,13 @@ class AutoCompleterTest extends \PHPUnit\Framework\TestCase
$tabCompletion->addMatcher($matcher);
}
- $context->setAll(array('foo' => 12, 'bar' => new \DOMDocument()));
+ $context->setAll(['foo' => 12, 'bar' => new \DOMDocument()]);
- $code = $tabCompletion->processCallback('', 0, array(
+ $code = $tabCompletion->processCallback('', 0, [
'line_buffer' => $line,
'point' => 0,
'end' => strlen($line),
- ));
+ ]);
foreach ($mustContain as $mc) {
$this->assertContains($mc, $code);
@@ -92,54 +92,54 @@ class AutoCompleterTest extends \PHPUnit\Framework\TestCase
*/
public function classesInput()
{
- return array(
+ return [
// input, must had, must not had
- array('T_OPE', array('T_OPEN_TAG'), array()),
- array('st', array('stdClass'), array()),
- array('stdCla', array('stdClass'), array()),
- array('new s', array('stdClass'), array()),
- array(
+ ['T_OPE', ['T_OPEN_TAG'], []],
+ ['st', ['stdClass'], []],
+ ['stdCla', ['stdClass'], []],
+ ['new s', ['stdClass'], []],
+ [
'new ',
- array('stdClass', 'Psy\\Context', 'Psy\\Configuration'),
- array('require', 'array_search', 'T_OPEN_TAG', '$foo'),
- ),
- array('new Psy\\C', array('Context'), array('CASE_LOWER')),
- array('\s', array('stdClass'), array()),
- array('array_', array('array_search', 'array_map', 'array_merge'), array()),
- array('$bar->', array('load'), array()),
- array('$b', array('bar'), array()),
- array('6 + $b', array('bar'), array()),
- array('$f', array('foo'), array()),
- array('l', array('ls'), array()),
- array('ls ', array(), array('ls')),
- array('sho', array('show'), array()),
- array('12 + clone $', array('foo'), array()),
+ ['stdClass', 'Psy\\Context', 'Psy\\Configuration'],
+ ['require', 'array_search', 'T_OPEN_TAG', '$foo'],
+ ],
+ ['new Psy\\C', ['Context'], ['CASE_LOWER']],
+ ['\s', ['stdClass'], []],
+ ['array_', ['array_search', 'array_map', 'array_merge'], []],
+ ['$bar->', ['load'], []],
+ ['$b', ['bar'], []],
+ ['6 + $b', ['bar'], []],
+ ['$f', ['foo'], []],
+ ['l', ['ls'], []],
+ ['ls ', [], ['ls']],
+ ['sho', ['show'], []],
+ ['12 + clone $', ['foo'], []],
// array(
// '$foo ',
// array('+', 'clone'),
// array('$foo', 'DOMDocument', 'array_map')
// ), requires a operator matcher?
- array('$', array('foo', 'bar'), array('require', 'array_search', 'T_OPEN_TAG', 'Psy')),
- array(
+ ['$', ['foo', 'bar'], ['require', 'array_search', 'T_OPEN_TAG', 'Psy']],
+ [
'Psy\\',
- array('Context', 'TabCompletion\\Matcher\\AbstractMatcher'),
- array('require', 'array_search'),
- ),
- array(
+ ['Context', 'TabCompletion\\Matcher\\AbstractMatcher'],
+ ['require', 'array_search'],
+ ],
+ [
'Psy\Test\TabCompletion\StaticSample::CO',
- array('Psy\Test\TabCompletion\StaticSample::CONSTANT_VALUE'),
- array(),
- ),
- array(
+ ['StaticSample::CONSTANT_VALUE'],
+ [],
+ ],
+ [
'Psy\Test\TabCompletion\StaticSample::',
- array('Psy\Test\TabCompletion\StaticSample::$staticVariable'),
- array(),
- ),
- array(
+ ['StaticSample::$staticVariable'],
+ [],
+ ],
+ [
'Psy\Test\TabCompletion\StaticSample::',
- array('Psy\Test\TabCompletion\StaticSample::staticFunction'),
- array(),
- ),
- );
+ ['StaticSample::staticFunction'],
+ [],
+ ],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/TabCompletion/StaticSample.php b/vendor/psy/psysh/test/TabCompletion/StaticSample.php
similarity index 93%
rename from vendor/psy/psysh/test/Psy/Test/TabCompletion/StaticSample.php
rename to vendor/psy/psysh/test/TabCompletion/StaticSample.php
index aea0031c..e0de2f0b 100644
--- a/vendor/psy/psysh/test/Psy/Test/TabCompletion/StaticSample.php
+++ b/vendor/psy/psysh/test/TabCompletion/StaticSample.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/test/Psy/Test/Util/DocblockTest.php b/vendor/psy/psysh/test/Util/DocblockTest.php
similarity index 65%
rename from vendor/psy/psysh/test/Psy/Test/Util/DocblockTest.php
rename to vendor/psy/psysh/test/Util/DocblockTest.php
index 9ed3c029..6fa775d9 100644
--- a/vendor/psy/psysh/test/Psy/Test/Util/DocblockTest.php
+++ b/vendor/psy/psysh/test/Util/DocblockTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -31,7 +31,7 @@ class DocblockTest extends \PHPUnit\Framework\TestCase
$docblock = new Docblock($reflector);
- $this->assertEquals($body, $docblock->desc);
+ $this->assertSame($body, $docblock->desc);
foreach ($tags as $tag => $value) {
$this->assertTrue($docblock->hasTag($tag));
@@ -45,20 +45,20 @@ class DocblockTest extends \PHPUnit\Framework\TestCase
$this->markTestSkipped('We have issues with PHPUnit mocks on HHVM.');
}
- return array(
- array('', '', array()),
- array(
+ return [
+ ['', '', []],
+ [
'/**
* This is a docblock
*
* @throws \Exception with a description
*/',
'This is a docblock',
- array(
- 'throws' => array(array('type' => '\Exception', 'desc' => 'with a description')),
- ),
- ),
- array(
+ [
+ 'throws' => [['type' => '\Exception', 'desc' => 'with a description']],
+ ],
+ ],
+ [
'/**
* This is a slightly longer docblock
*
@@ -69,18 +69,18 @@ class DocblockTest extends \PHPUnit\Framework\TestCase
* @return int At least it isn\'t a string
*/',
'This is a slightly longer docblock',
- array(
- 'param' => array(
- array('type' => 'int', 'desc' => 'Is a Foo', 'var' => '$foo'),
- array('type' => 'string', 'desc' => 'With some sort of description', 'var' => '$bar'),
- array('type' => '\ClassName', 'desc' => 'is cool too', 'var' => '$baz'),
- ),
- 'return' => array(
- array('type' => 'int', 'desc' => 'At least it isn\'t a string'),
- ),
- ),
- ),
- array(
+ [
+ 'param' => [
+ ['type' => 'int', 'desc' => 'Is a Foo', 'var' => '$foo'],
+ ['type' => 'string', 'desc' => 'With some sort of description', 'var' => '$bar'],
+ ['type' => '\ClassName', 'desc' => 'is cool too', 'var' => '$baz'],
+ ],
+ 'return' => [
+ ['type' => 'int', 'desc' => 'At least it isn\'t a string'],
+ ],
+ ],
+ ],
+ [
'/**
* This is a docblock!
*
@@ -91,10 +91,10 @@ class DocblockTest extends \PHPUnit\Framework\TestCase
* @return
*/',
"This is a docblock!\n\nIt spans lines, too!",
- array(
- 'tagname' => array('plus a description'),
- ),
- ),
- );
+ [
+ 'tagname' => ['plus a description'],
+ ],
+ ],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Util/MirrorTest.php b/vendor/psy/psysh/test/Util/MirrorTest.php
similarity index 58%
rename from vendor/psy/psysh/test/Psy/Test/Util/MirrorTest.php
rename to vendor/psy/psysh/test/Util/MirrorTest.php
index ab0b1726..09976bdf 100644
--- a/vendor/psy/psysh/test/Psy/Test/Util/MirrorTest.php
+++ b/vendor/psy/psysh/test/Util/MirrorTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,7 +11,6 @@
namespace Psy\Test\Util;
-use Psy\Reflection\ReflectionConstant;
use Psy\Util\Mirror;
class MirrorTest extends \PHPUnit\Framework\TestCase
@@ -28,28 +27,35 @@ class MirrorTest extends \PHPUnit\Framework\TestCase
public function testMirror()
{
$refl = Mirror::get('sort');
- $this->assertTrue($refl instanceof \ReflectionFunction);
+ $this->assertInstanceOf('ReflectionFunction', $refl);
$refl = Mirror::get('Psy\Test\Util\MirrorTest');
- $this->assertTrue($refl instanceof \ReflectionClass);
+ $this->assertInstanceOf('ReflectionClass', $refl);
$refl = Mirror::get($this);
- $this->assertTrue($refl instanceof \ReflectionObject);
+ $this->assertInstanceOf('ReflectionObject', $refl);
$refl = Mirror::get($this, 'FOO');
- $this->assertTrue($refl instanceof ReflectionConstant);
+ if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
+ $this->assertInstanceOf('ReflectionClassConstant', $refl);
+ } else {
+ $this->assertInstanceOf('Psy\Reflection\ReflectionClassConstant', $refl);
+ }
+
+ $refl = Mirror::get('PHP_VERSION');
+ $this->assertInstanceOf('Psy\Reflection\ReflectionConstant_', $refl);
$refl = Mirror::get($this, 'bar');
- $this->assertTrue($refl instanceof \ReflectionProperty);
+ $this->assertInstanceOf('ReflectionProperty', $refl);
$refl = Mirror::get($this, 'baz');
- $this->assertTrue($refl instanceof \ReflectionProperty);
+ $this->assertInstanceOf('ReflectionProperty', $refl);
$refl = Mirror::get($this, 'aPublicMethod');
- $this->assertTrue($refl instanceof \ReflectionMethod);
+ $this->assertInstanceOf('ReflectionMethod', $refl);
$refl = Mirror::get($this, 'baz', Mirror::STATIC_PROPERTY);
- $this->assertTrue($refl instanceof \ReflectionProperty);
+ $this->assertInstanceOf('ReflectionProperty', $refl);
}
/**
@@ -71,10 +77,10 @@ class MirrorTest extends \PHPUnit\Framework\TestCase
public function invalidArguments()
{
- return array(
- array('not_a_function_or_class'),
- array(array()),
- array(1),
- );
+ return [
+ ['not_a_function_or_class'],
+ [[]],
+ [1],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/Util/StrTest.php b/vendor/psy/psysh/test/Util/StrTest.php
similarity index 62%
rename from vendor/psy/psysh/test/Psy/Test/Util/StrTest.php
rename to vendor/psy/psysh/test/Util/StrTest.php
index 46cdb230..2a58d9f9 100644
--- a/vendor/psy/psysh/test/Psy/Test/Util/StrTest.php
+++ b/vendor/psy/psysh/test/Util/StrTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,12 +20,12 @@ class StrTest extends \PHPUnit\Framework\TestCase
*/
public function testUnvis($input, $expected)
{
- $this->assertEquals($expected, Str::unvis($input));
+ $this->assertSame($expected, Str::unvis($input));
}
public function unvisProvider()
{
- //return require_once(__DIR__.'/../../../fixtures/unvis_fixtures.php');
- return json_decode(file_get_contents(__DIR__ . '/../../../fixtures/unvis_fixtures.json'));
+ //return require_once(__DIR__.'/../fixtures/unvis_fixtures.php');
+ return json_decode(file_get_contents(__DIR__ . '/../fixtures/unvis_fixtures.json'));
}
}
diff --git a/vendor/psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php b/vendor/psy/psysh/test/VersionUpdater/GitHubCheckerTest.php
similarity index 55%
rename from vendor/psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php
rename to vendor/psy/psysh/test/VersionUpdater/GitHubCheckerTest.php
index 07eb0c6e..bbbd69cf 100644
--- a/vendor/psy/psysh/test/Psy/Test/VersionUpdater/GitHubCheckerTest.php
+++ b/vendor/psy/psysh/test/VersionUpdater/GitHubCheckerTest.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -20,12 +20,12 @@ class GitHubCheckerTest extends \PHPUnit\Framework\TestCase
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Unable to check for updates
*
- * @param $input
+ * @param mixed $input
*/
public function testExceptionInvocation($input)
{
$checker = $this->getMockBuilder('Psy\\VersionUpdater\\GitHubChecker')
- ->setMethods(array('fetchLatestRelease'))
+ ->setMethods(['fetchLatestRelease'])
->getMock();
$checker->expects($this->once())->method('fetchLatestRelease')->willReturn($input);
$checker->isLatest();
@@ -34,13 +34,13 @@ class GitHubCheckerTest extends \PHPUnit\Framework\TestCase
/**
* @dataProvider jsonResults
*
- * @param $assertion
- * @param $input
+ * @param bool $assertion
+ * @param mixed $input
*/
public function testDataSetResults($assertion, $input)
{
$checker = $this->getMockBuilder('Psy\\VersionUpdater\\GitHubChecker')
- ->setMethods(array('fetchLatestRelease'))
+ ->setMethods(['fetchLatestRelease'])
->getMock();
$checker->expects($this->once())->method('fetchLatestRelease')->willReturn($input);
$this->assertSame($assertion, $checker->isLatest());
@@ -51,15 +51,15 @@ class GitHubCheckerTest extends \PHPUnit\Framework\TestCase
*/
public function jsonResults()
{
- return array(
- array(false, json_decode('{"tag_name":"v9.0.0"}')),
- array(true, json_decode('{"tag_name":"v' . Shell::VERSION . '"}')),
- array(true, json_decode('{"tag_name":"v0.0.1"}')),
- array(true, json_decode('{"tag_name":"v0.4.1-alpha"}')),
- array(true, json_decode('{"tag_name":"v0.4.2-beta3"}')),
- array(true, json_decode('{"tag_name":"v0.0.1"}')),
- array(true, json_decode('{"tag_name":""}')),
- );
+ return [
+ [false, json_decode('{"tag_name":"v9.0.0"}')],
+ [true, json_decode('{"tag_name":"v' . Shell::VERSION . '"}')],
+ [true, json_decode('{"tag_name":"v0.0.1"}')],
+ [true, json_decode('{"tag_name":"v0.4.1-alpha"}')],
+ [true, json_decode('{"tag_name":"v0.4.2-beta3"}')],
+ [true, json_decode('{"tag_name":"v0.0.1"}')],
+ [true, json_decode('{"tag_name":""}')],
+ ];
}
/**
@@ -67,16 +67,16 @@ class GitHubCheckerTest extends \PHPUnit\Framework\TestCase
*/
public function malformedResults()
{
- return array(
- array(null),
- array(false),
- array(true),
- array(json_decode('{"foo":"bar"}')),
- array(json_decode('{}')),
- array(json_decode('[]')),
- array(array()),
- array(json_decode('{"tag_name":false"}')),
- array(json_decode('{"tag_name":true"}')),
- );
+ return [
+ [null],
+ [false],
+ [true],
+ [json_decode('{"foo":"bar"}')],
+ [json_decode('{}')],
+ [json_decode('[]')],
+ [[]],
+ [json_decode('{"tag_name":false"}')],
+ [json_decode('{"tag_name":true"}')],
+ ];
}
}
diff --git a/vendor/psy/psysh/test/VersionUpdater/NoopCheckerTest.php b/vendor/psy/psysh/test/VersionUpdater/NoopCheckerTest.php
new file mode 100644
index 00000000..b9ba568c
--- /dev/null
+++ b/vendor/psy/psysh/test/VersionUpdater/NoopCheckerTest.php
@@ -0,0 +1,25 @@
+assertTrue($checker->isLatest());
+ $this->assertEquals(Shell::VERSION, $checker->getLatest());
+ }
+}
diff --git a/vendor/psy/psysh/test/fixtures/config.php b/vendor/psy/psysh/test/fixtures/config.php
index 31a4ef54..4aa1f5fb 100644
--- a/vendor/psy/psysh/test/fixtures/config.php
+++ b/vendor/psy/psysh/test/fixtures/config.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,8 +11,10 @@
$config->setRuntimeDir(sys_get_temp_dir() . '/psysh_test/withconfig/temp');
-return array(
+return [
'useReadline' => true,
'usePcntl' => false,
+ 'requireSemicolons' => false,
+ 'useUnicode' => true,
'errorLoggingLevel' => E_ALL & ~E_NOTICE,
-);
+];
diff --git a/vendor/psy/psysh/test/fixtures/empty.php b/vendor/psy/psysh/test/fixtures/empty.php
index a385c6c9..ba4e5784 100644
--- a/vendor/psy/psysh/test/fixtures/empty.php
+++ b/vendor/psy/psysh/test/fixtures/empty.php
@@ -3,7 +3,7 @@
/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
diff --git a/vendor/psy/psysh/test/fixtures/project/.psysh.php b/vendor/psy/psysh/test/fixtures/project/.psysh.php
index a6ac121e..8ba668c8 100644
--- a/vendor/psy/psysh/test/fixtures/project/.psysh.php
+++ b/vendor/psy/psysh/test/fixtures/project/.psysh.php
@@ -10,6 +10,8 @@
*/
return array(
- 'useReadline' => false,
- 'usePcntl' => true,
+ 'useReadline' => false,
+ 'usePcntl' => true,
+ 'requireSemicolons' => true,
+ 'useUnicode' => false,
);
diff --git a/vendor/psy/psysh/vendor-bin/box/composer.json b/vendor/psy/psysh/vendor-bin/box/composer.json
new file mode 100644
index 00000000..a5ef2062
--- /dev/null
+++ b/vendor/psy/psysh/vendor-bin/box/composer.json
@@ -0,0 +1,7 @@
+{
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "require": {
+ "humbug/box": "^3.0@alpha"
+ }
+}
diff --git a/vendor/psy/psysh/vendor-bin/box/composer.lock b/vendor/psy/psysh/vendor-bin/box/composer.lock
new file mode 100644
index 00000000..3c449638
--- /dev/null
+++ b/vendor/psy/psysh/vendor-bin/box/composer.lock
@@ -0,0 +1,2524 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "d98ffe050f0ba4e81c2d1a98ca945200",
+ "packages": [
+ {
+ "name": "amphp/amp",
+ "version": "v2.0.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/amphp/amp.git",
+ "reference": "d561cc9736bc18dd94a2fc9cdae98b616bd92c43"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/amphp/amp/zipball/d561cc9736bc18dd94a2fc9cdae98b616bd92c43",
+ "reference": "d561cc9736bc18dd94a2fc9cdae98b616bd92c43",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7"
+ },
+ "require-dev": {
+ "amphp/phpunit-util": "^1",
+ "friendsofphp/php-cs-fixer": "^2.3",
+ "phpstan/phpstan": "^0.8.5",
+ "phpunit/phpunit": "^6.0.9",
+ "react/promise": "^2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Amp\\": "lib"
+ },
+ "files": [
+ "lib/functions.php",
+ "lib/Internal/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bob Weinand",
+ "email": "bobwei9@hotmail.com"
+ },
+ {
+ "name": "Niklas Keller",
+ "email": "me@kelunik.com"
+ },
+ {
+ "name": "Daniel Lowrey",
+ "email": "rdlowrey@php.net"
+ },
+ {
+ "name": "Aaron Piotrowski",
+ "email": "aaron@trowski.com"
+ }
+ ],
+ "description": "A non-blocking concurrency framework for PHP applications.",
+ "homepage": "http://amphp.org/amp",
+ "keywords": [
+ "async",
+ "asynchronous",
+ "awaitable",
+ "concurrency",
+ "event",
+ "event-loop",
+ "future",
+ "non-blocking",
+ "promise"
+ ],
+ "time": "2018-04-30T20:49:57+00:00"
+ },
+ {
+ "name": "amphp/byte-stream",
+ "version": "v1.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/amphp/byte-stream.git",
+ "reference": "1b75b122e6f069e7d102eef065dc192119d99ca7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/amphp/byte-stream/zipball/1b75b122e6f069e7d102eef065dc192119d99ca7",
+ "reference": "1b75b122e6f069e7d102eef065dc192119d99ca7",
+ "shasum": ""
+ },
+ "require": {
+ "amphp/amp": "^2"
+ },
+ "require-dev": {
+ "amphp/phpunit-util": "^1",
+ "friendsofphp/php-cs-fixer": "^2.3",
+ "phpunit/phpunit": "^6"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Amp\\ByteStream\\": "lib"
+ },
+ "files": [
+ "lib/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Niklas Keller",
+ "email": "me@kelunik.com"
+ },
+ {
+ "name": "Aaron Piotrowski",
+ "email": "aaron@trowski.com"
+ }
+ ],
+ "description": "A stream abstraction to make working with non-blocking I/O simple.",
+ "homepage": "http://amphp.org/byte-stream",
+ "keywords": [
+ "amp",
+ "amphp",
+ "async",
+ "io",
+ "non-blocking",
+ "stream"
+ ],
+ "time": "2018-04-04T05:33:09+00:00"
+ },
+ {
+ "name": "amphp/parallel",
+ "version": "v0.2.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/amphp/parallel.git",
+ "reference": "732694688461936bec02c0ccf020dfee10c4f7ee"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/amphp/parallel/zipball/732694688461936bec02c0ccf020dfee10c4f7ee",
+ "reference": "732694688461936bec02c0ccf020dfee10c4f7ee",
+ "shasum": ""
+ },
+ "require": {
+ "amphp/amp": "^2",
+ "amphp/byte-stream": "^1.2",
+ "amphp/parser": "^1",
+ "amphp/process": "^0.2 || ^0.3",
+ "amphp/sync": "^1.0.1"
+ },
+ "require-dev": {
+ "amphp/phpunit-util": "^1",
+ "friendsofphp/php-cs-fixer": "^2.3",
+ "phpunit/phpunit": "^6"
+ },
+ "suggest": {
+ "ext-pthreads": "Required for thread contexts"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Amp\\Parallel\\": "lib"
+ },
+ "files": [
+ "lib/Worker/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Stephen Coakley",
+ "email": "me@stephencoakley.com"
+ },
+ {
+ "name": "Aaron Piotrowski",
+ "email": "aaron@trowski.com"
+ }
+ ],
+ "description": "Parallel processing component for Amp.",
+ "homepage": "https://github.com/amphp/parallel",
+ "keywords": [
+ "async",
+ "asynchronous",
+ "concurrent",
+ "multi-processing",
+ "multi-threading"
+ ],
+ "time": "2018-03-21T14:37:51+00:00"
+ },
+ {
+ "name": "amphp/parallel-functions",
+ "version": "v0.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/amphp/parallel-functions.git",
+ "reference": "999ba8a00adaf4d1fd3a7cb40bf7e565e507ff48"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/amphp/parallel-functions/zipball/999ba8a00adaf4d1fd3a7cb40bf7e565e507ff48",
+ "reference": "999ba8a00adaf4d1fd3a7cb40bf7e565e507ff48",
+ "shasum": ""
+ },
+ "require": {
+ "amphp/amp": "^2.0.3",
+ "amphp/parallel": "^0.1.8 || ^0.2",
+ "opis/closure": "^3.0.7",
+ "php": ">=7"
+ },
+ "require-dev": {
+ "amphp/phpunit-util": "^1.0",
+ "friendsofphp/php-cs-fixer": "^2.9",
+ "phpunit/phpunit": "^6.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Amp\\ParallelFunctions\\": "src"
+ },
+ "files": [
+ "src/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Niklas Keller",
+ "email": "me@kelunik.com"
+ }
+ ],
+ "description": "Parallel processing made simple.",
+ "time": "2017-12-17T18:33:29+00:00"
+ },
+ {
+ "name": "amphp/parser",
+ "version": "v1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/amphp/parser.git",
+ "reference": "f83e68f03d5b8e8e0365b8792985a7f341c57ae1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/amphp/parser/zipball/f83e68f03d5b8e8e0365b8792985a7f341c57ae1",
+ "reference": "f83e68f03d5b8e8e0365b8792985a7f341c57ae1",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^2.3",
+ "phpunit/phpunit": "^6"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Amp\\Parser\\": "lib"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Niklas Keller",
+ "email": "me@kelunik.com"
+ },
+ {
+ "name": "Aaron Piotrowski",
+ "email": "aaron@trowski.com"
+ }
+ ],
+ "description": "A generator parser to make streaming parsers simple.",
+ "homepage": "https://github.com/amphp/parser",
+ "keywords": [
+ "async",
+ "non-blocking",
+ "parser",
+ "stream"
+ ],
+ "time": "2017-06-06T05:29:10+00:00"
+ },
+ {
+ "name": "amphp/process",
+ "version": "v0.3.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/amphp/process.git",
+ "reference": "b795d20a7f6d5a0637128a02be613f520f1705fc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/amphp/process/zipball/b795d20a7f6d5a0637128a02be613f520f1705fc",
+ "reference": "b795d20a7f6d5a0637128a02be613f520f1705fc",
+ "shasum": ""
+ },
+ "require": {
+ "amphp/amp": "^2",
+ "amphp/byte-stream": "^1",
+ "php": ">=7"
+ },
+ "require-dev": {
+ "amphp/phpunit-util": "^1",
+ "friendsofphp/php-cs-fixer": "^2.3",
+ "phpunit/phpunit": "^6"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Amp\\Process\\": "lib"
+ },
+ "files": [
+ "lib/constants.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bob Weinand",
+ "email": "bobwei9@hotmail.com"
+ },
+ {
+ "name": "Niklas Keller",
+ "email": "me@kelunik.com"
+ },
+ {
+ "name": "Aaron Piotrowski",
+ "email": "aaron@trowski.com"
+ }
+ ],
+ "description": "Asynchronous process manager.",
+ "homepage": "https://github.com/amphp/process",
+ "time": "2018-04-08T18:55:42+00:00"
+ },
+ {
+ "name": "amphp/sync",
+ "version": "v1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/amphp/sync.git",
+ "reference": "a1d8f244eb19e3e2a96abc4686cebc80995bbc90"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/amphp/sync/zipball/a1d8f244eb19e3e2a96abc4686cebc80995bbc90",
+ "reference": "a1d8f244eb19e3e2a96abc4686cebc80995bbc90",
+ "shasum": ""
+ },
+ "require": {
+ "amphp/amp": "^2"
+ },
+ "require-dev": {
+ "amphp/phpunit-util": "^1",
+ "friendsofphp/php-cs-fixer": "^2.3",
+ "phpunit/phpunit": "^6"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Amp\\Sync\\": "lib"
+ },
+ "files": [
+ "lib/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Stephen Coakley",
+ "email": "me@stephencoakley.com"
+ },
+ {
+ "name": "Aaron Piotrowski",
+ "email": "aaron@trowski.com"
+ }
+ ],
+ "description": "Mutex, Semaphore, and other synchronization tools for Amp.",
+ "homepage": "https://github.com/amphp/sync",
+ "keywords": [
+ "async",
+ "asynchronous",
+ "mutex",
+ "semaphore",
+ "synchronization"
+ ],
+ "time": "2017-11-29T21:48:53+00:00"
+ },
+ {
+ "name": "beberlei/assert",
+ "version": "v2.9.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/beberlei/assert.git",
+ "reference": "c07fe163d6a3b3e4b1275981ec004397954afa89"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/beberlei/assert/zipball/c07fe163d6a3b3e4b1275981ec004397954afa89",
+ "reference": "c07fe163d6a3b3e4b1275981ec004397954afa89",
+ "shasum": ""
+ },
+ "require": {
+ "ext-mbstring": "*",
+ "php": ">=5.3"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^2.1.1",
+ "phpunit/phpunit": "^4.8.35|^5.7"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Assert\\": "lib/Assert"
+ },
+ "files": [
+ "lib/Assert/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-2-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de",
+ "role": "Lead Developer"
+ },
+ {
+ "name": "Richard Quadling",
+ "email": "rquadling@gmail.com",
+ "role": "Collaborator"
+ }
+ ],
+ "description": "Thin assertion library for input validation in business models.",
+ "keywords": [
+ "assert",
+ "assertion",
+ "validation"
+ ],
+ "time": "2018-04-16T11:18:27+00:00"
+ },
+ {
+ "name": "composer/ca-bundle",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/ca-bundle.git",
+ "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/d2c0a83b7533d6912e8d516756ebd34f893e9169",
+ "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169",
+ "shasum": ""
+ },
+ "require": {
+ "ext-openssl": "*",
+ "ext-pcre": "*",
+ "php": "^5.3.2 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
+ "psr/log": "^1.0",
+ "symfony/process": "^2.5 || ^3.0 || ^4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Composer\\CaBundle\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
+ "keywords": [
+ "cabundle",
+ "cacert",
+ "certificate",
+ "ssl",
+ "tls"
+ ],
+ "time": "2018-03-29T19:57:20+00:00"
+ },
+ {
+ "name": "composer/composer",
+ "version": "1.6.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/composer.git",
+ "reference": "b184a92419cc9a9c4c6a09db555a94d441cb11c9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/composer/zipball/b184a92419cc9a9c4c6a09db555a94d441cb11c9",
+ "reference": "b184a92419cc9a9c4c6a09db555a94d441cb11c9",
+ "shasum": ""
+ },
+ "require": {
+ "composer/ca-bundle": "^1.0",
+ "composer/semver": "^1.0",
+ "composer/spdx-licenses": "^1.2",
+ "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0",
+ "php": "^5.3.2 || ^7.0",
+ "psr/log": "^1.0",
+ "seld/cli-prompt": "^1.0",
+ "seld/jsonlint": "^1.4",
+ "seld/phar-utils": "^1.0",
+ "symfony/console": "^2.7 || ^3.0 || ^4.0",
+ "symfony/filesystem": "^2.7 || ^3.0 || ^4.0",
+ "symfony/finder": "^2.7 || ^3.0 || ^4.0",
+ "symfony/process": "^2.7 || ^3.0 || ^4.0"
+ },
+ "conflict": {
+ "symfony/console": "2.8.38"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35 || ^5.7",
+ "phpunit/phpunit-mock-objects": "^2.3 || ^3.0"
+ },
+ "suggest": {
+ "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages",
+ "ext-zip": "Enabling the zip extension allows you to unzip archives",
+ "ext-zlib": "Allow gzip compression of HTTP requests"
+ },
+ "bin": [
+ "bin/composer"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Composer\\": "src/Composer"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nils Adermann",
+ "email": "naderman@naderman.de",
+ "homepage": "http://www.naderman.de"
+ },
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.",
+ "homepage": "https://getcomposer.org/",
+ "keywords": [
+ "autoload",
+ "dependency",
+ "package"
+ ],
+ "time": "2018-05-04T09:44:59+00:00"
+ },
+ {
+ "name": "composer/semver",
+ "version": "1.4.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/semver.git",
+ "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573",
+ "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.2 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.5 || ^5.0.5",
+ "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Composer\\Semver\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nils Adermann",
+ "email": "naderman@naderman.de",
+ "homepage": "http://www.naderman.de"
+ },
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ },
+ {
+ "name": "Rob Bast",
+ "email": "rob.bast@gmail.com",
+ "homepage": "http://robbast.nl"
+ }
+ ],
+ "description": "Semver library that offers utilities, version constraint parsing and validation.",
+ "keywords": [
+ "semantic",
+ "semver",
+ "validation",
+ "versioning"
+ ],
+ "time": "2016-08-30T16:08:34+00:00"
+ },
+ {
+ "name": "composer/spdx-licenses",
+ "version": "1.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/spdx-licenses.git",
+ "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/cb17687e9f936acd7e7245ad3890f953770dec1b",
+ "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.2 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5",
+ "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Composer\\Spdx\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nils Adermann",
+ "email": "naderman@naderman.de",
+ "homepage": "http://www.naderman.de"
+ },
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ },
+ {
+ "name": "Rob Bast",
+ "email": "rob.bast@gmail.com",
+ "homepage": "http://robbast.nl"
+ }
+ ],
+ "description": "SPDX licenses list and validation library.",
+ "keywords": [
+ "license",
+ "spdx",
+ "validator"
+ ],
+ "time": "2018-04-30T10:33:04+00:00"
+ },
+ {
+ "name": "composer/xdebug-handler",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/composer/xdebug-handler.git",
+ "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/c919dc6c62e221fc6406f861ea13433c0aa24f08",
+ "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.2 || ^7.0",
+ "psr/log": "^1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Composer\\XdebugHandler\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "John Stevenson",
+ "email": "john-stevenson@blueyonder.co.uk"
+ }
+ ],
+ "description": "Restarts a process without xdebug.",
+ "keywords": [
+ "Xdebug",
+ "performance"
+ ],
+ "time": "2018-04-11T15:42:36+00:00"
+ },
+ {
+ "name": "doctrine/annotations",
+ "version": "v1.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/annotations.git",
+ "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
+ "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/lexer": "1.*",
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "doctrine/cache": "1.*",
+ "phpunit/phpunit": "^6.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Jonathan Wage",
+ "email": "jonwage@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Docblock Annotations Parser",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "annotations",
+ "docblock",
+ "parser"
+ ],
+ "time": "2017-12-06T07:11:42+00:00"
+ },
+ {
+ "name": "doctrine/lexer",
+ "version": "v1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/lexer.git",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Doctrine\\Common\\Lexer\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "lexer",
+ "parser"
+ ],
+ "time": "2014-09-09T13:34:57+00:00"
+ },
+ {
+ "name": "herrera-io/annotations",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/kherge-abandoned/php-annotations.git",
+ "reference": "7d8b9a536da7f12aad8de7f28b2cb5266bde8da1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/kherge-abandoned/php-annotations/zipball/7d8b9a536da7f12aad8de7f28b2cb5266bde8da1",
+ "reference": "7d8b9a536da7f12aad8de7f28b2cb5266bde8da1",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/annotations": "~1.0",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "herrera-io/phpunit-test-case": "1.*",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Herrera\\Annotations": "src/lib"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Kevin Herrera",
+ "email": "kevin@herrera.io",
+ "homepage": "http://kevin.herrera.io"
+ }
+ ],
+ "description": "A tokenizer for Doctrine annotations.",
+ "homepage": "https://github.com/herrera-io/php-annotations",
+ "keywords": [
+ "annotations",
+ "doctrine",
+ "tokenizer"
+ ],
+ "abandoned": true,
+ "time": "2014-02-03T17:34:08+00:00"
+ },
+ {
+ "name": "humbug/box",
+ "version": "3.0.0-alpha.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/humbug/box.git",
+ "reference": "26b3f481e3b375f55c0644f501b831f7c05d8058"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/humbug/box/zipball/26b3f481e3b375f55c0644f501b831f7c05d8058",
+ "reference": "26b3f481e3b375f55c0644f501b831f7c05d8058",
+ "shasum": ""
+ },
+ "require": {
+ "amphp/parallel-functions": "^0.1.2",
+ "beberlei/assert": "^2.8",
+ "composer/composer": "^1.6",
+ "composer/xdebug-handler": "^1.1.0",
+ "ext-phar": "*",
+ "herrera-io/annotations": "~1.0",
+ "humbug/php-scoper": "^1.0@dev",
+ "justinrainbow/json-schema": "^5.2",
+ "nikic/iter": "^1.6",
+ "php": "^7.1",
+ "phpseclib/phpseclib": "~2.0",
+ "seld/jsonlint": "^1.6",
+ "symfony/console": "^3.4 || ^4.0",
+ "symfony/filesystem": "^3.4 || ^4.0",
+ "symfony/finder": "^3.4 || ^4.0",
+ "symfony/var-dumper": "^3.4 || ^4.0",
+ "webmozart/path-util": "^2.3"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.2",
+ "infection/infection": "^0.8",
+ "mikey179/vfsstream": "^1.1",
+ "phpunit/phpunit": "^7.0"
+ },
+ "suggest": {
+ "ext-openssl": "To accelerate private key generation."
+ },
+ "bin": [
+ "bin/box"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ },
+ "bamarni-bin": {
+ "bin-links": false
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "KevinGH\\Box\\": "src"
+ },
+ "files": [
+ "src/FileSystem/file_system.php",
+ "src/functions.php"
+ ],
+ "exclude-from-classmap": [
+ "/Test/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Kevin Herrera",
+ "email": "kevin@herrera.io",
+ "homepage": "http://kevin.herrera.io"
+ },
+ {
+ "name": "Théo Fidry",
+ "email": "theo.fidry@gmail.com"
+ }
+ ],
+ "description": "Fast, zero config application bundler with PHARs.",
+ "keywords": [
+ "phar"
+ ],
+ "time": "2018-05-04T22:04:10+00:00"
+ },
+ {
+ "name": "humbug/php-scoper",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/humbug/php-scoper.git",
+ "reference": "450fe36a7457847d0cb431e7379b5df9d05992a4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/humbug/php-scoper/zipball/450fe36a7457847d0cb431e7379b5df9d05992a4",
+ "reference": "450fe36a7457847d0cb431e7379b5df9d05992a4",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "^3.0",
+ "ocramius/package-versions": "^1.1",
+ "padraic/phar-updater": "^1.0",
+ "php": "^7.1",
+ "roave/better-reflection": "^2.0",
+ "symfony/console": "^3.2 || ^4.0",
+ "symfony/filesystem": "^3.2 || ^4.0",
+ "symfony/finder": "^3.2 || ^4.0"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.1",
+ "phpunit/phpunit": "^6.1"
+ },
+ "bin": [
+ "bin/php-scoper"
+ ],
+ "type": "library",
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": false
+ },
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/functions.php"
+ ],
+ "psr-4": {
+ "Humbug\\PhpScoper\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ },
+ {
+ "name": "Théo Fidry",
+ "email": "theo.fidry@gmail.com"
+ },
+ {
+ "name": "Pádraic Brady",
+ "email": "padraic.brady@gmail.com"
+ }
+ ],
+ "description": "Prefixes all PHP namespaces in a file or directory.",
+ "time": "2018-04-25T21:59:07+00:00"
+ },
+ {
+ "name": "justinrainbow/json-schema",
+ "version": "5.2.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/justinrainbow/json-schema.git",
+ "reference": "8560d4314577199ba51bf2032f02cd1315587c23"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8560d4314577199ba51bf2032f02cd1315587c23",
+ "reference": "8560d4314577199ba51bf2032f02cd1315587c23",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "^2.1",
+ "json-schema/json-schema-test-suite": "1.2.0",
+ "phpunit/phpunit": "^4.8.35"
+ },
+ "bin": [
+ "bin/validate-json"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "JsonSchema\\": "src/JsonSchema/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bruno Prieto Reis",
+ "email": "bruno.p.reis@gmail.com"
+ },
+ {
+ "name": "Justin Rainbow",
+ "email": "justin.rainbow@gmail.com"
+ },
+ {
+ "name": "Igor Wiedler",
+ "email": "igor@wiedler.ch"
+ },
+ {
+ "name": "Robert Schönthal",
+ "email": "seroscho@googlemail.com"
+ }
+ ],
+ "description": "A library to validate a json schema.",
+ "homepage": "https://github.com/justinrainbow/json-schema",
+ "keywords": [
+ "json",
+ "schema"
+ ],
+ "time": "2018-02-14T22:26:30+00:00"
+ },
+ {
+ "name": "nikic/iter",
+ "version": "v1.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/iter.git",
+ "reference": "fed36b417ea93fe9b4b7cb2e2abf98d91092564c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/iter/zipball/fed36b417ea93fe9b4b7cb2e2abf98d91092564c",
+ "reference": "fed36b417ea93fe9b4b7cb2e2abf98d91092564c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0|~5.0"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov",
+ "email": "nikic@php.net"
+ }
+ ],
+ "description": "Iteration primitives using generators",
+ "keywords": [
+ "functional",
+ "generator",
+ "iterator"
+ ],
+ "time": "2017-11-10T22:56:03+00:00"
+ },
+ {
+ "name": "nikic/php-parser",
+ "version": "v3.1.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/PHP-Parser.git",
+ "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce",
+ "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0|~5.0"
+ },
+ "bin": [
+ "bin/php-parse"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpParser\\": "lib/PhpParser"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "parser",
+ "php"
+ ],
+ "time": "2018-02-28T20:30:58+00:00"
+ },
+ {
+ "name": "ocramius/package-versions",
+ "version": "1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Ocramius/PackageVersions.git",
+ "reference": "4489d5002c49d55576fa0ba786f42dbb009be46f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/4489d5002c49d55576fa0ba786f42dbb009be46f",
+ "reference": "4489d5002c49d55576fa0ba786f42dbb009be46f",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.0.0",
+ "php": "^7.1.0"
+ },
+ "require-dev": {
+ "composer/composer": "^1.6.3",
+ "ext-zip": "*",
+ "infection/infection": "^0.7.1",
+ "phpunit/phpunit": "^7.0.0"
+ },
+ "type": "composer-plugin",
+ "extra": {
+ "class": "PackageVersions\\Installer",
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PackageVersions\\": "src/PackageVersions"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com"
+ }
+ ],
+ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
+ "time": "2018-02-05T13:05:30+00:00"
+ },
+ {
+ "name": "opis/closure",
+ "version": "3.0.12",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/opis/closure.git",
+ "reference": "507a28d15e79258d404ba76e73976ba895d0eb11"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/opis/closure/zipball/507a28d15e79258d404ba76e73976ba895d0eb11",
+ "reference": "507a28d15e79258d404ba76e73976ba895d0eb11",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "jeremeamia/superclosure": "^2.0",
+ "phpunit/phpunit": "^4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Opis\\Closure\\": "src/"
+ },
+ "files": [
+ "functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marius Sarca",
+ "email": "marius.sarca@gmail.com"
+ }
+ ],
+ "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
+ "homepage": "http://www.opis.io/closure",
+ "keywords": [
+ "anonymous functions",
+ "closure",
+ "function",
+ "serializable",
+ "serialization",
+ "serialize"
+ ],
+ "time": "2018-02-23T08:08:14+00:00"
+ },
+ {
+ "name": "padraic/humbug_get_contents",
+ "version": "1.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/humbug/file_get_contents.git",
+ "reference": "dcb086060c9dd6b2f51d8f7a895500307110b7a7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/humbug/file_get_contents/zipball/dcb086060c9dd6b2f51d8f7a895500307110b7a7",
+ "reference": "dcb086060c9dd6b2f51d8f7a895500307110b7a7",
+ "shasum": ""
+ },
+ "require": {
+ "composer/ca-bundle": "^1.0",
+ "ext-openssl": "*",
+ "php": "^5.3 || ^7.0 || ^7.1 || ^7.2"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.1",
+ "mikey179/vfsstream": "^1.6",
+ "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5"
+ },
+ "type": "library",
+ "extra": {
+ "bamarni-bin": {
+ "bin-links": false
+ },
+ "branch-alias": {
+ "dev-master": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Humbug\\": "src/"
+ },
+ "files": [
+ "src/function.php",
+ "src/functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Padraic Brady",
+ "email": "padraic.brady@gmail.com",
+ "homepage": "http://blog.astrumfutura.com"
+ },
+ {
+ "name": "Théo Fidry",
+ "email": "theo.fidry@gmail.com"
+ }
+ ],
+ "description": "Secure wrapper for accessing HTTPS resources with file_get_contents for PHP 5.3+",
+ "homepage": "https://github.com/padraic/file_get_contents",
+ "keywords": [
+ "download",
+ "file_get_contents",
+ "http",
+ "https",
+ "ssl",
+ "tls"
+ ],
+ "time": "2018-02-12T18:47:17+00:00"
+ },
+ {
+ "name": "padraic/phar-updater",
+ "version": "v1.0.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/humbug/phar-updater.git",
+ "reference": "d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/humbug/phar-updater/zipball/d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1",
+ "reference": "d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1",
+ "shasum": ""
+ },
+ "require": {
+ "padraic/humbug_get_contents": "^1.0",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Humbug\\SelfUpdate\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Pádraic Brady",
+ "email": "padraic.brady@gmail.com",
+ "homepage": "http://blog.astrumfutura.com"
+ }
+ ],
+ "description": "A thing to make PHAR self-updating easy and secure.",
+ "keywords": [
+ "humbug",
+ "phar",
+ "self-update",
+ "update"
+ ],
+ "time": "2018-03-30T12:52:15+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-common",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
+ "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
+ "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jaap van Otterdijk",
+ "email": "opensource@ijaap.nl"
+ }
+ ],
+ "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
+ "homepage": "http://www.phpdoc.org",
+ "keywords": [
+ "FQSEN",
+ "phpDocumentor",
+ "phpdoc",
+ "reflection",
+ "static analysis"
+ ],
+ "time": "2017-09-11T18:02:19+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "4.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "94fd0001232e47129dd3504189fa1c7225010d08"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08",
+ "reference": "94fd0001232e47129dd3504189fa1c7225010d08",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0",
+ "phpdocumentor/reflection-common": "^1.0.0",
+ "phpdocumentor/type-resolver": "^0.4.0",
+ "webmozart/assert": "^1.0"
+ },
+ "require-dev": {
+ "doctrine/instantiator": "~1.0.5",
+ "mockery/mockery": "^1.0",
+ "phpunit/phpunit": "^6.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
+ "time": "2017-11-30T07:14:17+00:00"
+ },
+ {
+ "name": "phpdocumentor/type-resolver",
+ "version": "0.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/TypeResolver.git",
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7",
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.5 || ^7.0",
+ "phpdocumentor/reflection-common": "^1.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.4",
+ "phpunit/phpunit": "^5.2||^4.8.24"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "time": "2017-07-14T14:27:02+00:00"
+ },
+ {
+ "name": "phpseclib/phpseclib",
+ "version": "2.0.11",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpseclib/phpseclib.git",
+ "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7053f06f91b3de78e143d430e55a8f7889efc08b",
+ "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phing/phing": "~2.7",
+ "phpunit/phpunit": "^4.8.35|^5.7|^6.0",
+ "sami/sami": "~2.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "suggest": {
+ "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
+ "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
+ "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
+ "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "phpseclib/bootstrap.php"
+ ],
+ "psr-4": {
+ "phpseclib\\": "phpseclib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jim Wigginton",
+ "email": "terrafrost@php.net",
+ "role": "Lead Developer"
+ },
+ {
+ "name": "Patrick Monnerat",
+ "email": "pm@datasphere.ch",
+ "role": "Developer"
+ },
+ {
+ "name": "Andreas Fischer",
+ "email": "bantu@phpbb.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Hans-Jürgen Petrich",
+ "email": "petrich@tronic-media.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Graham Campbell",
+ "email": "graham@alt-three.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
+ "homepage": "http://phpseclib.sourceforge.net",
+ "keywords": [
+ "BigInteger",
+ "aes",
+ "asn.1",
+ "asn1",
+ "blowfish",
+ "crypto",
+ "cryptography",
+ "encryption",
+ "rsa",
+ "security",
+ "sftp",
+ "signature",
+ "signing",
+ "ssh",
+ "twofish",
+ "x.509",
+ "x509"
+ ],
+ "time": "2018-04-15T16:55:05+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "time": "2016-10-10T12:19:37+00:00"
+ },
+ {
+ "name": "roave/better-reflection",
+ "version": "2.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Roave/BetterReflection.git",
+ "reference": "efc45b50cb52d5eeaacab15741376e981e28738b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Roave/BetterReflection/zipball/efc45b50cb52d5eeaacab15741376e981e28738b",
+ "reference": "efc45b50cb52d5eeaacab15741376e981e28738b",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "^3.1.1",
+ "php": ">=7.1.0,<7.3.0",
+ "phpdocumentor/reflection-docblock": "^4.1.1",
+ "phpdocumentor/type-resolver": "^0.4.0",
+ "roave/signature": "^1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.3.0"
+ },
+ "suggest": {
+ "composer/composer": "Required to use the ComposerSourceLocator"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Roave\\BetterReflection\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.io/"
+ },
+ {
+ "name": "James Titcumb",
+ "email": "james@asgrim.com",
+ "homepage": "https://github.com/asgrim"
+ },
+ {
+ "name": "Gary Hockin",
+ "email": "gary@roave.com",
+ "homepage": "https://github.com/geeh"
+ },
+ {
+ "name": "Jaroslav Hanslík",
+ "email": "kukulich@kukulich.cz",
+ "homepage": "https://github.com/kukulich"
+ }
+ ],
+ "description": "Better Reflection - an improved code reflection API",
+ "time": "2018-02-05T08:08:57+00:00"
+ },
+ {
+ "name": "roave/signature",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Roave/Signature.git",
+ "reference": "bed4ecbdd7f312ab6bb39561ac191f520bcee386"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Roave/Signature/zipball/bed4ecbdd7f312ab6bb39561ac191f520bcee386",
+ "reference": "bed4ecbdd7f312ab6bb39561ac191f520bcee386",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.0|^7.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.6"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Roave\\Signature\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Sign and verify stuff",
+ "time": "2017-02-17T13:53:21+00:00"
+ },
+ {
+ "name": "seld/cli-prompt",
+ "version": "1.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/cli-prompt.git",
+ "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
+ "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Seld\\CliPrompt\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be"
+ }
+ ],
+ "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type",
+ "keywords": [
+ "cli",
+ "console",
+ "hidden",
+ "input",
+ "prompt"
+ ],
+ "time": "2017-03-18T11:32:45+00:00"
+ },
+ {
+ "name": "seld/jsonlint",
+ "version": "1.7.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/jsonlint.git",
+ "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38",
+ "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
+ },
+ "bin": [
+ "bin/jsonlint"
+ ],
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Seld\\JsonLint\\": "src/Seld/JsonLint/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "JSON Linter",
+ "keywords": [
+ "json",
+ "linter",
+ "parser",
+ "validator"
+ ],
+ "time": "2018-01-24T12:46:19+00:00"
+ },
+ {
+ "name": "seld/phar-utils",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/phar-utils.git",
+ "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a",
+ "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Seld\\PharUtils\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be"
+ }
+ ],
+ "description": "PHAR file format utilities, for when PHP phars you up",
+ "keywords": [
+ "phra"
+ ],
+ "time": "2015-10-13T18:44:15+00:00"
+ },
+ {
+ "name": "symfony/console",
+ "version": "v4.0.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/console.git",
+ "reference": "3e820bc2c520a87ca209ad8fa961c97f42e0b4ae"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/console/zipball/3e820bc2c520a87ca209ad8fa961c97f42e0b4ae",
+ "reference": "3e820bc2c520a87ca209ad8fa961c97f42e0b4ae",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1.3",
+ "symfony/polyfill-mbstring": "~1.0"
+ },
+ "conflict": {
+ "symfony/dependency-injection": "<3.4",
+ "symfony/process": "<3.3"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~3.4|~4.0",
+ "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/event-dispatcher": "~3.4|~4.0",
+ "symfony/lock": "~3.4|~4.0",
+ "symfony/process": "~3.4|~4.0"
+ },
+ "suggest": {
+ "psr/log-implementation": "For using the console logger",
+ "symfony/event-dispatcher": "",
+ "symfony/lock": "",
+ "symfony/process": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Console\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Console Component",
+ "homepage": "https://symfony.com",
+ "time": "2018-04-30T01:23:47+00:00"
+ },
+ {
+ "name": "symfony/filesystem",
+ "version": "v4.0.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/filesystem.git",
+ "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21",
+ "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Filesystem\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Filesystem Component",
+ "homepage": "https://symfony.com",
+ "time": "2018-02-22T10:50:29+00:00"
+ },
+ {
+ "name": "symfony/finder",
+ "version": "v4.0.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/finder.git",
+ "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/ca27c02b7a3fef4828c998c2ff9ba7aae1641c49",
+ "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Finder\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Finder Component",
+ "homepage": "https://symfony.com",
+ "time": "2018-04-04T05:10:37+00:00"
+ },
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "v1.8.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "3296adf6a6454a050679cde90f95350ad604b171"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171",
+ "reference": "3296adf6a6454a050679cde90f95350ad604b171",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.8-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for the Mbstring extension",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "mbstring",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2018-04-26T10:06:28+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php72",
+ "version": "v1.8.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php72.git",
+ "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/a4576e282d782ad82397f3e4ec1df8e0f0cafb46",
+ "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.8-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php72\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2018-04-26T10:06:28+00:00"
+ },
+ {
+ "name": "symfony/process",
+ "version": "v4.0.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/process.git",
+ "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/process/zipball/d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25",
+ "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Process\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Process Component",
+ "homepage": "https://symfony.com",
+ "time": "2018-04-03T05:24:00+00:00"
+ },
+ {
+ "name": "symfony/var-dumper",
+ "version": "v4.0.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/var-dumper.git",
+ "reference": "3c34cf3f4bbac9e003d9325225e9ef1a49180a18"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/var-dumper/zipball/3c34cf3f4bbac9e003d9325225e9ef1a49180a18",
+ "reference": "3c34cf3f4bbac9e003d9325225e9ef1a49180a18",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1.3",
+ "symfony/polyfill-mbstring": "~1.0",
+ "symfony/polyfill-php72": "~1.5"
+ },
+ "conflict": {
+ "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
+ },
+ "require-dev": {
+ "ext-iconv": "*",
+ "twig/twig": "~1.34|~2.4"
+ },
+ "suggest": {
+ "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
+ "ext-intl": "To show region name in time zone dump"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "Resources/functions/dump.php"
+ ],
+ "psr-4": {
+ "Symfony\\Component\\VarDumper\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony mechanism for exploring and dumping PHP variables",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "debug",
+ "dump"
+ ],
+ "time": "2018-04-26T16:12:06+00:00"
+ },
+ {
+ "name": "webmozart/assert",
+ "version": "1.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/webmozart/assert.git",
+ "reference": "0df1908962e7a3071564e857d86874dad1ef204a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a",
+ "reference": "0df1908962e7a3071564e857d86874dad1ef204a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.3 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6",
+ "sebastian/version": "^1.0.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Webmozart\\Assert\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "Assertions to validate method input/output with nice error messages.",
+ "keywords": [
+ "assert",
+ "check",
+ "validate"
+ ],
+ "time": "2018-01-29T19:49:41+00:00"
+ },
+ {
+ "name": "webmozart/path-util",
+ "version": "2.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/webmozart/path-util.git",
+ "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
+ "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "webmozart/assert": "~1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6",
+ "sebastian/version": "^1.0.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Webmozart\\PathUtil\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
+ "time": "2015-12-17T08:42:14+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "dev",
+ "stability-flags": {
+ "humbug/box": 15
+ },
+ "prefer-stable": true,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": []
+}
diff --git a/vendor/symfony/console/Command/Command.php b/vendor/symfony/console/Command/Command.php
index 06930425..627da5ec 100644
--- a/vendor/symfony/console/Command/Command.php
+++ b/vendor/symfony/console/Command/Command.php
@@ -218,12 +218,11 @@ class Command
if (null !== $this->processTitle) {
if (function_exists('cli_set_process_title')) {
- if (false === @cli_set_process_title($this->processTitle)) {
+ if (!@cli_set_process_title($this->processTitle)) {
if ('Darwin' === PHP_OS) {
$output->writeln('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS. ');
} else {
- $error = error_get_last();
- trigger_error($error['message'], E_USER_WARNING);
+ cli_set_process_title($this->processTitle);
}
}
} elseif (function_exists('setproctitle')) {
diff --git a/vendor/symfony/console/Descriptor/DescriptorInterface.php b/vendor/symfony/console/Descriptor/DescriptorInterface.php
index 3929b6d9..5d3339a9 100644
--- a/vendor/symfony/console/Descriptor/DescriptorInterface.php
+++ b/vendor/symfony/console/Descriptor/DescriptorInterface.php
@@ -21,7 +21,7 @@ use Symfony\Component\Console\Output\OutputInterface;
interface DescriptorInterface
{
/**
- * Describes an InputArgument instance.
+ * Describes an object if supported.
*
* @param OutputInterface $output
* @param object $object
diff --git a/vendor/symfony/console/Descriptor/JsonDescriptor.php b/vendor/symfony/console/Descriptor/JsonDescriptor.php
index 35c87c22..f60323be 100644
--- a/vendor/symfony/console/Descriptor/JsonDescriptor.php
+++ b/vendor/symfony/console/Descriptor/JsonDescriptor.php
@@ -121,7 +121,7 @@ class JsonDescriptor extends Descriptor
{
return array(
'name' => '--'.$option->getName(),
- 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
+ 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
'accept_value' => $option->acceptValue(),
'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(),
diff --git a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php
index 106bff51..d52ba553 100644
--- a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php
+++ b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php
@@ -70,7 +70,7 @@ class MarkdownDescriptor extends Descriptor
{
$name = '--'.$option->getName();
if ($option->getShortcut()) {
- $name .= '|-'.implode('|-', explode('|', $option->getShortcut())).'';
+ $name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
}
$this->write(
diff --git a/vendor/symfony/console/Descriptor/XmlDescriptor.php b/vendor/symfony/console/Descriptor/XmlDescriptor.php
index f05756ca..1a105352 100644
--- a/vendor/symfony/console/Descriptor/XmlDescriptor.php
+++ b/vendor/symfony/console/Descriptor/XmlDescriptor.php
@@ -224,7 +224,7 @@ class XmlDescriptor extends Descriptor
$pos = strpos($option->getShortcut(), '|');
if (false !== $pos) {
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
- $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
+ $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
} else {
$objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
}
diff --git a/vendor/symfony/console/EventListener/ErrorListener.php b/vendor/symfony/console/EventListener/ErrorListener.php
index 3774f9e6..909d6ea3 100644
--- a/vendor/symfony/console/EventListener/ErrorListener.php
+++ b/vendor/symfony/console/EventListener/ErrorListener.php
@@ -40,10 +40,10 @@ class ErrorListener implements EventSubscriberInterface
$error = $event->getError();
if (!$inputString = $this->getInputString($event)) {
- return $this->logger->error('An error occurred while using the console. Message: "{message}"', array('error' => $error, 'message' => $error->getMessage()));
+ return $this->logger->error('An error occurred while using the console. Message: "{message}"', array('exception' => $error, 'message' => $error->getMessage()));
}
- $this->logger->error('Error thrown while running command "{command}". Message: "{message}"', array('error' => $error, 'command' => $inputString, 'message' => $error->getMessage()));
+ $this->logger->error('Error thrown while running command "{command}". Message: "{message}"', array('exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()));
}
public function onConsoleTerminate(ConsoleTerminateEvent $event)
diff --git a/vendor/symfony/console/Helper/QuestionHelper.php b/vendor/symfony/console/Helper/QuestionHelper.php
index 5bcd96b3..e793256f 100644
--- a/vendor/symfony/console/Helper/QuestionHelper.php
+++ b/vendor/symfony/console/Helper/QuestionHelper.php
@@ -305,7 +305,7 @@ class QuestionHelper extends Helper
foreach ($autocomplete as $value) {
// If typed characters match the beginning chunk of value (e.g. [AcmeDe]moBundle)
- if (0 === strpos($value, $ret) && $i !== strlen($value)) {
+ if (0 === strpos($value, $ret)) {
$matches[$numMatches++] = $value;
}
}
diff --git a/vendor/symfony/console/Input/ArgvInput.php b/vendor/symfony/console/Input/ArgvInput.php
index 1a430f1f..fd819810 100644
--- a/vendor/symfony/console/Input/ArgvInput.php
+++ b/vendor/symfony/console/Input/ArgvInput.php
@@ -282,7 +282,11 @@ class ArgvInput extends Input
return false;
}
foreach ($values as $value) {
- if ($token === $value || 0 === strpos($token, $value.'=')) {
+ // Options with values:
+ // For long options, test for '--option=' at beginning
+ // For short options, test for '-o' at beginning
+ $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
+ if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
return true;
}
}
@@ -306,13 +310,16 @@ class ArgvInput extends Input
}
foreach ($values as $value) {
- if ($token === $value || 0 === strpos($token, $value.'=')) {
- if (false !== $pos = strpos($token, '=')) {
- return substr($token, $pos + 1);
- }
-
+ if ($token === $value) {
return array_shift($tokens);
}
+ // Options with values:
+ // For long options, test for '--option=' at beginning
+ // For short options, test for '-o' at beginning
+ $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
+ if ('' !== $leading && 0 === strpos($token, $leading)) {
+ return substr($token, strlen($leading));
+ }
}
}
diff --git a/vendor/symfony/console/Input/ArrayInput.php b/vendor/symfony/console/Input/ArrayInput.php
index e6c28de9..4d9797ba 100644
--- a/vendor/symfony/console/Input/ArrayInput.php
+++ b/vendor/symfony/console/Input/ArrayInput.php
@@ -114,7 +114,7 @@ class ArrayInput extends Input
$params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
}
} else {
- $params[] = is_array($val) ? array_map(array($this, 'escapeToken'), $val) : $this->escapeToken($val);
+ $params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
}
}
diff --git a/vendor/symfony/console/Input/InputInterface.php b/vendor/symfony/console/Input/InputInterface.php
index b9e0651f..43810f7a 100644
--- a/vendor/symfony/console/Input/InputInterface.php
+++ b/vendor/symfony/console/Input/InputInterface.php
@@ -33,6 +33,8 @@ interface InputInterface
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
+ * Does not necessarily return the correct result for short options
+ * when multiple flags are combined in the same option.
*
* @param string|array $values The values to look for in the raw parameters (can be an array)
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
@@ -46,6 +48,8 @@ interface InputInterface
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
+ * Does not necessarily return the correct result for short options
+ * when multiple flags are combined in the same option.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param mixed $default The default value to return if no result is found
diff --git a/vendor/symfony/console/Input/InputOption.php b/vendor/symfony/console/Input/InputOption.php
index 3af8077c..c9da966a 100644
--- a/vendor/symfony/console/Input/InputOption.php
+++ b/vendor/symfony/console/Input/InputOption.php
@@ -195,7 +195,7 @@ class InputOption
*
* @return bool
*/
- public function equals(InputOption $option)
+ public function equals(self $option)
{
return $option->getName() === $this->getName()
&& $option->getShortcut() === $this->getShortcut()
diff --git a/vendor/symfony/console/Output/StreamOutput.php b/vendor/symfony/console/Output/StreamOutput.php
index 51cad9b1..5fc5d01e 100644
--- a/vendor/symfony/console/Output/StreamOutput.php
+++ b/vendor/symfony/console/Output/StreamOutput.php
@@ -83,21 +83,34 @@ class StreamOutput extends Output
*
* Colorization is disabled if not supported by the stream:
*
- * - Windows != 10.0.10586 without Ansicon, ConEmu or Mintty
- * - non tty consoles
+ * This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo
+ * terminals via named pipes, so we can only check the environment.
+ *
+ * Reference: Composer\XdebugHandler\Process::supportsColor
+ * https://github.com/composer/xdebug-handler
*
* @return bool true if the stream supports colorization, false otherwise
*/
protected function hasColorSupport()
{
if (DIRECTORY_SEPARATOR === '\\') {
- return
- '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
+ return (function_exists('sapi_windows_vt100_support')
+ && @sapi_windows_vt100_support($this->stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}
- return function_exists('posix_isatty') && @posix_isatty($this->stream);
+ if (function_exists('stream_isatty')) {
+ return @stream_isatty($this->stream);
+ }
+
+ if (function_exists('posix_isatty')) {
+ return @posix_isatty($this->stream);
+ }
+
+ $stat = @fstat($this->stream);
+ // Check if formatted mode is S_IFCHR
+ return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
}
}
diff --git a/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php b/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php
index 17eaae09..3794a266 100644
--- a/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php
+++ b/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php
@@ -34,7 +34,7 @@ class ErrorListenerTest extends TestCase
$logger
->expects($this->once())
->method('error')
- ->with('Error thrown while running command "{command}". Message: "{message}"', array('error' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'))
+ ->with('Error thrown while running command "{command}". Message: "{message}"', array('exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'))
;
$listener = new ErrorListener($logger);
@@ -49,7 +49,7 @@ class ErrorListenerTest extends TestCase
$logger
->expects($this->once())
->method('error')
- ->with('An error occurred while using the console. Message: "{message}"', array('error' => $error, 'message' => 'An error occurred'))
+ ->with('An error occurred while using the console. Message: "{message}"', array('exception' => $error, 'message' => 'An error occurred'))
;
$listener = new ErrorListener($logger);
diff --git a/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php b/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php
index 78ec1d3c..cf12acdb 100644
--- a/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php
+++ b/vendor/symfony/console/Tests/Helper/QuestionHelperTest.php
@@ -157,6 +157,29 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
$this->assertEquals('AsseticBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
}
+ public function testAskWithAutocompleteWithExactMatch()
+ {
+ if (!$this->hasSttyAvailable()) {
+ $this->markTestSkipped('`stty` is required to test autocomplete functionality');
+ }
+
+ $inputStream = $this->getInputStream("b\n");
+
+ $possibleChoices = array(
+ 'a' => 'berlin',
+ 'b' => 'copenhagen',
+ 'c' => 'amsterdam',
+ );
+
+ $dialog = new QuestionHelper();
+ $dialog->setHelperSet(new HelperSet(array(new FormatterHelper())));
+
+ $question = new ChoiceQuestion('Please select a city', $possibleChoices);
+ $question->setMaxAttempts(1);
+
+ $this->assertSame('b', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
+ }
+
public function testAutocompleteWithTrailingBackslash()
{
if (!$this->hasSttyAvailable()) {
diff --git a/vendor/symfony/console/Tests/Input/ArgvInputTest.php b/vendor/symfony/console/Tests/Input/ArgvInputTest.php
index 8287bce5..61d1723e 100644
--- a/vendor/symfony/console/Tests/Input/ArgvInputTest.php
+++ b/vendor/symfony/console/Tests/Input/ArgvInputTest.php
@@ -314,6 +314,10 @@ class ArgvInputTest extends TestCase
$input = new ArgvInput(array('cli.php', '-f', 'foo'));
$this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ $input = new ArgvInput(array('cli.php', '-etest'));
+ $this->assertTrue($input->hasParameterOption('-e'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ $this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input');
+
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
@@ -339,6 +343,46 @@ class ArgvInputTest extends TestCase
$this->assertFalse($input->hasParameterOption('--foo', true), '->hasParameterOption() returns false if the given option is in the raw input but after an end of options signal');
}
+ public function testHasParameterOptionEdgeCasesAndLimitations()
+ {
+ $input = new ArgvInput(array('cli.php', '-fh'));
+ // hasParameterOption does not know if the previous short option, -f,
+ // takes a value or not. If -f takes a value, then -fh does NOT include
+ // -h; Otherwise it does. Since we do not know which short options take
+ // values, hasParameterOption does not support this use-case.
+ $this->assertFalse($input->hasParameterOption('-h'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ // hasParameterOption does detect that `-fh` contains `-f`, since
+ // `-f` is the first short option in the set.
+ $this->assertTrue($input->hasParameterOption('-f'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ // The test below happens to pass, although it might make more sense
+ // to disallow it, and require the use of
+ // $input->hasParameterOption('-f') && $input->hasParameterOption('-h')
+ // instead.
+ $this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ // In theory, if -fh is supported, then -hf should also work.
+ // However, this is not supported.
+ $this->assertFalse($input->hasParameterOption('-hf'), '->hasParameterOption() returns true if the given short option is in the raw input');
+
+ $input = new ArgvInput(array('cli.php', '-f', '-h'));
+ // If hasParameterOption('-fh') is supported for 'cli.php -fh', then
+ // one might also expect that it should also be supported for
+ // 'cli.php -f -h'. However, this is not supported.
+ $this->assertFalse($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
+ }
+
+ public function testNoWarningOnInvalidParameterOption()
+ {
+ $input = new ArgvInput(array('cli.php', '-edev'));
+
+ $this->assertTrue($input->hasParameterOption(array('-e', '')));
+ // No warning thrown
+ $this->assertFalse($input->hasParameterOption(array('-m', '')));
+
+ $this->assertEquals('dev', $input->getParameterOption(array('-e', '')));
+ // No warning thrown
+ $this->assertFalse($input->getParameterOption(array('-m', '')));
+ }
+
public function testToString()
{
$input = new ArgvInput(array('cli.php', '-f', 'foo'));
diff --git a/vendor/symfony/console/Tests/Input/ArrayInputTest.php b/vendor/symfony/console/Tests/Input/ArrayInputTest.php
index 3e858435..6b443e0b 100644
--- a/vendor/symfony/console/Tests/Input/ArrayInputTest.php
+++ b/vendor/symfony/console/Tests/Input/ArrayInputTest.php
@@ -170,5 +170,8 @@ class ArrayInputTest extends TestCase
$input = new ArrayInput(array('-b' => array('bval_1', 'bval_2'), '--f' => array('fval_1', 'fval_2')));
$this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input);
+
+ $input = new ArrayInput(array('array_arg' => array('val_1', 'val_2')));
+ $this->assertSame('val_1 val_2', (string) $input);
}
}
diff --git a/vendor/symfony/console/composer.json b/vendor/symfony/console/composer.json
index e9d10e0c..ab348abd 100644
--- a/vendor/symfony/console/composer.json
+++ b/vendor/symfony/console/composer.json
@@ -32,7 +32,7 @@
"symfony/event-dispatcher": "",
"symfony/lock": "",
"symfony/process": "",
- "psr/log": "For using the console logger"
+ "psr/log-implementation": "For using the console logger"
},
"conflict": {
"symfony/dependency-injection": "<3.4",
diff --git a/vendor/symfony/css-selector/CssSelectorConverter.php b/vendor/symfony/css-selector/CssSelectorConverter.php
index 8d66dbd0..d1aeb7eb 100644
--- a/vendor/symfony/css-selector/CssSelectorConverter.php
+++ b/vendor/symfony/css-selector/CssSelectorConverter.php
@@ -31,7 +31,7 @@ class CssSelectorConverter
/**
* @param bool $html Whether HTML support should be enabled. Disable it for XML documents
*/
- public function __construct($html = true)
+ public function __construct(bool $html = true)
{
$this->translator = new Translator();
diff --git a/vendor/symfony/css-selector/Node/AbstractNode.php b/vendor/symfony/css-selector/Node/AbstractNode.php
index 7477e911..123ef1b1 100644
--- a/vendor/symfony/css-selector/Node/AbstractNode.php
+++ b/vendor/symfony/css-selector/Node/AbstractNode.php
@@ -31,7 +31,7 @@ abstract class AbstractNode implements NodeInterface
/**
* @return string
*/
- public function getNodeName()
+ public function getNodeName(): string
{
if (null === $this->nodeName) {
$this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', get_called_class());
diff --git a/vendor/symfony/css-selector/Node/AttributeNode.php b/vendor/symfony/css-selector/Node/AttributeNode.php
index 1caccb6b..bf702d9c 100644
--- a/vendor/symfony/css-selector/Node/AttributeNode.php
+++ b/vendor/symfony/css-selector/Node/AttributeNode.php
@@ -29,14 +29,7 @@ class AttributeNode extends AbstractNode
private $operator;
private $value;
- /**
- * @param NodeInterface $selector
- * @param string $namespace
- * @param string $attribute
- * @param string $operator
- * @param string $value
- */
- public function __construct(NodeInterface $selector, $namespace, $attribute, $operator, $value)
+ public function __construct(NodeInterface $selector, ?string $namespace, string $attribute, string $operator, ?string $value)
{
$this->selector = $selector;
$this->namespace = $namespace;
@@ -45,42 +38,27 @@ class AttributeNode extends AbstractNode
$this->value = $value;
}
- /**
- * @return NodeInterface
- */
- public function getSelector()
+ public function getSelector(): NodeInterface
{
return $this->selector;
}
- /**
- * @return string
- */
- public function getNamespace()
+ public function getNamespace(): ?string
{
return $this->namespace;
}
- /**
- * @return string
- */
- public function getAttribute()
+ public function getAttribute(): string
{
return $this->attribute;
}
- /**
- * @return string
- */
- public function getOperator()
+ public function getOperator(): string
{
return $this->operator;
}
- /**
- * @return string
- */
- public function getValue()
+ public function getValue(): ?string
{
return $this->value;
}
@@ -88,7 +66,7 @@ class AttributeNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -96,7 +74,7 @@ class AttributeNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
$attribute = $this->namespace ? $this->namespace.'|'.$this->attribute : $this->attribute;
diff --git a/vendor/symfony/css-selector/Node/ClassNode.php b/vendor/symfony/css-selector/Node/ClassNode.php
index 69462e8e..1998b4bd 100644
--- a/vendor/symfony/css-selector/Node/ClassNode.php
+++ b/vendor/symfony/css-selector/Node/ClassNode.php
@@ -26,28 +26,18 @@ class ClassNode extends AbstractNode
private $selector;
private $name;
- /**
- * @param NodeInterface $selector
- * @param string $name
- */
- public function __construct(NodeInterface $selector, $name)
+ public function __construct(NodeInterface $selector, string $name)
{
$this->selector = $selector;
$this->name = $name;
}
- /**
- * @return NodeInterface
- */
- public function getSelector()
+ public function getSelector(): NodeInterface
{
return $this->selector;
}
- /**
- * @return string
- */
- public function getName()
+ public function getName(): string
{
return $this->name;
}
@@ -55,7 +45,7 @@ class ClassNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -63,7 +53,7 @@ class ClassNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
return sprintf('%s[%s.%s]', $this->getNodeName(), $this->selector, $this->name);
}
diff --git a/vendor/symfony/css-selector/Node/CombinedSelectorNode.php b/vendor/symfony/css-selector/Node/CombinedSelectorNode.php
index 2aa583aa..f97fd21a 100644
--- a/vendor/symfony/css-selector/Node/CombinedSelectorNode.php
+++ b/vendor/symfony/css-selector/Node/CombinedSelectorNode.php
@@ -27,38 +27,24 @@ class CombinedSelectorNode extends AbstractNode
private $combinator;
private $subSelector;
- /**
- * @param NodeInterface $selector
- * @param string $combinator
- * @param NodeInterface $subSelector
- */
- public function __construct(NodeInterface $selector, $combinator, NodeInterface $subSelector)
+ public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector)
{
$this->selector = $selector;
$this->combinator = $combinator;
$this->subSelector = $subSelector;
}
- /**
- * @return NodeInterface
- */
- public function getSelector()
+ public function getSelector(): NodeInterface
{
return $this->selector;
}
- /**
- * @return string
- */
- public function getCombinator()
+ public function getCombinator(): string
{
return $this->combinator;
}
- /**
- * @return NodeInterface
- */
- public function getSubSelector()
+ public function getSubSelector(): NodeInterface
{
return $this->subSelector;
}
@@ -66,7 +52,7 @@ class CombinedSelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
}
@@ -74,7 +60,7 @@ class CombinedSelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
$combinator = ' ' === $this->combinator ? '' : $this->combinator;
diff --git a/vendor/symfony/css-selector/Node/ElementNode.php b/vendor/symfony/css-selector/Node/ElementNode.php
index bcdce7a7..7d405b31 100644
--- a/vendor/symfony/css-selector/Node/ElementNode.php
+++ b/vendor/symfony/css-selector/Node/ElementNode.php
@@ -30,7 +30,7 @@ class ElementNode extends AbstractNode
* @param string|null $namespace
* @param string|null $element
*/
- public function __construct($namespace = null, $element = null)
+ public function __construct(string $namespace = null, string $element = null)
{
$this->namespace = $namespace;
$this->element = $element;
@@ -55,7 +55,7 @@ class ElementNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return new Specificity(0, 0, $this->element ? 1 : 0);
}
@@ -63,7 +63,7 @@ class ElementNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
$element = $this->element ?: '*';
diff --git a/vendor/symfony/css-selector/Node/FunctionNode.php b/vendor/symfony/css-selector/Node/FunctionNode.php
index 50268255..89b64378 100644
--- a/vendor/symfony/css-selector/Node/FunctionNode.php
+++ b/vendor/symfony/css-selector/Node/FunctionNode.php
@@ -34,25 +34,19 @@ class FunctionNode extends AbstractNode
* @param string $name
* @param Token[] $arguments
*/
- public function __construct(NodeInterface $selector, $name, array $arguments = array())
+ public function __construct(NodeInterface $selector, string $name, array $arguments = array())
{
$this->selector = $selector;
$this->name = strtolower($name);
$this->arguments = $arguments;
}
- /**
- * @return NodeInterface
- */
- public function getSelector()
+ public function getSelector(): NodeInterface
{
return $this->selector;
}
- /**
- * @return string
- */
- public function getName()
+ public function getName(): string
{
return $this->name;
}
@@ -68,7 +62,7 @@ class FunctionNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -76,7 +70,7 @@ class FunctionNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
$arguments = implode(', ', array_map(function (Token $token) {
return "'".$token->getValue()."'";
diff --git a/vendor/symfony/css-selector/Node/HashNode.php b/vendor/symfony/css-selector/Node/HashNode.php
index ebf9a987..f73fa2e7 100644
--- a/vendor/symfony/css-selector/Node/HashNode.php
+++ b/vendor/symfony/css-selector/Node/HashNode.php
@@ -26,28 +26,18 @@ class HashNode extends AbstractNode
private $selector;
private $id;
- /**
- * @param NodeInterface $selector
- * @param string $id
- */
- public function __construct(NodeInterface $selector, $id)
+ public function __construct(NodeInterface $selector, string $id)
{
$this->selector = $selector;
$this->id = $id;
}
- /**
- * @return NodeInterface
- */
- public function getSelector()
+ public function getSelector(): NodeInterface
{
return $this->selector;
}
- /**
- * @return string
- */
- public function getId()
+ public function getId(): string
{
return $this->id;
}
@@ -55,7 +45,7 @@ class HashNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(1, 0, 0));
}
@@ -63,7 +53,7 @@ class HashNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
return sprintf('%s[%s#%s]', $this->getNodeName(), $this->selector, $this->id);
}
diff --git a/vendor/symfony/css-selector/Node/NegationNode.php b/vendor/symfony/css-selector/Node/NegationNode.php
index bf97caeb..9d3e9bc7 100644
--- a/vendor/symfony/css-selector/Node/NegationNode.php
+++ b/vendor/symfony/css-selector/Node/NegationNode.php
@@ -51,7 +51,7 @@ class NegationNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
}
@@ -59,7 +59,7 @@ class NegationNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
return sprintf('%s[%s:not(%s)]', $this->getNodeName(), $this->selector, $this->subSelector);
}
diff --git a/vendor/symfony/css-selector/Node/NodeInterface.php b/vendor/symfony/css-selector/Node/NodeInterface.php
index d919e20c..b078d26d 100644
--- a/vendor/symfony/css-selector/Node/NodeInterface.php
+++ b/vendor/symfony/css-selector/Node/NodeInterface.php
@@ -23,24 +23,9 @@ namespace Symfony\Component\CssSelector\Node;
*/
interface NodeInterface
{
- /**
- * Returns node's name.
- *
- * @return string
- */
- public function getNodeName();
+ public function getNodeName(): string;
- /**
- * Returns node's specificity.
- *
- * @return Specificity
- */
- public function getSpecificity();
+ public function getSpecificity(): Specificity;
- /**
- * Returns node's string representation.
- *
- * @return string
- */
- public function __toString();
+ public function __toString(): string;
}
diff --git a/vendor/symfony/css-selector/Node/PseudoNode.php b/vendor/symfony/css-selector/Node/PseudoNode.php
index 3842c695..7d4a011e 100644
--- a/vendor/symfony/css-selector/Node/PseudoNode.php
+++ b/vendor/symfony/css-selector/Node/PseudoNode.php
@@ -26,28 +26,18 @@ class PseudoNode extends AbstractNode
private $selector;
private $identifier;
- /**
- * @param NodeInterface $selector
- * @param string $identifier
- */
- public function __construct(NodeInterface $selector, $identifier)
+ public function __construct(NodeInterface $selector, string $identifier)
{
$this->selector = $selector;
$this->identifier = strtolower($identifier);
}
- /**
- * @return NodeInterface
- */
- public function getSelector()
+ public function getSelector(): NodeInterface
{
return $this->selector;
}
- /**
- * @return string
- */
- public function getIdentifier()
+ public function getIdentifier(): string
{
return $this->identifier;
}
@@ -55,7 +45,7 @@ class PseudoNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
}
@@ -63,7 +53,7 @@ class PseudoNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
return sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier);
}
diff --git a/vendor/symfony/css-selector/Node/SelectorNode.php b/vendor/symfony/css-selector/Node/SelectorNode.php
index 5ef2be62..a76aa5bb 100644
--- a/vendor/symfony/css-selector/Node/SelectorNode.php
+++ b/vendor/symfony/css-selector/Node/SelectorNode.php
@@ -26,28 +26,18 @@ class SelectorNode extends AbstractNode
private $tree;
private $pseudoElement;
- /**
- * @param NodeInterface $tree
- * @param null|string $pseudoElement
- */
- public function __construct(NodeInterface $tree, $pseudoElement = null)
+ public function __construct(NodeInterface $tree, string $pseudoElement = null)
{
$this->tree = $tree;
$this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null;
}
- /**
- * @return NodeInterface
- */
- public function getTree()
+ public function getTree(): NodeInterface
{
return $this->tree;
}
- /**
- * @return null|string
- */
- public function getPseudoElement()
+ public function getPseudoElement(): ?string
{
return $this->pseudoElement;
}
@@ -55,7 +45,7 @@ class SelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function getSpecificity()
+ public function getSpecificity(): Specificity
{
return $this->tree->getSpecificity()->plus(new Specificity(0, 0, $this->pseudoElement ? 1 : 0));
}
@@ -63,7 +53,7 @@ class SelectorNode extends AbstractNode
/**
* {@inheritdoc}
*/
- public function __toString()
+ public function __toString(): string
{
return sprintf('%s[%s%s]', $this->getNodeName(), $this->tree, $this->pseudoElement ? '::'.$this->pseudoElement : '');
}
diff --git a/vendor/symfony/css-selector/Node/Specificity.php b/vendor/symfony/css-selector/Node/Specificity.php
index 6aa70d78..9b35cb41 100644
--- a/vendor/symfony/css-selector/Node/Specificity.php
+++ b/vendor/symfony/css-selector/Node/Specificity.php
@@ -33,32 +33,19 @@ class Specificity
private $b;
private $c;
- /**
- * @param int $a
- * @param int $b
- * @param int $c
- */
- public function __construct($a, $b, $c)
+ public function __construct(int $a, int $b, int $c)
{
$this->a = $a;
$this->b = $b;
$this->c = $c;
}
- /**
- * @return self
- */
- public function plus(Specificity $specificity)
+ public function plus(self $specificity): self
{
return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c);
}
- /**
- * Returns global specificity value.
- *
- * @return int
- */
- public function getValue()
+ public function getValue(): int
{
return $this->a * self::A_FACTOR + $this->b * self::B_FACTOR + $this->c * self::C_FACTOR;
}
@@ -69,7 +56,7 @@ class Specificity
*
* @return int
*/
- public function compareTo(Specificity $specificity)
+ public function compareTo(self $specificity)
{
if ($this->a !== $specificity->a) {
return $this->a > $specificity->a ? 1 : -1;
diff --git a/vendor/symfony/css-selector/Parser/Handler/CommentHandler.php b/vendor/symfony/css-selector/Parser/Handler/CommentHandler.php
index a29775ca..93f31884 100644
--- a/vendor/symfony/css-selector/Parser/Handler/CommentHandler.php
+++ b/vendor/symfony/css-selector/Parser/Handler/CommentHandler.php
@@ -29,7 +29,7 @@ class CommentHandler implements HandlerInterface
/**
* {@inheritdoc}
*/
- public function handle(Reader $reader, TokenStream $stream)
+ public function handle(Reader $reader, TokenStream $stream): bool
{
if ('/*' !== $reader->getSubstring(2)) {
return false;
diff --git a/vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php b/vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php
index de931f67..d7ac4d33 100644
--- a/vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php
+++ b/vendor/symfony/css-selector/Parser/Handler/HandlerInterface.php
@@ -29,5 +29,5 @@ interface HandlerInterface
/**
* @return bool
*/
- public function handle(Reader $reader, TokenStream $stream);
+ public function handle(Reader $reader, TokenStream $stream): bool;
}
diff --git a/vendor/symfony/css-selector/Parser/Handler/HashHandler.php b/vendor/symfony/css-selector/Parser/Handler/HashHandler.php
index 5f7f4d23..f40807cd 100644
--- a/vendor/symfony/css-selector/Parser/Handler/HashHandler.php
+++ b/vendor/symfony/css-selector/Parser/Handler/HashHandler.php
@@ -41,7 +41,7 @@ class HashHandler implements HandlerInterface
/**
* {@inheritdoc}
*/
- public function handle(Reader $reader, TokenStream $stream)
+ public function handle(Reader $reader, TokenStream $stream): bool
{
$match = $reader->findPattern($this->patterns->getHashPattern());
diff --git a/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php b/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php
index aa6804ed..5ea0d5fd 100644
--- a/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php
+++ b/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php
@@ -41,7 +41,7 @@ class IdentifierHandler implements HandlerInterface
/**
* {@inheritdoc}
*/
- public function handle(Reader $reader, TokenStream $stream)
+ public function handle(Reader $reader, TokenStream $stream): bool
{
$match = $reader->findPattern($this->patterns->getIdentifierPattern());
diff --git a/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php b/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php
index 7e561d1d..41e5844e 100644
--- a/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php
+++ b/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php
@@ -38,7 +38,7 @@ class NumberHandler implements HandlerInterface
/**
* {@inheritdoc}
*/
- public function handle(Reader $reader, TokenStream $stream)
+ public function handle(Reader $reader, TokenStream $stream): bool
{
$match = $reader->findPattern($this->patterns->getNumberPattern());
diff --git a/vendor/symfony/css-selector/Parser/Handler/StringHandler.php b/vendor/symfony/css-selector/Parser/Handler/StringHandler.php
index f842e1ce..fe92c1fc 100644
--- a/vendor/symfony/css-selector/Parser/Handler/StringHandler.php
+++ b/vendor/symfony/css-selector/Parser/Handler/StringHandler.php
@@ -43,7 +43,7 @@ class StringHandler implements HandlerInterface
/**
* {@inheritdoc}
*/
- public function handle(Reader $reader, TokenStream $stream)
+ public function handle(Reader $reader, TokenStream $stream): bool
{
$quote = $reader->getSubstring(1);
diff --git a/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php b/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php
index 4c2d3354..ebf8a19f 100644
--- a/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php
+++ b/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php
@@ -30,7 +30,7 @@ class WhitespaceHandler implements HandlerInterface
/**
* {@inheritdoc}
*/
- public function handle(Reader $reader, TokenStream $stream)
+ public function handle(Reader $reader, TokenStream $stream): bool
{
$match = $reader->findPattern('~^[ \t\r\n\f]+~');
diff --git a/vendor/symfony/css-selector/Parser/Parser.php b/vendor/symfony/css-selector/Parser/Parser.php
index 195e1071..dc84cc18 100644
--- a/vendor/symfony/css-selector/Parser/Parser.php
+++ b/vendor/symfony/css-selector/Parser/Parser.php
@@ -37,7 +37,7 @@ class Parser implements ParserInterface
/**
* {@inheritdoc}
*/
- public function parse($source)
+ public function parse(string $source): array
{
$reader = new Reader($source);
$stream = $this->tokenizer->tokenize($reader);
@@ -50,11 +50,9 @@ class Parser implements ParserInterface
*
* @param Token[] $tokens
*
- * @return array
- *
* @throws SyntaxErrorException
*/
- public static function parseSeries(array $tokens)
+ public static function parseSeries(array $tokens): array
{
foreach ($tokens as $token) {
if ($token->isString()) {
@@ -94,12 +92,7 @@ class Parser implements ParserInterface
);
}
- /**
- * Parses selector nodes.
- *
- * @return array
- */
- private function parseSelectorList(TokenStream $stream)
+ private function parseSelectorList(TokenStream $stream): array
{
$stream->skipWhitespace();
$selectors = array();
@@ -118,14 +111,7 @@ class Parser implements ParserInterface
return $selectors;
}
- /**
- * Parses next selector or combined node.
- *
- * @return Node\SelectorNode
- *
- * @throws SyntaxErrorException
- */
- private function parserSelectorNode(TokenStream $stream)
+ private function parserSelectorNode(TokenStream $stream): Node\SelectorNode
{
list($result, $pseudoElement) = $this->parseSimpleSelector($stream);
@@ -158,14 +144,9 @@ class Parser implements ParserInterface
/**
* Parses next simple node (hash, class, pseudo, negation).
*
- * @param TokenStream $stream
- * @param bool $insideNegation
- *
- * @return array
- *
* @throws SyntaxErrorException
*/
- private function parseSimpleSelector(TokenStream $stream, $insideNegation = false)
+ private function parseSimpleSelector(TokenStream $stream, bool $insideNegation = false): array
{
$stream->skipWhitespace();
@@ -279,12 +260,7 @@ class Parser implements ParserInterface
return array($result, $pseudoElement);
}
- /**
- * Parses next element node.
- *
- * @return Node\ElementNode
- */
- private function parseElementNode(TokenStream $stream)
+ private function parseElementNode(TokenStream $stream): Node\ElementNode
{
$peek = $stream->getPeek();
@@ -310,14 +286,7 @@ class Parser implements ParserInterface
return new Node\ElementNode($namespace, $element);
}
- /**
- * Parses next attribute node.
- *
- * @return Node\AttributeNode
- *
- * @throws SyntaxErrorException
- */
- private function parseAttributeNode(Node\NodeInterface $selector, TokenStream $stream)
+ private function parseAttributeNode(Node\NodeInterface $selector, TokenStream $stream): Node\AttributeNode
{
$stream->skipWhitespace();
$attribute = $stream->getNextIdentifierOrStar();
diff --git a/vendor/symfony/css-selector/Parser/ParserInterface.php b/vendor/symfony/css-selector/Parser/ParserInterface.php
index c5af2036..51c3d935 100644
--- a/vendor/symfony/css-selector/Parser/ParserInterface.php
+++ b/vendor/symfony/css-selector/Parser/ParserInterface.php
@@ -28,9 +28,7 @@ interface ParserInterface
/**
* Parses given selector source into an array of tokens.
*
- * @param string $source
- *
* @return SelectorNode[]
*/
- public function parse($source);
+ public function parse(string $source): array;
}
diff --git a/vendor/symfony/css-selector/Parser/Reader.php b/vendor/symfony/css-selector/Parser/Reader.php
index 5a1be30c..adfd3c21 100644
--- a/vendor/symfony/css-selector/Parser/Reader.php
+++ b/vendor/symfony/css-selector/Parser/Reader.php
@@ -27,56 +27,33 @@ class Reader
private $length;
private $position = 0;
- /**
- * @param string $source
- */
- public function __construct($source)
+ public function __construct(string $source)
{
$this->source = $source;
$this->length = strlen($source);
}
- /**
- * @return bool
- */
- public function isEOF()
+ public function isEOF(): bool
{
return $this->position >= $this->length;
}
- /**
- * @return int
- */
- public function getPosition()
+ public function getPosition(): int
{
return $this->position;
}
- /**
- * @return int
- */
- public function getRemainingLength()
+ public function getRemainingLength(): int
{
return $this->length - $this->position;
}
- /**
- * @param int $length
- * @param int $offset
- *
- * @return string
- */
- public function getSubstring($length, $offset = 0)
+ public function getSubstring(int $length, int $offset = 0): string
{
return substr($this->source, $this->position + $offset, $length);
}
- /**
- * @param string $string
- *
- * @return int
- */
- public function getOffset($string)
+ public function getOffset(string $string)
{
$position = strpos($this->source, $string, $this->position);
@@ -84,11 +61,9 @@ class Reader
}
/**
- * @param string $pattern
- *
* @return array|false
*/
- public function findPattern($pattern)
+ public function findPattern(string $pattern)
{
$source = substr($this->source, $this->position);
@@ -99,10 +74,7 @@ class Reader
return false;
}
- /**
- * @param int $length
- */
- public function moveForward($length)
+ public function moveForward(int $length)
{
$this->position += $length;
}
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php b/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
index c513de5f..ce7b20ef 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/ClassParser.php
@@ -31,7 +31,7 @@ class ClassParser implements ParserInterface
/**
* {@inheritdoc}
*/
- public function parse($source)
+ public function parse(string $source): array
{
// Matches an optional namespace, optional element, and required class
// $source = 'test|input.ab6bd_field';
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php b/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php
index c29f5e44..3b93f006 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/ElementParser.php
@@ -30,7 +30,7 @@ class ElementParser implements ParserInterface
/**
* {@inheritdoc}
*/
- public function parse($source)
+ public function parse(string $source): array
{
// Matches an optional namespace, required element or `*`
// $source = 'testns|testel';
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php b/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php
index 16d374af..e8a89cc4 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php
@@ -34,7 +34,7 @@ class EmptyStringParser implements ParserInterface
/**
* {@inheritdoc}
*/
- public function parse($source)
+ public function parse(string $source): array
{
// Matches an empty string
if ('' == $source) {
diff --git a/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php b/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php
index 3f3883bb..e94ce0a4 100644
--- a/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php
+++ b/vendor/symfony/css-selector/Parser/Shortcut/HashParser.php
@@ -31,7 +31,7 @@ class HashParser implements ParserInterface
/**
* {@inheritdoc}
*/
- public function parse($source)
+ public function parse(string $source): array
{
// Matches an optional namespace, optional element, and required id
// $source = 'test|input#ab6bd_field';
diff --git a/vendor/symfony/css-selector/Parser/Token.php b/vendor/symfony/css-selector/Parser/Token.php
index 9baaa6dd..554deb8e 100644
--- a/vendor/symfony/css-selector/Parser/Token.php
+++ b/vendor/symfony/css-selector/Parser/Token.php
@@ -35,54 +35,34 @@ class Token
private $value;
private $position;
- /**
- * @param int $type
- * @param string $value
- * @param int $position
- */
- public function __construct($type, $value, $position)
+ public function __construct(?string $type, ?string $value, ?int $position)
{
$this->type = $type;
$this->value = $value;
$this->position = $position;
}
- /**
- * @return int
- */
- public function getType()
+ public function getType(): ?int
{
return $this->type;
}
- /**
- * @return string
- */
- public function getValue()
+ public function getValue(): ?string
{
return $this->value;
}
- /**
- * @return int
- */
- public function getPosition()
+ public function getPosition(): ?int
{
return $this->position;
}
- /**
- * @return bool
- */
- public function isFileEnd()
+ public function isFileEnd(): bool
{
return self::TYPE_FILE_END === $this->type;
}
- /**
- * @return bool
- */
- public function isDelimiter(array $values = array())
+ public function isDelimiter(array $values = array()): bool
{
if (self::TYPE_DELIMITER !== $this->type) {
return false;
@@ -95,50 +75,32 @@ class Token
return in_array($this->value, $values);
}
- /**
- * @return bool
- */
- public function isWhitespace()
+ public function isWhitespace(): bool
{
return self::TYPE_WHITESPACE === $this->type;
}
- /**
- * @return bool
- */
- public function isIdentifier()
+ public function isIdentifier(): bool
{
return self::TYPE_IDENTIFIER === $this->type;
}
- /**
- * @return bool
- */
- public function isHash()
+ public function isHash(): bool
{
return self::TYPE_HASH === $this->type;
}
- /**
- * @return bool
- */
- public function isNumber()
+ public function isNumber(): bool
{
return self::TYPE_NUMBER === $this->type;
}
- /**
- * @return bool
- */
- public function isString()
+ public function isString(): bool
{
return self::TYPE_STRING === $this->type;
}
- /**
- * @return string
- */
- public function __toString()
+ public function __toString(): string
{
if ($this->value) {
return sprintf('<%s "%s" at %s>', $this->type, $this->value, $this->position);
diff --git a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php
index c6f289aa..2df63f51 100644
--- a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php
+++ b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php
@@ -30,36 +30,21 @@ class TokenizerEscaping
$this->patterns = $patterns;
}
- /**
- * @param string $value
- *
- * @return string
- */
- public function escapeUnicode($value)
+ public function escapeUnicode(string $value): string
{
$value = $this->replaceUnicodeSequences($value);
return preg_replace($this->patterns->getSimpleEscapePattern(), '$1', $value);
}
- /**
- * @param string $value
- *
- * @return string
- */
- public function escapeUnicodeAndNewLine($value)
+ public function escapeUnicodeAndNewLine(string $value): string
{
$value = preg_replace($this->patterns->getNewLineEscapePattern(), '', $value);
return $this->escapeUnicode($value);
}
- /**
- * @param string $value
- *
- * @return string
- */
- private function replaceUnicodeSequences($value)
+ private function replaceUnicodeSequences(string $value): string
{
return preg_replace_callback($this->patterns->getUnicodeEscapePattern(), function ($match) {
$c = hexdec($match[1]);
diff --git a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php
index 30584ca9..5f16ac48 100644
--- a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php
+++ b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php
@@ -46,66 +46,43 @@ class TokenizerPatterns
$this->nonAsciiPattern = '[^\x00-\x7F]';
$this->nmCharPattern = '[_a-z0-9-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
$this->nmStartPattern = '[_a-z]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
- $this->identifierPattern = '(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
+ $this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
$this->hashPattern = '#((?:'.$this->nmCharPattern.')+)';
$this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)';
$this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*';
}
- /**
- * @return string
- */
- public function getNewLineEscapePattern()
+ public function getNewLineEscapePattern(): string
{
return '~^'.$this->newLineEscapePattern.'~';
}
- /**
- * @return string
- */
- public function getSimpleEscapePattern()
+ public function getSimpleEscapePattern(): string
{
return '~^'.$this->simpleEscapePattern.'~';
}
- /**
- * @return string
- */
- public function getUnicodeEscapePattern()
+ public function getUnicodeEscapePattern(): string
{
return '~^'.$this->unicodeEscapePattern.'~i';
}
- /**
- * @return string
- */
- public function getIdentifierPattern()
+ public function getIdentifierPattern(): string
{
return '~^'.$this->identifierPattern.'~i';
}
- /**
- * @return string
- */
- public function getHashPattern()
+ public function getHashPattern(): string
{
return '~^'.$this->hashPattern.'~i';
}
- /**
- * @return string
- */
- public function getNumberPattern()
+ public function getNumberPattern(): string
{
return '~^'.$this->numberPattern.'~';
}
- /**
- * @param string $quote
- *
- * @return string
- */
- public function getQuotedStringPattern($quote)
+ public function getQuotedStringPattern(string $quote): string
{
return '~^'.sprintf($this->quotedStringPattern, $quote).'~i';
}
diff --git a/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php b/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php
index a27fadfe..a3eea7ad 100644
--- a/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php
+++ b/vendor/symfony/css-selector/Tests/CssSelectorConverterTest.php
@@ -59,7 +59,7 @@ class CssSelectorConverterTest extends TestCase
array('h1', 'h1'),
array('foo|h1', 'foo:h1'),
array('h1, h2, h3', 'h1 | h2 | h3'),
- array('h1:nth-child(3n+1)', "*/*[name() = 'h1' and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"),
+ array('h1:nth-child(3n+1)', "*/*[(name() = 'h1') and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"),
array('h1 > p', 'h1/p'),
array('h1#foo', "h1[@id = 'foo']"),
array('h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
diff --git a/vendor/symfony/css-selector/Tests/Parser/ParserTest.php b/vendor/symfony/css-selector/Tests/Parser/ParserTest.php
index 37a3ef1d..53b35a95 100644
--- a/vendor/symfony/css-selector/Tests/Parser/ParserTest.php
+++ b/vendor/symfony/css-selector/Tests/Parser/ParserTest.php
@@ -186,6 +186,7 @@ class ParserTest extends TestCase
array('foo:after', 'Element[foo]', 'after'),
array('foo::selection', 'Element[foo]', 'selection'),
array('lorem#ipsum ~ a#b.c[href]:empty::selection', 'CombinedSelector[Hash[Element[lorem]#ipsum] ~ Pseudo[Attribute[Class[Hash[Element[a]#b].c][href]]:empty]]', 'selection'),
+ array('video::-webkit-media-controls', 'Element[video]', '-webkit-media-controls'),
);
}
diff --git a/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php b/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php
index 218a3b43..51941783 100644
--- a/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php
+++ b/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php
@@ -102,18 +102,20 @@ class TranslatorTest extends TestCase
array('e[foo^="bar"]', "e[@foo and starts-with(@foo, 'bar')]"),
array('e[foo$="bar"]', "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar']"),
array('e[foo*="bar"]', "e[@foo and contains(@foo, 'bar')]"),
+ array('e[foo!="bar"]', "e[not(@foo) or @foo != 'bar']"),
+ array('e[foo!="bar"][foo!="baz"]', "e[(not(@foo) or @foo != 'bar') and (not(@foo) or @foo != 'baz')]"),
array('e[hreflang|="en"]', "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))]"),
- array('e:nth-child(1)', "*/*[name() = 'e' and (position() = 1)]"),
- array('e:nth-last-child(1)', "*/*[name() = 'e' and (position() = last() - 0)]"),
- array('e:nth-last-child(2n+2)', "*/*[name() = 'e' and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"),
+ array('e:nth-child(1)', "*/*[(name() = 'e') and (position() = 1)]"),
+ array('e:nth-last-child(1)', "*/*[(name() = 'e') and (position() = last() - 0)]"),
+ array('e:nth-last-child(2n+2)', "*/*[(name() = 'e') and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"),
array('e:nth-of-type(1)', '*/e[position() = 1]'),
array('e:nth-last-of-type(1)', '*/e[position() = last() - 0]'),
array('div e:nth-last-of-type(1) .aclass', "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]"),
- array('e:first-child', "*/*[name() = 'e' and (position() = 1)]"),
- array('e:last-child', "*/*[name() = 'e' and (position() = last())]"),
+ array('e:first-child', "*/*[(name() = 'e') and (position() = 1)]"),
+ array('e:last-child', "*/*[(name() = 'e') and (position() = last())]"),
array('e:first-of-type', '*/e[position() = 1]'),
array('e:last-of-type', '*/e[position() = last()]'),
- array('e:only-child', "*/*[name() = 'e' and (last() = 1)]"),
+ array('e:only-child', "*/*[(name() = 'e') and (last() = 1)]"),
array('e:only-of-type', 'e[last() = 1]'),
array('e:empty', 'e[not(*) and not(string-length())]'),
array('e:EmPTY', 'e[not(*) and not(string-length())]'),
@@ -127,7 +129,7 @@ class TranslatorTest extends TestCase
array('e:nOT(*)', 'e[0]'),
array('e f', 'e/descendant-or-self::*/f'),
array('e > f', 'e/f'),
- array('e + f', "e/following-sibling::*[name() = 'f' and (position() = 1)]"),
+ array('e + f', "e/following-sibling::*[(name() = 'f') and (position() = 1)]"),
array('e ~ f', 'e/following-sibling::f'),
array('div#container p', "div[@id = 'container']/descendant-or-self::*/p"),
);
diff --git a/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php b/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php
index 6ace8b59..ee8976fd 100644
--- a/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php
@@ -43,38 +43,17 @@ class AttributeMatchingExtension extends AbstractExtension
);
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translateExists(XPathExpr $xpath, $attribute, $value)
+ public function translateExists(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition($attribute);
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translateEquals(XPathExpr $xpath, $attribute, $value)
+ public function translateEquals(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition(sprintf('%s = %s', $attribute, Translator::getXpathLiteral($value)));
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translateIncludes(XPathExpr $xpath, $attribute, $value)
+ public function translateIncludes(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition($value ? sprintf(
'%1$s and contains(concat(\' \', normalize-space(%1$s), \' \'), %2$s)',
@@ -83,14 +62,7 @@ class AttributeMatchingExtension extends AbstractExtension
) : '0');
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translateDashMatch(XPathExpr $xpath, $attribute, $value)
+ public function translateDashMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition(sprintf(
'%1$s and (%1$s = %2$s or starts-with(%1$s, %3$s))',
@@ -100,14 +72,7 @@ class AttributeMatchingExtension extends AbstractExtension
));
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translatePrefixMatch(XPathExpr $xpath, $attribute, $value)
+ public function translatePrefixMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition($value ? sprintf(
'%1$s and starts-with(%1$s, %2$s)',
@@ -116,14 +81,7 @@ class AttributeMatchingExtension extends AbstractExtension
) : '0');
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translateSuffixMatch(XPathExpr $xpath, $attribute, $value)
+ public function translateSuffixMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition($value ? sprintf(
'%1$s and substring(%1$s, string-length(%1$s)-%2$s) = %3$s',
@@ -133,14 +91,7 @@ class AttributeMatchingExtension extends AbstractExtension
) : '0');
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translateSubstringMatch(XPathExpr $xpath, $attribute, $value)
+ public function translateSubstringMatch(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition($value ? sprintf(
'%1$s and contains(%1$s, %2$s)',
@@ -149,14 +100,7 @@ class AttributeMatchingExtension extends AbstractExtension
) : '0');
}
- /**
- * @param XPathExpr $xpath
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- */
- public function translateDifferent(XPathExpr $xpath, $attribute, $value)
+ public function translateDifferent(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
return $xpath->addCondition(sprintf(
$value ? 'not(%1$s) or %1$s != %2$s' : '%s != %s',
diff --git a/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php b/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php
index 0c9cc032..85181fd9 100644
--- a/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/CombinationExtension.php
@@ -28,7 +28,7 @@ class CombinationExtension extends AbstractExtension
/**
* {@inheritdoc}
*/
- public function getCombinationTranslators()
+ public function getCombinationTranslators(): array
{
return array(
' ' => array($this, 'translateDescendant'),
@@ -41,7 +41,7 @@ class CombinationExtension extends AbstractExtension
/**
* @return XPathExpr
*/
- public function translateDescendant(XPathExpr $xpath, XPathExpr $combinedXpath)
+ public function translateDescendant(XPathExpr $xpath, XPathExpr $combinedXpath): XPathExpr
{
return $xpath->join('/descendant-or-self::*/', $combinedXpath);
}
diff --git a/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php b/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php
index c2606b5a..52b9c2f6 100644
--- a/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php
@@ -46,16 +46,9 @@ class FunctionExtension extends AbstractExtension
}
/**
- * @param XPathExpr $xpath
- * @param FunctionNode $function
- * @param bool $last
- * @param bool $addNameTest
- *
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function translateNthChild(XPathExpr $xpath, FunctionNode $function, $last = false, $addNameTest = true)
+ public function translateNthChild(XPathExpr $xpath, FunctionNode $function, bool $last = false, bool $addNameTest = true): XPathExpr
{
try {
list($a, $b) = Parser::parseSeries($function->getArguments());
@@ -110,28 +103,20 @@ class FunctionExtension extends AbstractExtension
// -1n+6 means elements 6 and previous
}
- /**
- * @return XPathExpr
- */
- public function translateNthLastChild(XPathExpr $xpath, FunctionNode $function)
+ public function translateNthLastChild(XPathExpr $xpath, FunctionNode $function): XPathExpr
{
return $this->translateNthChild($xpath, $function, true);
}
- /**
- * @return XPathExpr
- */
- public function translateNthOfType(XPathExpr $xpath, FunctionNode $function)
+ public function translateNthOfType(XPathExpr $xpath, FunctionNode $function): XPathExpr
{
return $this->translateNthChild($xpath, $function, false, false);
}
/**
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function translateNthLastOfType(XPathExpr $xpath, FunctionNode $function)
+ public function translateNthLastOfType(XPathExpr $xpath, FunctionNode $function): XPathExpr
{
if ('*' === $xpath->getElement()) {
throw new ExpressionErrorException('"*:nth-of-type()" is not implemented.');
@@ -141,11 +126,9 @@ class FunctionExtension extends AbstractExtension
}
/**
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function translateContains(XPathExpr $xpath, FunctionNode $function)
+ public function translateContains(XPathExpr $xpath, FunctionNode $function): XPathExpr
{
$arguments = $function->getArguments();
foreach ($arguments as $token) {
@@ -164,11 +147,9 @@ class FunctionExtension extends AbstractExtension
}
/**
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function translateLang(XPathExpr $xpath, FunctionNode $function)
+ public function translateLang(XPathExpr $xpath, FunctionNode $function): XPathExpr
{
$arguments = $function->getArguments();
foreach ($arguments as $token) {
diff --git a/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php b/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php
index 715d9611..61442b6f 100644
--- a/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php
+++ b/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php
@@ -33,21 +33,15 @@ class NodeExtension extends AbstractExtension
private $flags;
- /**
- * @param int $flags
- */
- public function __construct($flags = 0)
+ public function __construct(int $flags = 0)
{
$this->flags = $flags;
}
/**
- * @param int $flag
- * @param bool $on
- *
* @return $this
*/
- public function setFlag($flag, $on)
+ public function setFlag(int $flag, bool $on)
{
if ($on && !$this->hasFlag($flag)) {
$this->flags += $flag;
@@ -60,12 +54,7 @@ class NodeExtension extends AbstractExtension
return $this;
}
- /**
- * @param int $flag
- *
- * @return bool
- */
- public function hasFlag($flag)
+ public function hasFlag(int $flag): bool
{
return (bool) ($this->flags & $flag);
}
@@ -88,26 +77,17 @@ class NodeExtension extends AbstractExtension
);
}
- /**
- * @return XPathExpr
- */
- public function translateSelector(Node\SelectorNode $node, Translator $translator)
+ public function translateSelector(Node\SelectorNode $node, Translator $translator): XPathExpr
{
return $translator->nodeToXPath($node->getTree());
}
- /**
- * @return XPathExpr
- */
- public function translateCombinedSelector(Node\CombinedSelectorNode $node, Translator $translator)
+ public function translateCombinedSelector(Node\CombinedSelectorNode $node, Translator $translator): XPathExpr
{
return $translator->addCombination($node->getCombinator(), $node->getSelector(), $node->getSubSelector());
}
- /**
- * @return XPathExpr
- */
- public function translateNegation(Node\NegationNode $node, Translator $translator)
+ public function translateNegation(Node\NegationNode $node, Translator $translator): XPathExpr
{
$xpath = $translator->nodeToXPath($node->getSelector());
$subXpath = $translator->nodeToXPath($node->getSubSelector());
@@ -120,30 +100,21 @@ class NodeExtension extends AbstractExtension
return $xpath->addCondition('0');
}
- /**
- * @return XPathExpr
- */
- public function translateFunction(Node\FunctionNode $node, Translator $translator)
+ public function translateFunction(Node\FunctionNode $node, Translator $translator): XPathExpr
{
$xpath = $translator->nodeToXPath($node->getSelector());
return $translator->addFunction($xpath, $node);
}
- /**
- * @return XPathExpr
- */
- public function translatePseudo(Node\PseudoNode $node, Translator $translator)
+ public function translatePseudo(Node\PseudoNode $node, Translator $translator): XPathExpr
{
$xpath = $translator->nodeToXPath($node->getSelector());
return $translator->addPseudoClass($xpath, $node->getIdentifier());
}
- /**
- * @return XPathExpr
- */
- public function translateAttribute(Node\AttributeNode $node, Translator $translator)
+ public function translateAttribute(Node\AttributeNode $node, Translator $translator): XPathExpr
{
$name = $node->getAttribute();
$safe = $this->isSafeName($name);
@@ -168,30 +139,21 @@ class NodeExtension extends AbstractExtension
return $translator->addAttributeMatching($xpath, $node->getOperator(), $attribute, $value);
}
- /**
- * @return XPathExpr
- */
- public function translateClass(Node\ClassNode $node, Translator $translator)
+ public function translateClass(Node\ClassNode $node, Translator $translator): XPathExpr
{
$xpath = $translator->nodeToXPath($node->getSelector());
return $translator->addAttributeMatching($xpath, '~=', '@class', $node->getName());
}
- /**
- * @return XPathExpr
- */
- public function translateHash(Node\HashNode $node, Translator $translator)
+ public function translateHash(Node\HashNode $node, Translator $translator): XPathExpr
{
$xpath = $translator->nodeToXPath($node->getSelector());
return $translator->addAttributeMatching($xpath, '=', '@id', $node->getId());
}
- /**
- * @return XPathExpr
- */
- public function translateElement(Node\ElementNode $node)
+ public function translateElement(Node\ElementNode $node): XPathExpr
{
$element = $node->getElement();
@@ -228,14 +190,7 @@ class NodeExtension extends AbstractExtension
return 'node';
}
- /**
- * Tests if given name is safe.
- *
- * @param string $name
- *
- * @return bool
- */
- private function isSafeName($name)
+ private function isSafeName(string $name): bool
{
return 0 < preg_match('~^[a-zA-Z_][a-zA-Z0-9_.-]*$~', $name);
}
diff --git a/vendor/symfony/css-selector/XPath/Translator.php b/vendor/symfony/css-selector/XPath/Translator.php
index d20ad7dc..73b54821 100644
--- a/vendor/symfony/css-selector/XPath/Translator.php
+++ b/vendor/symfony/css-selector/XPath/Translator.php
@@ -61,12 +61,7 @@ class Translator implements TranslatorInterface
;
}
- /**
- * @param string $element
- *
- * @return string
- */
- public static function getXpathLiteral($element)
+ public static function getXpathLiteral(string $element): string
{
if (false === strpos($element, "'")) {
return "'".$element."'";
@@ -95,7 +90,7 @@ class Translator implements TranslatorInterface
/**
* {@inheritdoc}
*/
- public function cssToXPath($cssExpr, $prefix = 'descendant-or-self::')
+ public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
{
$selectors = $this->parseSelectors($cssExpr);
@@ -114,17 +109,12 @@ class Translator implements TranslatorInterface
/**
* {@inheritdoc}
*/
- public function selectorToXPath(SelectorNode $selector, $prefix = 'descendant-or-self::')
+ public function selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::'): string
{
return ($prefix ?: '').$this->nodeToXPath($selector);
}
- /**
- * Registers an extension.
- *
- * @return $this
- */
- public function registerExtension(Extension\ExtensionInterface $extension)
+ public function registerExtension(Extension\ExtensionInterface $extension): self
{
$this->extensions[$extension->getName()] = $extension;
@@ -138,13 +128,9 @@ class Translator implements TranslatorInterface
}
/**
- * @param string $name
- *
- * @return Extension\ExtensionInterface
- *
* @throws ExpressionErrorException
*/
- public function getExtension($name)
+ public function getExtension(string $name): Extension\ExtensionInterface
{
if (!isset($this->extensions[$name])) {
throw new ExpressionErrorException(sprintf('Extension "%s" not registered.', $name));
@@ -153,12 +139,7 @@ class Translator implements TranslatorInterface
return $this->extensions[$name];
}
- /**
- * Registers a shortcut parser.
- *
- * @return $this
- */
- public function registerParserShortcut(ParserInterface $shortcut)
+ public function registerParserShortcut(ParserInterface $shortcut): self
{
$this->shortcutParsers[] = $shortcut;
@@ -166,11 +147,9 @@ class Translator implements TranslatorInterface
}
/**
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function nodeToXPath(NodeInterface $node)
+ public function nodeToXPath(NodeInterface $node): XPathExpr
{
if (!isset($this->nodeTranslators[$node->getNodeName()])) {
throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName()));
@@ -180,15 +159,9 @@ class Translator implements TranslatorInterface
}
/**
- * @param string $combiner
- * @param NodeInterface $xpath
- * @param NodeInterface $combinedXpath
- *
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function addCombination($combiner, NodeInterface $xpath, NodeInterface $combinedXpath)
+ public function addCombination(string $combiner, NodeInterface $xpath, NodeInterface $combinedXpath): XPathExpr
{
if (!isset($this->combinationTranslators[$combiner])) {
throw new ExpressionErrorException(sprintf('Combiner "%s" not supported.', $combiner));
@@ -198,11 +171,9 @@ class Translator implements TranslatorInterface
}
/**
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function addFunction(XPathExpr $xpath, FunctionNode $function)
+ public function addFunction(XPathExpr $xpath, FunctionNode $function): XPathExpr
{
if (!isset($this->functionTranslators[$function->getName()])) {
throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function->getName()));
@@ -212,14 +183,9 @@ class Translator implements TranslatorInterface
}
/**
- * @param XPathExpr $xpath
- * @param string $pseudoClass
- *
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function addPseudoClass(XPathExpr $xpath, $pseudoClass)
+ public function addPseudoClass(XPathExpr $xpath, string $pseudoClass): XPathExpr
{
if (!isset($this->pseudoClassTranslators[$pseudoClass])) {
throw new ExpressionErrorException(sprintf('Pseudo-class "%s" not supported.', $pseudoClass));
@@ -229,16 +195,9 @@ class Translator implements TranslatorInterface
}
/**
- * @param XPathExpr $xpath
- * @param string $operator
- * @param string $attribute
- * @param string $value
- *
- * @return XPathExpr
- *
* @throws ExpressionErrorException
*/
- public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $value)
+ public function addAttributeMatching(XPathExpr $xpath, string $operator, string $attribute, $value): XPathExpr
{
if (!isset($this->attributeMatchingTranslators[$operator])) {
throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator));
@@ -248,11 +207,9 @@ class Translator implements TranslatorInterface
}
/**
- * @param string $css
- *
* @return SelectorNode[]
*/
- private function parseSelectors($css)
+ private function parseSelectors(string $css)
{
foreach ($this->shortcutParsers as $shortcut) {
$tokens = $shortcut->parse($css);
diff --git a/vendor/symfony/css-selector/XPath/TranslatorInterface.php b/vendor/symfony/css-selector/XPath/TranslatorInterface.php
index 0b5de83d..c19eefb9 100644
--- a/vendor/symfony/css-selector/XPath/TranslatorInterface.php
+++ b/vendor/symfony/css-selector/XPath/TranslatorInterface.php
@@ -27,21 +27,11 @@ interface TranslatorInterface
{
/**
* Translates a CSS selector to an XPath expression.
- *
- * @param string $cssExpr
- * @param string $prefix
- *
- * @return string
*/
- public function cssToXPath($cssExpr, $prefix = 'descendant-or-self::');
+ public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string;
/**
* Translates a parsed selector node to an XPath expression.
- *
- * @param SelectorNode $selector
- * @param string $prefix
- *
- * @return string
*/
- public function selectorToXPath(SelectorNode $selector, $prefix = 'descendant-or-self::');
+ public function selectorToXPath(SelectorNode $selector, string $prefix = 'descendant-or-self::'): string;
}
diff --git a/vendor/symfony/css-selector/XPath/XPathExpr.php b/vendor/symfony/css-selector/XPath/XPathExpr.php
index fa59bce2..638cbd0f 100644
--- a/vendor/symfony/css-selector/XPath/XPathExpr.php
+++ b/vendor/symfony/css-selector/XPath/XPathExpr.php
@@ -27,13 +27,7 @@ class XPathExpr
private $element;
private $condition;
- /**
- * @param string $path
- * @param string $element
- * @param string $condition
- * @param bool $starPrefix
- */
- public function __construct($path = '', $element = '*', $condition = '', $starPrefix = false)
+ public function __construct(string $path = '', string $element = '*', string $condition = '', bool $starPrefix = false)
{
$this->path = $path;
$this->element = $element;
@@ -44,38 +38,24 @@ class XPathExpr
}
}
- /**
- * @return string
- */
- public function getElement()
+ public function getElement(): string
{
return $this->element;
}
- /**
- * @param $condition
- *
- * @return $this
- */
- public function addCondition($condition)
+ public function addCondition(string $condition): self
{
- $this->condition = $this->condition ? sprintf('%s and (%s)', $this->condition, $condition) : $condition;
+ $this->condition = $this->condition ? sprintf('(%s) and (%s)', $this->condition, $condition) : $condition;
return $this;
}
- /**
- * @return string
- */
- public function getCondition()
+ public function getCondition(): string
{
return $this->condition;
}
- /**
- * @return $this
- */
- public function addNameTest()
+ public function addNameTest(): self
{
if ('*' !== $this->element) {
$this->addCondition('name() = '.Translator::getXpathLiteral($this->element));
@@ -85,10 +65,7 @@ class XPathExpr
return $this;
}
- /**
- * @return $this
- */
- public function addStarPrefix()
+ public function addStarPrefix(): self
{
$this->path .= '*/';
@@ -98,12 +75,9 @@ class XPathExpr
/**
* Joins another XPathExpr with a combiner.
*
- * @param string $combiner
- * @param XPathExpr $expr
- *
* @return $this
*/
- public function join($combiner, XPathExpr $expr)
+ public function join(string $combiner, self $expr): self
{
$path = $this->__toString().$combiner;
@@ -118,10 +92,7 @@ class XPathExpr
return $this;
}
- /**
- * @return string
- */
- public function __toString()
+ public function __toString(): string
{
$path = $this->path.$this->element;
$condition = null === $this->condition || '' === $this->condition ? '' : '['.$this->condition.']';
diff --git a/vendor/symfony/css-selector/composer.json b/vendor/symfony/css-selector/composer.json
index 56ab35b8..e2ed078e 100644
--- a/vendor/symfony/css-selector/composer.json
+++ b/vendor/symfony/css-selector/composer.json
@@ -20,7 +20,7 @@
}
],
"require": {
- "php": "^5.5.9|>=7.0.8"
+ "php": "^7.1.3"
},
"autoload": {
"psr-4": { "Symfony\\Component\\CssSelector\\": "" },
@@ -31,7 +31,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.1-dev"
}
}
}
diff --git a/vendor/symfony/debug/Debug.php b/vendor/symfony/debug/Debug.php
index e3665ae5..aaa54118 100644
--- a/vendor/symfony/debug/Debug.php
+++ b/vendor/symfony/debug/Debug.php
@@ -45,7 +45,7 @@ class Debug
error_reporting(E_ALL);
}
- if ('cli' !== PHP_SAPI) {
+ if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
ini_set('display_errors', 0);
ExceptionHandler::register();
} elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
diff --git a/vendor/symfony/debug/DebugClassLoader.php b/vendor/symfony/debug/DebugClassLoader.php
index 78bfb853..33e715a8 100644
--- a/vendor/symfony/debug/DebugClassLoader.php
+++ b/vendor/symfony/debug/DebugClassLoader.php
@@ -141,7 +141,7 @@ class DebugClassLoader
if ($this->isFinder && !isset($this->loaded[$class])) {
$this->loaded[$class] = true;
if ($file = $this->classLoader[0]->findFile($class) ?: false) {
- $wasCached = \function_exists('opcache_is_script_cached') && opcache_is_script_cached($file);
+ $wasCached = \function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file);
require $file;
diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php
index 90e5535d..bed0e04a 100644
--- a/vendor/symfony/debug/ErrorHandler.php
+++ b/vendor/symfony/debug/ErrorHandler.php
@@ -136,9 +136,20 @@ class ErrorHandler
}
if (!$replace && $prev) {
restore_error_handler();
+ $handlerIsRegistered = is_array($prev) && $handler === $prev[0];
+ } else {
+ $handlerIsRegistered = true;
}
- if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] === $handler) {
+ if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
restore_exception_handler();
+ if (!$handlerIsRegistered) {
+ $handler = $prev[0];
+ } elseif ($handler !== $prev[0] && $replace) {
+ set_exception_handler(array($handler, 'handleException'));
+ $p = $prev[0]->setExceptionHandler(null);
+ $handler->setExceptionHandler($p);
+ $prev[0]->setExceptionHandler($p);
+ }
} else {
$handler->setExceptionHandler($prev);
}
@@ -372,14 +383,16 @@ class ErrorHandler
public function handleError($type, $message, $file, $line)
{
// Level is the current error reporting level to manage silent error.
+ $level = error_reporting();
+ $silenced = 0 === ($level & $type);
// Strong errors are not authorized to be silenced.
- $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
+ $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
$log = $this->loggedErrors & $type;
$throw = $this->thrownErrors & $type & $level;
$type &= $level | $this->screamedErrors;
if (!$type || (!$log && !$throw)) {
- return $type && $log;
+ return !$silenced && $type && $log;
}
$scope = $this->scopedErrors & $type;
@@ -513,7 +526,7 @@ class ErrorHandler
}
}
- return $type && $log;
+ return !$silenced && $type && $log;
}
/**
@@ -568,15 +581,16 @@ class ErrorHandler
}
}
}
+ $exceptionHandler = $this->exceptionHandler;
+ $this->exceptionHandler = null;
try {
- if (null !== $this->exceptionHandler) {
- return \call_user_func($this->exceptionHandler, $exception);
+ if (null !== $exceptionHandler) {
+ return \call_user_func($exceptionHandler, $exception);
}
$handlerException = $handlerException ?: $exception;
} catch (\Exception $handlerException) {
} catch (\Throwable $handlerException) {
}
- $this->exceptionHandler = null;
if ($exception === $handlerException) {
self::$reservedMemory = null; // Disable the fatal error handler
throw $exception; // Give back $exception to the native handler
diff --git a/vendor/symfony/debug/Exception/FatalThrowableError.php b/vendor/symfony/debug/Exception/FatalThrowableError.php
index 34f43b17..fafc9226 100644
--- a/vendor/symfony/debug/Exception/FatalThrowableError.php
+++ b/vendor/symfony/debug/Exception/FatalThrowableError.php
@@ -36,7 +36,8 @@ class FatalThrowableError extends FatalErrorException
$e->getCode(),
$severity,
$e->getFile(),
- $e->getLine()
+ $e->getLine(),
+ $e->getPrevious()
);
$this->setTrace($e->getTrace());
diff --git a/vendor/symfony/debug/Exception/FlattenException.php b/vendor/symfony/debug/Exception/FlattenException.php
index 24679dca..f491bf2a 100644
--- a/vendor/symfony/debug/Exception/FlattenException.php
+++ b/vendor/symfony/debug/Exception/FlattenException.php
@@ -157,7 +157,7 @@ class FlattenException
return $this->previous;
}
- public function setPrevious(FlattenException $previous)
+ public function setPrevious(self $previous)
{
$this->previous = $previous;
}
diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php
index 97470cb6..f22b70f6 100644
--- a/vendor/symfony/debug/ExceptionHandler.php
+++ b/vendor/symfony/debug/ExceptionHandler.php
@@ -40,7 +40,7 @@ class ExceptionHandler
{
$this->debug = $debug;
$this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
- $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
+ $this->fileLinkFormat = $fileLinkFormat;
}
/**
@@ -355,13 +355,29 @@ EOF;
private function formatPath($path, $line)
{
$file = $this->escapeHtml(preg_match('#[^/\\\\]*+$#', $path, $file) ? $file[0] : $path);
- $fmt = $this->fileLinkFormat;
+ $fmt = $this->fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
- if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $path, '%l' => $line)) : $fmt->format($path, $line)) {
- return sprintf('in %s (line %d)', $this->escapeHtml($link), $file, $line);
+ if (!$fmt) {
+ return sprintf('in %s%s', $this->escapeHtml($path), $file, 0 < $line ? ' line '.$line : '');
}
- return sprintf('in %s (line %d)', $this->escapeHtml($path), $file, $line);
+ if (\is_string($fmt)) {
+ $i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: strlen($f);
+ $fmt = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ for ($i = 1; isset($fmt[$i]); ++$i) {
+ if (0 === strpos($path, $k = $fmt[$i++])) {
+ $path = substr_replace($path, $fmt[$i], 0, strlen($k));
+ break;
+ }
+ }
+
+ $link = strtr($fmt[0], array('%f' => $path, '%l' => $line));
+ } else {
+ $link = $fmt->format($path, $line);
+ }
+
+ return sprintf('in %s%s', $this->escapeHtml($link), $file, 0 < $line ? ' line '.$line : '');
}
/**
diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php
index a57e83ee..b354e641 100644
--- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php
+++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php
@@ -35,7 +35,7 @@ class ErrorHandlerTest extends TestCase
$newHandler = new ErrorHandler();
- $this->assertSame($newHandler, ErrorHandler::register($newHandler, false));
+ $this->assertSame($handler, ErrorHandler::register($newHandler, false));
$h = set_error_handler('var_dump');
restore_error_handler();
$this->assertSame(array($handler, 'handleError'), $h);
@@ -65,6 +65,30 @@ class ErrorHandlerTest extends TestCase
}
}
+ public function testErrorGetLast()
+ {
+ $handler = ErrorHandler::register();
+ $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
+ $handler->setDefaultLogger($logger);
+ $handler->screamAt(E_ALL);
+
+ try {
+ @trigger_error('Hello', E_USER_WARNING);
+ $expected = array(
+ 'type' => E_USER_WARNING,
+ 'message' => 'Hello',
+ 'file' => __FILE__,
+ 'line' => __LINE__ - 5,
+ );
+ $this->assertSame($expected, error_get_last());
+ } catch (\Exception $e) {
+ restore_error_handler();
+ restore_exception_handler();
+
+ throw $e;
+ }
+ }
+
public function testNotice()
{
ErrorHandler::register();
@@ -545,4 +569,18 @@ class ErrorHandlerTest extends TestCase
restore_exception_handler();
}
}
+
+ /**
+ * @expectedException \Exception
+ * @group no-hhvm
+ */
+ public function testCustomExceptionHandler()
+ {
+ $handler = new ErrorHandler();
+ $handler->setExceptionHandler(function ($e) use ($handler) {
+ $handler->handleException($e);
+ });
+
+ $handler->handleException(new \Exception());
+ }
}
diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
index 8fd1c795..66171e3a 100644
--- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
+++ b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php
@@ -111,7 +111,7 @@ class FlattenExceptionTest extends TestCase
/**
* @dataProvider flattenDataProvider
*/
- public function testFlattenHttpException(\Exception $exception, $statusCode)
+ public function testFlattenHttpException(\Exception $exception)
{
$flattened = FlattenException::create($exception);
$flattened2 = FlattenException::create($exception);
@@ -126,7 +126,7 @@ class FlattenExceptionTest extends TestCase
/**
* @dataProvider flattenDataProvider
*/
- public function testPrevious(\Exception $exception, $statusCode)
+ public function testPrevious(\Exception $exception)
{
$flattened = FlattenException::create($exception);
$flattened2 = FlattenException::create($exception);
@@ -173,7 +173,7 @@ class FlattenExceptionTest extends TestCase
/**
* @dataProvider flattenDataProvider
*/
- public function testToArray(\Exception $exception, $statusCode)
+ public function testToArray(\Exception $exception)
{
$flattened = FlattenException::create($exception);
$flattened->setTrace(array(), 'foo.php', 123);
@@ -193,7 +193,7 @@ class FlattenExceptionTest extends TestCase
public function flattenDataProvider()
{
return array(
- array(new \Exception('test', 123), 500),
+ array(new \Exception('test', 123)),
);
}
diff --git a/vendor/symfony/event-dispatcher/CHANGELOG.md b/vendor/symfony/event-dispatcher/CHANGELOG.md
index c6aa5389..b581d314 100644
--- a/vendor/symfony/event-dispatcher/CHANGELOG.md
+++ b/vendor/symfony/event-dispatcher/CHANGELOG.md
@@ -1,6 +1,19 @@
CHANGELOG
=========
+4.1.0
+-----
+
+ * added support for invokable event listeners tagged with `kernel.event_listener` by default
+ * The `TraceableEventDispatcher::getOrphanedEvents()` method has been added.
+ * The `TraceableEventDispatcherInterface` has been deprecated.
+
+4.0.0
+-----
+
+ * removed the `ContainerAwareEventDispatcher` class
+ * added the `reset()` method to the `TraceableEventDispatcherInterface`
+
3.4.0
-----
diff --git a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php b/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php
deleted file mode 100644
index 81a1ff7c..00000000
--- a/vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php
+++ /dev/null
@@ -1,197 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\EventDispatcher;
-
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Lazily loads listeners and subscribers from the dependency injection
- * container.
- *
- * @author Fabien Potencier
- * @author Bernhard Schussek
- * @author Jordan Alliot
- *
- * @deprecated since 3.3, to be removed in 4.0. Use EventDispatcher with closure factories instead.
- */
-class ContainerAwareEventDispatcher extends EventDispatcher
-{
- private $container;
-
- /**
- * The service IDs of the event listeners and subscribers.
- */
- private $listenerIds = array();
-
- /**
- * The services registered as listeners.
- */
- private $listeners = array();
-
- public function __construct(ContainerInterface $container)
- {
- $this->container = $container;
-
- $class = get_class($this);
- if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) {
- $class = get_parent_class($class);
- }
- if (__CLASS__ !== $class) {
- @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
- }
- }
-
- /**
- * Adds a service as event listener.
- *
- * @param string $eventName Event for which the listener is added
- * @param array $callback The service ID of the listener service & the method
- * name that has to be called
- * @param int $priority The higher this value, the earlier an event listener
- * will be triggered in the chain.
- * Defaults to 0.
- *
- * @throws \InvalidArgumentException
- */
- public function addListenerService($eventName, $callback, $priority = 0)
- {
- @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
-
- if (!is_array($callback) || 2 !== count($callback)) {
- throw new \InvalidArgumentException('Expected an array("service", "method") argument');
- }
-
- $this->listenerIds[$eventName][] = array($callback[0], $callback[1], $priority);
- }
-
- public function removeListener($eventName, $listener)
- {
- $this->lazyLoad($eventName);
-
- if (isset($this->listenerIds[$eventName])) {
- foreach ($this->listenerIds[$eventName] as $i => list($serviceId, $method)) {
- $key = $serviceId.'.'.$method;
- if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) {
- unset($this->listeners[$eventName][$key]);
- if (empty($this->listeners[$eventName])) {
- unset($this->listeners[$eventName]);
- }
- unset($this->listenerIds[$eventName][$i]);
- if (empty($this->listenerIds[$eventName])) {
- unset($this->listenerIds[$eventName]);
- }
- }
- }
- }
-
- parent::removeListener($eventName, $listener);
- }
-
- /**
- * {@inheritdoc}
- */
- public function hasListeners($eventName = null)
- {
- if (null === $eventName) {
- return $this->listenerIds || $this->listeners || parent::hasListeners();
- }
-
- if (isset($this->listenerIds[$eventName])) {
- return true;
- }
-
- return parent::hasListeners($eventName);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getListeners($eventName = null)
- {
- if (null === $eventName) {
- foreach ($this->listenerIds as $serviceEventName => $args) {
- $this->lazyLoad($serviceEventName);
- }
- } else {
- $this->lazyLoad($eventName);
- }
-
- return parent::getListeners($eventName);
- }
-
- /**
- * {@inheritdoc}
- */
- public function getListenerPriority($eventName, $listener)
- {
- $this->lazyLoad($eventName);
-
- return parent::getListenerPriority($eventName, $listener);
- }
-
- /**
- * Adds a service as event subscriber.
- *
- * @param string $serviceId The service ID of the subscriber service
- * @param string $class The service's class name (which must implement EventSubscriberInterface)
- */
- public function addSubscriberService($serviceId, $class)
- {
- @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
-
- foreach ($class::getSubscribedEvents() as $eventName => $params) {
- if (is_string($params)) {
- $this->listenerIds[$eventName][] = array($serviceId, $params, 0);
- } elseif (is_string($params[0])) {
- $this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0);
- } else {
- foreach ($params as $listener) {
- $this->listenerIds[$eventName][] = array($serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0);
- }
- }
- }
- }
-
- public function getContainer()
- {
- @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 as its class will be removed in 4.0. Inject the container or the services you need in your listeners/subscribers instead.', E_USER_DEPRECATED);
-
- return $this->container;
- }
-
- /**
- * Lazily loads listeners for this event from the dependency injection
- * container.
- *
- * @param string $eventName The name of the event to dispatch. The name of
- * the event is the name of the method that is
- * invoked on listeners.
- */
- protected function lazyLoad($eventName)
- {
- if (isset($this->listenerIds[$eventName])) {
- foreach ($this->listenerIds[$eventName] as list($serviceId, $method, $priority)) {
- $listener = $this->container->get($serviceId);
-
- $key = $serviceId.'.'.$method;
- if (!isset($this->listeners[$eventName][$key])) {
- $this->addListener($eventName, array($listener, $method), $priority);
- } elseif ($this->listeners[$eventName][$key] !== $listener) {
- parent::removeListener($eventName, array($this->listeners[$eventName][$key], $method));
- $this->addListener($eventName, array($listener, $method), $priority);
- }
-
- $this->listeners[$eventName][$key] = $listener;
- }
- }
- }
-}
diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
index 9b5c689a..3b6e7cc3 100644
--- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
+++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php
@@ -32,6 +32,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
private $called;
private $dispatcher;
private $wrappedListeners;
+ private $orphanedEvents;
public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null)
{
@@ -40,6 +41,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
$this->logger = $logger;
$this->called = array();
$this->wrappedListeners = array();
+ $this->orphanedEvents = array();
}
/**
@@ -207,6 +209,11 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
return $notCalled;
}
+ public function getOrphanedEvents(): array
+ {
+ return $this->orphanedEvents;
+ }
+
public function reset()
{
$this->called = array();
@@ -247,6 +254,12 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
private function preProcess($eventName)
{
+ if (!$this->dispatcher->hasListeners($eventName)) {
+ $this->orphanedEvents[] = $eventName;
+
+ return;
+ }
+
foreach ($this->dispatcher->getListeners($eventName) as $listener) {
$priority = $this->getListenerPriority($eventName, $listener);
$wrappedListener = new WrappedListener($listener, null, $this->stopwatch, $this);
diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
index f0212753..d716f191 100644
--- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
+++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php
@@ -14,9 +14,9 @@ namespace Symfony\Component\EventDispatcher\Debug;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
- * @author Fabien Potencier
+ * @deprecated since Symfony 4.1
*
- * @method reset() Resets the trace.
+ * @author Fabien Potencier
*/
interface TraceableEventDispatcherInterface extends EventDispatcherInterface
{
@@ -33,4 +33,9 @@ interface TraceableEventDispatcherInterface extends EventDispatcherInterface
* @return array An array of not called listeners
*/
public function getNotCalledListeners();
+
+ /**
+ * Resets the trace.
+ */
+ public function reset();
}
diff --git a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
index 9f9c09c5..17a89e7f 100644
--- a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
+++ b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php
@@ -31,12 +31,7 @@ class RegisterListenersPass implements CompilerPassInterface
private $hotPathEvents = array();
private $hotPathTagName;
- /**
- * @param string $dispatcherService Service name of the event dispatcher in processed container
- * @param string $listenerTag Tag name used for listener
- * @param string $subscriberTag Tag name used for subscribers
- */
- public function __construct($dispatcherService = 'event_dispatcher', $listenerTag = 'kernel.event_listener', $subscriberTag = 'kernel.event_subscriber')
+ public function __construct(string $dispatcherService = 'event_dispatcher', string $listenerTag = 'kernel.event_listener', string $subscriberTag = 'kernel.event_subscriber')
{
$this->dispatcherService = $dispatcherService;
$this->listenerTag = $listenerTag;
@@ -73,6 +68,10 @@ class RegisterListenersPass implements CompilerPassInterface
'/[^a-z0-9]/i',
), function ($matches) { return strtoupper($matches[0]); }, $event['event']);
$event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']);
+
+ if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method']) && $r->hasMethod('__invoke')) {
+ $event['method'] = '__invoke';
+ }
}
$definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority));
@@ -89,17 +88,15 @@ class RegisterListenersPass implements CompilerPassInterface
$def = $container->getDefinition($id);
// We must assume that the class value has been correctly filled, even if the service is created by a factory
- $class = $container->getParameterBag()->resolveValue($def->getClass());
- $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
+ $class = $def->getClass();
- if (!is_subclass_of($class, $interface)) {
- if (!class_exists($class, false)) {
- throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
- }
-
- throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
+ if (!$r = $container->getReflectionClass($class)) {
+ throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
- $container->addObjectResource($class);
+ if (!$r->isSubclassOf(EventSubscriberInterface::class)) {
+ throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, EventSubscriberInterface::class));
+ }
+ $class = $r->name;
ExtractingEventDispatcher::$subscriber = $class;
$extractingDispatcher->addSubscriber($extractingDispatcher);
diff --git a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
index 9443f216..9997a7b0 100644
--- a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php
@@ -158,7 +158,7 @@ abstract class AbstractEventDispatcherTest extends TestCase
// be executed
// Manually set priority to enforce $this->listener to be called first
$this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10);
- $this->dispatcher->addListener('post.foo', array($otherListener, 'preFoo'));
+ $this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo'));
$this->dispatcher->dispatch(self::postFoo);
$this->assertTrue($this->listener->postFooInvoked);
$this->assertFalse($otherListener->postFooInvoked);
diff --git a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php
deleted file mode 100644
index 9d5eecc5..00000000
--- a/vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php
+++ /dev/null
@@ -1,210 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\EventDispatcher\Tests;
-
-use Symfony\Component\DependencyInjection\Container;
-use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-
-/**
- * @group legacy
- */
-class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
-{
- protected function createEventDispatcher()
- {
- $container = new Container();
-
- return new ContainerAwareEventDispatcher($container);
- }
-
- public function testAddAListenerService()
- {
- $event = new Event();
-
- $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
-
- $service
- ->expects($this->once())
- ->method('onEvent')
- ->with($event)
- ;
-
- $container = new Container();
- $container->set('service.listener', $service);
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
-
- $dispatcher->dispatch('onEvent', $event);
- }
-
- public function testAddASubscriberService()
- {
- $event = new Event();
-
- $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\SubscriberService')->getMock();
-
- $service
- ->expects($this->once())
- ->method('onEvent')
- ->with($event)
- ;
-
- $service
- ->expects($this->once())
- ->method('onEventWithPriority')
- ->with($event)
- ;
-
- $service
- ->expects($this->once())
- ->method('onEventNested')
- ->with($event)
- ;
-
- $container = new Container();
- $container->set('service.subscriber', $service);
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addSubscriberService('service.subscriber', 'Symfony\Component\EventDispatcher\Tests\SubscriberService');
-
- $dispatcher->dispatch('onEvent', $event);
- $dispatcher->dispatch('onEventWithPriority', $event);
- $dispatcher->dispatch('onEventNested', $event);
- }
-
- public function testPreventDuplicateListenerService()
- {
- $event = new Event();
-
- $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
-
- $service
- ->expects($this->once())
- ->method('onEvent')
- ->with($event)
- ;
-
- $container = new Container();
- $container->set('service.listener', $service);
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'), 5);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'), 10);
-
- $dispatcher->dispatch('onEvent', $event);
- }
-
- public function testHasListenersOnLazyLoad()
- {
- $event = new Event();
-
- $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
-
- $container = new Container();
- $container->set('service.listener', $service);
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
-
- $service
- ->expects($this->once())
- ->method('onEvent')
- ->with($event)
- ;
-
- $this->assertTrue($dispatcher->hasListeners());
-
- if ($dispatcher->hasListeners('onEvent')) {
- $dispatcher->dispatch('onEvent');
- }
- }
-
- public function testGetListenersOnLazyLoad()
- {
- $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
-
- $container = new Container();
- $container->set('service.listener', $service);
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
-
- $listeners = $dispatcher->getListeners();
-
- $this->assertArrayHasKey('onEvent', $listeners);
-
- $this->assertCount(1, $dispatcher->getListeners('onEvent'));
- }
-
- public function testRemoveAfterDispatch()
- {
- $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
-
- $container = new Container();
- $container->set('service.listener', $service);
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
-
- $dispatcher->dispatch('onEvent', new Event());
- $dispatcher->removeListener('onEvent', array($container->get('service.listener'), 'onEvent'));
- $this->assertFalse($dispatcher->hasListeners('onEvent'));
- }
-
- public function testRemoveBeforeDispatch()
- {
- $service = $this->getMockBuilder('Symfony\Component\EventDispatcher\Tests\Service')->getMock();
-
- $container = new Container();
- $container->set('service.listener', $service);
-
- $dispatcher = new ContainerAwareEventDispatcher($container);
- $dispatcher->addListenerService('onEvent', array('service.listener', 'onEvent'));
-
- $dispatcher->removeListener('onEvent', array($container->get('service.listener'), 'onEvent'));
- $this->assertFalse($dispatcher->hasListeners('onEvent'));
- }
-}
-
-class Service
-{
- public function onEvent(Event $e)
- {
- }
-}
-
-class SubscriberService implements EventSubscriberInterface
-{
- public static function getSubscribedEvents()
- {
- return array(
- 'onEvent' => 'onEvent',
- 'onEventWithPriority' => array('onEventWithPriority', 10),
- 'onEventNested' => array(array('onEventNested')),
- );
- }
-
- public function onEvent(Event $e)
- {
- }
-
- public function onEventWithPriority(Event $e)
- {
- }
-
- public function onEventNested(Event $e)
- {
- }
-}
diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
index 53a3421a..2521f741 100644
--- a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php
@@ -153,6 +153,31 @@ class TraceableEventDispatcherTest extends TestCase
$this->assertCount(2, $dispatcher->getCalledListeners());
}
+ public function testItReturnsNoOrphanedEventsWhenCreated()
+ {
+ $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
+ $events = $tdispatcher->getOrphanedEvents();
+ $this->assertEmpty($events);
+ }
+
+ public function testItReturnsOrphanedEventsAfterDispatch()
+ {
+ $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
+ $tdispatcher->dispatch('foo');
+ $events = $tdispatcher->getOrphanedEvents();
+ $this->assertCount(1, $events);
+ $this->assertEquals(array('foo'), $events);
+ }
+
+ public function testItDoesNotReturnHandledEvents()
+ {
+ $tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
+ $tdispatcher->addListener('foo', function () {});
+ $tdispatcher->dispatch('foo');
+ $events = $tdispatcher->getOrphanedEvents();
+ $this->assertEmpty($events);
+ }
+
public function testLogger()
{
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
diff --git a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
index dbb1aa5c..a359bd7e 100644
--- a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
+++ b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php
@@ -27,29 +27,10 @@ class RegisterListenersPassTest extends TestCase
*/
public function testEventSubscriberWithoutInterface()
{
- // one service, not implementing any interface
- $services = array(
- 'my_event_subscriber' => array(0 => array()),
- );
-
- $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
- $definition->expects($this->atLeastOnce())
- ->method('getClass')
- ->will($this->returnValue('stdClass'));
-
- $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
- $builder->expects($this->any())
- ->method('hasDefinition')
- ->will($this->returnValue(true));
-
- // We don't test kernel.event_listener here
- $builder->expects($this->atLeastOnce())
- ->method('findTaggedServiceIds')
- ->will($this->onConsecutiveCalls(array(), $services));
-
- $builder->expects($this->atLeastOnce())
- ->method('getDefinition')
- ->will($this->returnValue($definition));
+ $builder = new ContainerBuilder();
+ $builder->register('event_dispatcher');
+ $builder->register('my_event_subscriber', 'stdClass')
+ ->addTag('kernel.event_subscriber');
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($builder);
@@ -61,31 +42,25 @@ class RegisterListenersPassTest extends TestCase
'my_event_subscriber' => array(0 => array()),
);
- $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
- $definition->expects($this->atLeastOnce())
- ->method('getClass')
- ->will($this->returnValue('Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'));
-
- $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'findDefinition'))->getMock();
- $builder->expects($this->any())
- ->method('hasDefinition')
- ->will($this->returnValue(true));
-
- // We don't test kernel.event_listener here
- $builder->expects($this->atLeastOnce())
- ->method('findTaggedServiceIds')
- ->will($this->onConsecutiveCalls(array(), $services));
-
- $builder->expects($this->atLeastOnce())
- ->method('getDefinition')
- ->will($this->returnValue($definition));
-
- $builder->expects($this->atLeastOnce())
- ->method('findDefinition')
- ->will($this->returnValue($definition));
+ $builder = new ContainerBuilder();
+ $eventDispatcherDefinition = $builder->register('event_dispatcher');
+ $builder->register('my_event_subscriber', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService')
+ ->addTag('kernel.event_subscriber');
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($builder);
+
+ $expectedCalls = array(
+ array(
+ 'addListener',
+ array(
+ 'event',
+ array(new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'),
+ 0,
+ ),
+ ),
+ );
+ $this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls());
}
/**
@@ -166,6 +141,47 @@ class RegisterListenersPassTest extends TestCase
$registerListenersPass = new RegisterListenersPass();
$registerListenersPass->process($container);
}
+
+ public function testInvokableEventListener()
+ {
+ $container = new ContainerBuilder();
+ $container->register('foo', \stdClass::class)->addTag('kernel.event_listener', array('event' => 'foo.bar'));
+ $container->register('bar', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'foo.bar'));
+ $container->register('baz', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'event'));
+ $container->register('event_dispatcher', \stdClass::class);
+
+ $registerListenersPass = new RegisterListenersPass();
+ $registerListenersPass->process($container);
+
+ $definition = $container->getDefinition('event_dispatcher');
+ $expectedCalls = array(
+ array(
+ 'addListener',
+ array(
+ 'foo.bar',
+ array(new ServiceClosureArgument(new Reference('foo')), 'onFooBar'),
+ 0,
+ ),
+ ),
+ array(
+ 'addListener',
+ array(
+ 'foo.bar',
+ array(new ServiceClosureArgument(new Reference('bar')), '__invoke'),
+ 0,
+ ),
+ ),
+ array(
+ 'addListener',
+ array(
+ 'event',
+ array(new ServiceClosureArgument(new Reference('baz')), 'onEvent'),
+ 0,
+ ),
+ ),
+ );
+ $this->assertEquals($expectedCalls, $definition->getMethodCalls());
+ }
}
class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
@@ -177,3 +193,14 @@ class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubsc
);
}
}
+
+class InvokableListenerService
+{
+ public function __invoke()
+ {
+ }
+
+ public function onEvent()
+ {
+ }
+}
diff --git a/vendor/symfony/event-dispatcher/composer.json b/vendor/symfony/event-dispatcher/composer.json
index 75b881b9..12ee5327 100644
--- a/vendor/symfony/event-dispatcher/composer.json
+++ b/vendor/symfony/event-dispatcher/composer.json
@@ -16,17 +16,17 @@
}
],
"require": {
- "php": "^5.5.9|>=7.0.8"
+ "php": "^7.1.3"
},
"require-dev": {
- "symfony/dependency-injection": "~3.3|~4.0",
- "symfony/expression-language": "~2.8|~3.0|~4.0",
- "symfony/config": "~2.8|~3.0|~4.0",
- "symfony/stopwatch": "~2.8|~3.0|~4.0",
+ "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/expression-language": "~3.4|~4.0",
+ "symfony/config": "~3.4|~4.0",
+ "symfony/stopwatch": "~3.4|~4.0",
"psr/log": "~1.0"
},
"conflict": {
- "symfony/dependency-injection": "<3.3"
+ "symfony/dependency-injection": "<3.4"
},
"suggest": {
"symfony/dependency-injection": "",
@@ -41,7 +41,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.1-dev"
}
}
}
diff --git a/vendor/symfony/finder/Finder.php b/vendor/symfony/finder/Finder.php
index 07dce771..278b9841 100644
--- a/vendor/symfony/finder/Finder.php
+++ b/vendor/symfony/finder/Finder.php
@@ -297,6 +297,10 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Excludes directories.
*
+ * Directories passed as argument must be relative to the ones defined with the `in()` method. For example:
+ *
+ * $finder->in(__DIR__)->exclude('ruby');
+ *
* @param string|array $dirs A directory path or an array of directories
*
* @return $this
@@ -313,6 +317,8 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Excludes "hidden" directories and files (starting with a dot).
*
+ * This option is enabled by default.
+ *
* @param bool $ignoreDotFiles Whether to exclude "hidden" files or not
*
* @return $this
@@ -333,6 +339,8 @@ class Finder implements \IteratorAggregate, \Countable
/**
* Forces the finder to ignore version control directories.
*
+ * This option is enabled by default.
+ *
* @param bool $ignoreVCS Whether to exclude VCS files or not
*
* @return $this
@@ -532,9 +540,9 @@ class Finder implements \IteratorAggregate, \Countable
foreach ((array) $dirs as $dir) {
if (is_dir($dir)) {
- $resolvedDirs[] = $dir;
+ $resolvedDirs[] = $this->normalizeDir($dir);
} elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
- $resolvedDirs = array_merge($resolvedDirs, $glob);
+ $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
} else {
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
}
@@ -720,4 +728,16 @@ class Finder implements \IteratorAggregate, \Countable
return $iterator;
}
+
+ /**
+ * Normalizes given directory names by removing trailing slashes.
+ *
+ * @param string $dir
+ *
+ * @return string
+ */
+ private function normalizeDir($dir)
+ {
+ return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
+ }
}
diff --git a/vendor/symfony/finder/SplFileInfo.php b/vendor/symfony/finder/SplFileInfo.php
index 19f95e26..0f4e025b 100644
--- a/vendor/symfony/finder/SplFileInfo.php
+++ b/vendor/symfony/finder/SplFileInfo.php
@@ -66,12 +66,11 @@ class SplFileInfo extends \SplFileInfo
*/
public function getContents()
{
- $level = error_reporting(0);
+ set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
$content = file_get_contents($this->getPathname());
- error_reporting($level);
+ restore_error_handler();
if (false === $content) {
- $error = error_get_last();
- throw new \RuntimeException($error['message']);
+ throw new \RuntimeException($error);
}
return $content;
diff --git a/vendor/symfony/finder/Tests/FinderTest.php b/vendor/symfony/finder/Tests/FinderTest.php
index 7e75f141..c7908fa8 100644
--- a/vendor/symfony/finder/Tests/FinderTest.php
+++ b/vendor/symfony/finder/Tests/FinderTest.php
@@ -46,6 +46,45 @@ class FinderTest extends Iterator\RealIteratorTestCase
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
}
+ public function testRemoveTrailingSlash()
+ {
+ $finder = $this->buildFinder();
+
+ $expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar'));
+ $in = self::$tmpDir.'//';
+
+ $this->assertIterator($expected, $finder->in($in)->files()->getIterator());
+ }
+
+ public function testSymlinksNotResolved()
+ {
+ if ('\\' === DIRECTORY_SEPARATOR) {
+ $this->markTestSkipped('symlinks are not supported on Windows');
+ }
+
+ $finder = $this->buildFinder();
+
+ symlink($this->toAbsolute('foo'), $this->toAbsolute('baz'));
+ $expected = $this->toAbsolute(array('baz/bar.tmp'));
+ $in = self::$tmpDir.'/baz/';
+ try {
+ $this->assertIterator($expected, $finder->in($in)->files()->getIterator());
+ unlink($this->toAbsolute('baz'));
+ } catch (\Exception $e) {
+ unlink($this->toAbsolute('baz'));
+ throw $e;
+ }
+ }
+
+ public function testBackPathNotNormalized()
+ {
+ $finder = $this->buildFinder();
+
+ $expected = $this->toAbsolute(array('foo/../foo/bar.tmp'));
+ $in = self::$tmpDir.'/foo/../foo/';
+ $this->assertIterator($expected, $finder->in($in)->files()->getIterator());
+ }
+
public function testDepth()
{
$finder = $this->buildFinder();
@@ -261,7 +300,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
public function testInWithGlob()
{
$finder = $this->buildFinder();
- $finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator();
+ $finder->in(array(__DIR__.'/Fixtures/*/B/C/', __DIR__.'/Fixtures/*/*/B/C/'))->getIterator();
$this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
}
diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php
index 4519a6ad..d202dc6c 100644
--- a/vendor/symfony/http-foundation/Cookie.php
+++ b/vendor/symfony/http-foundation/Cookie.php
@@ -145,12 +145,12 @@ class Cookie
$str = ($this->isRaw() ? $this->getName() : urlencode($this->getName())).'=';
if ('' === (string) $this->getValue()) {
- $str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001';
+ $str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0';
} else {
$str .= $this->isRaw() ? $this->getValue() : rawurlencode($this->getValue());
if (0 !== $this->getExpiresTime()) {
- $str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()).'; max-age='.$this->getMaxAge();
+ $str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime()).'; Max-Age='.$this->getMaxAge();
}
}
@@ -224,7 +224,9 @@ class Cookie
*/
public function getMaxAge()
{
- return 0 !== $this->expire ? $this->expire - time() : 0;
+ $maxAge = $this->expire - time();
+
+ return 0 >= $maxAge ? 0 : $maxAge;
}
/**
diff --git a/vendor/symfony/http-foundation/File/File.php b/vendor/symfony/http-foundation/File/File.php
index e2a67684..65ece983 100644
--- a/vendor/symfony/http-foundation/File/File.php
+++ b/vendor/symfony/http-foundation/File/File.php
@@ -93,9 +93,11 @@ class File extends \SplFileInfo
{
$target = $this->getTargetFile($directory, $name);
- if (!@rename($this->getPathname(), $target)) {
- $error = error_get_last();
- throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
+ set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
+ $renamed = rename($this->getPathname(), $target);
+ restore_error_handler();
+ if (!$renamed) {
+ throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
}
@chmod($target, 0666 & ~umask());
diff --git a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php
index c2ac6768..3c358104 100644
--- a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php
@@ -43,7 +43,21 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
*/
public static function isSupported()
{
- return '\\' !== DIRECTORY_SEPARATOR && function_exists('passthru') && function_exists('escapeshellarg');
+ static $supported = null;
+
+ if (null !== $supported) {
+ return $supported;
+ }
+
+ if ('\\' === DIRECTORY_SEPARATOR || !function_exists('passthru') || !function_exists('escapeshellarg')) {
+ return $supported = false;
+ }
+
+ ob_start();
+ passthru('command -v file', $exitStatus);
+ $binPath = trim(ob_get_clean());
+
+ return $supported = 0 === $exitStatus && '' !== $binPath;
}
/**
diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php
index 896c135a..77bf51b1 100644
--- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php
@@ -599,6 +599,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface
'application/x-xliff+xml' => 'xlf',
'application/x-xpinstall' => 'xpi',
'application/x-xz' => 'xz',
+ 'application/x-zip-compressed' => 'zip',
'application/x-zmachine' => 'z1',
'application/xaml+xml' => 'xaml',
'application/xcap-diff+xml' => 'xdf',
diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php
index e3ef45ef..d78c7606 100644
--- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php
+++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php
@@ -80,13 +80,8 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
*/
private function __construct()
{
- if (FileBinaryMimeTypeGuesser::isSupported()) {
- $this->register(new FileBinaryMimeTypeGuesser());
- }
-
- if (FileinfoMimeTypeGuesser::isSupported()) {
- $this->register(new FileinfoMimeTypeGuesser());
- }
+ $this->register(new FileBinaryMimeTypeGuesser());
+ $this->register(new FileinfoMimeTypeGuesser());
}
/**
@@ -125,18 +120,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface
throw new AccessDeniedException($path);
}
- if (!$this->guessers) {
- $msg = 'Unable to guess the mime type as no guessers are available';
- if (!FileinfoMimeTypeGuesser::isSupported()) {
- $msg .= ' (Did you enable the php_fileinfo extension?)';
- }
- throw new \LogicException($msg);
- }
-
foreach ($this->guessers as $guesser) {
if (null !== $mimeType = $guesser->guess($path)) {
return $mimeType;
}
}
+
+ if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) {
+ throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)');
+ }
}
}
diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php
index 082d8d53..39b29775 100644
--- a/vendor/symfony/http-foundation/File/UploadedFile.php
+++ b/vendor/symfony/http-foundation/File/UploadedFile.php
@@ -192,9 +192,11 @@ class UploadedFile extends File
$target = $this->getTargetFile($directory, $name);
- if (!@move_uploaded_file($this->getPathname(), $target)) {
- $error = error_get_last();
- throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
+ set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
+ $moved = move_uploaded_file($this->getPathname(), $target);
+ restore_error_handler();
+ if (!$moved) {
+ throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));
}
@chmod($target, 0666 & ~umask());
diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php
index be55069e..da17df90 100644
--- a/vendor/symfony/http-foundation/Request.php
+++ b/vendor/symfony/http-foundation/Request.php
@@ -144,7 +144,7 @@ class Request
public $headers;
/**
- * @var string|resource
+ * @var string|resource|false|null
*/
protected $content;
@@ -242,13 +242,13 @@ class Request
);
/**
- * @param array $query The GET parameters
- * @param array $request The POST parameters
- * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
- * @param array $cookies The COOKIE parameters
- * @param array $files The FILES parameters
- * @param array $server The SERVER parameters
- * @param string|resource $content The raw body data
+ * @param array $query The GET parameters
+ * @param array $request The POST parameters
+ * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
+ * @param array $cookies The COOKIE parameters
+ * @param array $files The FILES parameters
+ * @param array $server The SERVER parameters
+ * @param string|resource|null $content The raw body data
*/
public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
{
@@ -260,13 +260,13 @@ class Request
*
* This method also re-initializes all properties.
*
- * @param array $query The GET parameters
- * @param array $request The POST parameters
- * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
- * @param array $cookies The COOKIE parameters
- * @param array $files The FILES parameters
- * @param array $server The SERVER parameters
- * @param string|resource $content The raw body data
+ * @param array $query The GET parameters
+ * @param array $request The POST parameters
+ * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
+ * @param array $cookies The COOKIE parameters
+ * @param array $files The FILES parameters
+ * @param array $server The SERVER parameters
+ * @param string|resource|null $content The raw body data
*/
public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null)
{
@@ -329,13 +329,13 @@ class Request
* The information contained in the URI always take precedence
* over the other information (server and parameters).
*
- * @param string $uri The URI
- * @param string $method The HTTP method
- * @param array $parameters The query (GET) or request (POST) parameters
- * @param array $cookies The request cookies ($_COOKIE)
- * @param array $files The request files ($_FILES)
- * @param array $server The server parameters ($_SERVER)
- * @param string|resource $content The raw body data
+ * @param string $uri The URI
+ * @param string $method The HTTP method
+ * @param array $parameters The query (GET) or request (POST) parameters
+ * @param array $cookies The request cookies ($_COOKIE)
+ * @param array $files The request files ($_FILES)
+ * @param array $server The server parameters ($_SERVER)
+ * @param string|resource|null $content The raw body data
*
* @return static
*/
@@ -557,7 +557,7 @@ class Request
*/
public function overrideGlobals()
{
- $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&')));
+ $this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), '', '&')));
$_GET = $this->query->all();
$_POST = $this->request->all();
@@ -641,7 +641,7 @@ class Request
public static function setTrustedHosts(array $hostPatterns)
{
self::$trustedHostPatterns = array_map(function ($hostPattern) {
- return sprintf('#%s#i', $hostPattern);
+ return sprintf('{%s}i', $hostPattern);
}, $hostPatterns);
// we need to reset trusted hosts on trusted host patterns change
self::$trustedHosts = array();
@@ -1378,7 +1378,7 @@ class Request
*
* @param string $format The format
*
- * @return string The associated mime type (null if not found)
+ * @return string|null The associated mime type (null if not found)
*/
public function getMimeType($format)
{
diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php
index cf1325af..e05194b0 100644
--- a/vendor/symfony/http-foundation/Response.php
+++ b/vendor/symfony/http-foundation/Response.php
@@ -21,6 +21,7 @@ class Response
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
+ const HTTP_EARLY_HINTS = 103; // RFC8297
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@@ -327,7 +328,7 @@ class Response
}
// headers
- foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
+ foreach ($this->headers->allPreserveCase() as $name => $values) {
foreach ($values as $value) {
header($name.': '.$value, false, $this->statusCode);
}
@@ -336,15 +337,6 @@ class Response
// status
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
- // cookies
- foreach ($this->headers->getCookies() as $cookie) {
- if ($cookie->isRaw()) {
- setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
- } else {
- setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
- }
- }
-
return $this;
}
@@ -372,7 +364,7 @@ class Response
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
- } elseif ('cli' !== PHP_SAPI) {
+ } elseif (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
static::closeOutputBuffers(0, true);
}
@@ -519,13 +511,19 @@ class Response
}
/**
- * Returns true if the response is worth caching under any circumstance.
+ * Returns true if the response may safely be kept in a shared (surrogate) cache.
*
* Responses marked "private" with an explicit Cache-Control directive are
* considered uncacheable.
*
* Responses with neither a freshness lifetime (Expires, max-age) nor cache
- * validator (Last-Modified, ETag) are considered uncacheable.
+ * validator (Last-Modified, ETag) are considered uncacheable because there is
+ * no way to tell when or how to remove them from the cache.
+ *
+ * Note that RFC 7231 and RFC 7234 possibly allow for a more permissive implementation,
+ * for example "status codes that are defined as cacheable by default [...]
+ * can be reused by a cache with heuristic expiration unless otherwise indicated"
+ * (https://tools.ietf.org/html/rfc7231#section-6.1)
*
* @return bool true if the response is worth caching, false otherwise
*
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
index 9f4ef702..dd37eae1 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php
@@ -80,7 +80,9 @@ class MemcachedSessionHandler extends AbstractSessionHandler
*/
public function updateTimestamp($sessionId, $data)
{
- return $this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl);
+ $this->memcached->touch($this->prefix.$sessionId, time() + $this->ttl);
+
+ return true;
}
/**
diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
index 2e1692b6..37ec7571 100644
--- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -164,7 +164,7 @@ class PdoSessionHandler extends AbstractSessionHandler
* * db_connection_options: An array of driver-specific connection options [default: array()]
* * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL]
*
- * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or null
+ * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null
* @param array $options An associative array of options
*
* @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
@@ -178,6 +178,8 @@ class PdoSessionHandler extends AbstractSessionHandler
$this->pdo = $pdoOrDsn;
$this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
+ } elseif (is_string($pdoOrDsn) && false !== strpos($pdoOrDsn, '://')) {
+ $this->dsn = $this->buildDsnFromUrl($pdoOrDsn);
} else {
$this->dsn = $pdoOrDsn;
}
@@ -431,6 +433,102 @@ class PdoSessionHandler extends AbstractSessionHandler
$this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
}
+ /**
+ * Builds a PDO DSN from a URL-like connection string.
+ *
+ * @param string $dsnOrUrl
+ *
+ * @return string
+ *
+ * @todo implement missing support for oci DSN (which look totally different from other PDO ones)
+ */
+ private function buildDsnFromUrl($dsnOrUrl)
+ {
+ // (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid
+ $url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $dsnOrUrl);
+
+ $params = parse_url($url);
+
+ if (false === $params) {
+ return $dsnOrUrl; // If the URL is not valid, let's assume it might be a DSN already.
+ }
+
+ $params = array_map('rawurldecode', $params);
+
+ // Override the default username and password. Values passed through options will still win over these in the constructor.
+ if (isset($params['user'])) {
+ $this->username = $params['user'];
+ }
+
+ if (isset($params['pass'])) {
+ $this->password = $params['pass'];
+ }
+
+ if (!isset($params['scheme'])) {
+ throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler');
+ }
+
+ $driverAliasMap = array(
+ 'mssql' => 'sqlsrv',
+ 'mysql2' => 'mysql', // Amazon RDS, for some weird reason
+ 'postgres' => 'pgsql',
+ 'postgresql' => 'pgsql',
+ 'sqlite3' => 'sqlite',
+ );
+
+ $driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme'];
+
+ // Doctrine DBAL supports passing its internal pdo_* driver names directly too (allowing both dashes and underscores). This allows supporting the same here.
+ if (0 === strpos($driver, 'pdo_') || 0 === strpos($driver, 'pdo-')) {
+ $driver = substr($driver, 4);
+ }
+
+ switch ($driver) {
+ case 'mysql':
+ case 'pgsql':
+ $dsn = $driver.':';
+
+ if (isset($params['host']) && '' !== $params['host']) {
+ $dsn .= 'host='.$params['host'].';';
+ }
+
+ if (isset($params['port']) && '' !== $params['port']) {
+ $dsn .= 'port='.$params['port'].';';
+ }
+
+ if (isset($params['path'])) {
+ $dbName = substr($params['path'], 1); // Remove the leading slash
+ $dsn .= 'dbname='.$dbName.';';
+ }
+
+ return $dsn;
+
+ case 'sqlite':
+ return 'sqlite:'.substr($params['path'], 1);
+
+ case 'sqlsrv':
+ $dsn = 'sqlsrv:server=';
+
+ if (isset($params['host'])) {
+ $dsn .= $params['host'];
+ }
+
+ if (isset($params['port']) && '' !== $params['port']) {
+ $dsn .= ','.$params['port'];
+ }
+
+ if (isset($params['path'])) {
+ $dbName = substr($params['path'], 1); // Remove the leading slash
+ $dsn .= ';Database='.$dbName;
+ }
+
+ return $dsn;
+
+ default:
+ throw new \InvalidArgumentException(sprintf('The scheme "%s" is not supported by the PdoSessionHandler URL configuration. Pass a PDO DSN directly.', $params['scheme']));
+ }
+ }
+
/**
* Helper method to begin a transaction.
*
@@ -518,6 +616,7 @@ class PdoSessionHandler extends AbstractSessionHandler
$selectSql = $this->getSelectSql();
$selectStmt = $this->pdo->prepare($selectSql);
$selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
+ $insertStmt = null;
do {
$selectStmt->execute();
@@ -533,6 +632,11 @@ class PdoSessionHandler extends AbstractSessionHandler
return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0];
}
+ if (null !== $insertStmt) {
+ $this->rollback();
+ throw new \RuntimeException('Failed to read session: INSERT reported a duplicate id but next SELECT did not return any data.');
+ }
+
if (!ini_get('session.use_strict_mode') && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) {
// In strict mode, session fixation is not possible: new sessions always start with a unique
// random id, so that concurrency is not possible and this code path can be skipped.
@@ -578,14 +682,16 @@ class PdoSessionHandler extends AbstractSessionHandler
{
switch ($this->driver) {
case 'mysql':
+ // MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced.
+ $lockId = \substr($sessionId, 0, 64);
// should we handle the return value? 0 on timeout, null on error
// we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout
$stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)');
- $stmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
+ $stmt->bindValue(':key', $lockId, \PDO::PARAM_STR);
$stmt->execute();
$releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)');
- $releaseStmt->bindValue(':key', $sessionId, \PDO::PARAM_STR);
+ $releaseStmt->bindValue(':key', $lockId, \PDO::PARAM_STR);
return $releaseStmt;
case 'pgsql':
diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
index 0dfad9ac..6416a03f 100644
--- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
+++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php
@@ -349,7 +349,7 @@ class NativeSessionStorage implements SessionStorageInterface
}
$validOptions = array_flip(array(
- 'cache_limiter', 'cache_expire', 'cookie_domain', 'cookie_httponly',
+ 'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cookie_lifetime', 'cookie_path', 'cookie_secure',
'entropy_file', 'entropy_length', 'gc_divisor',
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
@@ -357,13 +357,13 @@ class NativeSessionStorage implements SessionStorageInterface
'serialize_handler', 'use_strict_mode', 'use_cookies',
'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
- 'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags',
+ 'upload_progress.freq', 'upload_progress.min_freq', 'url_rewriter.tags',
'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags',
));
foreach ($options as $key => $value) {
if (isset($validOptions[$key])) {
- ini_set('session.'.$key, $value);
+ ini_set('url_rewriter.tags' !== $key ? 'session.'.$key : $key, $value);
}
}
}
diff --git a/vendor/symfony/http-foundation/Tests/CookieTest.php b/vendor/symfony/http-foundation/Tests/CookieTest.php
index 070b7dd4..a47b71e1 100644
--- a/vendor/symfony/http-foundation/Tests/CookieTest.php
+++ b/vendor/symfony/http-foundation/Tests/CookieTest.php
@@ -162,13 +162,13 @@ class CookieTest extends TestCase
public function testToString()
{
$cookie = new Cookie('foo', 'bar', $expire = strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
- $this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() returns string representation of the cookie');
+ $this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() returns string representation of the cookie');
$cookie = new Cookie('foo', 'bar with white spaces', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true);
- $this->assertEquals('foo=bar%20with%20white%20spaces; expires=Fri, 20-May-2011 15:25:52 GMT; max-age='.($expire - time()).'; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20)');
+ $this->assertEquals('foo=bar%20with%20white%20spaces; expires=Fri, 20-May-2011 15:25:52 GMT; Max-Age=0; path=/; domain=.myfoodomain.com; secure; httponly', (string) $cookie, '->__toString() encodes the value of the cookie according to RFC 3986 (white space = %20)');
$cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
- $this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', $expire = time() - 31536001).'; max-age='.($expire - time()).'; path=/admin/; domain=.myfoodomain.com; httponly', (string) $cookie, '->__toString() returns string representation of a cleared cookie if value is NULL');
+ $this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', $expire = time() - 31536001).'; Max-Age=0; path=/admin/; domain=.myfoodomain.com; httponly', (string) $cookie, '->__toString() returns string representation of a cleared cookie if value is NULL');
$cookie = new Cookie('foo', 'bar', 0, '/', '');
$this->assertEquals('foo=bar; path=/; httponly', (string) $cookie);
@@ -194,7 +194,7 @@ class CookieTest extends TestCase
$this->assertEquals($expire - time(), $cookie->getMaxAge());
$cookie = new Cookie('foo', 'bar', $expire = time() - 100);
- $this->assertEquals($expire - time(), $cookie->getMaxAge());
+ $this->assertEquals(0, $cookie->getMaxAge());
}
public function testFromString()
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc
new file mode 100644
index 00000000..ba101d35
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc
@@ -0,0 +1,39 @@
+headers->set('Date', 'Sat, 12 Nov 1955 20:04:00 GMT');
+
+return $r;
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.expected
new file mode 100644
index 00000000..bdb9d023
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.expected
@@ -0,0 +1,11 @@
+
+Warning: Expiry date cannot have a year greater than 9999 in %scookie_max_age.php on line 10
+
+Array
+(
+ [0] => Content-Type: text/plain; charset=utf-8
+ [1] => Cache-Control: no-cache, private
+ [2] => Date: Sat, 12 Nov 1955 20:04:00 GMT
+ [3] => Set-Cookie: foo=bar; expires=Sat, 01-Jan-10000 02:46:40 GMT; Max-Age=%d; path=/
+)
+shutdown
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.php b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.php
new file mode 100644
index 00000000..8775a5cc
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_max_age.php
@@ -0,0 +1,10 @@
+headers->setCookie(new Cookie('foo', 'bar', 253402310800, '', null, false, false));
+$r->sendHeaders();
+
+setcookie('foo2', 'bar', 253402310800, '/');
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.expected
new file mode 100644
index 00000000..0c097972
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.expected
@@ -0,0 +1,10 @@
+
+Array
+(
+ [0] => Content-Type: text/plain; charset=utf-8
+ [1] => Cache-Control: no-cache, private
+ [2] => Date: Sat, 12 Nov 1955 20:04:00 GMT
+ [3] => Set-Cookie: ?*():@&+$/%#[]=?*():@&+$/%#[]; path=/
+ [4] => Set-Cookie: ?*():@&+$/%#[]=?*():@&+$/%#[]; path=/
+)
+shutdown
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.php b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.php
new file mode 100644
index 00000000..2ca5b59f
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_raw_urlencode.php
@@ -0,0 +1,12 @@
+headers->setCookie(new Cookie($str, $str, 0, '/', null, false, false, true));
+$r->sendHeaders();
+
+setrawcookie($str, $str, 0, '/', null, false, false);
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.expected
new file mode 100644
index 00000000..cbde2cbf
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.expected
@@ -0,0 +1,9 @@
+
+Array
+(
+ [0] => Content-Type: text/plain; charset=utf-8
+ [1] => Cache-Control: no-cache, private
+ [2] => Date: Sat, 12 Nov 1955 20:04:00 GMT
+ [3] => Set-Cookie: CookieSamesiteLaxTest=LaxValue; path=/; httponly; samesite=lax
+)
+shutdown
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.php b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.php
new file mode 100644
index 00000000..9a476f1d
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_lax.php
@@ -0,0 +1,8 @@
+headers->setCookie(new Cookie('CookieSamesiteLaxTest', 'LaxValue', 0, '/', null, false, true, false, Cookie::SAMESITE_LAX));
+$r->sendHeaders();
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.expected
new file mode 100644
index 00000000..adc491fd
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.expected
@@ -0,0 +1,9 @@
+
+Array
+(
+ [0] => Content-Type: text/plain; charset=utf-8
+ [1] => Cache-Control: no-cache, private
+ [2] => Date: Sat, 12 Nov 1955 20:04:00 GMT
+ [3] => Set-Cookie: CookieSamesiteStrictTest=StrictValue; path=/; httponly; samesite=strict
+)
+shutdown
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.php b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.php
new file mode 100644
index 00000000..3bcb41f8
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_samesite_strict.php
@@ -0,0 +1,8 @@
+headers->setCookie(new Cookie('CookieSamesiteStrictTest', 'StrictValue', 0, '/', null, false, true, false, Cookie::SAMESITE_STRICT));
+$r->sendHeaders();
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected
new file mode 100644
index 00000000..4e9c4c07
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected
@@ -0,0 +1,10 @@
+
+Array
+(
+ [0] => Content-Type: text/plain; charset=utf-8
+ [1] => Cache-Control: no-cache, private
+ [2] => Date: Sat, 12 Nov 1955 20:04:00 GMT
+ [3] => Set-Cookie: %3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
+ [4] => Set-Cookie: ?*():@&+$/%#[]=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
+)
+shutdown
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.php b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.php
new file mode 100644
index 00000000..05b9af30
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.php
@@ -0,0 +1,12 @@
+headers->setCookie(new Cookie($str, $str, 0, '', null, false, false));
+$r->sendHeaders();
+
+setcookie($str, $str, 0, '/');
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.expected
new file mode 100644
index 00000000..2b560f0b
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.expected
@@ -0,0 +1,6 @@
+The cookie name "Hello + world" contains invalid characters.
+Array
+(
+ [0] => Content-Type: text/plain; charset=utf-8
+)
+shutdown
diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.php b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.php
new file mode 100644
index 00000000..3fe15718
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/invalid_cookie_name.php
@@ -0,0 +1,11 @@
+headers->setCookie(new Cookie('Hello + world', 'hodor'));
+} catch (\InvalidArgumentException $e) {
+ echo $e->getMessage();
+}
diff --git a/vendor/symfony/http-foundation/Tests/RequestTest.php b/vendor/symfony/http-foundation/Tests/RequestTest.php
index 72add953..4266197a 100644
--- a/vendor/symfony/http-foundation/Tests/RequestTest.php
+++ b/vendor/symfony/http-foundation/Tests/RequestTest.php
@@ -23,6 +23,7 @@ class RequestTest extends TestCase
{
// reset
Request::setTrustedProxies(array(), -1);
+ Request::setTrustedHosts(array());
}
public function testInitialize()
@@ -2007,9 +2008,15 @@ class RequestTest extends TestCase
$request->headers->set('host', 'subdomain.trusted.com');
$this->assertEquals('subdomain.trusted.com', $request->getHost());
+ }
- // reset request for following tests
- Request::setTrustedHosts(array());
+ public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters()
+ {
+ Request::setTrustedHosts(array('localhost(\.local){0,1}#,example.com', 'localhost'));
+
+ $request = Request::create('/');
+ $request->headers->set('host', 'localhost');
+ $this->assertSame('localhost', $request->getHost());
}
public function testFactory()
@@ -2148,11 +2155,11 @@ class RequestTest extends TestCase
/**
* @dataProvider methodCacheableProvider
*/
- public function testMethodCacheable($method, $chacheable)
+ public function testMethodCacheable($method, $cacheable)
{
$request = new Request();
$request->setMethod($method);
- $this->assertEquals($chacheable, $request->isMethodCacheable());
+ $this->assertEquals($cacheable, $request->isMethodCacheable());
}
public function methodCacheableProvider()
@@ -2316,7 +2323,7 @@ class RequestContentProxy extends Request
{
public function getContent($asResource = false)
{
- return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'));
+ return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&');
}
}
diff --git a/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php
new file mode 100644
index 00000000..22f25e97
--- /dev/null
+++ b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php
@@ -0,0 +1,58 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\HttpFoundation\Tests;
+
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @requires PHP 7.0
+ */
+class ResponseFunctionalTest extends TestCase
+{
+ private static $server;
+
+ public static function setUpBeforeClass()
+ {
+ $spec = array(
+ 1 => array('file', '/dev/null', 'w'),
+ 2 => array('file', '/dev/null', 'w'),
+ );
+ if (!self::$server = @proc_open('exec php -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) {
+ self::markTestSkipped('PHP server unable to start.');
+ }
+ sleep(1);
+ }
+
+ public static function tearDownAfterClass()
+ {
+ if (self::$server) {
+ proc_terminate(self::$server);
+ proc_close(self::$server);
+ }
+ }
+
+ /**
+ * @dataProvider provideCookie
+ */
+ public function testCookie($fixture)
+ {
+ $result = file_get_contents(sprintf('http://localhost:8054/%s.php', $fixture));
+ $this->assertStringMatchesFormatFile(__DIR__.sprintf('/Fixtures/response-functional/%s.expected', $fixture), $result);
+ }
+
+ public function provideCookie()
+ {
+ foreach (glob(__DIR__.'/Fixtures/response-functional/*.php') as $file) {
+ yield array(pathinfo($file, PATHINFO_FILENAME));
+ }
+ }
+}
diff --git a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
index ce855359..7b5e720a 100644
--- a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php
@@ -116,7 +116,7 @@ class ResponseHeaderBagTest extends TestCase
$bag->clearCookie('foo');
- $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; httponly', $bag);
+ $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0; path=/; httponly', $bag);
}
public function testClearCookieSecureNotHttpOnly()
@@ -125,7 +125,7 @@ class ResponseHeaderBagTest extends TestCase
$bag->clearCookie('foo', '/', null, true, false);
- $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; max-age=-31536001; path=/; secure', $bag);
+ $this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0; path=/; secure', $bag);
}
public function testReplace()
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
index 1a68d575..4a9fb600 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
@@ -32,7 +32,7 @@ class NativeSessionHandlerTest extends TestCase
{
$handler = new NativeSessionHandler();
- $this->assertTrue($handler instanceof \SessionHandler);
+ $this->assertInstanceOf('SessionHandler', $handler);
$this->assertTrue($handler instanceof NativeSessionHandler);
}
}
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
index a0d7529f..0a0e4490 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php
@@ -324,6 +324,41 @@ class PdoSessionHandlerTest extends TestCase
$this->assertInstanceOf('\PDO', $method->invoke($storage));
}
+ /**
+ * @dataProvider provideUrlDsnPairs
+ */
+ public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null)
+ {
+ $storage = new PdoSessionHandler($url);
+
+ $this->assertAttributeEquals($expectedDsn, 'dsn', $storage);
+
+ if (null !== $expectedUser) {
+ $this->assertAttributeEquals($expectedUser, 'username', $storage);
+ }
+
+ if (null !== $expectedPassword) {
+ $this->assertAttributeEquals($expectedPassword, 'password', $storage);
+ }
+ }
+
+ public function provideUrlDsnPairs()
+ {
+ yield array('mysql://localhost/test', 'mysql:host=localhost;dbname=test;');
+ yield array('mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;');
+ yield array('mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd');
+ yield array('postgres://localhost/test', 'pgsql:host=localhost;dbname=test;');
+ yield array('postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;');
+ yield array('postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd');
+ yield 'sqlite relative path' => array('sqlite://localhost/tmp/test', 'sqlite:tmp/test');
+ yield 'sqlite absolute path' => array('sqlite://localhost//tmp/test', 'sqlite:/tmp/test');
+ yield 'sqlite relative path without host' => array('sqlite:///tmp/test', 'sqlite:tmp/test');
+ yield 'sqlite absolute path without host' => array('sqlite3:////tmp/test', 'sqlite:/tmp/test');
+ yield array('sqlite://localhost/:memory:', 'sqlite::memory:');
+ yield array('mssql://localhost/test', 'sqlsrv:server=localhost;Database=test');
+ yield array('mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test');
+ }
+
private function createStream($content)
{
$stream = tmpfile();
diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 8fb8b422..382707b0 100644
--- a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -182,6 +182,23 @@ class NativeSessionStorageTest extends TestCase
$this->assertEquals($options, $gco);
}
+ public function testSessionOptions()
+ {
+ if (defined('HHVM_VERSION')) {
+ $this->markTestSkipped('HHVM is not handled in this test case.');
+ }
+
+ $options = array(
+ 'url_rewriter.tags' => 'a=href',
+ 'cache_expire' => '200',
+ );
+
+ $this->getStorage($options);
+
+ $this->assertSame('a=href', ini_get('url_rewriter.tags'));
+ $this->assertSame('200', ini_get('session.cache_expire'));
+ }
+
/**
* @expectedException \InvalidArgumentException
*/
diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php
index c55564c0..7bc195f2 100644
--- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php
+++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php
@@ -39,9 +39,15 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface
if (\is_array($controller) && \is_callable($controller, true) && \is_string($controller[0])) {
$controller = $controller[0].'::'.$controller[1];
+ } elseif (!\is_string($controller) || '' === $controller) {
+ return false;
}
- return \is_string($controller) && $this->container->has($controller) && $this->container->get($controller)->has($argument->getName());
+ if ('\\' === $controller[0]) {
+ $controller = ltrim($controller, '\\');
+ }
+
+ return $this->container->has($controller) && $this->container->get($controller)->has($argument->getName());
}
/**
@@ -53,6 +59,10 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface
$controller = $controller[0].'::'.$controller[1];
}
+ if ('\\' === $controller[0]) {
+ $controller = ltrim($controller, '\\');
+ }
+
yield $this->container->get($controller)->get($argument->getName());
}
}
diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
index d1e7af20..0424850e 100644
--- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
+++ b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php
@@ -58,7 +58,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
}
foreach ($reflection->getParameters() as $param) {
- $arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param), $this->isVariadic($param), $this->hasDefaultValue($param), $this->getDefaultValue($param), $param->allowsNull());
+ $arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param, $reflection), $this->isVariadic($param), $this->hasDefaultValue($param), $this->getDefaultValue($param), $param->allowsNull());
}
return $arguments;
@@ -107,23 +107,35 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
*
* @return null|string
*/
- private function getType(\ReflectionParameter $parameter)
+ private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function)
{
if ($this->supportsParameterType) {
if (!$type = $parameter->getType()) {
return;
}
- $typeName = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
- if ('array' === $typeName && !$type->isBuiltin()) {
+ $name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
+ if ('array' === $name && !$type->isBuiltin()) {
// Special case for HHVM with variadics
return;
}
-
- return $typeName;
+ } elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $name)) {
+ $name = $name[1];
+ } else {
+ return;
}
+ $lcName = strtolower($name);
- if (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $info)) {
- return $info[1];
+ if ('self' !== $lcName && 'parent' !== $lcName) {
+ return $name;
+ }
+ if (!$function instanceof \ReflectionMethod) {
+ return;
+ }
+ if ('self' === $lcName) {
+ return $function->getDeclaringClass()->name;
+ }
+ if ($parent = $function->getDeclaringClass()->getParentClass()) {
+ return $parent->name;
}
}
}
diff --git a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php
index d0ca671e..27a9a825 100644
--- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php
+++ b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php
@@ -67,7 +67,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
if ($this->stopwatch) {
$this->stopwatch->start('dump');
}
- if ($this->isCollected) {
+ if ($this->isCollected && !$this->dumper) {
$this->isCollected = false;
}
@@ -250,7 +250,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
--$i;
}
- if ('cli' !== PHP_SAPI && stripos($h[$i], 'html')) {
+ if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) {
$this->dumper = new HtmlDumper('php://output', $this->charset);
$this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
} else {
diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
index c340d9b6..1a72ac7e 100644
--- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
+++ b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php
@@ -13,6 +13,8 @@ namespace Symfony\Component\HttpKernel\Debug;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
+use Symfony\Component\Routing\Exception\ExceptionInterface;
+use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Formats debug file links.
@@ -26,6 +28,9 @@ class FileLinkFormatter implements \Serializable
private $baseDir;
private $urlFormat;
+ /**
+ * @param string|\Closure $urlFormat the URL format, or a closure that returns it on-demand
+ */
public function __construct($fileLinkFormat = null, RequestStack $requestStack = null, $baseDir = null, $urlFormat = null)
{
$fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
@@ -70,6 +75,18 @@ class FileLinkFormatter implements \Serializable
}
}
+ /**
+ * @internal
+ */
+ public static function generateUrlFormat(UrlGeneratorInterface $router, $routeName, $queryString)
+ {
+ try {
+ return $router->generate($routeName).$queryString;
+ } catch (ExceptionInterface $e) {
+ return null;
+ }
+ }
+
private function getFileLinkFormat()
{
if ($this->fileLinkFormat) {
@@ -78,6 +95,10 @@ class FileLinkFormatter implements \Serializable
if ($this->requestStack && $this->baseDir && $this->urlFormat) {
$request = $this->requestStack->getMasterRequest();
if ($request instanceof Request) {
+ if ($this->urlFormat instanceof \Closure && !$this->urlFormat = \call_user_func($this->urlFormat)) {
+ return;
+ }
+
return array(
$request->getSchemeAndHttpHost().$request->getBaseUrl().$this->urlFormat,
$this->baseDir.DIRECTORY_SEPARATOR, '',
diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
index 985dfb71..cb88594e 100644
--- a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
+++ b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php
@@ -22,6 +22,7 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\TypedReference;
+use Symfony\Component\HttpFoundation\Request;
/**
* Creates the service-locators required by ServiceValueResolver.
@@ -148,6 +149,10 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface
continue;
}
+ if (Request::class === $type) {
+ continue;
+ }
+
if ($type && !$p->isOptional() && !$p->allowsNull() && !class_exists($type) && !interface_exists($type, false)) {
$message = sprintf('Cannot determine controller argument for "%s::%s()": the $%s argument is type-hinted with the non-existent class or interface: "%s".', $class, $r->name, $p->name, $type);
diff --git a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php
index 5f0ea5c0..82061fd6 100644
--- a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php
+++ b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php
@@ -29,6 +29,8 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
*/
abstract class AbstractTestSessionListener implements EventSubscriberInterface
{
+ private $sessionId;
+
public function onKernelRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
@@ -44,7 +46,8 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface
$cookies = $event->getRequest()->cookies;
if ($cookies->has($session->getName())) {
- $session->setId($cookies->get($session->getName()));
+ $this->sessionId = $cookies->get($session->getName());
+ $session->setId($this->sessionId);
}
}
@@ -66,9 +69,10 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface
$session->save();
}
- if ($session instanceof Session ? !$session->isEmpty() : $wasStarted) {
+ if ($session instanceof Session ? !$session->isEmpty() || (null !== $this->sessionId && $session->getId() !== $this->sessionId) : $wasStarted) {
$params = session_get_cookie_params();
$event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']));
+ $this->sessionId = $session->getId();
}
}
diff --git a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php
index f18e42c7..3dfa4cd8 100644
--- a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php
+++ b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php
@@ -12,9 +12,11 @@
namespace Symfony\Component\HttpKernel\EventListener;
use Psr\Log\LoggerInterface;
+use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
@@ -33,12 +35,14 @@ class ExceptionListener implements EventSubscriberInterface
protected $controller;
protected $logger;
protected $debug;
+ private $charset;
- public function __construct($controller, LoggerInterface $logger = null, $debug = false)
+ public function __construct($controller, LoggerInterface $logger = null, $debug = false, $charset = null)
{
$this->controller = $controller;
$this->logger = $logger;
$this->debug = $debug;
+ $this->charset = $charset;
}
public function onKernelException(GetResponseForExceptionEvent $event)
@@ -117,8 +121,12 @@ class ExceptionListener implements EventSubscriberInterface
protected function duplicateRequest(\Exception $exception, Request $request)
{
$attributes = array(
- '_controller' => $this->controller,
- 'exception' => FlattenException::create($exception),
+ 'exception' => $exception = FlattenException::create($exception),
+ '_controller' => $this->controller ?: function () use ($exception) {
+ $handler = new ExceptionHandler($this->debug, $this->charset);
+
+ return new Response($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders());
+ },
'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null,
);
$request = $request->duplicate(null, null, $attributes);
diff --git a/vendor/symfony/http-kernel/EventListener/RouterListener.php b/vendor/symfony/http-kernel/EventListener/RouterListener.php
index caaf80f8..959f2ba0 100644
--- a/vendor/symfony/http-kernel/EventListener/RouterListener.php
+++ b/vendor/symfony/http-kernel/EventListener/RouterListener.php
@@ -14,6 +14,7 @@ namespace Symfony\Component\HttpKernel\EventListener;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
+use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\KernelEvents;
@@ -129,12 +130,6 @@ class RouterListener implements EventSubscriberInterface
unset($parameters['_route'], $parameters['_controller']);
$request->attributes->set('_route_params', $parameters);
} catch (ResourceNotFoundException $e) {
- if ($this->debug && $e instanceof NoConfigurationException) {
- $event->setResponse($this->createWelcomeResponse());
-
- return;
- }
-
$message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo());
if ($referer = $request->headers->get('referer')) {
@@ -149,11 +144,23 @@ class RouterListener implements EventSubscriberInterface
}
}
+ public function onKernelException(GetResponseForExceptionEvent $event)
+ {
+ if (!$this->debug || !($e = $event->getException()) instanceof NotFoundHttpException) {
+ return;
+ }
+
+ if ($e->getPrevious() instanceof NoConfigurationException) {
+ $event->setResponse($this->createWelcomeResponse());
+ }
+ }
+
public static function getSubscribedEvents()
{
return array(
KernelEvents::REQUEST => array(array('onKernelRequest', 32)),
KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)),
+ KernelEvents::EXCEPTION => array('onKernelException', -64),
);
}
diff --git a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php
index 027b2b17..672cc893 100644
--- a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php
+++ b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php
@@ -72,7 +72,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
$response->setLastModified(null);
}
- if (!$response->isFresh()) {
+ if (!$response->isFresh() || !$response->isCacheable()) {
$this->cacheable = false;
}
diff --git a/vendor/symfony/http-kernel/HttpCache/Store.php b/vendor/symfony/http-kernel/HttpCache/Store.php
index fa0d4a86..d20bfaa1 100644
--- a/vendor/symfony/http-kernel/HttpCache/Store.php
+++ b/vendor/symfony/http-kernel/HttpCache/Store.php
@@ -387,16 +387,22 @@ class Store implements StoreInterface
$tmpFile = tempnam(dirname($path), basename($path));
if (false === $fp = @fopen($tmpFile, 'wb')) {
+ @unlink($tmpFile);
+
return false;
}
@fwrite($fp, $data);
@fclose($fp);
if ($data != file_get_contents($tmpFile)) {
+ @unlink($tmpFile);
+
return false;
}
if (false === @rename($tmpFile, $path)) {
+ @unlink($tmpFile);
+
return false;
}
}
diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php
index eb2364e4..ca0f0b95 100644
--- a/vendor/symfony/http-kernel/Kernel.php
+++ b/vendor/symfony/http-kernel/Kernel.php
@@ -22,6 +22,7 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
+use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
use Symfony\Component\Filesystem\Filesystem;
@@ -32,7 +33,6 @@ use Symfony\Component\HttpKernel\Config\EnvParametersResource;
use Symfony\Component\HttpKernel\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass;
-use Symfony\Component\Config\Loader\GlobFileLoader;
use Symfony\Component\Config\Loader\LoaderResolver;
use Symfony\Component\Config\Loader\DelegatingLoader;
use Symfony\Component\Config\ConfigCache;
@@ -67,11 +67,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
private $requestStackSize = 0;
private $resetServices = false;
- const VERSION = '3.4.4';
- const VERSION_ID = 30404;
+ const VERSION = '3.4.11';
+ const VERSION_ID = 30411;
const MAJOR_VERSION = 3;
const MINOR_VERSION = 4;
- const RELEASE_VERSION = 4;
+ const RELEASE_VERSION = 11;
const EXTRA_VERSION = '';
const END_OF_MAINTENANCE = '11/2020';
@@ -587,7 +587,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
$fresh = $oldContainer = false;
try {
- if (\is_object($this->container = include $cache->getPath())) {
+ if (file_exists($cache->getPath()) && \is_object($this->container = include $cache->getPath())) {
$this->container->set('kernel', $this);
$oldContainer = $this->container;
$fresh = true;
@@ -650,7 +650,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
}
}
- if (null === $oldContainer) {
+ if (null === $oldContainer && file_exists($cache->getPath())) {
$errorLevel = error_reporting(\E_ALL ^ \E_WARNING);
try {
$oldContainer = include $cache->getPath();
@@ -670,9 +670,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
// Because concurrent requests might still be using them,
// old container files are not removed immediately,
// but on a next dump of the container.
+ static $legacyContainers = array();
$oldContainerDir = dirname($oldContainer->getFileName());
- foreach (glob(dirname($oldContainerDir).'/*.legacy') as $legacyContainer) {
- if ($oldContainerDir.'.legacy' !== $legacyContainer && @unlink($legacyContainer)) {
+ $legacyContainers[$oldContainerDir.'.legacy'] = true;
+ foreach (glob(dirname($oldContainerDir).DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
+ if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) {
(new Filesystem())->remove(substr($legacyContainer, 0, -7));
}
}
@@ -790,7 +792,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
foreach ($this->bundles as $bundle) {
if ($extension = $bundle->getContainerExtension()) {
$container->registerExtension($extension);
- $extensions[] = $extension->getAlias();
}
if ($this->debug) {
@@ -804,6 +805,10 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$this->build($container);
+ foreach ($container->getExtensions() as $extension) {
+ $extensions[] = $extension->getAlias();
+ }
+
// ensure these extensions are implicitly loaded
$container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions));
}
@@ -842,7 +847,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
$dumper = new PhpDumper($container);
if (class_exists('ProxyManager\Configuration') && class_exists('Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper')) {
- $dumper->setProxyDumper(new ProxyDumper(substr(hash('sha256', $cache->getPath()), 0, 7)));
+ $dumper->setProxyDumper(new ProxyDumper());
}
$content = $dumper->dump(array(
@@ -852,6 +857,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
'as_files' => true,
'debug' => $this->debug,
'inline_class_loader_parameter' => \PHP_VERSION_ID >= 70000 && !$this->loadClassCache && !class_exists(ClassCollectionLoader::class, false) ? 'container.dumper.inline_class_loader' : null,
+ 'build_time' => $container->hasParameter('kernel.container_build_time') ? $container->getParameter('kernel.container_build_time') : time(),
));
$rootCode = array_pop($content);
@@ -880,7 +886,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
new YamlFileLoader($container, $locator),
new IniFileLoader($container, $locator),
new PhpFileLoader($container, $locator),
- new GlobFileLoader($locator),
+ new GlobFileLoader($container, $locator),
new DirectoryLoader($container, $locator),
new ClosureLoader($container),
));
diff --git a/vendor/symfony/http-kernel/KernelInterface.php b/vendor/symfony/http-kernel/KernelInterface.php
index b341e3e9..9ec4e7a9 100644
--- a/vendor/symfony/http-kernel/KernelInterface.php
+++ b/vendor/symfony/http-kernel/KernelInterface.php
@@ -27,7 +27,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable
/**
* Returns an array of bundles to register.
*
- * @return BundleInterface[] An array of bundle instances
+ * @return iterable|BundleInterface[] An iterable of bundle instances
*/
public function registerBundles();
diff --git a/vendor/symfony/http-kernel/Profiler/Profiler.php b/vendor/symfony/http-kernel/Profiler/Profiler.php
index 15bfbc5a..6245a21b 100644
--- a/vendor/symfony/http-kernel/Profiler/Profiler.php
+++ b/vendor/symfony/http-kernel/Profiler/Profiler.php
@@ -37,7 +37,7 @@ class Profiler
private $enabled = true;
/**
- * @param bool $enable The initial enabled state
+ * @param bool $enable The initial enabled state
*/
public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null, $enable = true)
{
diff --git a/vendor/symfony/http-kernel/Resources/welcome.html.php b/vendor/symfony/http-kernel/Resources/welcome.html.php
index d8c37beb..caac7fd6 100644
--- a/vendor/symfony/http-kernel/Resources/welcome.html.php
+++ b/vendor/symfony/http-kernel/Resources/welcome.html.php
@@ -76,7 +76,7 @@
- You're seeing this message because you have debug mode enabled and you haven't configured any URLs.
+ You're seeing this page because debug mode is enabled and you haven't configured any homepage URL.
diff --git a/vendor/symfony/http-kernel/Tests/ClientTest.php b/vendor/symfony/http-kernel/Tests/ClientTest.php
index 1ac72c73..b774d8ec 100644
--- a/vendor/symfony/http-kernel/Tests/ClientTest.php
+++ b/vendor/symfony/http-kernel/Tests/ClientTest.php
@@ -60,22 +60,17 @@ class ClientTest extends TestCase
$m = $r->getMethod('filterResponse');
$m->setAccessible(true);
- $expected = array(
- 'foo=bar; expires=Sun, 15-Feb-2009 20:00:00 GMT; max-age='.(strtotime('Sun, 15-Feb-2009 20:00:00 GMT') - time()).'; path=/foo; domain=http://example.com; secure; httponly',
- 'foo1=bar1; expires=Sun, 15-Feb-2009 20:00:00 GMT; max-age='.(strtotime('Sun, 15-Feb-2009 20:00:00 GMT') - time()).'; path=/foo; domain=http://example.com; secure; httponly',
- );
+ $response = new Response();
+ $response->headers->setCookie($cookie1 = new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
+ $domResponse = $m->invoke($client, $response);
+ $this->assertSame((string) $cookie1, $domResponse->getHeader('Set-Cookie'));
$response = new Response();
- $response->headers->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
+ $response->headers->setCookie($cookie1 = new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
+ $response->headers->setCookie($cookie2 = new Cookie('foo1', 'bar1', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
$domResponse = $m->invoke($client, $response);
- $this->assertEquals($expected[0], $domResponse->getHeader('Set-Cookie'));
-
- $response = new Response();
- $response->headers->setCookie(new Cookie('foo', 'bar', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
- $response->headers->setCookie(new Cookie('foo1', 'bar1', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true));
- $domResponse = $m->invoke($client, $response);
- $this->assertEquals($expected[0], $domResponse->getHeader('Set-Cookie'));
- $this->assertEquals($expected, $domResponse->getHeader('Set-Cookie', false));
+ $this->assertSame((string) $cookie1, $domResponse->getHeader('Set-Cookie'));
+ $this->assertSame(array((string) $cookie1, (string) $cookie2), $domResponse->getHeader('Set-Cookie', false));
}
public function testFilterResponseSupportsStreamedResponses()
@@ -97,6 +92,7 @@ class ClientTest extends TestCase
public function testUploadedFile()
{
$source = tempnam(sys_get_temp_dir(), 'source');
+ file_put_contents($source, '1');
$target = sys_get_temp_dir().'/sf.moved.file';
@unlink($target);
@@ -104,8 +100,8 @@ class ClientTest extends TestCase
$client = new Client($kernel);
$files = array(
- array('tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 123, 'error' => UPLOAD_ERR_OK),
- new UploadedFile($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true),
+ array('tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => 1, 'error' => UPLOAD_ERR_OK),
+ new UploadedFile($source, 'original', 'mime/original', 1, UPLOAD_ERR_OK, true),
);
$file = null;
@@ -120,7 +116,7 @@ class ClientTest extends TestCase
$this->assertEquals('original', $file->getClientOriginalName());
$this->assertEquals('mime/original', $file->getClientMimeType());
- $this->assertEquals('123', $file->getClientSize());
+ $this->assertSame(1, $file->getClientSize());
$this->assertTrue($file->isValid());
}
diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php
index b05828f5..7d34172c 100644
--- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php
+++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php
@@ -47,6 +47,25 @@ class ServiceValueResolverTest extends TestCase
$this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument));
}
+ public function testExistingControllerWithATrailingBackSlash()
+ {
+ $resolver = new ServiceValueResolver(new ServiceLocator(array(
+ 'App\\Controller\\Mine::method' => function () {
+ return new ServiceLocator(array(
+ 'dummy' => function () {
+ return new DummyService();
+ },
+ ));
+ },
+ )));
+
+ $request = $this->requestWithAttributes(array('_controller' => '\\App\\Controller\\Mine::method'));
+ $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null);
+
+ $this->assertTrue($resolver->supports($request, $argument));
+ $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument));
+ }
+
public function testControllerNameIsAnArray()
{
$resolver = new ServiceValueResolver(new ServiceLocator(array(
diff --git a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
index b4b449f3..bf0db5ad 100644
--- a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
+++ b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php
@@ -126,11 +126,11 @@ class ArgumentMetadataFactoryTest extends TestCase
), $arguments);
}
- private function signature1(ArgumentMetadataFactoryTest $foo, array $bar, callable $baz)
+ private function signature1(self $foo, array $bar, callable $baz)
{
}
- private function signature2(ArgumentMetadataFactoryTest $foo = null, FakeClassThatDoesNotExist $bar = null, ImportedAndFake $baz = null)
+ private function signature2(self $foo = null, FakeClassThatDoesNotExist $bar = null, ImportedAndFake $baz = null)
{
}
diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php
index fc4b92b5..d809331c 100644
--- a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php
+++ b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php
@@ -16,6 +16,7 @@ use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\VarDumper\Cloner\Data;
+use Symfony\Component\VarDumper\Dumper\CliDumper;
/**
* @author Nicolas Grekas
@@ -66,7 +67,7 @@ class DumpDataCollectorTest extends TestCase
ob_start();
$collector->collect(new Request(), new Response());
- $output = ob_get_clean();
+ $output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
$this->assertSame(1, $collector->getDumpsCount());
@@ -110,6 +111,28 @@ EOTXT;
ob_start();
$collector->__destruct();
- $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean());
+ $output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
+ $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output);
+ }
+
+ public function testFlushNothingWhenDataDumperIsProvided()
+ {
+ $data = new Data(array(array(456)));
+ $dumper = new CliDumper('php://output');
+ $collector = new DumpDataCollector(null, null, null, null, $dumper);
+
+ ob_start();
+ $collector->dump($data);
+ $line = __LINE__ - 1;
+ $output = preg_replace("/\033\[[^m]*m/", '', ob_get_clean());
+ if (\PHP_VERSION_ID >= 50400) {
+ $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", $output);
+ } else {
+ $this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", $output);
+ }
+
+ ob_start();
+ $collector->__destruct();
+ $this->assertEmpty(ob_get_clean());
}
}
diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php
index d28c6eca..e8957bb3 100644
--- a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php
+++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php
@@ -12,8 +12,10 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
-use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass;
use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;
@@ -22,73 +24,37 @@ class FragmentRendererPassTest extends TestCase
{
/**
* Tests that content rendering not implementing FragmentRendererInterface
- * trigger an exception.
+ * triggers an exception.
*
* @expectedException \InvalidArgumentException
*/
public function testContentRendererWithoutInterface()
{
- // one service, not implementing any interface
- $services = array(
- 'my_content_renderer' => array(array('alias' => 'foo')),
- );
-
- $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
-
- $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition'))->getMock();
- $builder->expects($this->any())
- ->method('hasDefinition')
- ->will($this->returnValue(true));
-
- // We don't test kernel.fragment_renderer here
- $builder->expects($this->atLeastOnce())
- ->method('findTaggedServiceIds')
- ->will($this->returnValue($services));
-
- $builder->expects($this->atLeastOnce())
- ->method('getDefinition')
- ->will($this->returnValue($definition));
+ $builder = new ContainerBuilder();
+ $fragmentHandlerDefinition = $builder->register('fragment.handler');
+ $builder->register('my_content_renderer', 'Symfony\Component\DependencyInjection\Definition')
+ ->addTag('kernel.fragment_renderer', array('alias' => 'foo'));
$pass = new FragmentRendererPass();
$pass->process($builder);
+
+ $this->assertEquals(array(array('addRendererService', array('foo', 'my_content_renderer'))), $fragmentHandlerDefinition->getMethodCalls());
}
public function testValidContentRenderer()
{
- $services = array(
- 'my_content_renderer' => array(array('alias' => 'foo')),
- );
-
- $renderer = new Definition('', array(null));
-
- $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
- $definition->expects($this->atLeastOnce())
- ->method('getClass')
- ->will($this->returnValue('Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService'));
-
- $builder = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('hasDefinition', 'findTaggedServiceIds', 'getDefinition', 'getReflectionClass'))->getMock();
- $builder->expects($this->any())
- ->method('hasDefinition')
- ->will($this->returnValue(true));
-
- // We don't test kernel.fragment_renderer here
- $builder->expects($this->atLeastOnce())
- ->method('findTaggedServiceIds')
- ->will($this->returnValue($services));
-
- $builder->expects($this->atLeastOnce())
- ->method('getDefinition')
- ->will($this->onConsecutiveCalls($renderer, $definition));
-
- $builder->expects($this->atLeastOnce())
- ->method('getReflectionClass')
- ->with('Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService')
- ->will($this->returnValue(new \ReflectionClass('Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService')));
+ $builder = new ContainerBuilder();
+ $fragmentHandlerDefinition = $builder->register('fragment.handler')
+ ->addArgument(null);
+ $builder->register('my_content_renderer', 'Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService')
+ ->addTag('kernel.fragment_renderer', array('alias' => 'foo'));
$pass = new FragmentRendererPass();
$pass->process($builder);
- $this->assertInstanceOf(Reference::class, $renderer->getArgument(0));
+ $serviceLocatorDefinition = $builder->getDefinition((string) $fragmentHandlerDefinition->getArgument(0));
+ $this->assertSame(ServiceLocator::class, $serviceLocatorDefinition->getClass());
+ $this->assertEquals(array('foo' => new ServiceClosureArgument(new Reference('my_content_renderer'))), $serviceLocatorDefinition->getArgument(0));
}
}
diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php
index 81fc8b45..ae421d91 100644
--- a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php
+++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php
@@ -12,44 +12,39 @@
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use PHPUnit\Framework\TestCase;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
class MergeExtensionConfigurationPassTest extends TestCase
{
public function testAutoloadMainExtension()
{
- $container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerBuilder')->setMethods(array('getExtensionConfig', 'loadFromExtension', 'getParameterBag', 'getDefinitions', 'getAliases', 'getExtensions'))->getMock();
- $params = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag')->getMock();
+ $container = new ContainerBuilder();
+ $container->registerExtension(new LoadedExtension());
+ $container->registerExtension(new NotLoadedExtension());
+ $container->loadFromExtension('loaded', array());
- $container->expects($this->at(0))
- ->method('getExtensionConfig')
- ->with('loaded')
- ->will($this->returnValue(array(array())));
- $container->expects($this->at(1))
- ->method('getExtensionConfig')
- ->with('notloaded')
- ->will($this->returnValue(array()));
- $container->expects($this->once())
- ->method('loadFromExtension')
- ->with('notloaded', array());
-
- $container->expects($this->any())
- ->method('getParameterBag')
- ->will($this->returnValue($params));
- $params->expects($this->any())
- ->method('all')
- ->will($this->returnValue(array()));
- $container->expects($this->any())
- ->method('getDefinitions')
- ->will($this->returnValue(array()));
- $container->expects($this->any())
- ->method('getAliases')
- ->will($this->returnValue(array()));
- $container->expects($this->any())
- ->method('getExtensions')
- ->will($this->returnValue(array()));
-
- $configPass = new MergeExtensionConfigurationPass(array('loaded', 'notloaded'));
+ $configPass = new MergeExtensionConfigurationPass(array('loaded', 'not_loaded'));
$configPass->process($container);
+
+ $this->assertTrue($container->hasDefinition('loaded.foo'));
+ $this->assertTrue($container->hasDefinition('not_loaded.bar'));
+ }
+}
+
+class LoadedExtension extends Extension
+{
+ public function load(array $configs, ContainerBuilder $container)
+ {
+ $container->register('loaded.foo');
+ }
+}
+
+class NotLoadedExtension extends Extension
+{
+ public function load(array $configs, ContainerBuilder $container)
+ {
+ $container->register('not_loaded.bar');
}
}
diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php
index 3cb0b298..b607bf90 100644
--- a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php
+++ b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php
@@ -151,6 +151,23 @@ class ExceptionListenerTest extends TestCase
$this->assertFalse($response->headers->has('content-security-policy'), 'CSP header has been removed');
$this->assertFalse($dispatcher->hasListeners(KernelEvents::RESPONSE), 'CSP removal listener has been removed');
}
+
+ public function testNullController()
+ {
+ $listener = new ExceptionListener(null);
+ $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) {
+ $controller = $request->attributes->get('_controller');
+
+ return $controller();
+ }));
+ $request = Request::create('/');
+ $event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo'));
+
+ $listener->onKernelException($event);
+
+ $this->assertContains('Whoops, looks like something went wrong.', $event->getResponse()->getContent());
+ }
}
class TestLogger extends Logger implements DebugLoggerInterface
diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php
index 4452f487..22a2b712 100644
--- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php
+++ b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php
@@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ServiceSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\EventListener\SessionListener;
@@ -44,6 +45,9 @@ class TestSessionListenerTest extends TestCase
{
$this->listener = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\EventListener\AbstractTestSessionListener');
$this->session = $this->getSession();
+ $this->listener->expects($this->any())
+ ->method('getSession')
+ ->will($this->returnValue($this->session));
}
public function testShouldSaveMasterRequestSession()
@@ -86,6 +90,22 @@ class TestSessionListenerTest extends TestCase
$this->assertSame(array(), $response->headers->getCookies());
}
+ public function testEmptySessionWithNewSessionIdDoesSendCookie()
+ {
+ $this->sessionHasBeenStarted();
+ $this->sessionIsEmpty();
+ $this->fixSessionId('456');
+
+ $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock();
+ $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123'));
+ $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
+ $this->listener->onKernelRequest($event);
+
+ $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST);
+
+ $this->assertNotEmpty($response->headers->getCookies());
+ }
+
public function testUnstartedSessionIsNotSave()
{
$this->sessionHasNotBeenStarted();
@@ -150,6 +170,13 @@ class TestSessionListenerTest extends TestCase
->will($this->returnValue(true));
}
+ private function fixSessionId($sessionId)
+ {
+ $this->session->expects($this->any())
+ ->method('getId')
+ ->will($this->returnValue($sessionId));
+ }
+
private function getSession()
{
$mock = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Session')
diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php
index 760366c6..05d8d787 100644
--- a/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php
+++ b/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php
@@ -6,21 +6,6 @@ use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
class UnprocessableEntityHttpExceptionTest extends HttpExceptionTest
{
- /**
- * Test that setting the headers using the setter function
- * is working as expected.
- *
- * @param array $headers The headers to set
- *
- * @dataProvider headerDataProvider
- */
- public function testHeadersSetter($headers)
- {
- $exception = new UnprocessableEntityHttpException(10);
- $exception->setHeaders($headers);
- $this->assertSame($headers, $exception->getHeaders());
- }
-
protected function createException()
{
return new UnprocessableEntityHttpException();
diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php
index d47287a1..4dae039c 100644
--- a/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php
+++ b/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php
@@ -6,17 +6,7 @@ use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException;
class UnsupportedMediaTypeHttpExceptionTest extends HttpExceptionTest
{
- /**
- * @dataProvider headerDataProvider
- */
- public function testHeadersSetter($headers)
- {
- $exception = new UnsupportedMediaTypeHttpException(10);
- $exception->setHeaders($headers);
- $this->assertSame($headers, $exception->getHeaders());
- }
-
- protected function createException($headers = array())
+ protected function createException()
{
return new UnsupportedMediaTypeHttpException();
}
diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php
index 5e4c3222..6d67a177 100644
--- a/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php
+++ b/vendor/symfony/http-kernel/Tests/HttpCache/ResponseCacheStrategyTest.php
@@ -175,8 +175,26 @@ class ResponseCacheStrategyTest extends TestCase
$cacheStrategy->update($masterResponse);
$this->assertTrue($masterResponse->headers->hasCacheControlDirective('private'));
- // Not sure if we should pass "max-age: 60" in this case, as long as the response is private and
- // that's the more conservative of both the master and embedded response...?
+ $this->assertFalse($masterResponse->headers->hasCacheControlDirective('public'));
+ }
+
+ public function testEmbeddingPublicResponseDoesNotMakeMainResponsePublic()
+ {
+ $cacheStrategy = new ResponseCacheStrategy();
+
+ $masterResponse = new Response();
+ $masterResponse->setPrivate(); // this is the default, but let's be explicit
+ $masterResponse->setMaxAge(100);
+
+ $embeddedResponse = new Response();
+ $embeddedResponse->setPublic();
+ $embeddedResponse->setSharedMaxAge(100);
+
+ $cacheStrategy->add($embeddedResponse);
+ $cacheStrategy->update($masterResponse);
+
+ $this->assertTrue($masterResponse->headers->hasCacheControlDirective('private'));
+ $this->assertFalse($masterResponse->headers->hasCacheControlDirective('public'));
}
public function testResponseIsExiprableWhenEmbeddedResponseCombinesExpiryAndValidation()
diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php
index 755e1db2..a16ac37d 100644
--- a/vendor/symfony/http-kernel/Tests/KernelTest.php
+++ b/vendor/symfony/http-kernel/Tests/KernelTest.php
@@ -849,14 +849,14 @@ EOF;
$kernel = new CustomProjectDirKernel();
$kernel->boot();
- $this->assertSame($containerClass, get_class($kernel->getContainer()));
+ $this->assertInstanceOf($containerClass, $kernel->getContainer());
$this->assertFileExists($containerFile);
unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta');
$kernel = new CustomProjectDirKernel(function ($container) { $container->register('foo', 'stdClass')->setPublic(true); });
$kernel->boot();
- $this->assertTrue(get_class($kernel->getContainer()) !== $containerClass);
+ $this->assertNotInstanceOf($containerClass, $kernel->getContainer());
$this->assertFileExists($containerFile);
$this->assertFileExists(dirname($containerFile).'.legacy');
}
diff --git a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php b/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php
index 99ff2075..a1db1d9c 100644
--- a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php
+++ b/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php
@@ -83,22 +83,22 @@ class FileProfilerStorageTest extends TestCase
$profile = new Profile('simple_quote');
$profile->setUrl('http://foo.bar/\'');
$this->storage->write($profile);
- $this->assertTrue(false !== $this->storage->read('simple_quote'), '->write() accepts single quotes in URL');
+ $this->assertNotFalse($this->storage->read('simple_quote'), '->write() accepts single quotes in URL');
$profile = new Profile('double_quote');
$profile->setUrl('http://foo.bar/"');
$this->storage->write($profile);
- $this->assertTrue(false !== $this->storage->read('double_quote'), '->write() accepts double quotes in URL');
+ $this->assertNotFalse($this->storage->read('double_quote'), '->write() accepts double quotes in URL');
$profile = new Profile('backslash');
$profile->setUrl('http://foo.bar/\\');
$this->storage->write($profile);
- $this->assertTrue(false !== $this->storage->read('backslash'), '->write() accepts backslash in URL');
+ $this->assertNotFalse($this->storage->read('backslash'), '->write() accepts backslash in URL');
$profile = new Profile('comma');
$profile->setUrl('http://foo.bar/,');
$this->storage->write($profile);
- $this->assertTrue(false !== $this->storage->read('comma'), '->write() accepts comma in URL');
+ $this->assertNotFalse($this->storage->read('comma'), '->write() accepts comma in URL');
}
public function testStoreDuplicateToken()
@@ -247,7 +247,7 @@ class FileProfilerStorageTest extends TestCase
$profile->setMethod('GET');
$this->storage->write($profile);
- $this->assertTrue(false !== $this->storage->read('token1'));
+ $this->assertNotFalse($this->storage->read('token1'));
$this->assertCount(1, $this->storage->find('127.0.0.1', '', 10, 'GET'));
$profile = new Profile('token2');
@@ -256,7 +256,7 @@ class FileProfilerStorageTest extends TestCase
$profile->setMethod('GET');
$this->storage->write($profile);
- $this->assertTrue(false !== $this->storage->read('token2'));
+ $this->assertNotFalse($this->storage->read('token2'));
$this->assertCount(2, $this->storage->find('127.0.0.1', '', 10, 'GET'));
$this->storage->purge();
diff --git a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php
index 243c3c5c..2d5f0ca5 100644
--- a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php
+++ b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php
@@ -44,7 +44,7 @@ class ProfilerTest extends TestCase
public function testReset()
{
$collector = $this->getMockBuilder(DataCollectorInterface::class)
- ->setMethods(['collect', 'getName', 'reset'])
+ ->setMethods(array('collect', 'getName', 'reset'))
->getMock();
$collector->expects($this->any())->method('getName')->willReturn('mock');
$collector->expects($this->once())->method('reset');
diff --git a/vendor/symfony/http-kernel/composer.json b/vendor/symfony/http-kernel/composer.json
index b3367576..17c0544c 100644
--- a/vendor/symfony/http-kernel/composer.json
+++ b/vendor/symfony/http-kernel/composer.json
@@ -20,6 +20,7 @@
"symfony/event-dispatcher": "~2.8|~3.0|~4.0",
"symfony/http-foundation": "^3.4.4|^4.0.4",
"symfony/debug": "~2.8|~3.0|~4.0",
+ "symfony/polyfill-ctype": "~1.8",
"psr/log": "~1.0"
},
"require-dev": {
@@ -28,7 +29,7 @@
"symfony/config": "~2.8|~3.0|~4.0",
"symfony/console": "~2.8|~3.0|~4.0",
"symfony/css-selector": "~2.8|~3.0|~4.0",
- "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/dependency-injection": "^3.4.5|^4.0.5",
"symfony/dom-crawler": "~2.8|~3.0|~4.0",
"symfony/expression-language": "~2.8|~3.0|~4.0",
"symfony/finder": "~2.8|~3.0|~4.0",
@@ -45,7 +46,7 @@
},
"conflict": {
"symfony/config": "<2.8",
- "symfony/dependency-injection": "<3.4",
+ "symfony/dependency-injection": "<3.4.5|<4.0.5,>=4",
"symfony/var-dumper": "<3.3",
"twig/twig": "<1.34|<2.4,>=2"
},
diff --git a/vendor/symfony/polyfill-ctype/Ctype.php b/vendor/symfony/polyfill-ctype/Ctype.php
new file mode 100644
index 00000000..58414dc7
--- /dev/null
+++ b/vendor/symfony/polyfill-ctype/Ctype.php
@@ -0,0 +1,227 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Polyfill\Ctype;
+
+/**
+ * Ctype implementation through regex.
+ *
+ * @internal
+ *
+ * @author Gert de Pagter
+ */
+final class Ctype
+{
+ /**
+ * Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise.
+ *
+ * @see https://php.net/ctype-alnum
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_alnum($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text is a letter, FALSE otherwise.
+ *
+ * @see https://php.net/ctype-alpha
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_alpha($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise.
+ *
+ * @see https://php.net/ctype-cntrl
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_cntrl($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise.
+ *
+ * @see https://php.net/ctype-digit
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_digit($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise.
+ *
+ * @see https://php.net/ctype-graph
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_graph($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text is a lowercase letter.
+ *
+ * @see https://php.net/ctype-lower
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_lower($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all.
+ *
+ * @see https://php.net/ctype-print
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_print($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise.
+ *
+ * @see https://php.net/ctype-punct
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_punct($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters.
+ *
+ * @see https://php.net/ctype-space
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_space($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text is an uppercase letter.
+ *
+ * @see https://php.net/ctype-upper
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_upper($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
+ }
+
+ /**
+ * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise.
+ *
+ * @see https://php.net/ctype-xdigit
+ *
+ * @param string|int $text
+ *
+ * @return bool
+ */
+ public static function ctype_xdigit($text)
+ {
+ $text = self::convert_int_to_char_for_ctype($text);
+
+ return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
+ }
+
+ /**
+ * Converts integers to their char versions according to normal ctype behaviour, if needed.
+ *
+ * If an integer between -128 and 255 inclusive is provided,
+ * it is interpreted as the ASCII value of a single character
+ * (negative values have 256 added in order to allow characters in the Extended ASCII range).
+ * Any other integer is interpreted as a string containing the decimal digits of the integer.
+ *
+ * @param string|int $int
+ *
+ * @return mixed
+ */
+ private static function convert_int_to_char_for_ctype($int)
+ {
+ if (!\is_int($int)) {
+ return $int;
+ }
+
+ if ($int < -128 || $int > 255) {
+ return (string) $int;
+ }
+
+ if ($int < 0) {
+ $int += 256;
+ }
+
+ return \chr($int);
+ }
+}
diff --git a/vendor/symfony/polyfill-ctype/LICENSE b/vendor/symfony/polyfill-ctype/LICENSE
new file mode 100644
index 00000000..ad399a79
--- /dev/null
+++ b/vendor/symfony/polyfill-ctype/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2018 Fabien Potencier
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/symfony/polyfill-ctype/README.md b/vendor/symfony/polyfill-ctype/README.md
new file mode 100644
index 00000000..8add1ab0
--- /dev/null
+++ b/vendor/symfony/polyfill-ctype/README.md
@@ -0,0 +1,12 @@
+Symfony Polyfill / Ctype
+========================
+
+This component provides `ctype_*` functions to users who run php versions without the ctype extension.
+
+More information can be found in the
+[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).
+
+License
+=======
+
+This library is released under the [MIT license](LICENSE).
diff --git a/vendor/symfony/polyfill-ctype/bootstrap.php b/vendor/symfony/polyfill-ctype/bootstrap.php
new file mode 100644
index 00000000..14d1d0fa
--- /dev/null
+++ b/vendor/symfony/polyfill-ctype/bootstrap.php
@@ -0,0 +1,26 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Symfony\Polyfill\Ctype as p;
+
+if (!function_exists('ctype_alnum')) {
+ function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
+ function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
+ function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
+ function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
+ function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
+ function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
+ function ctype_print($text) { return p\Ctype::ctype_print($text); }
+ function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
+ function ctype_space($text) { return p\Ctype::ctype_space($text); }
+ function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
+ function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
+}
diff --git a/vendor/symfony/polyfill-ctype/composer.json b/vendor/symfony/polyfill-ctype/composer.json
new file mode 100644
index 00000000..0504dda0
--- /dev/null
+++ b/vendor/symfony/polyfill-ctype/composer.json
@@ -0,0 +1,31 @@
+{
+ "name": "symfony/polyfill-ctype",
+ "type": "library",
+ "description": "Symfony polyfill for ctype functions",
+ "keywords": ["polyfill", "compatibility", "portable", "ctype"],
+ "homepage": "https://symfony.com",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Gert de Pagter",
+ "email": "BackEndTea@gmail.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "autoload": {
+ "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" },
+ "files": [ "bootstrap.php" ]
+ },
+ "minimum-stability": "dev",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.8-dev"
+ }
+ }
+}
diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php
index 67cf9ab8..4bd326e5 100644
--- a/vendor/symfony/polyfill-mbstring/Mbstring.php
+++ b/vendor/symfony/polyfill-mbstring/Mbstring.php
@@ -78,7 +78,7 @@ final class Mbstring
public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
{
- if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
+ if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
$fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
} else {
$fromEncoding = self::getEncoding($fromEncoding);
@@ -140,16 +140,16 @@ final class Mbstring
public static function mb_decode_numericentity($s, $convmap, $encoding = null)
{
- if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) {
+ if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
return null;
}
- if (!is_array($convmap) || !$convmap) {
+ if (!\is_array($convmap) || !$convmap) {
return false;
}
- if (null !== $encoding && !is_scalar($encoding)) {
+ if (null !== $encoding && !\is_scalar($encoding)) {
trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
return ''; // Instead of null (cf. mb_encode_numericentity).
}
@@ -170,7 +170,7 @@ final class Mbstring
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
}
- $cnt = floor(count($convmap) / 4) * 4;
+ $cnt = floor(\count($convmap) / 4) * 4;
for ($i = 0; $i < $cnt; $i += 4) {
// collector_decode_htmlnumericentity ignores $convmap[$i + 3]
@@ -197,21 +197,21 @@ final class Mbstring
public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
{
- if (null !== $s && !is_scalar($s) && !(is_object($s) && method_exists($s, '__toString'))) {
+ if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING);
return null;
}
- if (!is_array($convmap) || !$convmap) {
+ if (!\is_array($convmap) || !$convmap) {
return false;
}
- if (null !== $encoding && !is_scalar($encoding)) {
+ if (null !== $encoding && !\is_scalar($encoding)) {
trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING);
return null; // Instead of '' (cf. mb_decode_numericentity).
}
- if (null !== $is_hex && !is_scalar($is_hex)) {
+ if (null !== $is_hex && !\is_scalar($is_hex)) {
trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING);
return null;
}
@@ -234,9 +234,9 @@ final class Mbstring
static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
- $cnt = floor(count($convmap) / 4) * 4;
+ $cnt = floor(\count($convmap) / 4) * 4;
$i = 0;
- $len = strlen($s);
+ $len = \strlen($s);
$result = '';
while ($i < $len) {
@@ -305,7 +305,7 @@ final class Mbstring
static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
$i = 0;
- $len = strlen($s);
+ $len = \strlen($s);
while ($i < $len) {
$ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
@@ -314,7 +314,7 @@ final class Mbstring
if (isset($map[$uchr])) {
$uchr = $map[$uchr];
- $nlen = strlen($uchr);
+ $nlen = \strlen($uchr);
if ($nlen == $ulen) {
$nlen = $i;
@@ -404,7 +404,7 @@ final class Mbstring
if (null === $encodingList) {
$encodingList = self::$encodingList;
} else {
- if (!is_array($encodingList)) {
+ if (!\is_array($encodingList)) {
$encodingList = array_map('trim', explode(',', $encodingList));
}
$encodingList = array_map('strtoupper', $encodingList);
@@ -441,7 +441,7 @@ final class Mbstring
return self::$encodingList;
}
- if (!is_array($encodingList)) {
+ if (!\is_array($encodingList)) {
$encodingList = array_map('trim', explode(',', $encodingList));
}
$encodingList = array_map('strtoupper', $encodingList);
@@ -467,7 +467,7 @@ final class Mbstring
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
- return strlen($s);
+ return \strlen($s);
}
return @iconv_strlen($s, $encoding);
@@ -679,13 +679,13 @@ final class Mbstring
public static function mb_chr($code, $encoding = null)
{
if (0x80 > $code %= 0x200000) {
- $s = chr($code);
+ $s = \chr($code);
} elseif (0x800 > $code) {
- $s = chr(0xC0 | $code >> 6).chr(0x80 | $code & 0x3F);
+ $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
} elseif (0x10000 > $code) {
- $s = chr(0xE0 | $code >> 12).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
+ $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
} else {
- $s = chr(0xF0 | $code >> 18).chr(0x80 | $code >> 12 & 0x3F).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
+ $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
}
if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
@@ -735,7 +735,7 @@ final class Mbstring
while (isset($m[$i])) {
if (0x80 > $m[$i]) {
- $entities .= chr($m[$i++]);
+ $entities .= \chr($m[$i++]);
continue;
}
if (0xF0 <= $m[$i]) {
diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json
index 4febcdd5..49b720dd 100644
--- a/vendor/symfony/polyfill-mbstring/composer.json
+++ b/vendor/symfony/polyfill-mbstring/composer.json
@@ -28,7 +28,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.7-dev"
+ "dev-master": "1.8-dev"
}
}
}
diff --git a/vendor/symfony/polyfill-php70/Php70.php b/vendor/symfony/polyfill-php70/Php70.php
index 8e784506..39e66450 100644
--- a/vendor/symfony/polyfill-php70/Php70.php
+++ b/vendor/symfony/polyfill-php70/Php70.php
@@ -60,12 +60,12 @@ final class Php70
restore_error_handler();
}
- public static function intArg($value, $caller, $pos)
+ private static function intArg($value, $caller, $pos)
{
- if (is_int($value)) {
+ if (\is_int($value)) {
return $value;
}
- if (!is_numeric($value) || PHP_INT_MAX <= ($value += 0) || ~PHP_INT_MAX >= $value) {
+ if (!\is_numeric($value) || PHP_INT_MAX <= ($value += 0) || ~PHP_INT_MAX >= $value) {
throw new \TypeError(sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, gettype($value)));
}
diff --git a/vendor/symfony/polyfill-php70/composer.json b/vendor/symfony/polyfill-php70/composer.json
index 88ff357a..871045d2 100644
--- a/vendor/symfony/polyfill-php70/composer.json
+++ b/vendor/symfony/polyfill-php70/composer.json
@@ -27,7 +27,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.7-dev"
+ "dev-master": "1.8-dev"
}
}
}
diff --git a/vendor/symfony/process/ExecutableFinder.php b/vendor/symfony/process/ExecutableFinder.php
index d042a5b1..1ec6526d 100644
--- a/vendor/symfony/process/ExecutableFinder.php
+++ b/vendor/symfony/process/ExecutableFinder.php
@@ -77,7 +77,7 @@ class ExecutableFinder
}
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
- if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
+ if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || @is_executable($file))) {
return $file;
}
}
diff --git a/vendor/symfony/process/PhpExecutableFinder.php b/vendor/symfony/process/PhpExecutableFinder.php
index db31cc1b..67015902 100644
--- a/vendor/symfony/process/PhpExecutableFinder.php
+++ b/vendor/symfony/process/PhpExecutableFinder.php
@@ -44,12 +44,12 @@ class PhpExecutableFinder
}
// PHP_BINARY return the current sapi executable
- if (PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
+ if (PHP_BINARY && \in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
return PHP_BINARY.$args;
}
if ($php = getenv('PHP_PATH')) {
- if (!is_executable($php)) {
+ if (!@is_executable($php)) {
return false;
}
@@ -57,11 +57,15 @@ class PhpExecutableFinder
}
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
- if (is_executable($php)) {
+ if (@is_executable($php)) {
return $php;
}
}
+ if (@is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
+ return $php;
+ }
+
$dirs = array(PHP_BINDIR);
if ('\\' === DIRECTORY_SEPARATOR) {
$dirs[] = 'C:\xampp\php\\';
diff --git a/vendor/symfony/process/Pipes/AbstractPipes.php b/vendor/symfony/process/Pipes/AbstractPipes.php
index 2bd1fe75..9a7d88be 100644
--- a/vendor/symfony/process/Pipes/AbstractPipes.php
+++ b/vendor/symfony/process/Pipes/AbstractPipes.php
@@ -25,6 +25,7 @@ abstract class AbstractPipes implements PipesInterface
private $inputBuffer = '';
private $input;
private $blocked = true;
+ private $lastError;
/**
* @param resource|string|int|float|bool|\Iterator|null $input
@@ -58,10 +59,11 @@ abstract class AbstractPipes implements PipesInterface
*/
protected function hasSystemCallBeenInterrupted()
{
- $lastError = error_get_last();
+ $lastError = $this->lastError;
+ $this->lastError = null;
// stream_select returns false when the `select` system call is interrupted by an incoming signal
- return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
+ return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
}
/**
@@ -165,4 +167,12 @@ abstract class AbstractPipes implements PipesInterface
return array($this->pipes[0]);
}
}
+
+ /**
+ * @internal
+ */
+ public function handleError($type, $msg)
+ {
+ $this->lastError = $msg;
+ }
}
diff --git a/vendor/symfony/process/Pipes/UnixPipes.php b/vendor/symfony/process/Pipes/UnixPipes.php
index 78ffee7b..254df519 100644
--- a/vendor/symfony/process/Pipes/UnixPipes.php
+++ b/vendor/symfony/process/Pipes/UnixPipes.php
@@ -99,7 +99,9 @@ class UnixPipes extends AbstractPipes
unset($r[0]);
// let's have a look if something changed in streams
- if (($r || $w) && false === @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
+ set_error_handler(array($this, 'handleError'));
+ if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
+ restore_error_handler();
// if a system call has been interrupted, forget about it, let's try again
// otherwise, an error occurred, let's reset pipes
if (!$this->hasSystemCallBeenInterrupted()) {
@@ -108,6 +110,7 @@ class UnixPipes extends AbstractPipes
return $read;
}
+ restore_error_handler();
foreach ($r as $pipe) {
// prior PHP 5.4 the array passed to stream_select is modified and
diff --git a/vendor/symfony/routing/Loader/AnnotationClassLoader.php b/vendor/symfony/routing/Loader/AnnotationClassLoader.php
index 2fe6fb59..fd1d2b65 100644
--- a/vendor/symfony/routing/Loader/AnnotationClassLoader.php
+++ b/vendor/symfony/routing/Loader/AnnotationClassLoader.php
@@ -119,10 +119,15 @@ abstract class AnnotationClassLoader implements LoaderInterface
}
}
- if (0 === $collection->count() && $class->hasMethod('__invoke') && $annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
- $globals['path'] = '';
- $globals['name'] = '';
- $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke'));
+ if (0 === $collection->count() && $class->hasMethod('__invoke')) {
+ foreach ($this->reader->getClassAnnotations($class) as $annot) {
+ if ($annot instanceof $this->routeAnnotationClass) {
+ $globals['path'] = '';
+ $globals['name'] = '';
+
+ $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke'));
+ }
+ }
}
return $collection;
diff --git a/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php b/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php
index 38d86cb8..8baefdd5 100644
--- a/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php
+++ b/vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php
@@ -23,13 +23,15 @@ class CollectionConfigurator
use Traits\RouteTrait;
private $parent;
+ private $parentConfigurator;
- public function __construct(RouteCollection $parent, $name)
+ public function __construct(RouteCollection $parent, $name, self $parentConfigurator = null)
{
$this->parent = $parent;
$this->name = $name;
$this->collection = new RouteCollection();
$this->route = new Route('');
+ $this->parentConfigurator = $parentConfigurator; // for GC control
}
public function __destruct()
@@ -50,7 +52,7 @@ class CollectionConfigurator
{
$this->collection->add($this->name.$name, $route = clone $this->route);
- return new RouteConfigurator($this->collection, $route->setPath($path), $this->name);
+ return new RouteConfigurator($this->collection, $route->setPath($path), $this->name, $this);
}
/**
@@ -60,7 +62,7 @@ class CollectionConfigurator
*/
final public function collection($name = '')
{
- return new self($this->collection, $this->name.$name);
+ return new self($this->collection, $this->name.$name, $this);
}
/**
diff --git a/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php b/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php
index b8d87025..6422bbf6 100644
--- a/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php
+++ b/vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php
@@ -22,10 +22,13 @@ class RouteConfigurator
use Traits\AddTrait;
use Traits\RouteTrait;
- public function __construct(RouteCollection $collection, Route $route, $name = '')
+ private $parentConfigurator;
+
+ public function __construct(RouteCollection $collection, Route $route, $name = '', CollectionConfigurator $parentConfigurator = null)
{
$this->collection = $collection;
$this->route = $route;
$this->name = $name;
+ $this->parentConfigurator = $parentConfigurator; // for GC control
}
}
diff --git a/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php b/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php
index 4591a86b..d992cef8 100644
--- a/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php
+++ b/vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php
@@ -39,9 +39,17 @@ class RoutingConfigurator
final public function import($resource, $type = null, $ignoreErrors = false)
{
$this->loader->setCurrentDir(dirname($this->path));
- $subCollection = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
+ $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
+ if (!is_array($imported)) {
+ return new ImportConfigurator($this->collection, $imported);
+ }
- return new ImportConfigurator($this->collection, $subCollection);
+ $mergedCollection = new RouteCollection();
+ foreach ($imported as $subCollection) {
+ $mergedCollection->addCollection($subCollection);
+ }
+
+ return new ImportConfigurator($this->collection, $mergedCollection);
}
/**
diff --git a/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php b/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php
index 7171fd24..e8b8fa26 100644
--- a/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php
+++ b/vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php
@@ -34,9 +34,10 @@ trait AddTrait
*/
final public function add($name, $path)
{
+ $parentConfigurator = $this instanceof RouteConfigurator ? $this->parentConfigurator : null;
$this->collection->add($this->name.$name, $route = new Route($path));
- return new RouteConfigurator($this->collection, $route);
+ return new RouteConfigurator($this->collection, $route, '', $parentConfigurator);
}
/**
diff --git a/vendor/symfony/routing/Loader/GlobFileLoader.php b/vendor/symfony/routing/Loader/GlobFileLoader.php
new file mode 100644
index 00000000..03ee341b
--- /dev/null
+++ b/vendor/symfony/routing/Loader/GlobFileLoader.php
@@ -0,0 +1,47 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Loader;
+
+use Symfony\Component\Config\Loader\FileLoader;
+use Symfony\Component\Routing\RouteCollection;
+
+/**
+ * GlobFileLoader loads files from a glob pattern.
+ *
+ * @author Nicolas Grekas
+ */
+class GlobFileLoader extends FileLoader
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function load($resource, $type = null)
+ {
+ $collection = new RouteCollection();
+
+ foreach ($this->glob($resource, false, $globResource) as $path => $info) {
+ $collection->addCollection($this->import($path));
+ }
+
+ $collection->addResource($globResource);
+
+ return $collection;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supports($resource, $type = null)
+ {
+ return 'glob' === $type;
+ }
+}
diff --git a/vendor/symfony/routing/Loader/XmlFileLoader.php b/vendor/symfony/routing/Loader/XmlFileLoader.php
index 3a778907..f3f66055 100644
--- a/vendor/symfony/routing/Loader/XmlFileLoader.php
+++ b/vendor/symfony/routing/Loader/XmlFileLoader.php
@@ -146,26 +146,33 @@ class XmlFileLoader extends FileLoader
$this->setCurrentDir(dirname($path));
- $subCollection = $this->import($resource, ('' !== $type ? $type : null), false, $file);
- /* @var $subCollection RouteCollection */
- $subCollection->addPrefix($prefix);
- if (null !== $host) {
- $subCollection->setHost($host);
- }
- if (null !== $condition) {
- $subCollection->setCondition($condition);
- }
- if (null !== $schemes) {
- $subCollection->setSchemes($schemes);
- }
- if (null !== $methods) {
- $subCollection->setMethods($methods);
- }
- $subCollection->addDefaults($defaults);
- $subCollection->addRequirements($requirements);
- $subCollection->addOptions($options);
+ $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file);
- $collection->addCollection($subCollection);
+ if (!is_array($imported)) {
+ $imported = array($imported);
+ }
+
+ foreach ($imported as $subCollection) {
+ /* @var $subCollection RouteCollection */
+ $subCollection->addPrefix($prefix);
+ if (null !== $host) {
+ $subCollection->setHost($host);
+ }
+ if (null !== $condition) {
+ $subCollection->setCondition($condition);
+ }
+ if (null !== $schemes) {
+ $subCollection->setSchemes($schemes);
+ }
+ if (null !== $methods) {
+ $subCollection->setMethods($methods);
+ }
+ $subCollection->addDefaults($defaults);
+ $subCollection->addRequirements($requirements);
+ $subCollection->addOptions($options);
+
+ $collection->addCollection($subCollection);
+ }
}
/**
diff --git a/vendor/symfony/routing/Loader/YamlFileLoader.php b/vendor/symfony/routing/Loader/YamlFileLoader.php
index 037d581d..f59f9097 100644
--- a/vendor/symfony/routing/Loader/YamlFileLoader.php
+++ b/vendor/symfony/routing/Loader/YamlFileLoader.php
@@ -158,26 +158,33 @@ class YamlFileLoader extends FileLoader
$this->setCurrentDir(dirname($path));
- $subCollection = $this->import($config['resource'], $type, false, $file);
- /* @var $subCollection RouteCollection */
- $subCollection->addPrefix($prefix);
- if (null !== $host) {
- $subCollection->setHost($host);
- }
- if (null !== $condition) {
- $subCollection->setCondition($condition);
- }
- if (null !== $schemes) {
- $subCollection->setSchemes($schemes);
- }
- if (null !== $methods) {
- $subCollection->setMethods($methods);
- }
- $subCollection->addDefaults($defaults);
- $subCollection->addRequirements($requirements);
- $subCollection->addOptions($options);
+ $imported = $this->import($config['resource'], $type, false, $file);
- $collection->addCollection($subCollection);
+ if (!is_array($imported)) {
+ $imported = array($imported);
+ }
+
+ foreach ($imported as $subCollection) {
+ /* @var $subCollection RouteCollection */
+ $subCollection->addPrefix($prefix);
+ if (null !== $host) {
+ $subCollection->setHost($host);
+ }
+ if (null !== $condition) {
+ $subCollection->setCondition($condition);
+ }
+ if (null !== $schemes) {
+ $subCollection->setSchemes($schemes);
+ }
+ if (null !== $methods) {
+ $subCollection->setMethods($methods);
+ }
+ $subCollection->addDefaults($defaults);
+ $subCollection->addRequirements($requirements);
+ $subCollection->addOptions($options);
+
+ $collection->addCollection($subCollection);
+ }
}
/**
diff --git a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php
index 6916297b..dd057d2e 100644
--- a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php
+++ b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php
@@ -106,7 +106,7 @@ class DumperCollection implements \IteratorAggregate
/**
* Sets the parent collection.
*/
- protected function setParent(DumperCollection $parent)
+ protected function setParent(self $parent)
{
$this->parent = $parent;
}
diff --git a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php
index acb9eddb..40d8df67 100644
--- a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php
+++ b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php
@@ -102,15 +102,13 @@ EOF;
\$pathinfo = rawurldecode(\$rawPathinfo);
\$trimmedPathinfo = rtrim(\$pathinfo, '/');
\$context = \$this->context;
- \$request = \$this->request;
+ \$request = \$this->request ?: \$this->createRequest(\$pathinfo);
\$requestMethod = \$canonicalMethod = \$context->getMethod();
- \$scheme = \$context->getScheme();
if ('HEAD' === \$requestMethod) {
\$canonicalMethod = 'GET';
}
-
$code
throw 0 < count(\$allow) ? new MethodNotAllowedException(array_unique(\$allow)) : new ResourceNotFoundException();
@@ -155,11 +153,10 @@ EOF;
}
}
- if ('' === $code) {
- $code .= " if ('/' === \$pathinfo) {\n";
- $code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
- $code .= " }\n";
- }
+ // used to display the Welcome Page in apps that don't define a homepage
+ $code .= " if ('/' === \$pathinfo && !\$allow) {\n";
+ $code .= " throw new Symfony\Component\Routing\Exception\NoConfigurationException();\n";
+ $code .= " }\n";
return $code;
}
@@ -239,7 +236,7 @@ EOF;
$hostMatches = false;
$methods = $route->getMethods();
- $supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('HEAD', $methods) || in_array('GET', $methods));
+ $supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('GET', $methods));
$regex = $compiledRoute->getRegex();
if (!count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P.*?)\$\1#'.('u' === substr($regex, -1) ? 'u' : ''), $regex, $m)) {
@@ -281,59 +278,6 @@ EOF;
$gotoname = 'not_'.preg_replace('/[^A-Za-z0-9_]/', '', $name);
- if ($methods) {
- if (1 === count($methods)) {
- if ('HEAD' === $methods[0]) {
- $code .= <<redirect(\$rawPathinfo.'/', '$name'));
}
@@ -369,29 +317,69 @@ EOF;
EOF;
}
+ if ($methods) {
+ $methodVariable = in_array('GET', $methods) ? '$canonicalMethod' : '$requestMethod';
+ $methods = implode("', '", $methods);
+ }
+
if ($schemes = $route->getSchemes()) {
if (!$supportsRedirections) {
throw new \LogicException('The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.');
}
$schemes = str_replace("\n", '', var_export(array_flip($schemes), true));
- $code .= <<getScheme()]);
+ if (!in_array($methodVariable, array('$methods'))) {
+ if (\$hasRequiredScheme) {
+ \$allow = array_merge(\$allow, array('$methods'));
+ }
+ goto $gotoname;
+ }
+ if (!\$hasRequiredScheme) {
+ if ('GET' !== \$canonicalMethod) {
+ goto $gotoname;
+ }
+
return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
}
+EOF;
+ } else {
+ $code .= <<getScheme()])) {
+ if ('GET' !== \$canonicalMethod) {
+ goto $gotoname;
+ }
+
+ return array_replace(\$ret, \$this->redirect(\$rawPathinfo, '$name', key(\$requiredSchemes)));
+ }
+
+
+EOF;
+ }
+ } elseif ($methods) {
+ $code .= <<routes) && '/' === $pathinfo) {
+ if ('/' === $pathinfo && !$this->allow) {
throw new NoConfigurationException();
}
@@ -135,6 +135,12 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
continue;
}
+ $status = $this->handleRouteRequirements($pathinfo, $name, $route);
+
+ if (self::REQUIREMENT_MISMATCH === $status[0]) {
+ continue;
+ }
+
// check HTTP method requirement
if ($requiredMethods = $route->getMethods()) {
// HEAD and GET are equivalent as per RFC
@@ -143,18 +149,14 @@ class UrlMatcher implements UrlMatcherInterface, RequestMatcherInterface
}
if (!in_array($method, $requiredMethods)) {
- $this->allow = array_merge($this->allow, $requiredMethods);
+ if (self::REQUIREMENT_MATCH === $status[0]) {
+ $this->allow = array_merge($this->allow, $requiredMethods);
+ }
continue;
}
}
- $status = $this->handleRouteRequirements($pathinfo, $name, $route);
-
- if (self::REQUIREMENT_MISMATCH === $status[0]) {
- continue;
- }
-
return $this->getAttributes($route, $name, array_replace($matches, $hostMatches, isset($status[1]) ? $status[1] : array()));
}
}
diff --git a/vendor/symfony/routing/RouteCollection.php b/vendor/symfony/routing/RouteCollection.php
index feabf234..e22cbc5f 100644
--- a/vendor/symfony/routing/RouteCollection.php
+++ b/vendor/symfony/routing/RouteCollection.php
@@ -117,7 +117,7 @@ class RouteCollection implements \IteratorAggregate, \Countable
* Adds a route collection at the end of the current set by appending all
* routes of the added collection.
*/
- public function addCollection(RouteCollection $collection)
+ public function addCollection(self $collection)
{
// we need to remove all routes with the same names first because just replacing them
// would not place the new route at the end of the merged array
diff --git a/vendor/symfony/routing/RouteCollectionBuilder.php b/vendor/symfony/routing/RouteCollectionBuilder.php
index e8a9a165..3aec1469 100644
--- a/vendor/symfony/routing/RouteCollectionBuilder.php
+++ b/vendor/symfony/routing/RouteCollectionBuilder.php
@@ -118,7 +118,7 @@ class RouteCollectionBuilder
* @param string $prefix
* @param RouteCollectionBuilder $builder
*/
- public function mount($prefix, RouteCollectionBuilder $builder)
+ public function mount($prefix, self $builder)
{
$builder->prefix = trim(trim($prefix), '/');
$this->routes[] = $builder;
@@ -251,8 +251,6 @@ class RouteCollectionBuilder
/**
* Adds a resource for this collection.
*
- * @param ResourceInterface $resource
- *
* @return $this
*/
private function addResource(ResourceInterface $resource)
diff --git a/vendor/symfony/routing/RouteCompiler.php b/vendor/symfony/routing/RouteCompiler.php
index 9b5526f3..dc4e4f80 100644
--- a/vendor/symfony/routing/RouteCompiler.php
+++ b/vendor/symfony/routing/RouteCompiler.php
@@ -210,7 +210,7 @@ class RouteCompiler implements RouteCompilerInterface
for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) {
$regexp .= self::computeRegexp($tokens, $i, $firstOptional);
}
- $regexp = self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'s'.($isHost ? 'i' : '');
+ $regexp = self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'sD'.($isHost ? 'i' : '');
// enable Utf8 matching if really required
if ($needsUtf8) {
diff --git a/vendor/symfony/routing/Router.php b/vendor/symfony/routing/Router.php
index 0de92185..ed56332e 100644
--- a/vendor/symfony/routing/Router.php
+++ b/vendor/symfony/routing/Router.php
@@ -302,7 +302,9 @@ class Router implements RouterInterface, RequestMatcherInterface
}
);
- require_once $cache->getPath();
+ if (!class_exists($this->options['matcher_cache_class'], false)) {
+ require_once $cache->getPath();
+ }
return $this->matcher = new $this->options['matcher_cache_class']($this->context);
}
@@ -334,7 +336,9 @@ class Router implements RouterInterface, RequestMatcherInterface
}
);
- require_once $cache->getPath();
+ if (!class_exists($this->options['generator_cache_class'], false)) {
+ require_once $cache->getPath();
+ }
$this->generator = new $this->options['generator_cache_class']($this->context, $this->logger);
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php
index 839c7d13..9e9b9103 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher0.php
@@ -21,16 +21,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
- if ('/' === $pathinfo) {
+ if ('/' === $pathinfo && !$allow) {
throw new Symfony\Component\Routing\Exception\NoConfigurationException();
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php
index 5d7dca8e..23a93c19 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher1.php
@@ -21,18 +21,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
if (0 === strpos($pathinfo, '/foo')) {
// foo
- if (preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/foo/(?Pbaz|symfony)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
}
@@ -45,24 +43,26 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/bar')) {
// bar
- if (preg_match('#^/bar/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (preg_match('#^/bar/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
+ if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
+ $allow = array_merge($allow, array('GET', 'HEAD'));
goto not_bar;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
+ return $ret;
}
not_bar:
// barhead
- if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_barhead;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
+ return $ret;
}
not_barhead:
@@ -88,36 +88,38 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// baz4
- if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
}
// baz5
- if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_baz5;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
+ return $ret;
}
not_baz5:
// baz.baz6
- if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('PUT' !== $canonicalMethod) {
- $allow[] = 'PUT';
+ if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
+ if (!in_array($requestMethod, array('PUT'))) {
+ $allow = array_merge($allow, array('PUT'));
goto not_bazbaz6;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
+ return $ret;
}
not_bazbaz6:
}
// quoter
- if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/(?P[\']+)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
}
@@ -129,30 +131,30 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
if (0 === strpos($pathinfo, '/a')) {
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo1
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
}
// bar1
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
}
}
// overridden
- if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/(?P.*)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
}
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo2
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
}
// bar2
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
}
@@ -162,7 +164,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/multi')) {
// helloWorld
- if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
}
@@ -179,12 +181,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// foo3
- if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
}
// bar3
- if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
}
@@ -195,7 +197,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// foo4
- if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/aba/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
}
@@ -203,7 +205,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$host = $context->getHost();
- if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route1
if ('/route1' === $pathinfo) {
return array('_route' => 'route1');
@@ -216,7 +218,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
- if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) {
// route3
if ('/c2/route3' === $pathinfo) {
return array('_route' => 'route3');
@@ -224,7 +226,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
- if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route4
if ('/route4' === $pathinfo) {
return array('_route' => 'route4');
@@ -232,7 +234,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
- if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route5
if ('/route5' === $pathinfo) {
return array('_route' => 'route5');
@@ -245,7 +247,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
return array('_route' => 'route6');
}
- if (preg_match('#^(?P[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^(?P[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) {
if (0 === strpos($pathinfo, '/route1')) {
// route11
if ('/route11' === $pathinfo) {
@@ -258,12 +260,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// route13
- if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
}
// route14
- if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
}
@@ -271,16 +273,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
- if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route15
- if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
}
}
// route16
- if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
}
@@ -296,17 +298,21 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
if (0 === strpos($pathinfo, '/a/b')) {
// b
- if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
}
// c
- if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
}
}
+ if ('/' === $pathinfo && !$allow) {
+ throw new Symfony\Component\Routing\Exception\NoConfigurationException();
+ }
+
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php
index 49ce082a..e430adb1 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher2.php
@@ -21,18 +21,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
if (0 === strpos($pathinfo, '/foo')) {
// foo
- if (preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/foo/(?Pbaz|symfony)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',));
}
@@ -45,24 +43,26 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/bar')) {
// bar
- if (preg_match('#^/bar/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (preg_match('#^/bar/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
+ if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
+ $allow = array_merge($allow, array('GET', 'HEAD'));
goto not_bar;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ());
+ return $ret;
}
not_bar:
// barhead
- if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_barhead;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ());
+ return $ret;
}
not_barhead:
@@ -83,51 +83,63 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// baz3
if ('/test/baz3' === $trimmedPathinfo) {
$ret = array('_route' => 'baz3');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_baz3;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz3'));
}
return $ret;
}
+ not_baz3:
}
// baz4
- if (preg_match('#^/test/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/test/(?P[^/]++)/?$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ());
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_baz4;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'baz4'));
}
return $ret;
}
+ not_baz4:
// baz5
- if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_baz5;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ());
+ return $ret;
}
not_baz5:
// baz.baz6
- if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('PUT' !== $canonicalMethod) {
- $allow[] = 'PUT';
+ if (preg_match('#^/test/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
+ if (!in_array($requestMethod, array('PUT'))) {
+ $allow = array_merge($allow, array('PUT'));
goto not_bazbaz6;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ());
+ return $ret;
}
not_bazbaz6:
}
// quoter
- if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/(?P[\']+)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ());
}
@@ -139,30 +151,30 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (0 === strpos($pathinfo, '/a')) {
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo1
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ());
}
// bar1
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ());
}
}
// overridden
- if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/(?P.*)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ());
}
if (0 === strpos($pathinfo, '/a/b\'b')) {
// foo2
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ());
}
// bar2
- if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b\'b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ());
}
@@ -172,19 +184,24 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/multi')) {
// helloWorld
- if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',));
}
// hey
if ('/multi/hey' === $trimmedPathinfo) {
$ret = array('_route' => 'hey');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_hey;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'hey'));
}
return $ret;
}
+ not_hey:
// overridden2
if ('/multi/new' === $pathinfo) {
@@ -194,12 +211,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// foo3
- if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ());
}
// bar3
- if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ());
}
@@ -210,7 +227,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// foo4
- if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/aba/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ());
}
@@ -218,7 +235,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$host = $context->getHost();
- if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route1
if ('/route1' === $pathinfo) {
return array('_route' => 'route1');
@@ -231,7 +248,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
- if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^b\\.example\\.com$#sDi', $host, $hostMatches)) {
// route3
if ('/c2/route3' === $pathinfo) {
return array('_route' => 'route3');
@@ -239,7 +256,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
- if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^a\\.example\\.com$#sDi', $host, $hostMatches)) {
// route4
if ('/route4' === $pathinfo) {
return array('_route' => 'route4');
@@ -247,7 +264,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
- if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route5
if ('/route5' === $pathinfo) {
return array('_route' => 'route5');
@@ -260,7 +277,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
return array('_route' => 'route6');
}
- if (preg_match('#^(?P[^\\.]++)\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^(?P[^\\.]++)\\.example\\.com$#sDi', $host, $hostMatches)) {
if (0 === strpos($pathinfo, '/route1')) {
// route11
if ('/route11' === $pathinfo) {
@@ -273,12 +290,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// route13
- if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ());
}
// route14
- if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',));
}
@@ -286,16 +303,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
- if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) {
+ if (preg_match('#^c\\.example\\.com$#sDi', $host, $hostMatches)) {
// route15
- if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ());
}
}
// route16
- if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',));
}
@@ -311,12 +328,12 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if (0 === strpos($pathinfo, '/a/b')) {
// b
- if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/a/b/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ());
}
// c
- if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ());
}
@@ -326,23 +343,37 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
if ('/secure' === $pathinfo) {
$ret = array('_route' => 'secure');
$requiredSchemes = array ( 'https' => 0,);
- if (!isset($requiredSchemes[$scheme])) {
+ if (!isset($requiredSchemes[$context->getScheme()])) {
+ if ('GET' !== $canonicalMethod) {
+ goto not_secure;
+ }
+
return array_replace($ret, $this->redirect($rawPathinfo, 'secure', key($requiredSchemes)));
}
return $ret;
}
+ not_secure:
// nonsecure
if ('/nonsecure' === $pathinfo) {
$ret = array('_route' => 'nonsecure');
$requiredSchemes = array ( 'http' => 0,);
- if (!isset($requiredSchemes[$scheme])) {
+ if (!isset($requiredSchemes[$context->getScheme()])) {
+ if ('GET' !== $canonicalMethod) {
+ goto not_nonsecure;
+ }
+
return array_replace($ret, $this->redirect($rawPathinfo, 'nonsecure', key($requiredSchemes)));
}
return $ret;
}
+ not_nonsecure:
+
+ if ('/' === $pathinfo && !$allow) {
+ throw new Symfony\Component\Routing\Exception\NoConfigurationException();
+ }
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php
index ae549563..67c46674 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher3.php
@@ -21,15 +21,13 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
if (0 === strpos($pathinfo, '/rootprefix')) {
// static
if ('/rootprefix/test' === $pathinfo) {
@@ -37,7 +35,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
}
// dynamic
- if (preg_match('#^/rootprefix/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/rootprefix/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ());
}
@@ -48,6 +46,10 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
return array('_route' => 'with-condition');
}
+ if ('/' === $pathinfo && !$allow) {
+ throw new Symfony\Component\Routing\Exception\NoConfigurationException();
+ }
+
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php
index 50da489f..ed07194a 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher4.php
@@ -21,84 +21,92 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
// just_head
if ('/just_head' === $pathinfo) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
+ $ret = array('_route' => 'just_head');
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
goto not_just_head;
}
- return array('_route' => 'just_head');
+ return $ret;
}
not_just_head:
// head_and_get
if ('/head_and_get' === $pathinfo) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ $ret = array('_route' => 'head_and_get');
+ if (!in_array($canonicalMethod, array('HEAD', 'GET'))) {
+ $allow = array_merge($allow, array('HEAD', 'GET'));
goto not_head_and_get;
}
- return array('_route' => 'head_and_get');
+ return $ret;
}
not_head_and_get:
// get_and_head
if ('/get_and_head' === $pathinfo) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ $ret = array('_route' => 'get_and_head');
+ if (!in_array($canonicalMethod, array('GET', 'HEAD'))) {
+ $allow = array_merge($allow, array('GET', 'HEAD'));
goto not_get_and_head;
}
- return array('_route' => 'get_and_head');
+ return $ret;
}
not_get_and_head:
// post_and_head
- if ('/post_and_get' === $pathinfo) {
+ if ('/post_and_head' === $pathinfo) {
+ $ret = array('_route' => 'post_and_head');
if (!in_array($requestMethod, array('POST', 'HEAD'))) {
$allow = array_merge($allow, array('POST', 'HEAD'));
goto not_post_and_head;
}
- return array('_route' => 'post_and_head');
+ return $ret;
}
not_post_and_head:
if (0 === strpos($pathinfo, '/put_and_post')) {
// put_and_post
if ('/put_and_post' === $pathinfo) {
+ $ret = array('_route' => 'put_and_post');
if (!in_array($requestMethod, array('PUT', 'POST'))) {
$allow = array_merge($allow, array('PUT', 'POST'));
goto not_put_and_post;
}
- return array('_route' => 'put_and_post');
+ return $ret;
}
not_put_and_post:
// put_and_get_and_head
if ('/put_and_post' === $pathinfo) {
- if (!in_array($canonicalMethod, array('PUT', 'GET'))) {
- $allow = array_merge($allow, array('PUT', 'GET'));
+ $ret = array('_route' => 'put_and_get_and_head');
+ if (!in_array($canonicalMethod, array('PUT', 'GET', 'HEAD'))) {
+ $allow = array_merge($allow, array('PUT', 'GET', 'HEAD'));
goto not_put_and_get_and_head;
}
- return array('_route' => 'put_and_get_and_head');
+ return $ret;
}
not_put_and_get_and_head:
}
+ if ('/' === $pathinfo && !$allow) {
+ throw new Symfony\Component\Routing\Exception\NoConfigurationException();
+ }
+
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php
index 51be5b0b..2b22513a 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher5.php
@@ -21,15 +21,13 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
if (0 === strpos($pathinfo, '/a')) {
// a_first
if ('/a/11' === $pathinfo) {
@@ -49,7 +47,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
}
// a_wildcard
- if (preg_match('#^/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (preg_match('#^/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'a_wildcard')), array ());
}
@@ -57,37 +55,52 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// a_fourth
if ('/a/44' === $trimmedPathinfo) {
$ret = array('_route' => 'a_fourth');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_a_fourth;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fourth'));
}
return $ret;
}
+ not_a_fourth:
// a_fifth
if ('/a/55' === $trimmedPathinfo) {
$ret = array('_route' => 'a_fifth');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_a_fifth;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_fifth'));
}
return $ret;
}
+ not_a_fifth:
// a_sixth
if ('/a/66' === $trimmedPathinfo) {
$ret = array('_route' => 'a_sixth');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_a_sixth;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'a_sixth'));
}
return $ret;
}
+ not_a_sixth:
}
// nested_wildcard
- if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/nested') && preg_match('#^/nested/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'nested_wildcard')), array ());
}
@@ -95,32 +108,47 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// nested_a
if ('/nested/group/a' === $trimmedPathinfo) {
$ret = array('_route' => 'nested_a');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_nested_a;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_a'));
}
return $ret;
}
+ not_nested_a:
// nested_b
if ('/nested/group/b' === $trimmedPathinfo) {
$ret = array('_route' => 'nested_b');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_nested_b;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_b'));
}
return $ret;
}
+ not_nested_b:
// nested_c
if ('/nested/group/c' === $trimmedPathinfo) {
$ret = array('_route' => 'nested_c');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_nested_c;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'nested_c'));
}
return $ret;
}
+ not_nested_c:
}
@@ -128,35 +156,54 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// slashed_a
if ('/slashed/group' === $trimmedPathinfo) {
$ret = array('_route' => 'slashed_a');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_slashed_a;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_a'));
}
return $ret;
}
+ not_slashed_a:
// slashed_b
if ('/slashed/group/b' === $trimmedPathinfo) {
$ret = array('_route' => 'slashed_b');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_slashed_b;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_b'));
}
return $ret;
}
+ not_slashed_b:
// slashed_c
if ('/slashed/group/c' === $trimmedPathinfo) {
$ret = array('_route' => 'slashed_c');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_slashed_c;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'slashed_c'));
}
return $ret;
}
+ not_slashed_c:
}
+ if ('/' === $pathinfo && !$allow) {
+ throw new Symfony\Component\Routing\Exception\NoConfigurationException();
+ }
+
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php
index 93352569..48ecdf81 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher6.php
@@ -21,15 +21,13 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
if (0 === strpos($pathinfo, '/trailing/simple')) {
// simple_trailing_slash_no_methods
if ('/trailing/simple/no-methods/' === $pathinfo) {
@@ -38,34 +36,37 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// simple_trailing_slash_GET_method
if ('/trailing/simple/get-method/' === $pathinfo) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ $ret = array('_route' => 'simple_trailing_slash_GET_method');
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_simple_trailing_slash_GET_method;
}
- return array('_route' => 'simple_trailing_slash_GET_method');
+ return $ret;
}
not_simple_trailing_slash_GET_method:
// simple_trailing_slash_HEAD_method
if ('/trailing/simple/head-method/' === $pathinfo) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
+ $ret = array('_route' => 'simple_trailing_slash_HEAD_method');
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
goto not_simple_trailing_slash_HEAD_method;
}
- return array('_route' => 'simple_trailing_slash_HEAD_method');
+ return $ret;
}
not_simple_trailing_slash_HEAD_method:
// simple_trailing_slash_POST_method
if ('/trailing/simple/post-method/' === $pathinfo) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ $ret = array('_route' => 'simple_trailing_slash_POST_method');
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_simple_trailing_slash_POST_method;
}
- return array('_route' => 'simple_trailing_slash_POST_method');
+ return $ret;
}
not_simple_trailing_slash_POST_method:
@@ -73,40 +74,43 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/trailing/regex')) {
// regex_trailing_slash_no_methods
- if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
}
// regex_trailing_slash_GET_method
- if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_regex_trailing_slash_GET_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
+ return $ret;
}
not_regex_trailing_slash_GET_method:
// regex_trailing_slash_HEAD_method
- if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
+ if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
goto not_regex_trailing_slash_HEAD_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
+ return $ret;
}
not_regex_trailing_slash_HEAD_method:
// regex_trailing_slash_POST_method
- if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_regex_trailing_slash_POST_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
+ return $ret;
}
not_regex_trailing_slash_POST_method:
@@ -120,34 +124,37 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
// simple_not_trailing_slash_GET_method
if ('/not-trailing/simple/get-method' === $pathinfo) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ $ret = array('_route' => 'simple_not_trailing_slash_GET_method');
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_simple_not_trailing_slash_GET_method;
}
- return array('_route' => 'simple_not_trailing_slash_GET_method');
+ return $ret;
}
not_simple_not_trailing_slash_GET_method:
// simple_not_trailing_slash_HEAD_method
if ('/not-trailing/simple/head-method' === $pathinfo) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
+ $ret = array('_route' => 'simple_not_trailing_slash_HEAD_method');
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
goto not_simple_not_trailing_slash_HEAD_method;
}
- return array('_route' => 'simple_not_trailing_slash_HEAD_method');
+ return $ret;
}
not_simple_not_trailing_slash_HEAD_method:
// simple_not_trailing_slash_POST_method
if ('/not-trailing/simple/post-method' === $pathinfo) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ $ret = array('_route' => 'simple_not_trailing_slash_POST_method');
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_simple_not_trailing_slash_POST_method;
}
- return array('_route' => 'simple_not_trailing_slash_POST_method');
+ return $ret;
}
not_simple_not_trailing_slash_POST_method:
@@ -155,45 +162,52 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher
elseif (0 === strpos($pathinfo, '/not-trailing/regex')) {
// regex_not_trailing_slash_no_methods
- if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ());
}
// regex_not_trailing_slash_GET_method
- if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_regex_not_trailing_slash_GET_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
+ return $ret;
}
not_regex_not_trailing_slash_GET_method:
// regex_not_trailing_slash_HEAD_method
- if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
+ if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
goto not_regex_not_trailing_slash_HEAD_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
+ return $ret;
}
not_regex_not_trailing_slash_HEAD_method:
// regex_not_trailing_slash_POST_method
- if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_regex_not_trailing_slash_POST_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
+ return $ret;
}
not_regex_not_trailing_slash_POST_method:
}
+ if ('/' === $pathinfo && !$allow) {
+ throw new Symfony\Component\Routing\Exception\NoConfigurationException();
+ }
+
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php
index bceee6f3..81d76ea4 100644
--- a/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php
+++ b/vendor/symfony/routing/Tests/Fixtures/dumper/url_matcher7.php
@@ -21,36 +21,43 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
$pathinfo = rawurldecode($rawPathinfo);
$trimmedPathinfo = rtrim($pathinfo, '/');
$context = $this->context;
- $request = $this->request;
+ $request = $this->request ?: $this->createRequest($pathinfo);
$requestMethod = $canonicalMethod = $context->getMethod();
- $scheme = $context->getScheme();
if ('HEAD' === $requestMethod) {
$canonicalMethod = 'GET';
}
-
if (0 === strpos($pathinfo, '/trailing/simple')) {
// simple_trailing_slash_no_methods
if ('/trailing/simple/no-methods' === $trimmedPathinfo) {
$ret = array('_route' => 'simple_trailing_slash_no_methods');
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_simple_trailing_slash_no_methods;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_no_methods'));
}
return $ret;
}
+ not_simple_trailing_slash_no_methods:
// simple_trailing_slash_GET_method
if ('/trailing/simple/get-method' === $trimmedPathinfo) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ $ret = array('_route' => 'simple_trailing_slash_GET_method');
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
goto not_simple_trailing_slash_GET_method;
+ } else {
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method'));
}
- $ret = array('_route' => 'simple_trailing_slash_GET_method');
- if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_GET_method'));
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
+ goto not_simple_trailing_slash_GET_method;
}
return $ret;
@@ -58,15 +65,11 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
not_simple_trailing_slash_GET_method:
// simple_trailing_slash_HEAD_method
- if ('/trailing/simple/head-method' === $trimmedPathinfo) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
- goto not_simple_trailing_slash_HEAD_method;
- }
-
+ if ('/trailing/simple/head-method/' === $pathinfo) {
$ret = array('_route' => 'simple_trailing_slash_HEAD_method');
- if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($rawPathinfo.'/', 'simple_trailing_slash_HEAD_method'));
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
+ goto not_simple_trailing_slash_HEAD_method;
}
return $ret;
@@ -75,12 +78,13 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// simple_trailing_slash_POST_method
if ('/trailing/simple/post-method/' === $pathinfo) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ $ret = array('_route' => 'simple_trailing_slash_POST_method');
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_simple_trailing_slash_POST_method;
}
- return array('_route' => 'simple_trailing_slash_POST_method');
+ return $ret;
}
not_simple_trailing_slash_POST_method:
@@ -88,25 +92,34 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/trailing/regex')) {
// regex_trailing_slash_no_methods
- if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/trailing/regex/no-methods') && preg_match('#^/trailing/regex/no\\-methods/(?P[^/]++)/?$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_no_methods')), array ());
- if (substr($pathinfo, -1) !== '/') {
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
+ goto not_regex_trailing_slash_no_methods;
+ } else {
return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_no_methods'));
}
return $ret;
}
+ not_regex_trailing_slash_no_methods:
// regex_trailing_slash_GET_method
- if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (0 === strpos($pathinfo, '/trailing/regex/get-method') && preg_match('#^/trailing/regex/get\\-method/(?P[^/]++)/?$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
+ if ('/' === substr($pathinfo, -1)) {
+ // no-op
+ } elseif ('GET' !== $canonicalMethod) {
goto not_regex_trailing_slash_GET_method;
+ } else {
+ return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method'));
}
- $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_GET_method')), array ());
- if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_GET_method'));
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
+ goto not_regex_trailing_slash_GET_method;
}
return $ret;
@@ -114,15 +127,11 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
not_regex_trailing_slash_GET_method:
// regex_trailing_slash_HEAD_method
- if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/?$#s', $pathinfo, $matches)) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
- goto not_regex_trailing_slash_HEAD_method;
- }
-
+ if (0 === strpos($pathinfo, '/trailing/regex/head-method') && preg_match('#^/trailing/regex/head\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
$ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_HEAD_method')), array ());
- if (substr($pathinfo, -1) !== '/') {
- return array_replace($ret, $this->redirect($rawPathinfo.'/', 'regex_trailing_slash_HEAD_method'));
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
+ goto not_regex_trailing_slash_HEAD_method;
}
return $ret;
@@ -130,13 +139,14 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
not_regex_trailing_slash_HEAD_method:
// regex_trailing_slash_POST_method
- if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#s', $pathinfo, $matches)) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ if (0 === strpos($pathinfo, '/trailing/regex/post-method') && preg_match('#^/trailing/regex/post\\-method/(?P[^/]++)/$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_regex_trailing_slash_POST_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_trailing_slash_POST_method')), array ());
+ return $ret;
}
not_regex_trailing_slash_POST_method:
@@ -150,34 +160,37 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
// simple_not_trailing_slash_GET_method
if ('/not-trailing/simple/get-method' === $pathinfo) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ $ret = array('_route' => 'simple_not_trailing_slash_GET_method');
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_simple_not_trailing_slash_GET_method;
}
- return array('_route' => 'simple_not_trailing_slash_GET_method');
+ return $ret;
}
not_simple_not_trailing_slash_GET_method:
// simple_not_trailing_slash_HEAD_method
if ('/not-trailing/simple/head-method' === $pathinfo) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
+ $ret = array('_route' => 'simple_not_trailing_slash_HEAD_method');
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
goto not_simple_not_trailing_slash_HEAD_method;
}
- return array('_route' => 'simple_not_trailing_slash_HEAD_method');
+ return $ret;
}
not_simple_not_trailing_slash_HEAD_method:
// simple_not_trailing_slash_POST_method
if ('/not-trailing/simple/post-method' === $pathinfo) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ $ret = array('_route' => 'simple_not_trailing_slash_POST_method');
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_simple_not_trailing_slash_POST_method;
}
- return array('_route' => 'simple_not_trailing_slash_POST_method');
+ return $ret;
}
not_simple_not_trailing_slash_POST_method:
@@ -185,45 +198,52 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec
elseif (0 === strpos($pathinfo, '/not-trailing/regex')) {
// regex_not_trailing_slash_no_methods
- if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#s', $pathinfo, $matches)) {
+ if (0 === strpos($pathinfo, '/not-trailing/regex/no-methods') && preg_match('#^/not\\-trailing/regex/no\\-methods/(?P[^/]++)$#sD', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_no_methods')), array ());
}
// regex_not_trailing_slash_GET_method
- if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('GET' !== $canonicalMethod) {
- $allow[] = 'GET';
+ if (0 === strpos($pathinfo, '/not-trailing/regex/get-method') && preg_match('#^/not\\-trailing/regex/get\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
+ if (!in_array($canonicalMethod, array('GET'))) {
+ $allow = array_merge($allow, array('GET'));
goto not_regex_not_trailing_slash_GET_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_GET_method')), array ());
+ return $ret;
}
not_regex_not_trailing_slash_GET_method:
// regex_not_trailing_slash_HEAD_method
- if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('HEAD' !== $requestMethod) {
- $allow[] = 'HEAD';
+ if (0 === strpos($pathinfo, '/not-trailing/regex/head-method') && preg_match('#^/not\\-trailing/regex/head\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
+ if (!in_array($requestMethod, array('HEAD'))) {
+ $allow = array_merge($allow, array('HEAD'));
goto not_regex_not_trailing_slash_HEAD_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_HEAD_method')), array ());
+ return $ret;
}
not_regex_not_trailing_slash_HEAD_method:
// regex_not_trailing_slash_POST_method
- if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#s', $pathinfo, $matches)) {
- if ('POST' !== $canonicalMethod) {
- $allow[] = 'POST';
+ if (0 === strpos($pathinfo, '/not-trailing/regex/post-method') && preg_match('#^/not\\-trailing/regex/post\\-method/(?P[^/]++)$#sD', $pathinfo, $matches)) {
+ $ret = $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
+ if (!in_array($requestMethod, array('POST'))) {
+ $allow = array_merge($allow, array('POST'));
goto not_regex_not_trailing_slash_POST_method;
}
- return $this->mergeDefaults(array_replace($matches, array('_route' => 'regex_not_trailing_slash_POST_method')), array ());
+ return $ret;
}
not_regex_not_trailing_slash_POST_method:
}
+ if ('/' === $pathinfo && !$allow) {
+ throw new Symfony\Component\Routing\Exception\NoConfigurationException();
+ }
+
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
}
}
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/bar.xml b/vendor/symfony/routing/Tests/Fixtures/glob/bar.xml
new file mode 100644
index 00000000..0d31eeb1
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/bar.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/bar.yml b/vendor/symfony/routing/Tests/Fixtures/glob/bar.yml
new file mode 100644
index 00000000..ba3bc229
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/bar.yml
@@ -0,0 +1,4 @@
+bar_route:
+ path: /bar
+ defaults:
+ _controller: AppBundle:Bar:view
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/baz.xml b/vendor/symfony/routing/Tests/Fixtures/glob/baz.xml
new file mode 100644
index 00000000..3abba1ac
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/baz.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/baz.yml b/vendor/symfony/routing/Tests/Fixtures/glob/baz.yml
new file mode 100644
index 00000000..f7d8c67f
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/baz.yml
@@ -0,0 +1,4 @@
+baz_route:
+ path: /baz
+ defaults:
+ _controller: AppBundle:Baz:view
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.xml b/vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.xml
new file mode 100644
index 00000000..ca6b1b5a
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.yml b/vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.yml
new file mode 100644
index 00000000..d1ae5854
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/import_multiple.yml
@@ -0,0 +1,2 @@
+_static:
+ resource: ba?.yml
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/import_single.xml b/vendor/symfony/routing/Tests/Fixtures/glob/import_single.xml
new file mode 100644
index 00000000..15f5698c
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/import_single.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/import_single.yml b/vendor/symfony/routing/Tests/Fixtures/glob/import_single.yml
new file mode 100644
index 00000000..f56ddbd0
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/import_single.yml
@@ -0,0 +1,2 @@
+_static:
+ resource: b?r.yml
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl.php b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl.php
new file mode 100644
index 00000000..897fa11f
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl.php
@@ -0,0 +1,7 @@
+import('php_dsl_ba?.php');
+};
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php
new file mode 100644
index 00000000..e2b91b17
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_bar.php
@@ -0,0 +1,12 @@
+collection();
+
+ $collection->add('bar_route', '/bar')
+ ->defaults(array('_controller' => 'AppBundle:Bar:view'));
+
+ return $collection;
+};
diff --git a/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php
new file mode 100644
index 00000000..ca8f188a
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Fixtures/glob/php_dsl_baz.php
@@ -0,0 +1,12 @@
+collection();
+
+ $collection->add('baz_route', '/baz')
+ ->defaults(array('_controller' => 'AppBundle:Baz:view'));
+
+ return $collection;
+};
diff --git a/vendor/symfony/routing/Tests/Fixtures/php_dsl.php b/vendor/symfony/routing/Tests/Fixtures/php_dsl.php
index 04f6d7ed..0780c9fa 100644
--- a/vendor/symfony/routing/Tests/Fixtures/php_dsl.php
+++ b/vendor/symfony/routing/Tests/Fixtures/php_dsl.php
@@ -4,6 +4,7 @@ namespace Symfony\Component\Routing\Loader\Configurator;
return function (RoutingConfigurator $routes) {
$routes
+ ->collection()
->add('foo', '/foo')
->condition('abc')
->options(array('utf8' => true))
diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php
index 70db1ccd..32e40129 100644
--- a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php
+++ b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php
@@ -191,9 +191,9 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
);
$this->reader
- ->expects($this->exactly(2))
- ->method('getClassAnnotation')
- ->will($this->returnValue($this->getAnnotatedRoute($classRouteData)))
+ ->expects($this->exactly(1))
+ ->method('getClassAnnotations')
+ ->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData))))
;
$this->reader
->expects($this->once())
@@ -205,8 +205,49 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
$route = $routeCollection->get($classRouteData['name']);
$this->assertSame($classRouteData['path'], $route->getPath(), '->load preserves class route path');
- $this->assertEquals(array_merge($classRouteData['schemes'], $classRouteData['schemes']), $route->getSchemes(), '->load preserves class route schemes');
- $this->assertEquals(array_merge($classRouteData['methods'], $classRouteData['methods']), $route->getMethods(), '->load preserves class route methods');
+ $this->assertEquals($classRouteData['schemes'], $route->getSchemes(), '->load preserves class route schemes');
+ $this->assertEquals($classRouteData['methods'], $route->getMethods(), '->load preserves class route methods');
+ }
+
+ public function testInvokableClassMultipleRouteLoad()
+ {
+ $classRouteData1 = array(
+ 'name' => 'route1',
+ 'path' => '/1',
+ 'schemes' => array('https'),
+ 'methods' => array('GET'),
+ );
+
+ $classRouteData2 = array(
+ 'name' => 'route2',
+ 'path' => '/2',
+ 'schemes' => array('https'),
+ 'methods' => array('GET'),
+ );
+
+ $this->reader
+ ->expects($this->exactly(1))
+ ->method('getClassAnnotations')
+ ->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData1), $this->getAnnotatedRoute($classRouteData2))))
+ ;
+ $this->reader
+ ->expects($this->once())
+ ->method('getMethodAnnotations')
+ ->will($this->returnValue(array()))
+ ;
+
+ $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass');
+ $route = $routeCollection->get($classRouteData1['name']);
+
+ $this->assertSame($classRouteData1['path'], $route->getPath(), '->load preserves class route path');
+ $this->assertEquals($classRouteData1['schemes'], $route->getSchemes(), '->load preserves class route schemes');
+ $this->assertEquals($classRouteData1['methods'], $route->getMethods(), '->load preserves class route methods');
+
+ $route = $routeCollection->get($classRouteData2['name']);
+
+ $this->assertSame($classRouteData2['path'], $route->getPath(), '->load preserves class route path');
+ $this->assertEquals($classRouteData2['schemes'], $route->getSchemes(), '->load preserves class route schemes');
+ $this->assertEquals($classRouteData2['methods'], $route->getMethods(), '->load preserves class route methods');
}
public function testInvokableClassWithMethodRouteLoad()
diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
index 1e8ee394..8a6668e0 100644
--- a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
+++ b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php
@@ -29,7 +29,7 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
public function testLoad()
{
- $this->reader->expects($this->exactly(4))->method('getClassAnnotation');
+ $this->reader->expects($this->exactly(3))->method('getClassAnnotation');
$this->reader
->expects($this->any())
@@ -37,6 +37,12 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
->will($this->returnValue(array()))
;
+ $this->reader
+ ->expects($this->any())
+ ->method('getClassAnnotations')
+ ->will($this->returnValue(array()))
+ ;
+
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
}
@@ -45,7 +51,6 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
$this->expectAnnotationsToBeReadFrom(array(
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BarClass',
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass',
- 'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass',
'Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\FooClass',
));
@@ -55,6 +60,12 @@ class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest
->will($this->returnValue(array()))
;
+ $this->reader
+ ->expects($this->any())
+ ->method('getClassAnnotations')
+ ->will($this->returnValue(array()))
+ ;
+
$this->loader->load(__DIR__.'/../Fixtures/AnnotatedClasses');
}
diff --git a/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php
new file mode 100644
index 00000000..08d806a8
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php
@@ -0,0 +1,45 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Loader;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Config\Resource\GlobResource;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\Routing\Loader\GlobFileLoader;
+use Symfony\Component\Routing\RouteCollection;
+
+class GlobFileLoaderTest extends TestCase
+{
+ public function testSupports()
+ {
+ $loader = new GlobFileLoader(new FileLocator());
+
+ $this->assertTrue($loader->supports('any-path', 'glob'), '->supports() returns true if the resource has the glob type');
+ $this->assertFalse($loader->supports('any-path'), '->supports() returns false if the resource is not of glob type');
+ }
+
+ public function testLoadAddsTheGlobResourceToTheContainer()
+ {
+ $loader = new GlobFileLoaderWithoutImport(new FileLocator());
+ $collection = $loader->load(__DIR__.'/../Fixtures/directory/*.yml');
+
+ $this->assertEquals(new GlobResource(__DIR__.'/../Fixtures/directory', '/*.yml', false), $collection->getResources()[0]);
+ }
+}
+
+class GlobFileLoaderWithoutImport extends GlobFileLoader
+{
+ public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null)
+ {
+ return new RouteCollection();
+ }
+}
diff --git a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php
index 608d84ed..0dcf5d49 100644
--- a/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php
+++ b/vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php
@@ -117,4 +117,17 @@ class PhpFileLoaderTest extends TestCase
$this->assertEquals($expectedCollection, $routeCollection);
}
+
+ public function testRoutingConfiguratorCanImportGlobPatterns()
+ {
+ $locator = new FileLocator(array(__DIR__.'/../Fixtures/glob'));
+ $loader = new PhpFileLoader($locator);
+ $routeCollection = $loader->load('php_dsl.php');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('baz_route');
+ $this->assertSame('AppBundle:Baz:view', $route->getDefault('_controller'));
+ }
}
diff --git a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php
index 221434b0..21fc3400 100644
--- a/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php
+++ b/vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php
@@ -361,4 +361,25 @@ class XmlFileLoaderTest extends TestCase
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
$loader->load('import_override_defaults.xml');
}
+
+ public function testImportRouteWithGlobMatchingSingleFile()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_single.xml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+ }
+
+ public function testImportRouteWithGlobMatchingMultipleFiles()
+ {
+ $loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_multiple.xml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('baz_route');
+ $this->assertSame('AppBundle:Baz:view', $route->getDefault('_controller'));
+ }
}
diff --git a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php
index 1f7fd438..822bddf1 100644
--- a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php
+++ b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php
@@ -182,4 +182,25 @@ class YamlFileLoaderTest extends TestCase
$loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/controller')));
$loader->load('import_override_defaults.yml');
}
+
+ public function testImportRouteWithGlobMatchingSingleFile()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_single.yml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+ }
+
+ public function testImportRouteWithGlobMatchingMultipleFiles()
+ {
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/glob')));
+ $routeCollection = $loader->load('import_multiple.yml');
+
+ $route = $routeCollection->get('bar_route');
+ $this->assertSame('AppBundle:Bar:view', $route->getDefault('_controller'));
+
+ $route = $routeCollection->get('baz_route');
+ $this->assertSame('AppBundle:Baz:view', $route->getDefault('_controller'));
+ }
}
diff --git a/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php
new file mode 100644
index 00000000..cfbb524d
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php
@@ -0,0 +1,43 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Matcher;
+
+use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
+use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
+use Symfony\Component\Routing\Matcher\UrlMatcher;
+use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\RequestContext;
+
+class DumpedRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest
+{
+ protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
+ {
+ static $i = 0;
+
+ $class = 'DumpedRedirectableUrlMatcher'.++$i;
+ $dumper = new PhpMatcherDumper($routes);
+ eval('?>'.$dumper->dump(array('class' => $class, 'base_class' => 'Symfony\Component\Routing\Tests\Matcher\TestDumpedRedirectableUrlMatcher')));
+
+ return $this->getMockBuilder($class)
+ ->setConstructorArgs(array($context ?: new RequestContext()))
+ ->setMethods(array('redirect'))
+ ->getMock();
+ }
+}
+
+class TestDumpedRedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface
+{
+ public function redirect($path, $route, $scheme = null)
+ {
+ return array();
+ }
+}
diff --git a/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php
new file mode 100644
index 00000000..880b2b13
--- /dev/null
+++ b/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php
@@ -0,0 +1,48 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Routing\Tests\Matcher;
+
+use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
+use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\RequestContext;
+
+class DumpedUrlMatcherTest extends UrlMatcherTest
+{
+ /**
+ * @expectedException \LogicException
+ * @expectedExceptionMessage The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.
+ */
+ public function testSchemeRequirement()
+ {
+ parent::testSchemeRequirement();
+ }
+
+ /**
+ * @expectedException \LogicException
+ * @expectedExceptionMessage The "schemes" requirement is only supported for URL matchers that implement RedirectableUrlMatcherInterface.
+ */
+ public function testSchemeAndMethodMismatch()
+ {
+ parent::testSchemeRequirement();
+ }
+
+ protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
+ {
+ static $i = 0;
+
+ $class = 'DumpedUrlMatcher'.++$i;
+ $dumper = new PhpMatcherDumper($routes);
+ eval('?>'.$dumper->dump(array('class' => $class)));
+
+ return new $class($context ?: new RequestContext());
+ }
+}
diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
index e4c18c47..f29a6d6a 100644
--- a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
+++ b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php
@@ -354,7 +354,7 @@ class PhpMatcherDumperTest extends TestCase
array('GET', 'HEAD')
));
$headMatchCasesCollection->add('post_and_head', new Route(
- '/post_and_get',
+ '/post_and_head',
array(),
array(),
array(),
diff --git a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php
index 0948e002..7984391e 100644
--- a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php
+++ b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -11,19 +11,18 @@
namespace Symfony\Component\Routing\Tests\Matcher;
-use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
-class RedirectableUrlMatcherTest extends TestCase
+class RedirectableUrlMatcherTest extends UrlMatcherTest
{
- public function testRedirectWhenNoSlash()
+ public function testMissingTrailingSlash()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/'));
- $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher = $this->getUrlMatcher($coll);
$matcher->expects($this->once())->method('redirect')->will($this->returnValue(array()));
$matcher->match('/foo');
}
@@ -38,7 +37,7 @@ class RedirectableUrlMatcherTest extends TestCase
$context = new RequestContext();
$context->setMethod('POST');
- $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, $context));
+ $matcher = $this->getUrlMatcher($coll, $context);
$matcher->match('/foo');
}
@@ -47,7 +46,7 @@ class RedirectableUrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array('FTP', 'HTTPS')));
- $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher = $this->getUrlMatcher($coll);
$matcher
->expects($this->once())
->method('redirect')
@@ -57,12 +56,12 @@ class RedirectableUrlMatcherTest extends TestCase
$matcher->match('/foo');
}
- public function testNoSchemaRedirectIfOnOfMultipleSchemesMatches()
+ public function testNoSchemaRedirectIfOneOfMultipleSchemesMatches()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https', 'http')));
- $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher = $this->getUrlMatcher($coll);
$matcher
->expects($this->never())
->method('redirect');
@@ -74,7 +73,7 @@ class RedirectableUrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/{bar}', array(), array(), array(), '', array('https')));
- $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher = $this->getUrlMatcher($coll);
$matcher
->expects($this->once())
->method('redirect')
@@ -89,7 +88,7 @@ class RedirectableUrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/{bar}/'));
- $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher = $this->getUrlMatcher($coll);
$matcher
->expects($this->once())
->method('redirect')
@@ -104,8 +103,22 @@ class RedirectableUrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo:bar/'));
- $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
+ $matcher = $this->getUrlMatcher($coll);
$matcher->expects($this->once())->method('redirect')->with('/foo%3Abar/')->willReturn(array());
$matcher->match('/foo%3Abar');
}
+
+ public function testSchemeRequirement()
+ {
+ $coll = new RouteCollection();
+ $coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https')));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext());
+ $matcher->expects($this->once())->method('redirect')->with('/foo', 'foo', 'https')->willReturn(array());
+ $this->assertSame(array('_route' => 'foo'), $matcher->match('/foo'));
+ }
+
+ protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
+ {
+ return $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($routes, $context ?: new RequestContext()));
+ }
}
diff --git a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php
index 8545c2c2..e8d31e22 100644
--- a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php
+++ b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php
@@ -26,7 +26,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo'));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertInternalType('array', $matcher->match('/foo'));
}
@@ -35,7 +35,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('post')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
try {
$matcher->match('/foo');
@@ -45,12 +45,27 @@ class UrlMatcherTest extends TestCase
}
}
+ public function testMethodNotAllowedOnRoot()
+ {
+ $coll = new RouteCollection();
+ $coll->add('foo', new Route('/', array(), array(), array(), '', array(), array('GET')));
+
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'POST'));
+
+ try {
+ $matcher->match('/');
+ $this->fail();
+ } catch (MethodNotAllowedException $e) {
+ $this->assertEquals(array('GET'), $e->getAllowedMethods());
+ }
+ }
+
public function testHeadAllowedWhenRequirementContainsGet()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('get')));
- $matcher = new UrlMatcher($coll, new RequestContext('', 'head'));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'head'));
$this->assertInternalType('array', $matcher->match('/foo'));
}
@@ -60,7 +75,7 @@ class UrlMatcherTest extends TestCase
$coll->add('foo1', new Route('/foo', array(), array(), array(), '', array(), array('post')));
$coll->add('foo2', new Route('/foo', array(), array(), array(), '', array(), array('put', 'delete')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
try {
$matcher->match('/foo');
@@ -75,7 +90,7 @@ class UrlMatcherTest extends TestCase
// test the patterns are matched and parameters are returned
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo/{bar}'));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
try {
$matcher->match('/no-match');
$this->fail();
@@ -86,17 +101,17 @@ class UrlMatcherTest extends TestCase
// test that defaults are merged
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo/{bar}', array('def' => 'test')));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'def' => 'test'), $matcher->match('/foo/baz'));
// test that route "method" is ignored if no method is given in the context
$collection = new RouteCollection();
$collection->add('foo', new Route('/foo', array(), array(), array(), '', array(), array('get', 'head')));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertInternalType('array', $matcher->match('/foo'));
// route does not match with POST method context
- $matcher = new UrlMatcher($collection, new RequestContext('', 'post'));
+ $matcher = $this->getUrlMatcher($collection, new RequestContext('', 'post'));
try {
$matcher->match('/foo');
$this->fail();
@@ -104,28 +119,28 @@ class UrlMatcherTest extends TestCase
}
// route does match with GET or HEAD method context
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertInternalType('array', $matcher->match('/foo'));
- $matcher = new UrlMatcher($collection, new RequestContext('', 'head'));
+ $matcher = $this->getUrlMatcher($collection, new RequestContext('', 'head'));
$this->assertInternalType('array', $matcher->match('/foo'));
// route with an optional variable as the first segment
$collection = new RouteCollection();
$collection->add('bar', new Route('/{bar}/foo', array('bar' => 'bar'), array('bar' => 'foo|bar')));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/bar/foo'));
$this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo/foo'));
$collection = new RouteCollection();
$collection->add('bar', new Route('/{bar}', array('bar' => 'bar'), array('bar' => 'foo|bar')));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo'));
$this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/'));
// route with only optional variables
$collection = new RouteCollection();
$collection->add('bar', new Route('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar'), array()));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'bar', 'foo' => 'foo', 'bar' => 'bar'), $matcher->match('/'));
$this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'bar'), $matcher->match('/a'));
$this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'b'), $matcher->match('/a/b'));
@@ -138,7 +153,7 @@ class UrlMatcherTest extends TestCase
$collection->addPrefix('/b');
$collection->addPrefix('/a');
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'foo', 'foo' => 'foo'), $matcher->match('/a/b/foo'));
}
@@ -149,7 +164,7 @@ class UrlMatcherTest extends TestCase
$collection->addPrefix('/b');
$collection->addPrefix('/{_locale}');
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_locale' => 'fr', '_route' => 'foo', 'foo' => 'foo'), $matcher->match('/fr/b/foo'));
}
@@ -158,17 +173,29 @@ class UrlMatcherTest extends TestCase
$collection = new RouteCollection();
$collection->add('$péß^a|', new Route('/bar'));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => '$péß^a|'), $matcher->match('/bar'));
}
+ /**
+ * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
+ */
+ public function testTrailingEncodedNewlineIsNotOverlooked()
+ {
+ $collection = new RouteCollection();
+ $collection->add('foo', new Route('/foo'));
+
+ $matcher = $this->getUrlMatcher($collection);
+ $matcher->match('/foo%0a');
+ }
+
public function testMatchNonAlpha()
{
$collection = new RouteCollection();
$chars = '!"$%éà &\'()*+,./:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[]^_`abcdefghijklmnopqrstuvwxyz{|}~-';
$collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '['.preg_quote($chars).']+'), array('utf8' => true)));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.rawurlencode($chars).'/bar'));
$this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.strtr($chars, array('%' => '%25')).'/bar'));
}
@@ -178,7 +205,7 @@ class UrlMatcherTest extends TestCase
$collection = new RouteCollection();
$collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '.+')));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'foo', 'foo' => "\n"), $matcher->match('/'.urlencode("\n").'/bar'), 'linefeed character is matched');
}
@@ -192,7 +219,7 @@ class UrlMatcherTest extends TestCase
$collection->addCollection($collection1);
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
$this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1'));
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException');
@@ -205,12 +232,12 @@ class UrlMatcherTest extends TestCase
$coll->add('foo', new Route('/foo/{foo}'));
$coll->add('bar', new Route('/foo/bar/{foo}'));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('foo' => 'bar', '_route' => 'bar'), $matcher->match('/foo/bar/bar'));
$collection = new RouteCollection();
$collection->add('foo', new Route('/{bar}'));
- $matcher = new UrlMatcher($collection, new RequestContext());
+ $matcher = $this->getUrlMatcher($collection);
try {
$matcher->match('/');
$this->fail();
@@ -223,7 +250,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}', array('page' => 'index', '_format' => 'html')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('page' => 'my-page', '_format' => 'xml', '_route' => 'test'), $matcher->match('/my-page.xml'));
}
@@ -232,7 +259,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('test', new Route('/{foo}-{bar}-', array(), array('foo' => '.+', 'bar' => '.+')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('foo' => 'text1-text2-text3', 'bar' => 'text4', '_route' => 'test'), $matcher->match('/text1-text2-text3-text4-'));
}
@@ -241,7 +268,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('test', new Route('/{w}{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => 'y|Y')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
// 'w' eagerly matches as much as possible and the other variables match the remaining chars.
// This also shows that the variables w-z must all exclude the separating char (the dot '.' in this case) by default requirement.
// Otherwise they would also consume '.xml' and _format would never match as it's an optional variable.
@@ -260,7 +287,7 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
$coll->add('test', new Route('/get{what}', array('what' => 'All')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('what' => 'All', '_route' => 'test'), $matcher->match('/get'));
$this->assertEquals(array('what' => 'Sites', '_route' => 'test'), $matcher->match('/getSites'));
@@ -275,7 +302,7 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
$coll->add('test', new Route('/get{what}Suffix'));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('what' => 'Sites', '_route' => 'test'), $matcher->match('/getSitesSuffix'));
}
@@ -284,7 +311,7 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}'));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('page' => 'index', '_format' => 'mobile.html', '_route' => 'test'), $matcher->match('/index.mobile.html'));
}
@@ -296,7 +323,7 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}'));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$matcher->match('/index.sl/ash');
}
@@ -308,7 +335,7 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
$coll->add('test', new Route('/{page}.{_format}', array(), array('_format' => 'html|xml')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$matcher->match('/do.t.html');
}
@@ -320,7 +347,7 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo', array(), array(), array(), '', array('https')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$matcher->match('/foo');
}
@@ -333,7 +360,7 @@ class UrlMatcherTest extends TestCase
$route = new Route('/foo');
$route->setCondition('context.getMethod() == "POST"');
$coll->add('foo', $route);
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$matcher->match('/foo');
}
@@ -343,7 +370,7 @@ class UrlMatcherTest extends TestCase
$route = new Route('/foo/{bar}');
$route->setCondition('request.getBaseUrl() == "/sub/front.php" and request.getPathInfo() == "/foo/bar"');
$coll->add('foo', $route);
- $matcher = new UrlMatcher($coll, new RequestContext('/sub/front.php'));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('/sub/front.php'));
$this->assertEquals(array('bar' => 'bar', '_route' => 'foo'), $matcher->match('/foo/bar'));
}
@@ -352,7 +379,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/{foo}'));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('foo' => 'bar%23', '_route' => 'foo'), $matcher->match('/foo/bar%2523'));
}
@@ -368,7 +395,7 @@ class UrlMatcherTest extends TestCase
$coll->addCollection($subColl);
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$this->assertEquals(array('_route' => 'bar'), $matcher->match('/new'));
}
@@ -377,7 +404,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/{foo}', array(), array(), array(), '{locale}.example.com'));
- $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
$this->assertEquals(array('foo' => 'bar', '_route' => 'foo', 'locale' => 'en'), $matcher->match('/foo/bar'));
}
@@ -388,10 +415,10 @@ class UrlMatcherTest extends TestCase
$coll->add('bar', new Route('/bar/{foo}', array(), array(), array(), '{locale}.example.net'));
$coll->setHost('{locale}.example.com');
- $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
$this->assertEquals(array('foo' => 'bar', '_route' => 'foo', 'locale' => 'en'), $matcher->match('/foo/bar'));
- $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
$this->assertEquals(array('foo' => 'bar', '_route' => 'bar', 'locale' => 'en'), $matcher->match('/bar/bar'));
}
@@ -403,7 +430,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/foo/{foo}', array(), array(), array(), '{locale}.example.com'));
- $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'example.com'));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'example.com'));
$matcher->match('/foo/bar');
}
@@ -415,7 +442,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/locale', array(), array('locale' => 'EN|FR|DE')));
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$matcher->match('/en');
}
@@ -424,7 +451,7 @@ class UrlMatcherTest extends TestCase
$coll = new RouteCollection();
$coll->add('foo', new Route('/', array(), array('locale' => 'EN|FR|DE'), array(), '{locale}.example.com'));
- $matcher = new UrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
+ $matcher = $this->getUrlMatcher($coll, new RequestContext('', 'GET', 'en.example.com'));
$this->assertEquals(array('_route' => 'foo', 'locale' => 'en'), $matcher->match('/'));
}
@@ -435,7 +462,48 @@ class UrlMatcherTest extends TestCase
{
$coll = new RouteCollection();
- $matcher = new UrlMatcher($coll, new RequestContext());
+ $matcher = $this->getUrlMatcher($coll);
$matcher->match('/');
}
+
+ public function testNestedCollections()
+ {
+ $coll = new RouteCollection();
+
+ $subColl = new RouteCollection();
+ $subColl->add('a', new Route('/a'));
+ $subColl->add('b', new Route('/b'));
+ $subColl->add('c', new Route('/c'));
+ $subColl->addPrefix('/p');
+ $coll->addCollection($subColl);
+
+ $coll->add('baz', new Route('/{baz}'));
+
+ $subColl = new RouteCollection();
+ $subColl->add('buz', new Route('/buz'));
+ $subColl->addPrefix('/prefix');
+ $coll->addCollection($subColl);
+
+ $matcher = $this->getUrlMatcher($coll);
+ $this->assertEquals(array('_route' => 'a'), $matcher->match('/p/a'));
+ $this->assertEquals(array('_route' => 'baz', 'baz' => 'p'), $matcher->match('/p'));
+ $this->assertEquals(array('_route' => 'buz'), $matcher->match('/prefix/buz'));
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
+ */
+ public function testSchemeAndMethodMismatch()
+ {
+ $coll = new RouteCollection();
+ $coll->add('foo', new Route('/', array(), array(), array(), null, array('https'), array('POST')));
+
+ $matcher = $this->getUrlMatcher($coll);
+ $matcher->match('/');
+ }
+
+ protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
+ {
+ return new UrlMatcher($routes, $context ?: new RequestContext());
+ }
}
diff --git a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php b/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php
index f6af600b..76a042d6 100644
--- a/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php
+++ b/vendor/symfony/routing/Tests/RouteCollectionBuilderTest.php
@@ -357,7 +357,7 @@ class RouteCollectionBuilderTest extends TestCase
$routeCollectionBuilder->import('/directory/recurse/*', '/other/', 'glob');
$routes = $routeCollectionBuilder->build()->all();
- $this->assertEquals(2, count($routes));
+ $this->assertCount(2, $routes);
$this->assertEquals('/other/a', $routes['a']->getPath());
$this->assertEquals('/other/b', $routes['b']->getPath());
}
diff --git a/vendor/symfony/routing/Tests/RouteCompilerTest.php b/vendor/symfony/routing/Tests/RouteCompilerTest.php
index 54006d7e..dc304e3e 100644
--- a/vendor/symfony/routing/Tests/RouteCompilerTest.php
+++ b/vendor/symfony/routing/Tests/RouteCompilerTest.php
@@ -38,7 +38,7 @@ class RouteCompilerTest extends TestCase
array(
'Static route',
array('/foo'),
- '/foo', '#^/foo$#s', array(), array(
+ '/foo', '#^/foo$#sD', array(), array(
array('text', '/foo'),
),
),
@@ -46,7 +46,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with a variable',
array('/foo/{bar}'),
- '/foo', '#^/foo/(?P[^/]++)$#s', array('bar'), array(
+ '/foo', '#^/foo/(?P[^/]++)$#sD', array('bar'), array(
array('variable', '/', '[^/]++', 'bar'),
array('text', '/foo'),
),
@@ -55,7 +55,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with a variable that has a default value',
array('/foo/{bar}', array('bar' => 'bar')),
- '/foo', '#^/foo(?:/(?P[^/]++))?$#s', array('bar'), array(
+ '/foo', '#^/foo(?:/(?P[^/]++))?$#sD', array('bar'), array(
array('variable', '/', '[^/]++', 'bar'),
array('text', '/foo'),
),
@@ -64,7 +64,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with several variables',
array('/foo/{bar}/{foobar}'),
- '/foo', '#^/foo/(?P[^/]++)/(?P[^/]++)$#s', array('bar', 'foobar'), array(
+ '/foo', '#^/foo/(?P[^/]++)/(?P[^/]++)$#sD', array('bar', 'foobar'), array(
array('variable', '/', '[^/]++', 'foobar'),
array('variable', '/', '[^/]++', 'bar'),
array('text', '/foo'),
@@ -74,7 +74,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with several variables that have default values',
array('/foo/{bar}/{foobar}', array('bar' => 'bar', 'foobar' => '')),
- '/foo', '#^/foo(?:/(?P[^/]++)(?:/(?P[^/]++))?)?$#s', array('bar', 'foobar'), array(
+ '/foo', '#^/foo(?:/(?P[^/]++)(?:/(?P[^/]++))?)?$#sD', array('bar', 'foobar'), array(
array('variable', '/', '[^/]++', 'foobar'),
array('variable', '/', '[^/]++', 'bar'),
array('text', '/foo'),
@@ -84,7 +84,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with several variables but some of them have no default values',
array('/foo/{bar}/{foobar}', array('bar' => 'bar')),
- '/foo', '#^/foo/(?P[^/]++)/(?P[^/]++)$#s', array('bar', 'foobar'), array(
+ '/foo', '#^/foo/(?P[^/]++)/(?P[^/]++)$#sD', array('bar', 'foobar'), array(
array('variable', '/', '[^/]++', 'foobar'),
array('variable', '/', '[^/]++', 'bar'),
array('text', '/foo'),
@@ -94,7 +94,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with an optional variable as the first segment',
array('/{bar}', array('bar' => 'bar')),
- '', '#^/(?P[^/]++)?$#s', array('bar'), array(
+ '', '#^/(?P[^/]++)?$#sD', array('bar'), array(
array('variable', '/', '[^/]++', 'bar'),
),
),
@@ -102,7 +102,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with a requirement of 0',
array('/{bar}', array('bar' => null), array('bar' => '0')),
- '', '#^/(?P0)?$#s', array('bar'), array(
+ '', '#^/(?P0)?$#sD', array('bar'), array(
array('variable', '/', '0', 'bar'),
),
),
@@ -110,7 +110,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with an optional variable as the first segment with requirements',
array('/{bar}', array('bar' => 'bar'), array('bar' => '(foo|bar)')),
- '', '#^/(?P(foo|bar))?$#s', array('bar'), array(
+ '', '#^/(?P(foo|bar))?$#sD', array('bar'), array(
array('variable', '/', '(foo|bar)', 'bar'),
),
),
@@ -118,7 +118,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with only optional variables',
array('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar')),
- '', '#^/(?P[^/]++)?(?:/(?P[^/]++))?$#s', array('foo', 'bar'), array(
+ '', '#^/(?P[^/]++)?(?:/(?P[^/]++))?$#sD', array('foo', 'bar'), array(
array('variable', '/', '[^/]++', 'bar'),
array('variable', '/', '[^/]++', 'foo'),
),
@@ -127,7 +127,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with a variable in last position',
array('/foo-{bar}'),
- '/foo-', '#^/foo\-(?P[^/]++)$#s', array('bar'), array(
+ '/foo-', '#^/foo\-(?P[^/]++)$#sD', array('bar'), array(
array('variable', '-', '[^/]++', 'bar'),
array('text', '/foo'),
),
@@ -136,7 +136,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with nested placeholders',
array('/{static{var}static}'),
- '/{static', '#^/\{static(?P[^/]+)static\}$#s', array('var'), array(
+ '/{static', '#^/\{static(?P[^/]+)static\}$#sD', array('var'), array(
array('text', 'static}'),
array('variable', '', '[^/]+', 'var'),
array('text', '/{static'),
@@ -146,7 +146,7 @@ class RouteCompilerTest extends TestCase
array(
'Route without separator between variables',
array('/{w}{x}{y}{z}.{_format}', array('z' => 'default-z', '_format' => 'html'), array('y' => '(y|Y)')),
- '', '#^/(?P[^/\.]+)(?P[^/\.]+)(?P(y|Y))(?:(?P[^/\.]++)(?:\.(?P<_format>[^/]++))?)?$#s', array('w', 'x', 'y', 'z', '_format'), array(
+ '', '#^/(?P[^/\.]+)(?P[^/\.]+)(?P(y|Y))(?:(?P[^/\.]++)(?:\.(?P<_format>[^/]++))?)?$#sD', array('w', 'x', 'y', 'z', '_format'), array(
array('variable', '.', '[^/]++', '_format'),
array('variable', '', '[^/\.]++', 'z'),
array('variable', '', '(y|Y)', 'y'),
@@ -158,7 +158,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with a format',
array('/foo/{bar}.{_format}'),
- '/foo', '#^/foo/(?P[^/\.]++)\.(?P<_format>[^/]++)$#s', array('bar', '_format'), array(
+ '/foo', '#^/foo/(?P[^/\.]++)\.(?P<_format>[^/]++)$#sD', array('bar', '_format'), array(
array('variable', '.', '[^/]++', '_format'),
array('variable', '/', '[^/\.]++', 'bar'),
array('text', '/foo'),
@@ -168,7 +168,7 @@ class RouteCompilerTest extends TestCase
array(
'Static non UTF-8 route',
array("/fo\xE9"),
- "/fo\xE9", "#^/fo\xE9$#s", array(), array(
+ "/fo\xE9", "#^/fo\xE9$#sD", array(), array(
array('text', "/fo\xE9"),
),
),
@@ -176,7 +176,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with an explicit UTF-8 requirement',
array('/{bar}', array('bar' => null), array('bar' => '.'), array('utf8' => true)),
- '', '#^/(?P.)?$#su', array('bar'), array(
+ '', '#^/(?P.)?$#sDu', array('bar'), array(
array('variable', '/', '.', 'bar', true),
),
),
@@ -206,7 +206,7 @@ class RouteCompilerTest extends TestCase
array(
'Static UTF-8 route',
array('/foé'),
- '/foé', '#^/foé$#su', array(), array(
+ '/foé', '#^/foé$#sDu', array(), array(
array('text', '/foé'),
),
'patterns',
@@ -215,7 +215,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with an implicit UTF-8 requirement',
array('/{bar}', array('bar' => null), array('bar' => 'é')),
- '', '#^/(?Pé)?$#su', array('bar'), array(
+ '', '#^/(?Pé)?$#sDu', array('bar'), array(
array('variable', '/', 'é', 'bar', true),
),
'requirements',
@@ -224,7 +224,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with a UTF-8 class requirement',
array('/{bar}', array('bar' => null), array('bar' => '\pM')),
- '', '#^/(?P\pM)?$#su', array('bar'), array(
+ '', '#^/(?P\pM)?$#sDu', array('bar'), array(
array('variable', '/', '\pM', 'bar', true),
),
'requirements',
@@ -233,7 +233,7 @@ class RouteCompilerTest extends TestCase
array(
'Route with a UTF-8 separator',
array('/foo/{bar}§{_format}', array(), array(), array('compiler_class' => Utf8RouteCompiler::class)),
- '/foo', '#^/foo/(?P[^/§]++)§(?P<_format>[^/]++)$#su', array('bar', '_format'), array(
+ '/foo', '#^/foo/(?P[^/§]++)§(?P<_format>[^/]++)$#sDu', array('bar', '_format'), array(
array('variable', '§', '[^/]++', '_format', true),
array('variable', '/', '[^/§]++', 'bar', true),
array('text', '/foo'),
@@ -327,21 +327,21 @@ class RouteCompilerTest extends TestCase
array(
'Route with host pattern',
array('/hello', array(), array(), array(), 'www.example.com'),
- '/hello', '#^/hello$#s', array(), array(), array(
+ '/hello', '#^/hello$#sD', array(), array(), array(
array('text', '/hello'),
),
- '#^www\.example\.com$#si', array(), array(
+ '#^www\.example\.com$#sDi', array(), array(
array('text', 'www.example.com'),
),
),
array(
'Route with host pattern and some variables',
array('/hello/{name}', array(), array(), array(), 'www.example.{tld}'),
- '/hello', '#^/hello/(?P[^/]++)$#s', array('tld', 'name'), array('name'), array(
+ '/hello', '#^/hello/(?P[^/]++)$#sD', array('tld', 'name'), array('name'), array(
array('variable', '/', '[^/]++', 'name'),
array('text', '/hello'),
),
- '#^www\.example\.(?P[^\.]++)$#si', array('tld'), array(
+ '#^www\.example\.(?P[^\.]++)$#sDi', array('tld'), array(
array('variable', '.', '[^\.]++', 'tld'),
array('text', 'www.example'),
),
@@ -349,10 +349,10 @@ class RouteCompilerTest extends TestCase
array(
'Route with variable at beginning of host',
array('/hello', array(), array(), array(), '{locale}.example.{tld}'),
- '/hello', '#^/hello$#s', array('locale', 'tld'), array(), array(
+ '/hello', '#^/hello$#sD', array('locale', 'tld'), array(), array(
array('text', '/hello'),
),
- '#^(?P[^\.]++)\.example\.(?P[^\.]++)$#si', array('locale', 'tld'), array(
+ '#^(?P[^\.]++)\.example\.(?P[^\.]++)$#sDi', array('locale', 'tld'), array(
array('variable', '.', '[^\.]++', 'tld'),
array('text', '.example'),
array('variable', '', '[^\.]++', 'locale'),
@@ -361,10 +361,10 @@ class RouteCompilerTest extends TestCase
array(
'Route with host variables that has a default value',
array('/hello', array('locale' => 'a', 'tld' => 'b'), array(), array(), '{locale}.example.{tld}'),
- '/hello', '#^/hello$#s', array('locale', 'tld'), array(), array(
+ '/hello', '#^/hello$#sD', array('locale', 'tld'), array(), array(
array('text', '/hello'),
),
- '#^(?P[^\.]++)\.example\.(?P[^\.]++)$#si', array('locale', 'tld'), array(
+ '#^(?P[^\.]++)\.example\.(?P[^\.]++)$#sDi', array('locale', 'tld'), array(
array('variable', '.', '[^\.]++', 'tld'),
array('text', '.example'),
array('variable', '', '[^\.]++', 'locale'),
diff --git a/vendor/symfony/routing/Tests/RouteTest.php b/vendor/symfony/routing/Tests/RouteTest.php
index ff7e320c..c7af058e 100644
--- a/vendor/symfony/routing/Tests/RouteTest.php
+++ b/vendor/symfony/routing/Tests/RouteTest.php
@@ -245,7 +245,7 @@ class RouteTest extends TestCase
*/
public function testSerializedRepresentationKeepsWorking()
{
- $serialized = 'C:31:"Symfony\Component\Routing\Route":934:{a:8:{s:4:"path";s:13:"/prefix/{foo}";s:4:"host";s:20:"{locale}.example.net";s:8:"defaults";a:1:{s:3:"foo";s:7:"default";}s:12:"requirements";a:1:{s:3:"foo";s:3:"\d+";}s:7:"options";a:1:{s:14:"compiler_class";s:39:"Symfony\Component\Routing\RouteCompiler";}s:7:"schemes";a:0:{}s:7:"methods";a:0:{}s:8:"compiled";C:39:"Symfony\Component\Routing\CompiledRoute":569:{a:8:{s:4:"vars";a:2:{i:0;s:6:"locale";i:1;s:3:"foo";}s:11:"path_prefix";s:7:"/prefix";s:10:"path_regex";s:30:"#^/prefix(?:/(?P\d+))?$#s";s:11:"path_tokens";a:2:{i:0;a:4:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:3:"\d+";i:3;s:3:"foo";}i:1;a:2:{i:0;s:4:"text";i:1;s:7:"/prefix";}}s:9:"path_vars";a:1:{i:0;s:3:"foo";}s:10:"host_regex";s:39:"#^(?P[^\.]++)\.example\.net$#si";s:11:"host_tokens";a:2:{i:0;a:2:{i:0;s:4:"text";i:1;s:12:".example.net";}i:1;a:4:{i:0;s:8:"variable";i:1;s:0:"";i:2;s:7:"[^\.]++";i:3;s:6:"locale";}}s:9:"host_vars";a:1:{i:0;s:6:"locale";}}}}}';
+ $serialized = 'C:31:"Symfony\Component\Routing\Route":936:{a:8:{s:4:"path";s:13:"/prefix/{foo}";s:4:"host";s:20:"{locale}.example.net";s:8:"defaults";a:1:{s:3:"foo";s:7:"default";}s:12:"requirements";a:1:{s:3:"foo";s:3:"\d+";}s:7:"options";a:1:{s:14:"compiler_class";s:39:"Symfony\Component\Routing\RouteCompiler";}s:7:"schemes";a:0:{}s:7:"methods";a:0:{}s:8:"compiled";C:39:"Symfony\Component\Routing\CompiledRoute":571:{a:8:{s:4:"vars";a:2:{i:0;s:6:"locale";i:1;s:3:"foo";}s:11:"path_prefix";s:7:"/prefix";s:10:"path_regex";s:31:"#^/prefix(?:/(?P\d+))?$#sD";s:11:"path_tokens";a:2:{i:0;a:4:{i:0;s:8:"variable";i:1;s:1:"/";i:2;s:3:"\d+";i:3;s:3:"foo";}i:1;a:2:{i:0;s:4:"text";i:1;s:7:"/prefix";}}s:9:"path_vars";a:1:{i:0;s:3:"foo";}s:10:"host_regex";s:40:"#^(?P[^\.]++)\.example\.net$#sDi";s:11:"host_tokens";a:2:{i:0;a:2:{i:0;s:4:"text";i:1;s:12:".example.net";}i:1;a:4:{i:0;s:8:"variable";i:1;s:0:"";i:2;s:7:"[^\.]++";i:3;s:6:"locale";}}s:9:"host_vars";a:1:{i:0;s:6:"locale";}}}}}';
$unserialized = unserialize($serialized);
$route = new Route('/prefix/{foo}', array('foo' => 'default'), array('foo' => '\d+'));
diff --git a/vendor/symfony/routing/Tests/RouterTest.php b/vendor/symfony/routing/Tests/RouterTest.php
index 409959ee..3e3d43f8 100644
--- a/vendor/symfony/routing/Tests/RouterTest.php
+++ b/vendor/symfony/routing/Tests/RouterTest.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Routing\Tests;
use PHPUnit\Framework\TestCase;
+use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Router;
use Symfony\Component\HttpFoundation\Request;
@@ -83,7 +84,7 @@ class RouterTest extends TestCase
{
$this->router->setOption('resource_type', 'ResourceType');
- $routeCollection = $this->getMockBuilder('Symfony\Component\Routing\RouteCollection')->getMock();
+ $routeCollection = new RouteCollection();
$this->loader->expects($this->once())
->method('load')->with('routing.yml', 'ResourceType')
@@ -101,7 +102,7 @@ class RouterTest extends TestCase
$this->loader->expects($this->once())
->method('load')->with('routing.yml', null)
- ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Routing\RouteCollection')->getMock()));
+ ->will($this->returnValue(new RouteCollection()));
$this->assertInstanceOf('Symfony\\Component\\Routing\\Matcher\\UrlMatcher', $this->router->getMatcher());
}
@@ -123,7 +124,7 @@ class RouterTest extends TestCase
$this->loader->expects($this->once())
->method('load')->with('routing.yml', null)
- ->will($this->returnValue($this->getMockBuilder('Symfony\Component\Routing\RouteCollection')->getMock()));
+ ->will($this->returnValue(new RouteCollection()));
$this->assertInstanceOf('Symfony\\Component\\Routing\\Generator\\UrlGenerator', $this->router->getGenerator());
}
diff --git a/vendor/symfony/routing/composer.json b/vendor/symfony/routing/composer.json
index 2ad746ec..4d820cc2 100644
--- a/vendor/symfony/routing/composer.json
+++ b/vendor/symfony/routing/composer.json
@@ -19,7 +19,7 @@
"php": "^5.5.9|>=7.0.8"
},
"require-dev": {
- "symfony/config": "~2.8|~3.0|~4.0",
+ "symfony/config": "^3.3.1|~4.0",
"symfony/http-foundation": "~2.8|~3.0|~4.0",
"symfony/yaml": "~3.4|~4.0",
"symfony/expression-language": "~2.8|~3.0|~4.0",
@@ -29,7 +29,7 @@
"psr/log": "~1.0"
},
"conflict": {
- "symfony/config": "<2.8",
+ "symfony/config": "<3.3.1",
"symfony/dependency-injection": "<3.3",
"symfony/yaml": "<3.4"
},
diff --git a/vendor/symfony/thanks/src/Command/ThanksCommand.php b/vendor/symfony/thanks/src/Command/ThanksCommand.php
index e96d404c..cafbb933 100644
--- a/vendor/symfony/thanks/src/Command/ThanksCommand.php
+++ b/vendor/symfony/thanks/src/Command/ThanksCommand.php
@@ -13,11 +13,13 @@ namespace Symfony\Thanks\Command;
use Composer\Command\BaseCommand;
use Composer\Composer;
+use Composer\Downloader\TransportException;
use Composer\Json\JsonFile;
use Composer\Util\RemoteFilesystem;
use Composer\Factory;
use Composer\Plugin\PluginEvents;
use Composer\Plugin\PreFileDownloadEvent;
+use Hirak\Prestissimo\CurlRemoteFilesystem;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -166,7 +168,8 @@ class ThanksCommand extends BaseCommand
}
}
- $repos = $this->callGitHub($rfs, sprintf("query{\n%s}", $graphql));
+ $failures = [];
+ $repos = $this->callGitHub($rfs, sprintf("query{\n%s}", $graphql), $failures);
$template = '%1$s: addStar(input:{clientMutationId:"%s",starrableId:"%s"}){clientMutationId}'."\n";
$graphql = '';
@@ -192,17 +195,29 @@ class ThanksCommand extends BaseCommand
}
}
+ if ($failures) {
+ $output->writeln('');
+ $output->writeln('Some repositories could not be starred, please run composer update and try again:');
+
+ foreach ($failures as $alias => $message) {
+ $output->writeln(sprintf(' * %s - %s', $aliases[$alias][1], $message));
+ }
+ }
+
$output->writeln(sprintf("\nThanks to you! %s", $this->love));
+ $output->writeln("Please consider contributing back in any way if you can!");
return 0;
}
- private function callGitHub(RemoteFilesystem $rfs, $graphql)
+ private function callGitHub(RemoteFilesystem $rfs, $graphql, &$failures = [])
{
if ($eventDispatcher = $this->getComposer()->getEventDispatcher()) {
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $rfs, 'https://api.github.com/graphql');
$eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
- $rfs = $preFileDownloadEvent->getRemoteFilesystem();
+ if (!$preFileDownloadEvent->getRemoteFilesystem() instanceof CurlRemoteFilesystem) {
+ $rfs = $preFileDownloadEvent->getRemoteFilesystem();
+ }
}
$result = $rfs->getContents('github.com', 'https://api.github.com/graphql', false, [
@@ -214,6 +229,19 @@ class ThanksCommand extends BaseCommand
]);
$result = json_decode($result, true);
+ if (isset($result['errors'][0]['message'])) {
+ if (!$result['data']) {
+ throw new TransportException($result['errors'][0]['message']);
+ }
+
+ foreach ($result['errors'] as $error) {
+ foreach ($error['path'] as $path) {
+ $failures += [$path => $error['message']];
+ unset($result['data'][$path]);
+ }
+ }
+ }
+
return $result['data'];
}
diff --git a/vendor/symfony/translation/CHANGELOG.md b/vendor/symfony/translation/CHANGELOG.md
index 105a67e2..527b8049 100644
--- a/vendor/symfony/translation/CHANGELOG.md
+++ b/vendor/symfony/translation/CHANGELOG.md
@@ -1,6 +1,20 @@
CHANGELOG
=========
+4.1.0
+-----
+
+ * The `FileDumper::setBackup()` method is deprecated.
+ * The `TranslationWriter::disableBackup()` method is deprecated.
+ * The `XliffFileDumper` will write "name" on the "unit" node when dumping XLIFF 2.0.
+
+4.0.0
+-----
+
+ * removed the backup feature of the `FileDumper` class
+ * removed `TranslationWriter::writeTranslations()` method
+ * removed support for passing `MessageSelector` instances to the constructor of the `Translator` class
+
3.4.0
-----
diff --git a/vendor/symfony/translation/Command/XliffLintCommand.php b/vendor/symfony/translation/Command/XliffLintCommand.php
index fead5edc..2caa6abe 100644
--- a/vendor/symfony/translation/Command/XliffLintCommand.php
+++ b/vendor/symfony/translation/Command/XliffLintCommand.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Translation\Command;
use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@@ -33,7 +34,7 @@ class XliffLintCommand extends Command
private $directoryIteratorProvider;
private $isReadableProvider;
- public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null)
+ public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null)
{
parent::__construct($name);
@@ -81,14 +82,14 @@ EOF
if (!$filename) {
if (!$stdin = $this->getStdin()) {
- throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.');
+ throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
}
return $this->display($io, array($this->validate($stdin)));
}
if (!$this->isReadable($filename)) {
- throw new \RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
+ throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
}
$filesInfo = array();
@@ -101,6 +102,8 @@ EOF
private function validate($content, $file = null)
{
+ $errors = array();
+
// Avoid: Warning DOMDocument::loadXML(): Empty string supplied as input
if ('' === trim($content)) {
return array('file' => $file, 'valid' => true);
@@ -110,22 +113,33 @@ EOF
$document = new \DOMDocument();
$document->loadXML($content);
- if ($document->schemaValidate(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd')) {
- return array('file' => $file, 'valid' => true);
+
+ if (null !== $targetLanguage = $this->getTargetLanguageFromFile($document)) {
+ $expectedFileExtension = sprintf('%s.xlf', str_replace('-', '_', $targetLanguage));
+ $realFileExtension = explode('.', basename($file), 2)[1] ?? '';
+
+ if ($expectedFileExtension !== $realFileExtension) {
+ $errors[] = array(
+ 'line' => -1,
+ 'column' => -1,
+ 'message' => sprintf('There is a mismatch between the file extension ("%s") and the "%s" value used in the "target-language" attribute of the file.', $realFileExtension, $targetLanguage),
+ );
+ }
}
- $errorMessages = array_map(function ($error) {
- return array(
- 'line' => $error->line,
- 'column' => $error->column,
- 'message' => trim($error->message),
- );
- }, libxml_get_errors());
+ $document->schemaValidate(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd');
+ foreach (libxml_get_errors() as $xmlError) {
+ $errors[] = array(
+ 'line' => $xmlError->line,
+ 'column' => $xmlError->column,
+ 'message' => trim($xmlError->message),
+ );
+ }
libxml_clear_errors();
libxml_use_internal_errors(false);
- return array('file' => $file, 'valid' => false, 'messages' => $errorMessages);
+ return array('file' => $file, 'valid' => 0 === count($errors), 'messages' => $errors);
}
private function display(SymfonyStyle $io, array $files)
@@ -136,7 +150,7 @@ EOF
case 'json':
return $this->displayJson($io, $files);
default:
- throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
+ throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
}
}
@@ -242,4 +256,15 @@ EOF
return $default($fileOrDirectory);
}
+
+ private function getTargetLanguageFromFile(\DOMDocument $xliffContents): ?string
+ {
+ foreach ($xliffContents->getElementsByTagName('file')[0]->attributes ?? array() as $attribute) {
+ if ('target-language' === $attribute->nodeName) {
+ return $attribute->nodeValue;
+ }
+ }
+
+ return null;
+ }
}
diff --git a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php
index 1ca79cf0..e620226e 100644
--- a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php
+++ b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php
@@ -23,7 +23,7 @@ class TranslationDumperPass implements CompilerPassInterface
private $writerServiceId;
private $dumperTag;
- public function __construct($writerServiceId = 'translation.writer', $dumperTag = 'translation.dumper')
+ public function __construct(string $writerServiceId = 'translation.writer', string $dumperTag = 'translation.dumper')
{
$this->writerServiceId = $writerServiceId;
$this->dumperTag = $dumperTag;
diff --git a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php
index 06105187..18c67f68 100644
--- a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php
+++ b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php
@@ -24,7 +24,7 @@ class TranslationExtractorPass implements CompilerPassInterface
private $extractorServiceId;
private $extractorTag;
- public function __construct($extractorServiceId = 'translation.extractor', $extractorTag = 'translation.extractor')
+ public function __construct(string $extractorServiceId = 'translation.extractor', string $extractorTag = 'translation.extractor')
{
$this->extractorServiceId = $extractorServiceId;
$this->extractorTag = $extractorTag;
diff --git a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php
index db2a2a1e..1f7839db 100644
--- a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php
+++ b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php
@@ -24,12 +24,8 @@ class TranslatorPass implements CompilerPassInterface
private $debugCommandServiceId;
private $updateCommandServiceId;
- public function __construct($translatorServiceId = 'translator.default', $readerServiceId = 'translation.loader', $loaderTag = 'translation.loader', $debugCommandServiceId = 'console.command.translation_debug', $updateCommandServiceId = 'console.command.translation_update')
+ public function __construct(string $translatorServiceId = 'translator.default', string $readerServiceId = 'translation.reader', string $loaderTag = 'translation.loader', string $debugCommandServiceId = 'console.command.translation_debug', string $updateCommandServiceId = 'console.command.translation_update')
{
- if ('translation.loader' === $readerServiceId && 2 > func_num_args()) {
- @trigger_error('The default value for $readerServiceId will change in 4.0 to "translation.reader".', E_USER_DEPRECATED);
- }
-
$this->translatorServiceId = $translatorServiceId;
$this->readerServiceId = $readerServiceId;
$this->loaderTag = $loaderTag;
@@ -62,18 +58,6 @@ class TranslatorPass implements CompilerPassInterface
}
}
- // Duplicated code to support "translation.reader", to be removed in 4.0
- if ('translation.reader' !== $this->readerServiceId) {
- if ($container->hasDefinition('translation.reader')) {
- $definition = $container->getDefinition('translation.reader');
- foreach ($loaders as $id => $formats) {
- foreach ($formats as $format) {
- $definition->addMethodCall('addLoader', array($format, $loaderRefs[$id]));
- }
- }
- }
- }
-
$container
->findDefinition($this->translatorServiceId)
->replaceArgument(0, ServiceLocatorTagPass::register($container, $loaderRefs))
diff --git a/vendor/symfony/translation/Dumper/FileDumper.php b/vendor/symfony/translation/Dumper/FileDumper.php
index 7296d8cc..5a67b3a0 100644
--- a/vendor/symfony/translation/Dumper/FileDumper.php
+++ b/vendor/symfony/translation/Dumper/FileDumper.php
@@ -17,7 +17,6 @@ use Symfony\Component\Translation\Exception\RuntimeException;
/**
* FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s).
- * Performs backup of already existing files.
*
* Options:
* - path (mandatory): the directory where the files should be saved
@@ -33,13 +32,6 @@ abstract class FileDumper implements DumperInterface
*/
protected $relativePathTemplate = '%domain%.%locale%.%extension%';
- /**
- * Make file backup before the dump.
- *
- * @var bool
- */
- private $backup = true;
-
/**
* Sets the template for the relative paths to files.
*
@@ -54,10 +46,16 @@ abstract class FileDumper implements DumperInterface
* Sets backup flag.
*
* @param bool
+ *
+ * @deprecated since Symfony 4.1
*/
public function setBackup($backup)
{
- $this->backup = $backup;
+ @trigger_error(sprintf('The %s() method is deprecated since Symfony 4.1.', __METHOD__), E_USER_DEPRECATED);
+
+ if (false !== $backup) {
+ throw new \LogicException('The backup feature is no longer supported.');
+ }
}
/**
@@ -71,14 +69,8 @@ abstract class FileDumper implements DumperInterface
// save a file for each domain
foreach ($messages->getDomains() as $domain) {
- // backup
$fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale());
- if (file_exists($fullpath)) {
- if ($this->backup) {
- @trigger_error('Creating a backup while dumping a message catalogue is deprecated since Symfony 3.1 and will be removed in 4.0. Use TranslationWriter::disableBackup() to disable the backup.', E_USER_DEPRECATED);
- copy($fullpath, $fullpath.'~');
- }
- } else {
+ if (!file_exists($fullpath)) {
$directory = dirname($fullpath);
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
@@ -109,13 +101,8 @@ abstract class FileDumper implements DumperInterface
/**
* Gets the relative file path using the template.
- *
- * @param string $domain The domain
- * @param string $locale The locale
- *
- * @return string The relative file path
*/
- private function getRelativePath($domain, $locale)
+ private function getRelativePath(string $domain, string $locale): string
{
return strtr($this->relativePathTemplate, array(
'%domain%' => $domain,
diff --git a/vendor/symfony/translation/Dumper/JsonFileDumper.php b/vendor/symfony/translation/Dumper/JsonFileDumper.php
index 08b538e1..32bdaf51 100644
--- a/vendor/symfony/translation/Dumper/JsonFileDumper.php
+++ b/vendor/symfony/translation/Dumper/JsonFileDumper.php
@@ -28,7 +28,7 @@ class JsonFileDumper extends FileDumper
if (isset($options['json_encoding'])) {
$flags = $options['json_encoding'];
} else {
- $flags = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
+ $flags = JSON_PRETTY_PRINT;
}
return json_encode($messages->all($domain), $flags);
diff --git a/vendor/symfony/translation/Dumper/XliffFileDumper.php b/vendor/symfony/translation/Dumper/XliffFileDumper.php
index d7e5ecc7..afeae3ac 100644
--- a/vendor/symfony/translation/Dumper/XliffFileDumper.php
+++ b/vendor/symfony/translation/Dumper/XliffFileDumper.php
@@ -146,6 +146,11 @@ class XliffFileDumper extends FileDumper
foreach ($messages->all($domain) as $source => $target) {
$translation = $dom->createElement('unit');
$translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._'));
+ $name = $source;
+ if (strlen($source) > 80) {
+ $name = substr(md5($source), -7);
+ }
+ $translation->setAttribute('name', $name);
$metadata = $messages->getMetadata($source, $domain);
// Add notes section
diff --git a/vendor/symfony/translation/Dumper/YamlFileDumper.php b/vendor/symfony/translation/Dumper/YamlFileDumper.php
index ecf00fa6..db9e4b36 100644
--- a/vendor/symfony/translation/Dumper/YamlFileDumper.php
+++ b/vendor/symfony/translation/Dumper/YamlFileDumper.php
@@ -25,7 +25,7 @@ class YamlFileDumper extends FileDumper
{
private $extension;
- public function __construct(/**string */$extension = 'yml')
+ public function __construct(string $extension = 'yml')
{
$this->extension = $extension;
}
diff --git a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php
index b9c524e8..40b36451 100644
--- a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php
+++ b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php
@@ -43,12 +43,7 @@ abstract class AbstractFileExtractor
return $files;
}
- /**
- * @param string $file
- *
- * @return \SplFileInfo
- */
- private function toSplFileInfo($file)
+ private function toSplFileInfo(string $file): \SplFileInfo
{
return ($file instanceof \SplFileInfo) ? $file : new \SplFileInfo($file);
}
diff --git a/vendor/symfony/translation/Extractor/PhpExtractor.php b/vendor/symfony/translation/Extractor/PhpExtractor.php
index ab641ba9..f364bdec 100644
--- a/vendor/symfony/translation/Extractor/PhpExtractor.php
+++ b/vendor/symfony/translation/Extractor/PhpExtractor.php
@@ -83,10 +83,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface
foreach ($files as $file) {
$this->parseTokens(token_get_all(file_get_contents($file)), $catalog);
- if (\PHP_VERSION_ID >= 70000) {
- // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
- gc_mem_caches();
- }
+ // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
+ gc_mem_caches();
}
}
diff --git a/vendor/symfony/translation/Loader/IcuDatFileLoader.php b/vendor/symfony/translation/Loader/IcuDatFileLoader.php
index 71ba90a3..822bc362 100644
--- a/vendor/symfony/translation/Loader/IcuDatFileLoader.php
+++ b/vendor/symfony/translation/Loader/IcuDatFileLoader.php
@@ -39,7 +39,6 @@ class IcuDatFileLoader extends IcuResFileLoader
try {
$rb = new \ResourceBundle($locale, $resource);
} catch (\Exception $e) {
- // HHVM compatibility: constructor throws on invalid resource
$rb = null;
}
diff --git a/vendor/symfony/translation/Loader/IcuResFileLoader.php b/vendor/symfony/translation/Loader/IcuResFileLoader.php
index 6b5b5e12..927cae16 100644
--- a/vendor/symfony/translation/Loader/IcuResFileLoader.php
+++ b/vendor/symfony/translation/Loader/IcuResFileLoader.php
@@ -39,7 +39,6 @@ class IcuResFileLoader implements LoaderInterface
try {
$rb = new \ResourceBundle($locale, $resource);
} catch (\Exception $e) {
- // HHVM compatibility: constructor throws on invalid resource
$rb = null;
}
diff --git a/vendor/symfony/translation/Loader/MoFileLoader.php b/vendor/symfony/translation/Loader/MoFileLoader.php
index aad2bba2..918bf94a 100644
--- a/vendor/symfony/translation/Loader/MoFileLoader.php
+++ b/vendor/symfony/translation/Loader/MoFileLoader.php
@@ -134,11 +134,8 @@ class MoFileLoader extends FileLoader
* Reads an unsigned long from stream respecting endianness.
*
* @param resource $stream
- * @param bool $isBigEndian
- *
- * @return int
*/
- private function readLong($stream, $isBigEndian)
+ private function readLong($stream, bool $isBigEndian): int
{
$result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4));
$result = current($result);
diff --git a/vendor/symfony/translation/Loader/XliffFileLoader.php b/vendor/symfony/translation/Loader/XliffFileLoader.php
index 8e4e5a78..b20d4909 100644
--- a/vendor/symfony/translation/Loader/XliffFileLoader.php
+++ b/vendor/symfony/translation/Loader/XliffFileLoader.php
@@ -75,7 +75,7 @@ class XliffFileLoader implements LoaderInterface
* @param MessageCatalogue $catalogue Catalogue where we'll collect messages and metadata
* @param string $domain The domain
*/
- private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, $domain)
+ private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
{
$xml = simplexml_import_dom($dom);
$encoding = strtoupper($dom->encoding);
@@ -115,12 +115,7 @@ class XliffFileLoader implements LoaderInterface
}
}
- /**
- * @param \DOMDocument $dom
- * @param MessageCatalogue $catalogue
- * @param string $domain
- */
- private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, $domain)
+ private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
{
$xml = simplexml_import_dom($dom);
$encoding = strtoupper($dom->encoding);
@@ -128,48 +123,44 @@ class XliffFileLoader implements LoaderInterface
$xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0');
foreach ($xml->xpath('//xliff:unit') as $unit) {
- $segment = $unit->segment;
- $source = $segment->source;
+ foreach ($unit->segment as $segment) {
+ $source = $segment->source;
- // If the xlf file has another encoding specified, try to convert it because
- // simple_xml will always return utf-8 encoded values
- $target = $this->utf8ToCharset((string) (isset($segment->target) ? $segment->target : $source), $encoding);
+ // If the xlf file has another encoding specified, try to convert it because
+ // simple_xml will always return utf-8 encoded values
+ $target = $this->utf8ToCharset((string) (isset($segment->target) ? $segment->target : $source), $encoding);
- $catalogue->set((string) $source, $target, $domain);
+ $catalogue->set((string) $source, $target, $domain);
- $metadata = array();
- if (isset($segment->target) && $segment->target->attributes()) {
- $metadata['target-attributes'] = array();
- foreach ($segment->target->attributes() as $key => $value) {
- $metadata['target-attributes'][$key] = (string) $value;
- }
- }
-
- if (isset($unit->notes)) {
- $metadata['notes'] = array();
- foreach ($unit->notes->note as $noteNode) {
- $note = array();
- foreach ($noteNode->attributes() as $key => $value) {
- $note[$key] = (string) $value;
+ $metadata = array();
+ if (isset($segment->target) && $segment->target->attributes()) {
+ $metadata['target-attributes'] = array();
+ foreach ($segment->target->attributes() as $key => $value) {
+ $metadata['target-attributes'][$key] = (string) $value;
}
- $note['content'] = (string) $noteNode;
- $metadata['notes'][] = $note;
}
- }
- $catalogue->setMetadata((string) $source, $metadata, $domain);
+ if (isset($unit->notes)) {
+ $metadata['notes'] = array();
+ foreach ($unit->notes->note as $noteNode) {
+ $note = array();
+ foreach ($noteNode->attributes() as $key => $value) {
+ $note[$key] = (string) $value;
+ }
+ $note['content'] = (string) $noteNode;
+ $metadata['notes'][] = $note;
+ }
+ }
+
+ $catalogue->setMetadata((string) $source, $metadata, $domain);
+ }
}
}
/**
* Convert a UTF8 string to the specified encoding.
- *
- * @param string $content String to decode
- * @param string $encoding Target encoding
- *
- * @return string
*/
- private function utf8ToCharset($content, $encoding = null)
+ private function utf8ToCharset(string $content, string $encoding = null): string
{
if ('UTF-8' !== $encoding && !empty($encoding)) {
return mb_convert_encoding($content, $encoding, 'UTF-8');
@@ -181,13 +172,9 @@ class XliffFileLoader implements LoaderInterface
/**
* Validates and parses the given file into a DOMDocument.
*
- * @param string $file
- * @param \DOMDocument $dom
- * @param string $schema source of the schema
- *
* @throws InvalidResourceException
*/
- private function validateSchema($file, \DOMDocument $dom, $schema)
+ private function validateSchema(string $file, \DOMDocument $dom, string $schema)
{
$internalErrors = libxml_use_internal_errors(true);
@@ -224,13 +211,8 @@ class XliffFileLoader implements LoaderInterface
/**
* Internally changes the URI of a dependent xsd to be loaded locally.
- *
- * @param string $schemaSource Current content of schema file
- * @param string $xmlUri External URI of XML to convert to local
- *
- * @return string
*/
- private function fixXmlLocation($schemaSource, $xmlUri)
+ private function fixXmlLocation(string $schemaSource, string $xmlUri): string
{
$newPath = str_replace('\\', '/', __DIR__).'/schema/dic/xliff-core/xml.xsd';
$parts = explode('/', $newPath);
@@ -254,12 +236,8 @@ class XliffFileLoader implements LoaderInterface
/**
* Returns the XML errors of the internal XML parser.
- *
- * @param bool $internalErrors
- *
- * @return array An array of errors
*/
- private function getXmlErrors($internalErrors)
+ private function getXmlErrors(bool $internalErrors): array
{
$errors = array();
foreach (libxml_get_errors() as $error) {
@@ -283,13 +261,9 @@ class XliffFileLoader implements LoaderInterface
* Gets xliff file version based on the root "version" attribute.
* Defaults to 1.2 for backwards compatibility.
*
- * @param \DOMDocument $dom
- *
* @throws InvalidArgumentException
- *
- * @return string
*/
- private function getVersionNumber(\DOMDocument $dom)
+ private function getVersionNumber(\DOMDocument $dom): string
{
/** @var \DOMNode $xliff */
foreach ($dom->getElementsByTagName('xliff') as $xliff) {
@@ -312,13 +286,7 @@ class XliffFileLoader implements LoaderInterface
return '1.2';
}
- /**
- * @param \SimpleXMLElement|null $noteElement
- * @param string|null $encoding
- *
- * @return array
- */
- private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, $encoding = null)
+ private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, string $encoding = null): array
{
$notes = array();
diff --git a/vendor/symfony/translation/Loader/YamlFileLoader.php b/vendor/symfony/translation/Loader/YamlFileLoader.php
index 07914f26..ef84c32f 100644
--- a/vendor/symfony/translation/Loader/YamlFileLoader.php
+++ b/vendor/symfony/translation/Loader/YamlFileLoader.php
@@ -15,6 +15,7 @@ use Symfony\Component\Translation\Exception\InvalidResourceException;
use Symfony\Component\Translation\Exception\LogicException;
use Symfony\Component\Yaml\Parser as YamlParser;
use Symfony\Component\Yaml\Exception\ParseException;
+use Symfony\Component\Yaml\Yaml;
/**
* YamlFileLoader loads translations from Yaml files.
@@ -38,18 +39,10 @@ class YamlFileLoader extends FileLoader
$this->yamlParser = new YamlParser();
}
- $prevErrorHandler = set_error_handler(function ($level, $message, $script, $line) use ($resource, &$prevErrorHandler) {
- $message = E_USER_DEPRECATED === $level ? preg_replace('/ on line \d+/', ' in "'.$resource.'"$0', $message) : $message;
-
- return $prevErrorHandler ? $prevErrorHandler($level, $message, $script, $line) : false;
- });
-
try {
- $messages = $this->yamlParser->parseFile($resource);
+ $messages = $this->yamlParser->parseFile($resource, Yaml::PARSE_CONSTANT);
} catch (ParseException $e) {
throw new InvalidResourceException(sprintf('Error parsing YAML, invalid file "%s"', $resource), 0, $e);
- } finally {
- restore_error_handler();
}
return $messages;
diff --git a/vendor/symfony/translation/MessageCatalogue.php b/vendor/symfony/translation/MessageCatalogue.php
index df917bbb..c36ea30e 100644
--- a/vendor/symfony/translation/MessageCatalogue.php
+++ b/vendor/symfony/translation/MessageCatalogue.php
@@ -30,7 +30,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf
* @param string $locale The locale
* @param array $messages An array of messages classified by domain
*/
- public function __construct($locale, array $messages = array())
+ public function __construct(?string $locale, array $messages = array())
{
$this->locale = $locale;
$this->messages = $messages;
diff --git a/vendor/symfony/translation/MessageCatalogueInterface.php b/vendor/symfony/translation/MessageCatalogueInterface.php
index 4dad27fb..e0dbb2bd 100644
--- a/vendor/symfony/translation/MessageCatalogueInterface.php
+++ b/vendor/symfony/translation/MessageCatalogueInterface.php
@@ -105,7 +105,7 @@ interface MessageCatalogueInterface
*
* The two catalogues must have the same locale.
*/
- public function addCatalogue(MessageCatalogueInterface $catalogue);
+ public function addCatalogue(self $catalogue);
/**
* Merges translations from the given Catalogue into the current one
@@ -113,7 +113,7 @@ interface MessageCatalogueInterface
*
* This is used to provide default translations when they do not exist for the current locale.
*/
- public function addFallbackCatalogue(MessageCatalogueInterface $catalogue);
+ public function addFallbackCatalogue(self $catalogue);
/**
* Gets the fallback catalogue.
diff --git a/vendor/symfony/translation/PluralizationRules.php b/vendor/symfony/translation/PluralizationRules.php
index 38dde743..48a6c608 100644
--- a/vendor/symfony/translation/PluralizationRules.php
+++ b/vendor/symfony/translation/PluralizationRules.php
@@ -107,6 +107,7 @@ class PluralizationRules
case 'nl':
case 'nn':
case 'no':
+ case 'oc':
case 'om':
case 'or':
case 'pa':
diff --git a/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd b/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd
index 056f5f95..dface628 100644
--- a/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd
+++ b/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd
@@ -3,16 +3,16 @@