Skip to content

Commit cbd8347

Browse files
committed
Merge pull request php-webdriver#249 from iFixit/remote-web-driver--make-new-element-protected
RemoteWebElement: allow overriding construction
2 parents 942f436 + e389158 commit cbd8347

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

lib/Remote/RemoteWebDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public function action() {
430430
* @param string $id The id of the element to be created.
431431
* @return RemoteWebElement
432432
*/
433-
private function newElement($id) {
433+
protected function newElement($id) {
434434
return new RemoteWebElement($this->getExecuteMethod(), $id);
435435
}
436436

lib/Remote/RemoteWebElement.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,7 @@ public function equals(WebDriverElement $other) {
416416
*
417417
* @return RemoteWebElement
418418
*/
419-
private function newElement($id) {
420-
$class = get_class($this);
421-
return new $class($this->executor, $id);
419+
protected function newElement($id) {
420+
return new static($this->executor, $id);
422421
}
423422
}

lib/Support/Events/EventFiringWebDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function getWebDriver() {
8585
* @param WebDriverElement $element
8686
* @return EventFiringWebElement
8787
*/
88-
private function newElement(WebDriverElement $element) {
88+
protected function newElement(WebDriverElement $element) {
8989
return new EventFiringWebElement($element, $this->getDispatcher());
9090
}
9191

lib/Support/Events/EventFiringWebElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public function getElement() {
7878
* @param WebDriverElement $element
7979
* @return EventFiringWebElement
8080
*/
81-
private function newElement(WebDriverElement $element) {
82-
return new EventFiringWebElement($element, $this->getDispatcher());
81+
protected function newElement(WebDriverElement $element) {
82+
return new static($element, $this->getDispatcher());
8383
}
8484

8585
/**

0 commit comments

Comments
 (0)