File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,14 @@ public function find(string $selector, int $nth = null)
252252 {
253253 $ this ->isLoaded ();
254254
255- return $ this ->root ->find ($ selector , $ nth , $ this ->options ->get ('depthFirstSearch ' ));
255+ $ depthFirstSearch = $ this ->options ->get ('depthFirstSearch ' );
256+ if (is_bool ($ depthFirstSearch )) {
257+ $ result = $ this ->root ->find ($ selector , $ nth , $ depthFirstSearch );
258+ } else {
259+ $ result = $ this ->root ->find ($ selector , $ nth );
260+ }
261+
262+ return $ result ;
256263 }
257264
258265 /**
@@ -793,15 +800,16 @@ protected function detectCharset(): bool
793800 return false ;
794801 }
795802
803+ /** @var AbstractNode $meta */
796804 $ meta = $ this ->root ->find ('meta[http-equiv=Content-Type] ' , 0 );
797805 if (is_null ($ meta )) {
798806 // could not find meta tag
799807 $ this ->root ->propagateEncoding ($ encode );
800808
801809 return false ;
802810 }
803- $ content = $ meta ->content ;
804- if (empty ($ content )) {
811+ $ content = $ meta ->getAttribute ( ' content ' ) ;
812+ if (is_null ($ content )) {
805813 // could not find content
806814 $ this ->root ->propagateEncoding ($ encode );
807815
Original file line number Diff line number Diff line change @@ -342,9 +342,9 @@ public function getAttributes(): array
342342 * on the tag of this node.
343343 *
344344 * @param string $key
345- * @return mixed
345+ * @return string|null
346346 */
347- public function getAttribute (string $ key )
347+ public function getAttribute (string $ key ): ? string
348348 {
349349 $ attribute = $ this ->tag ->getAttribute ($ key );
350350 if ( ! is_null ($ attribute )) {
Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ public function getAttributes()
294294 * Returns an attribute by the key
295295 *
296296 * @param string $key
297- * @return mixed
297+ * @return array|null
298298 */
299299 public function getAttribute (string $ key ):array
300300 {
You can’t perform that action at this time.
0 commit comments