Repository: phpactor/phpactor (php)

Issue:
Crash when try to fill object
```php
<?php

use App\Entity\Tag;

$tag = new Tag<>
```

```
[Error - 5:32:30 pm] Request textDocument/codeAction failed.
  Message: Exception [Error] Call to a member function getEndPosition() on null at /home/gingdev/code/gingdev/phpactor/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php#110
```

Pull request description:
Gh 1833 Support parenthsis in fill object
Fixes #1833 support adding parenthesis 

Patch:
diff --git a/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php b/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php
index 85d30af4..fc88484a 100644
--- a/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php
+++ b/lib/CodeTransform/Adapter/WorseReflection/Refactor/WorseFillObject.php
@@ -107,7 +107,19 @@ class WorseFillObject implements FillObject
             $sourceCode->use($import->__toString());
         }
         $textEdits = $this->updater->textEditsFor($sourceCode->build(), Code::fromString($document->__toString()));
-        $textEdits = $textEdits->add(TextEdit::create($node->openParen->getEndPosition(), 0, implode(', ', $args)));
+
+        $openParen = $closedParen = '';
+        if ($node->openParen) {
+            $endPosition = $node->openParen->getEndPosition();
+        } else {
+            $endPosition = $node->getEndPosition();
+            $openParen = '(';
+        }
+        if (!$node->closeParen) {
+            $closedParen = ')';
+        }
+
+        $textEdits = $textEdits->add(TextEdit::create($endPosition, 0, sprintf('%s%s%s', $openParen, implode(', ', $args), $closedParen)));
 
         return $textEdits;
     }


Test patch:
diff --git a/lib/CodeTransform/Tests/Adapter/WorseReflection/Refactor/fixtures/fillObject_noParens.test b/lib/CodeTransform/Tests/Adapter/WorseReflection/Refactor/fixtures/fillObject_noParens.test
new file mode 100644
index 00000000..9f014c3c
--- /dev/null
+++ b/lib/CodeTransform/Tests/Adapter/WorseReflection/Refactor/fixtures/fillObject_noParens.test
@@ -0,0 +1,27 @@
+// File: source
+<?php
+
+class DTO
+{
+    public function __construct(string $one) {}
+}
+
+new DT<>O;
+// File: expected
+<?php
+
+class DTO
+{
+    public function __construct(string $one) {}
+}
+
+new DTO(one: '');
+// File: nonamed
+<?php
+
+class DTO
+{
+    public function __construct(string $one) {}
+}
+
+new DTO('' /** $one string */);