Skip to content

Improved support for Codeception 5/PHP 8 #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 11 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "codeception/lib-innerbrowser",
"description": "Parent library for all Codeception framework modules and PhpBrowser",
"keywords": [ "codeception" ],
"homepage": "https://codeception.com/",
"type": "library",
"license": "MIT",
"type": "library",
"keywords": [
"codeception"
],
"authors": [
{
"name": "Michael Bodnarchuk",
Expand All @@ -15,29 +16,31 @@
"name": "Gintautas Miselis"
}
],
"minimum-stability": "dev",
"homepage": "https://codeception.com/",
"require": {
"php": "^8.0",
"ext-dom": "*",
"ext-json": "*",
"ext-mbstring": "*",
"codeception/codeception": "^5.0.0-alpha1",
"symfony/browser-kit": "^4.4 | ^5.4 | ^6.0",
"symfony/dom-crawler": "^4.4 | ^5.4 | ^6.0"
"codeception/codeception": "dev-5.0-interfaces as 5.0.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0",
"symfony/dom-crawler": "^4.4 || ^5.4 || ^6.0"
},
"require-dev": {
"codeception/util-universalframework": "dev-master"
},
"conflict": {
"codeception/codeception": "<5.0"
},
"minimum-stability": "dev",
"autoload": {
"classmap": [
"src/"
]
},
"config": {
"classmap-authoritative": true
"classmap-authoritative": true,
"sort-packages": true
},
"scripts": {
"test": "codecept run --coverage-xml"
Expand Down
12 changes: 6 additions & 6 deletions src/Codeception/Lib/InnerBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function _conflicts(): string
return \Codeception\Lib\Interfaces\Web::class;
}

public function _findElements($locator)
public function _findElements(mixed $locator): iterable
{
return $this->match($locator);
}
Expand Down Expand Up @@ -633,7 +633,7 @@ public function dontSeeCurrentUrlMatches(string $uri): void
$this->assertNotRegExp($uri, $this->_getCurrentUri());
}

public function grabFromCurrentUrl($uri = null)
public function grabFromCurrentUrl(string $uri = null): mixed
{
if (!$uri) {
return $this->_getCurrentUri();
Expand Down Expand Up @@ -1475,7 +1475,7 @@ protected function filterByAttributes(Crawler $nodes, array $attributes)
return $nodes;
}

public function grabTextFrom($cssOrXPathOrRegex)
public function grabTextFrom($cssOrXPathOrRegex): mixed
{
if (is_string($cssOrXPathOrRegex) && @preg_match($cssOrXPathOrRegex, $this->client->getInternalResponse()->getContent(), $matches)) {
return $matches[1];
Expand All @@ -1489,7 +1489,7 @@ public function grabTextFrom($cssOrXPathOrRegex)
throw new ElementNotFound($cssOrXPathOrRegex, 'Element that matches CSS or XPath or Regex');
}

public function grabAttributeFrom($cssOrXpath, $attribute)
public function grabAttributeFrom($cssOrXpath, string $attribute): mixed
{
$nodes = $this->match($cssOrXpath);
if ($nodes->count() === 0) {
Expand All @@ -1511,7 +1511,7 @@ public function grabMultiple($cssOrXpath, string $attribute = null): array
return $result;
}

public function grabValueFrom($field)
public function grabValueFrom($field): mixed
{
$nodes = $this->match($field);
if ($nodes->count() === 0) {
Expand Down Expand Up @@ -1566,7 +1566,7 @@ public function setCookie($name, $val, $params = [])
$this->debugCookieJar();
}

public function grabCookie($cookie, $params = [])
public function grabCookie(string $cookie, array $params = []): mixed
{
$params = array_merge($this->defaultCookieParameters, $params);
$this->debugCookieJar();
Expand Down