1414
1515namespace Playwright \Locator \Options ;
1616
17- use Playwright \Exception \InvalidArgumentException ;
18-
1917class DblClickOptions
2018{
2119 /**
@@ -36,6 +34,9 @@ public function __construct(
3634 ) {
3735 }
3836
37+ /**
38+ * @return array<string, mixed>
39+ */
3940 public function toArray (): array
4041 {
4142 $ options = [];
@@ -79,20 +80,25 @@ public static function from(array|self $options = []): self
7980 return $ options ;
8081 }
8182
82- if (!\is_array ($ options )) {
83- throw new InvalidArgumentException ('Options must be an array or an instance of DblClickOptions ' );
84- }
83+ /** @var 'left'|'right'|'middle'|null $button */
84+ $ button = $ options ['button ' ] ?? null ;
85+ /** @var float|null $delay */
86+ $ delay = $ options ['delay ' ] ?? null ;
87+ /** @var array<string>|null $modifiers */
88+ $ modifiers = $ options ['modifiers ' ] ?? null ;
89+ /** @var array{x: float, y: float}|null $position */
90+ $ position = $ options ['position ' ] ?? null ;
91+ /** @var bool|null $force */
92+ $ force = $ options ['force ' ] ?? null ;
93+ /** @var bool|null $noWaitAfter */
94+ $ noWaitAfter = $ options ['noWaitAfter ' ] ?? null ;
95+ /** @var int|null $steps */
96+ $ steps = $ options ['steps ' ] ?? null ;
97+ /** @var float|null $timeout */
98+ $ timeout = $ options ['timeout ' ] ?? null ;
99+ /** @var bool|null $trial */
100+ $ trial = $ options ['trial ' ] ?? null ;
85101
86- return new self (
87- $ options ['button ' ] ?? null ,
88- $ options ['delay ' ] ?? null ,
89- $ options ['modifiers ' ] ?? null ,
90- $ options ['position ' ] ?? null ,
91- $ options ['force ' ] ?? null ,
92- $ options ['noWaitAfter ' ] ?? null ,
93- $ options ['steps ' ] ?? null ,
94- $ options ['timeout ' ] ?? null ,
95- $ options ['trial ' ] ?? null ,
96- );
102+ return new self ($ button , $ delay , $ modifiers , $ position , $ force , $ noWaitAfter , $ steps , $ timeout , $ trial );
97103 }
98104}
0 commit comments