{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/18038","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/18038/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18038/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/18038/events","html_url":"https://github.com/symfony/symfony/issues/18038","id":138843010,"number":18038,"title":"DomCrawler ArrayAccess interface","user":{"login":"flip111","id":2244480,"avatar_url":"https://avatars.githubusercontent.com/u/2244480?v=3","gravatar_id":"","url":"https://api.github.com/users/flip111","html_url":"https://github.com/flip111","followers_url":"https://api.github.com/users/flip111/followers","following_url":"https://api.github.com/users/flip111/following{/other_user}","gists_url":"https://api.github.com/users/flip111/gists{/gist_id}","starred_url":"https://api.github.com/users/flip111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flip111/subscriptions","organizations_url":"https://api.github.com/users/flip111/orgs","repos_url":"https://api.github.com/users/flip111/repos","events_url":"https://api.github.com/users/flip111/events{/privacy}","received_events_url":"https://api.github.com/users/flip111/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/DomCrawler","name":"DomCrawler","color":"DDDDDD"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-03-06T21:57:54Z","updated_at":"2016-03-14T17:48:39Z","closed_at":"2016-03-13T09:43:21Z","body":"Would it be acceptable for the DomCrawler to implement the ArrayAccess interface? That way `foreach` can be used instead of `each()`. The closure needs to make explicit which outer variables to use (with `use`) and is more verbose. Also instead of `->eq(0)` just `[0]` can be used. Possibly both interfaces could co-exist"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/196432303","html_url":"https://github.com/symfony/symfony/issues/18038#issuecomment-196432303","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18038","id":196432303,"user":{"login":"flip111","id":2244480,"avatar_url":"https://avatars.githubusercontent.com/u/2244480?v=3","gravatar_id":"","url":"https://api.github.com/users/flip111","html_url":"https://github.com/flip111","followers_url":"https://api.github.com/users/flip111/followers","following_url":"https://api.github.com/users/flip111/following{/other_user}","gists_url":"https://api.github.com/users/flip111/gists{/gist_id}","starred_url":"https://api.github.com/users/flip111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flip111/subscriptions","organizations_url":"https://api.github.com/users/flip111/orgs","repos_url":"https://api.github.com/users/flip111/repos","events_url":"https://api.github.com/users/flip111/events{/privacy}","received_events_url":"https://api.github.com/users/flip111/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T17:48:39Z","updated_at":"2016-03-14T17:48:39Z","body":"@stof ah yes. Actually i forgot to mention something important ... `foreach` works but returns the raw nodes instead of wrapping it in a crawler. So now foreach comes with it's own boilerplate code having to wrap the nodes again manually ... Why not have a method `getNodes` to get an array of nodes, because when walking through the DOM you are more likely gonna need new domcrawlers to specificy your search further and further. I tent to end up with nested closures if im writing a small (throw away) crawler script."}}