Skip to content
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
21 changes: 20 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ name: CI
on: [push, pull_request]

jobs:
phpcs:
name: Code style
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
ini-values: memory_limit=-1, date.timezone='UTC'
tools: phpcs

- name: Check production code style
run: phpcs src/

- name: Check test code style
run: phpcs tests/ --standard=tests/phpcs.xml
tests:
runs-on: ubuntu-latest

Expand All @@ -11,7 +30,7 @@ jobs:

strategy:
matrix:
php: [8.0, 8.1]
php: [8.0, 8.1, 8.2]

steps:
- name: Checkout code
Expand Down
9 changes: 9 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="Codeception">
<description>Codeception code standard</description>
<rule ref="PSR12">
<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
</rule>
</ruleset>
8 changes: 1 addition & 7 deletions src/Codeception/Constraint/JsonContains.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@

class JsonContains extends Constraint
{
/**
* @var array
*/
protected $expected;

public function __construct(array $expected)
public function __construct(protected array $expected)
{
$this->expected = $expected;
}

/**
Expand Down
19 changes: 5 additions & 14 deletions src/Codeception/Constraint/JsonType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,17 @@

class JsonType extends Constraint
{
/**
* @var array
*/
protected $jsonType;
/**
* @var bool
*/
private $match;

public function __construct(array $jsonType, bool $match = true)
{
$this->jsonType = $jsonType;
$this->match = $match;
public function __construct(
protected array $jsonType,
private bool $match = true
) {
}

/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $jsonArray Value or object to evaluate.
* @param array|JsonArray $jsonArray Value or object to evaluate.
*/
protected function matches($jsonArray): bool
{
Expand Down
Loading