Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Property/Selector.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Selector implements Renderable
/**
* @var string
*/
private $selector;
private $selector = '';

/**
* @internal since V8.8.0
Expand All @@ -72,9 +72,12 @@ public static function isValid(string $selector): bool
/**
* @throws \UnexpectedValueException if the selector is not valid
*/
final public function __construct(string $selector)
final public function __construct(string $selector = '')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should cover creating a selector (and thus having an empty string for a selector) without passing the $selector with a test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's already been done, in #1498.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a test that uses new Selector() in #1498 - but I'm still at my first coffee. Am I missing something?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added an additional test for construction without a parameter.

{
$this->setSelector($selector);
// Allow construction of empty object for content to be set later via a setter method.
if ($selector !== '') {
$this->setSelector($selector);
}
}

/**
Expand Down