diff --git a/.github/workflows/ci-code-style.yml b/.github/workflows/ci-code-style.yml deleted file mode 100644 index 321cbe7..0000000 --- a/.github/workflows/ci-code-style.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Code Style - -on: - - push - - fork - - pull_request - -jobs: - code-style: - runs-on: ubuntu-latest - name: "Check code style" - steps: - - uses: actions/checkout@v2 - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - tools: composer:v2 - - run: composer install --dev --ignore-platform-req=php - shell: bash - - run: composer cs:list - shell: bash diff --git a/.github/workflows/ci-leak-test.yml b/.github/workflows/ci-leak-test.yml deleted file mode 100644 index 7395abc..0000000 --- a/.github/workflows/ci-leak-test.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Leak Tests - -on: - - push - - fork - - pull_request - -jobs: - tests: - runs-on: ubuntu-latest - name: "Running unit tests for PHP ${{ matrix.php-version }}" - strategy: - fail-fast: false - matrix: - php-version: ['8.1', '8.2', '8.3'] - steps: - - uses: actions/checkout@v2 - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - tools: composer:v2 - - run: composer install --ignore-platform-req=php - shell: bash - - run: composer test:leak - shell: bash diff --git a/.github/workflows/ci-markdown-lint.yml b/.github/workflows/ci-markdown-lint.yml deleted file mode 100644 index f849445..0000000 --- a/.github/workflows/ci-markdown-lint.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Markdown lint - -on: - - push - - fork - - pull_request - -jobs: - yml-lint: - runs-on: ubuntu-latest - name: "Markdown lint" - steps: - - uses: actions/checkout@v2 - - run: docker pull tmknom/markdownlint - - run: docker run --rm -v $(pwd):/work tmknom/markdownlint '**/*.md' --ignore vendor - shell: bash diff --git a/.github/workflows/ci-mutant-test.yml b/.github/workflows/ci-mutant-test.yml deleted file mode 100644 index 850b691..0000000 --- a/.github/workflows/ci-mutant-test.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Mutant Test - -on: - - push - - fork - - pull_request - -jobs: - tests: - runs-on: ubuntu-latest - name: "Running mutant tests" - steps: - - uses: actions/checkout@v2 - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - tools: composer:v2 - - run: composer install --ignore-platform-req=php - shell: bash - - run: composer test:mutant - shell: bash diff --git a/.github/workflows/ci-phpstan.yml b/.github/workflows/ci-phpstan.yml deleted file mode 100644 index d55f97e..0000000 --- a/.github/workflows/ci-phpstan.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: PHPStan - -on: - - push - - fork - - pull_request - -jobs: - tests: - runs-on: ubuntu-latest - name: "Check PHPStan" - steps: - - uses: actions/checkout@v2 - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - tools: composer:v2 - - run: composer install --ignore-platform-req=php - shell: bash - - run: composer phpstan - shell: bash diff --git a/.github/workflows/ci-psalm.yml b/.github/workflows/ci-psalm.yml deleted file mode 100644 index 43e6648..0000000 --- a/.github/workflows/ci-psalm.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Psalm - -on: - - push - - fork - - pull_request - -jobs: - tests: - runs-on: ubuntu-latest - name: "Check Psalm" - steps: - - uses: actions/checkout@v2 - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - tools: composer:v2 - - run: composer install --ignore-platform-req=php - shell: bash - - run: composer psalm - shell: bash diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml new file mode 100644 index 0000000..afde2af --- /dev/null +++ b/.github/workflows/ci-test.yml @@ -0,0 +1,149 @@ +name: Test + +on: + - push + - pull_request + +jobs: + + yml-lint: + runs-on: ubuntu-latest + name: 'YML lint' + timeout-minutes: 3 + steps: + - uses: actions/checkout@v4 + - run: docker pull cytopia/yamllint + - run: docker run --rm -t -v $(pwd):/data cytopia/yamllint --config-file=tests/.yamllint . + + markdown-lint: + runs-on: ubuntu-latest + name: 'Markdown lint' + timeout-minutes: 3 + steps: + - uses: actions/checkout@v4 + - run: docker pull tmknom/markdownlint + - run: docker run --rm -v $(pwd):/work tmknom/markdownlint '**/*.md' --config tests/.markdownlintrc --ignore vendor --ignore CHANGELOG.md --ignore var --ignore tmp + + cs-lint: + runs-on: ubuntu-latest + name: 'CS Lint' + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: composer:v2 + - run: composer install --dev --ignore-platform-req=php --quiet + shell: bash + - run: PHP_CS_FIXER_IGNORE_ENV=1 composer cs:list + shell: bash + + psalm: + runs-on: ubuntu-latest + name: 'Psalm' + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: composer:v2 + - run: composer install --ignore-platform-req=php --quiet + shell: bash + - run: composer psalm + shell: bash + + phpstan: + runs-on: ubuntu-latest + name: 'Phpstan' + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: composer:v2 + - run: composer install --ignore-platform-req=php --quiet + shell: bash + - run: composer phpstan + shell: bash + + test-unit: + runs-on: ubuntu-latest + name: "Unit tests (PHP ${{ matrix.php-version }}, Neo4j ${{ matrix.neo4j-version }})" + strategy: + fail-fast: false + matrix: + php-version: ['8.2', '8.3', '8.4'] + neo4j-version: ['4.4', '5.1.0', '5.26.2'] + timeout-minutes: 5 + env: + ENABLE_FEATURE_TEST: true + NEO4J_VERSION: ${{ matrix.neo4j-version }} + services: + neo4j: + image: neo4j:${{ matrix.neo4j-version }}-enterprise + env: + NEO4J_AUTH: neo4j/password + NEO4J_ACCEPT_LICENSE_AGREEMENT: yes + ports: + - "7474:7474" + - "7687:7687" + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: composer:v2 + - run: composer install --ignore-platform-req=php --quiet + shell: bash + - run: composer test + shell: bash + - run: cat ./tests/test.log + shell: bash + + test-unit-coverage: + runs-on: ubuntu-latest + name: "Running unit test coverage" + env: + XDEBUG_MODE: coverage + timeout-minutes: 5 + needs: + - test-unit + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + extensions: xdebug + tools: composer:v2 + - run: composer install --ignore-platform-req=php --quiet + shell: bash + - run: composer test:coverage:xml + shell: bash + - uses: paambaati/codeclimate-action@v9.0.0 + env: + CC_TEST_REPORTER_ID: 203d856fbc3ebebe66cc94cccde4429973298c7fb919df64a1557850cc9c8345 + with: + coverageLocations: coverage.xml:clover + - uses: actions/upload-artifact@v4 + with: + name: coverage.xml + path: coverage.xml + + test-mutant: + runs-on: ubuntu-latest + name: 'Mutant Test' + timeout-minutes: 5 + continue-on-error: true + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: composer:v2 + - run: composer install --ignore-platform-req=php --quiet + shell: bash + - run: composer test:mutant + shell: bash diff --git a/.github/workflows/ci-unit-test-coverage.yml b/.github/workflows/ci-unit-test-coverage.yml deleted file mode 100644 index 094607e..0000000 --- a/.github/workflows/ci-unit-test-coverage.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Unit Test Coverage Report - -on: - - push - - fork - - pull_request - -jobs: - coverage: - runs-on: ubuntu-latest - name: "Generate unit test coverage report for PHP ${{ matrix.php-version }}" - env: - XDEBUG_MODE: coverage - steps: - - uses: actions/checkout@v2 - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: xdebug - tools: composer:v2 - - run: composer install --ignore-platform-req=php - shell: bash - - run: composer test:coverage:xml - shell: bash - - uses: paambaati/codeclimate-action@v3.0.0 - env: - CC_TEST_REPORTER_ID: e0b199e87a2813189267e9baa3bf44d5354447ca73e8a4b2d8c027360b05523a - with: - coverageLocations: coverage.xml:clover - - uses: actions/upload-artifact@v2 - with: - name: coverage.xml - path: coverage.xml diff --git a/.github/workflows/ci-unit-test.yml b/.github/workflows/ci-unit-test.yml deleted file mode 100644 index 9de4e23..0000000 --- a/.github/workflows/ci-unit-test.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Unit Tests - -on: - - push - - fork - - pull_request - -jobs: - tests: - runs-on: ubuntu-latest - name: "Unit tests for PHP ${{ matrix.php-version }} & Neo4j ${{ matrix.neo4j-version }}" - container: ubuntu - strategy: - fail-fast: false - matrix: - php-version: ['8.1', '8.2', '8.3'] - neo4j-version: ['4.4', '5.1.0', '5.13.0'] - env: - ENABLE_FEATURE_TEST: true - NEO4J_VERSION: ${{ matrix.neo4j-version }} - services: - neo4j: - image: neo4j:${{ matrix.neo4j-version }}-enterprise - env: - NEO4J_AUTH: neo4j/password - NEO4J_ACCEPT_LICENSE_AGREEMENT: yes - ports: - - "7474:7474" - - "7687:7687" - steps: - - uses: actions/checkout@v2 - - name: Cache Composer dependencies - uses: actions/cache@v2 - with: - path: /tmp/composer-cache - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - tools: composer:v2 - - run: composer install --ignore-platform-req=php - shell: bash - - run: composer test - shell: bash - - run: cat ./tests/test.log - shell: bash diff --git a/.github/workflows/ci-yml-lint.yml b/.github/workflows/ci-yml-lint.yml deleted file mode 100644 index dc948fd..0000000 --- a/.github/workflows/ci-yml-lint.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: YML lint - -on: - - push - - fork - - pull_request - -jobs: - yml-lint: - runs-on: ubuntu-latest - name: "YML lint" - steps: - - uses: actions/checkout@v2 - - run: docker pull cytopia/yamllint - - run: docker run --rm -t -v $(pwd):/data cytopia/yamllint . - shell: bash diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100755 index 0000000..2d8af59 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## Unreleased +### Changed +- Made library compatible with PHP 8.4, closes #6. +- Refactor GitHub Actions, related to #6. +- Update dev dependencies, related to #6. +- Remove dev dependencies `roave/no-leaks` and `boesing/psalm-plugin-stringf` due to conflict with newer PHP versions, + related to #6. diff --git a/Readme.md b/Readme.md index de20d74..71c1a10 100755 --- a/Readme.md +++ b/Readme.md @@ -4,14 +4,6 @@ ![Packagist Version](https://img.shields.io/packagist/v/syndesi/cypher-entity-manager) ![Packagist Downloads](https://img.shields.io/packagist/dm/syndesi/cypher-entity-manager) -[![Unit Tests](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-unit-test.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-unit-test.yml) -[![Mutant Test](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-mutant-test.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-mutant-test.yml) -[![Leak Tests](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-leak-test.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-leak-test.yml) -[![PHPStan](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-phpstan.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-phpstan.yml) -[![Psalm](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-psalm.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-psalm.yml) -[![Code Style](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-code-style.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-code-style.yml) -[![YML lint](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-yml-lint.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-yml-lint.yml) -[![Markdown lint](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-markdown-lint.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-markdown-lint.yml) [![Test Coverage](https://api.codeclimate.com/v1/badges/ecd3da92ddb4d8ac99a5/test_coverage)](https://codeclimate.com/github/Syndesi/cypher-entity-manager/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/ecd3da92ddb4d8ac99a5/maintainability)](https://codeclimate.com/github/Syndesi/cypher-entity-manager/maintainability) diff --git a/composer.json b/composer.json index e1b2425..43a4dd3 100755 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": "^8.1", - "syndesi/cypher-data-structures": "^0.3.0", + "syndesi/cypher-data-structures": "^0.4.0", "laudis/neo4j-php-client": "^3.0", "psr/log": "^3.0", "psr/event-dispatcher": "^1.0" @@ -34,35 +34,33 @@ } }, "require-dev": { - "vimeo/psalm": "^5.16", - "boesing/psalm-plugin-stringf": "^1.1", - "phpstan/phpstan": "^1.6", - "phpunit/php-code-coverage": "^9.2", - "infection/infection": "^0.27.8", - "friendsofphp/php-cs-fixer": "^3.8", - "phpunit/phpunit": "^9.5", - "roave/no-leaks": "^1.3", + "vimeo/psalm": "^6.2", + "phpstan/phpstan": "^2.1", + "phpunit/php-code-coverage": "^11", + "infection/infection": "^0.29.8", + "friendsofphp/php-cs-fixer": "^3.48", + "phpunit/phpunit": "^11", "phpbench/phpbench": "^1.2", - "crell/tukio": "^1.4", + "crell/tukio": "^2.0", "monolog/monolog": "^3.2", "selective/container": "^1.2", - "phpspec/prophecy": "^1.15", - "vlucas/phpdotenv": "^5.5" + "phpspec/prophecy": "^1.18", + "phpspec/prophecy-phpunit": "^2.1", + "vlucas/phpdotenv": "^5.6" }, "scripts": { - "test": "export ENABLE_FEATURE_TEST=true && echo -n \"\" > ./tests/test.log && php vendor/phpunit/phpunit/phpunit", + "test": "export ENABLE_FEATURE_TEST=true && echo -n \"\" > ./tests/test.log && php vendor/phpunit/phpunit/phpunit --display-phpunit-deprecations", "test:current": "export ENABLE_FEATURE_TEST=true && echo -n \"\" > ./tests/test.log && php vendor/phpunit/phpunit/phpunit --group current", "test:coverage:xml": "export XDEBUG_MODE=coverage && php ./vendor/phpunit/phpunit/phpunit --coverage-clover coverage.xml", "test:coverage:html": "export XDEBUG_MODE=coverage && php ./vendor/phpunit/phpunit/phpunit --coverage-html ./tmp", "test:mutant": "export XDEBUG_MODE=coverage && php vendor/infection/infection/bin/infection --threads=4", - "test:leak": "export LEAK=true && php vendor/bin/roave-no-leaks", - "cs:list": "php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --allow-risky=yes --dry-run ./src", - "cs:fix": "php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --allow-risky=yes", + "cs:list": "PHP_CS_FIXER_IGNORE_ENV=1 php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --allow-risky=yes --dry-run ./src", + "cs:fix": "PHP_CS_FIXER_IGNORE_ENV=1 php vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --allow-risky=yes", "psalm": "php vendor/bin/psalm --show-info=true --no-cache", "psalm:fix": "php vendor/bin/psalm --alter --issues=MissingReturnType,InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType", "phpstan": "vendor/bin/phpstan", "yml:lint": "docker run --rm -it -v $(pwd):/data cytopia/yamllint .", - "markdown:lint": "docker run --rm -v $(pwd):/work tmknom/markdownlint '**/*.md' --ignore vendor", + "markdown:lint": "docker run --rm -v $(pwd):/work tmknom/markdownlint '**/*.md' --config tests/.markdownlintrc --ignore vendor --ignore CHANGELOG.md --ignore var --ignore tmp", "docs:serve": "docker run --rm -d -p 3000:3000 -v $(pwd)/docs:/docs sujaykumarh/docsify serve" }, "config": { diff --git a/docs/README.md b/docs/README.md index de20d74..71c1a10 100755 --- a/docs/README.md +++ b/docs/README.md @@ -4,14 +4,6 @@ ![Packagist Version](https://img.shields.io/packagist/v/syndesi/cypher-entity-manager) ![Packagist Downloads](https://img.shields.io/packagist/dm/syndesi/cypher-entity-manager) -[![Unit Tests](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-unit-test.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-unit-test.yml) -[![Mutant Test](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-mutant-test.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-mutant-test.yml) -[![Leak Tests](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-leak-test.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-leak-test.yml) -[![PHPStan](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-phpstan.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-phpstan.yml) -[![Psalm](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-psalm.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-psalm.yml) -[![Code Style](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-code-style.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-code-style.yml) -[![YML lint](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-yml-lint.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-yml-lint.yml) -[![Markdown lint](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-markdown-lint.yml/badge.svg)](https://github.com/neo4j-php/cypher-entity-manager/actions/workflows/ci-markdown-lint.yml) [![Test Coverage](https://api.codeclimate.com/v1/badges/ecd3da92ddb4d8ac99a5/test_coverage)](https://codeclimate.com/github/Syndesi/cypher-entity-manager/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/ecd3da92ddb4d8ac99a5/maintainability)](https://codeclimate.com/github/Syndesi/cypher-entity-manager/maintainability) diff --git a/phpstan.neon b/phpstan.neon index 53e07ef..c60224f 100755 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,7 +2,6 @@ parameters: level: 8 paths: - src - checkGenericClassInNonGenericObjectType: false ignoreErrors: # - '#Method [a-zA-Z0-9\\_:()]+ should return static\([a-zA-Z0-9\\_]+\) but returns [a-zA-Z0-9\\_]+\.#' # - '#Method [a-zA-Z0-9\\_]+::current\(\) should return [a-zA-Z0-9\\_]+ but returns object\.#' diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ee83a6f..c8cb578 100755 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,20 +1,20 @@ - - - - ./src - - + - + ./tests + + + ./src + + diff --git a/psalm.xml b/psalm.xml index 3a27bd2..6a914ba 100755 --- a/psalm.xml +++ b/psalm.xml @@ -14,4 +14,9 @@ - + + + + + + diff --git a/src/Contract/ActionCypherElementQueueInterface.php b/src/Contract/ActionCypherElementQueueInterface.php index d6469d3..518e4c8 100644 --- a/src/Contract/ActionCypherElementQueueInterface.php +++ b/src/Contract/ActionCypherElementQueueInterface.php @@ -13,7 +13,7 @@ interface ActionCypherElementQueueInterface extends \Iterator { public function enqueue(ActionCypherElementInterface $element): self; - public function dequeue(): ?ActionCypherElementInterface; + public function dequeue(): ActionCypherElementInterface; public function preFlush(): self; diff --git a/src/Contract/EntityManagerInterface.php b/src/Contract/EntityManagerInterface.php index fd3b117..89a19a6 100644 --- a/src/Contract/EntityManagerInterface.php +++ b/src/Contract/EntityManagerInterface.php @@ -53,6 +53,9 @@ public function clear(): self; public function replaceQueue(ActionCypherElementQueueInterface $queue): self; + /** + * @phpstan-ignore missingType.generics + */ public function getClient(): ClientInterface; public function run(string $statement): mixed; diff --git a/src/Event/ActionCypherElementToStatementEvent.php b/src/Event/ActionCypherElementToStatementEvent.php index ade471d..b5d2652 100644 --- a/src/Event/ActionCypherElementToStatementEvent.php +++ b/src/Event/ActionCypherElementToStatementEvent.php @@ -13,7 +13,7 @@ class ActionCypherElementToStatementEvent extends Event private ?Statement $statement = null; public function __construct( - readonly private ActionCypherElementInterface $actionCypherElement + readonly private ActionCypherElementInterface $actionCypherElement, ) { } diff --git a/src/EventListener/Neo4j/NodeConstraintCreateToStatementEventListener.php b/src/EventListener/Neo4j/NodeConstraintCreateToStatementEventListener.php index 23180a5..1e03ea9 100644 --- a/src/EventListener/Neo4j/NodeConstraintCreateToStatementEventListener.php +++ b/src/EventListener/Neo4j/NodeConstraintCreateToStatementEventListener.php @@ -42,11 +42,11 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function nodeConstraintStatement(NodeConstraintInterface $nodeConstraint): Statement { $name = $nodeConstraint->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForConstraintNameIsNull(); } $label = $nodeConstraint->getFor(); - if (!$label) { + if (null === $label) { throw InvalidArgumentException::createForConstraintForIsNull(); } $properties = []; @@ -54,7 +54,7 @@ public static function nodeConstraintStatement(NodeConstraintInterface $nodeCons $properties[] = sprintf("e.%s", $propertyName); } $type = $nodeConstraint->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForConstraintTypeIsNull(); } diff --git a/src/EventListener/Neo4j/NodeConstraintDeleteToStatementEventListener.php b/src/EventListener/Neo4j/NodeConstraintDeleteToStatementEventListener.php index 1c3bfb0..521ceeb 100644 --- a/src/EventListener/Neo4j/NodeConstraintDeleteToStatementEventListener.php +++ b/src/EventListener/Neo4j/NodeConstraintDeleteToStatementEventListener.php @@ -42,7 +42,7 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function nodeConstraintStatement(NodeConstraintInterface $nodeConstraint): Statement { $name = $nodeConstraint->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForConstraintNameIsNull(); } diff --git a/src/EventListener/Neo4j/NodeIndexCreateToStatementEventListener.php b/src/EventListener/Neo4j/NodeIndexCreateToStatementEventListener.php index 339facc..20f1891 100644 --- a/src/EventListener/Neo4j/NodeIndexCreateToStatementEventListener.php +++ b/src/EventListener/Neo4j/NodeIndexCreateToStatementEventListener.php @@ -42,17 +42,17 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function nodeIndexStatement(NodeIndexInterface $nodeIndex): Statement { $type = $nodeIndex->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForIndexTypeIsNull(); } $name = $nodeIndex->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForIndexNameIsNull(); } $label = $nodeIndex->getFor(); - if (!$label) { + if (null === $label) { throw InvalidArgumentException::createForIndexForIsNull(); } diff --git a/src/EventListener/Neo4j/NodeIndexDeleteToStatementEventListener.php b/src/EventListener/Neo4j/NodeIndexDeleteToStatementEventListener.php index 3129103..b352e8c 100644 --- a/src/EventListener/Neo4j/NodeIndexDeleteToStatementEventListener.php +++ b/src/EventListener/Neo4j/NodeIndexDeleteToStatementEventListener.php @@ -42,7 +42,7 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function nodeIndexStatement(NodeIndexInterface $nodeIndex): Statement { $name = $nodeIndex->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForIndexNameIsNull(); } diff --git a/src/EventListener/Neo4j/RelationConstraintCreateToStatementEventListener.php b/src/EventListener/Neo4j/RelationConstraintCreateToStatementEventListener.php index 91a7464..16456d3 100644 --- a/src/EventListener/Neo4j/RelationConstraintCreateToStatementEventListener.php +++ b/src/EventListener/Neo4j/RelationConstraintCreateToStatementEventListener.php @@ -42,11 +42,11 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function relationConstraintStatement(RelationConstraintInterface $relationConstraint): Statement { $name = $relationConstraint->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForConstraintNameIsNull(); } $relationType = $relationConstraint->getFor(); - if (!$relationType) { + if (null === $relationType) { throw InvalidArgumentException::createForConstraintForIsNull(); } $properties = []; @@ -54,7 +54,7 @@ public static function relationConstraintStatement(RelationConstraintInterface $ $properties[] = sprintf("e.%s", $propertyName); } $constraintType = $relationConstraint->getType(); - if (!$constraintType) { + if (null === $constraintType) { throw InvalidArgumentException::createForConstraintTypeIsNull(); } diff --git a/src/EventListener/Neo4j/RelationConstraintDeleteToStatementEventListener.php b/src/EventListener/Neo4j/RelationConstraintDeleteToStatementEventListener.php index 428a701..398e7e9 100644 --- a/src/EventListener/Neo4j/RelationConstraintDeleteToStatementEventListener.php +++ b/src/EventListener/Neo4j/RelationConstraintDeleteToStatementEventListener.php @@ -42,7 +42,7 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function relationConstraintStatement(RelationConstraintInterface $relationConstraint): Statement { $name = $relationConstraint->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForConstraintNameIsNull(); } diff --git a/src/EventListener/Neo4j/RelationIndexCreateToStatementEventListener.php b/src/EventListener/Neo4j/RelationIndexCreateToStatementEventListener.php index 04d65ed..b4057dd 100644 --- a/src/EventListener/Neo4j/RelationIndexCreateToStatementEventListener.php +++ b/src/EventListener/Neo4j/RelationIndexCreateToStatementEventListener.php @@ -42,17 +42,17 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function relationIndexStatement(RelationIndexInterface $relationIndex): Statement { $relationType = $relationIndex->getType(); - if (!$relationType) { + if (null === $relationType) { throw InvalidArgumentException::createForIndexTypeIsNull(); } $name = $relationIndex->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForIndexNameIsNull(); } $indexType = $relationIndex->getFor(); - if (!$indexType) { + if (null === $indexType) { throw InvalidArgumentException::createForIndexForIsNull(); } diff --git a/src/EventListener/Neo4j/RelationIndexDeleteToStatementEventListener.php b/src/EventListener/Neo4j/RelationIndexDeleteToStatementEventListener.php index 369ba80..906a840 100644 --- a/src/EventListener/Neo4j/RelationIndexDeleteToStatementEventListener.php +++ b/src/EventListener/Neo4j/RelationIndexDeleteToStatementEventListener.php @@ -42,7 +42,7 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function relationIndexStatement(RelationIndexInterface $relationIndex): Statement { $name = $relationIndex->getName(); - if (!$name) { + if (null === $name) { throw InvalidArgumentException::createForIndexNameIsNull(); } diff --git a/src/EventListener/OpenCypher/RelationCreateToStatementEventListener.php b/src/EventListener/OpenCypher/RelationCreateToStatementEventListener.php index 475f096..476a229 100644 --- a/src/EventListener/OpenCypher/RelationCreateToStatementEventListener.php +++ b/src/EventListener/OpenCypher/RelationCreateToStatementEventListener.php @@ -44,17 +44,17 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function relationStatement(RelationInterface $relation): Statement { $type = $relation->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForRelationTypeIsNull(); } $startNode = $relation->getStartNode(); - if (!$startNode) { + if (null === $startNode) { throw InvalidArgumentException::createForStartNodeIsNull(); } $endNode = $relation->getEndNode(); - if (!$endNode) { + if (null === $endNode) { throw InvalidArgumentException::createForEndNodeIsNull(); } diff --git a/src/EventListener/OpenCypher/RelationDeleteToStatementEventListener.php b/src/EventListener/OpenCypher/RelationDeleteToStatementEventListener.php index 78d54c6..8eb5ff9 100644 --- a/src/EventListener/OpenCypher/RelationDeleteToStatementEventListener.php +++ b/src/EventListener/OpenCypher/RelationDeleteToStatementEventListener.php @@ -44,17 +44,17 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function relationStatement(RelationInterface $relation): Statement { $type = $relation->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForRelationTypeIsNull(); } $startNode = $relation->getStartNode(); - if (!$startNode) { + if (null === $startNode) { throw InvalidArgumentException::createForStartNodeIsNull(); } $endNode = $relation->getEndNode(); - if (!$endNode) { + if (null === $endNode) { throw InvalidArgumentException::createForEndNodeIsNull(); } diff --git a/src/EventListener/OpenCypher/RelationMergeToStatementEventListener.php b/src/EventListener/OpenCypher/RelationMergeToStatementEventListener.php index 5c4735c..d9cdc66 100644 --- a/src/EventListener/OpenCypher/RelationMergeToStatementEventListener.php +++ b/src/EventListener/OpenCypher/RelationMergeToStatementEventListener.php @@ -44,17 +44,17 @@ public function onActionCypherElementToStatementEvent(ActionCypherElementToState public static function relationStatement(RelationInterface $relation): Statement { $type = $relation->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForRelationTypeIsNull(); } $startNode = $relation->getStartNode(); - if (!$startNode) { + if (null === $startNode) { throw InvalidArgumentException::createForStartNodeIsNull(); } $endNode = $relation->getEndNode(); - if (!$endNode) { + if (null === $endNode) { throw InvalidArgumentException::createForEndNodeIsNull(); } diff --git a/src/EventListener/OpenCypher/SimilarNodeQueueCreateToStatementEventListener.php b/src/EventListener/OpenCypher/SimilarNodeQueueCreateToStatementEventListener.php index d6e2f97..d607f1d 100644 --- a/src/EventListener/OpenCypher/SimilarNodeQueueCreateToStatementEventListener.php +++ b/src/EventListener/OpenCypher/SimilarNodeQueueCreateToStatementEventListener.php @@ -55,7 +55,7 @@ public static function similarNodeQueueStatement(SimilarNodeQueueInterface $simi 'property' => StructureHelper::getPropertiesWhichAreNotIdentifiers($node), ]; } - if (!$firstNode) { + if (null === $firstNode) { return StructureHelper::getEmptyStatement(); } diff --git a/src/EventListener/OpenCypher/SimilarNodeQueueDeleteToStatementEventListener.php b/src/EventListener/OpenCypher/SimilarNodeQueueDeleteToStatementEventListener.php index e34997b..2a627f1 100644 --- a/src/EventListener/OpenCypher/SimilarNodeQueueDeleteToStatementEventListener.php +++ b/src/EventListener/OpenCypher/SimilarNodeQueueDeleteToStatementEventListener.php @@ -52,7 +52,7 @@ public static function similarNodeQueueStatement(SimilarNodeQueueInterface $simi } $batch[] = $node->getIdentifiers(); } - if (!$firstNode) { + if (null === $firstNode) { return StructureHelper::getEmptyStatement(); } diff --git a/src/EventListener/OpenCypher/SimilarNodeQueueMergeToStatementEventListener.php b/src/EventListener/OpenCypher/SimilarNodeQueueMergeToStatementEventListener.php index 1e75dad..9af27a7 100644 --- a/src/EventListener/OpenCypher/SimilarNodeQueueMergeToStatementEventListener.php +++ b/src/EventListener/OpenCypher/SimilarNodeQueueMergeToStatementEventListener.php @@ -55,7 +55,7 @@ public static function similarNodeQueueStatement(SimilarNodeQueueInterface $simi 'property' => StructureHelper::getPropertiesWhichAreNotIdentifiers($node), ]; } - if (!$firstNode) { + if (null === $firstNode) { return StructureHelper::getEmptyStatement(); } diff --git a/src/EventListener/OpenCypher/SimilarRelationQueueCreateToStatementEventListener.php b/src/EventListener/OpenCypher/SimilarRelationQueueCreateToStatementEventListener.php index 2d74f13..ff50f2f 100644 --- a/src/EventListener/OpenCypher/SimilarRelationQueueCreateToStatementEventListener.php +++ b/src/EventListener/OpenCypher/SimilarRelationQueueCreateToStatementEventListener.php @@ -76,15 +76,15 @@ public static function similarRelationQueueStatement(SimilarRelationQueueInterfa } $type = $firstRelation->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForRelationTypeIsNull(); } - if (!$firstRelationStartNode) { + if (null === $firstRelationStartNode) { throw InvalidArgumentException::createForStartNodeIsNull(); } - if (!$firstRelationEndNode) { + if (null === $firstRelationEndNode) { throw InvalidArgumentException::createForEndNodeIsNull(); } diff --git a/src/EventListener/OpenCypher/SimilarRelationQueueDeleteToStatementEventListener.php b/src/EventListener/OpenCypher/SimilarRelationQueueDeleteToStatementEventListener.php index 9c8b704..7c87bcc 100644 --- a/src/EventListener/OpenCypher/SimilarRelationQueueDeleteToStatementEventListener.php +++ b/src/EventListener/OpenCypher/SimilarRelationQueueDeleteToStatementEventListener.php @@ -75,15 +75,15 @@ public static function similarRelationQueueStatement(SimilarRelationQueueInterfa } $type = $firstRelation->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForRelationTypeIsNull(); } - if (!$firstRelationStartNode) { + if (null === $firstRelationStartNode) { throw InvalidArgumentException::createForStartNodeIsNull(); } - if (!$firstRelationEndNode) { + if (null === $firstRelationEndNode) { throw InvalidArgumentException::createForEndNodeIsNull(); } diff --git a/src/EventListener/OpenCypher/SimilarRelationQueueMergeToStatementEventListener.php b/src/EventListener/OpenCypher/SimilarRelationQueueMergeToStatementEventListener.php index 3feab59..87f42fc 100644 --- a/src/EventListener/OpenCypher/SimilarRelationQueueMergeToStatementEventListener.php +++ b/src/EventListener/OpenCypher/SimilarRelationQueueMergeToStatementEventListener.php @@ -76,7 +76,7 @@ public static function similarRelationQueueStatement(SimilarRelationQueueInterfa } $type = $firstRelation->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForRelationTypeIsNull(); } diff --git a/src/Helper/StructureHelper.php b/src/Helper/StructureHelper.php index 3ad27d6..13912ae 100644 --- a/src/Helper/StructureHelper.php +++ b/src/Helper/StructureHelper.php @@ -68,7 +68,7 @@ public static function getRelationStructure(RelationInterface $relation): string throw InvalidArgumentException::createForEndNodeIsNull(); } $type = $relation->getType(); - if (!$type) { + if (null === $type) { throw InvalidArgumentException::createForRelationTypeIsNull(); } if (0 === count($relation->getIdentifiers())) { diff --git a/src/Type/ActionCypherElement.php b/src/Type/ActionCypherElement.php index 38274c3..34acaf3 100644 --- a/src/Type/ActionCypherElement.php +++ b/src/Type/ActionCypherElement.php @@ -25,7 +25,7 @@ public function __construct( NodeIndexInterface| RelationIndexInterface| SimilarNodeQueueInterface| - SimilarRelationQueueInterface $element + SimilarRelationQueueInterface $element, ) { } diff --git a/src/Type/EntityManager.php b/src/Type/EntityManager.php index 822f920..95366cb 100644 --- a/src/Type/EntityManager.php +++ b/src/Type/EntityManager.php @@ -14,6 +14,7 @@ use Syndesi\CypherDataStructures\Contract\RelationConstraintInterface; use Syndesi\CypherDataStructures\Contract\RelationIndexInterface; use Syndesi\CypherDataStructures\Contract\RelationInterface; +use Syndesi\CypherEntityManager\Contract\ActionCypherElementInterface; use Syndesi\CypherEntityManager\Contract\ActionCypherElementQueueInterface; use Syndesi\CypherEntityManager\Contract\EntityManagerInterface; use Syndesi\CypherEntityManager\Contract\SimilarNodeQueueInterface; @@ -25,12 +26,18 @@ class EntityManager implements EntityManagerInterface { + /** + * @phpstan-ignore missingType.generics + */ private ClientInterface $client; private ?LoggerInterface $logger; private ActionCypherElementQueueInterface $queue; private EventDispatcherInterface $dispatcher; - public function __construct(ClientInterface $client, EventDispatcherInterface $dispatcher, LoggerInterface $logger = null) + /** + * @phpstan-ignore missingType.generics + */ + public function __construct(ClientInterface $client, EventDispatcherInterface $dispatcher, ?LoggerInterface $logger = null) { $this->client = $client; $this->dispatcher = $dispatcher; @@ -97,6 +104,9 @@ public function flush(): self $this->logger?->debug("Dispatching PreFlushEvent"); $this->dispatcher->dispatch(new PreFlushEvent()); foreach ($this->queue as $actionCypherElement) { + /** + * @var ActionCypherElementInterface $actionCypherElement + */ $events = LifecycleEventHelper::getLifecycleEventForCypherActionElement($actionCypherElement, true); foreach ($events as $event) { $this->logger?->debug(sprintf("Dispatching %s", (new \ReflectionClass($event))->getShortName())); @@ -149,6 +159,9 @@ public function clear(): self public function replaceQueue(ActionCypherElementQueueInterface $queue): self { foreach ($this->queue as $actionCypherElement) { + /** + * @var ActionCypherElementInterface $actionCypherElement + */ $queue->enqueue($actionCypherElement); } $this->queue = $queue; @@ -156,6 +169,9 @@ public function replaceQueue(ActionCypherElementQueueInterface $queue): self return $this; } + /** + * @phpstan-ignore missingType.generics + */ public function getClient(): ClientInterface { return $this->client; diff --git a/src/Type/SimilarNodeQueue.php b/src/Type/SimilarNodeQueue.php index 6e720e1..880fe54 100644 --- a/src/Type/SimilarNodeQueue.php +++ b/src/Type/SimilarNodeQueue.php @@ -11,6 +11,9 @@ class SimilarNodeQueue implements SimilarNodeQueueInterface { + /** + * @var \SplQueue + */ private \SplQueue $queue; private ?string $nodeStructure = null; @@ -49,7 +52,7 @@ public function rewind(): void */ public function enqueue(NodeInterface $node): SimilarNodeQueueInterface { - if (!$this->nodeStructure) { + if (null === $this->nodeStructure) { $this->nodeStructure = StructureHelper::getNodeStructure($node); } if (!$this->supports($node)) { @@ -72,7 +75,7 @@ public function count(): int public function supports(NodeInterface $node): bool { - if (!$this->nodeStructure) { + if (null === $this->nodeStructure) { return true; } diff --git a/src/Type/SimilarRelationQueue.php b/src/Type/SimilarRelationQueue.php index c77e8aa..a0733c4 100644 --- a/src/Type/SimilarRelationQueue.php +++ b/src/Type/SimilarRelationQueue.php @@ -11,6 +11,9 @@ class SimilarRelationQueue implements SimilarRelationQueueInterface { + /** + * @var \SplQueue + */ private \SplQueue $queue; private ?string $relationStructure = null; @@ -49,7 +52,7 @@ public function rewind(): void */ public function enqueue(RelationInterface $relation): SimilarRelationQueueInterface { - if (!$this->relationStructure) { + if (null === $this->relationStructure) { $this->relationStructure = StructureHelper::getRelationStructure($relation); } if (!$this->supports($relation)) { @@ -67,7 +70,7 @@ public function dequeue(): ?RelationInterface public function supports(RelationInterface $relation): bool { - if (!$this->relationStructure) { + if (null === $this->relationStructure) { return true; } diff --git a/src/Type/SimpleActionCypherElementQueue.php b/src/Type/SimpleActionCypherElementQueue.php index 4d3d749..01b0c3c 100644 --- a/src/Type/SimpleActionCypherElementQueue.php +++ b/src/Type/SimpleActionCypherElementQueue.php @@ -9,6 +9,9 @@ class SimpleActionCypherElementQueue implements ActionCypherElementQueueInterface { + /** + * @var \SplQueue + */ private \SplQueue $queue; public function __construct() @@ -23,7 +26,7 @@ public function enqueue(ActionCypherElementInterface $element): self return $this; } - public function dequeue(): ?ActionCypherElementInterface + public function dequeue(): ActionCypherElementInterface { return $this->queue->dequeue(); } diff --git a/.markdownlintrc b/tests/.markdownlintrc similarity index 100% rename from .markdownlintrc rename to tests/.markdownlintrc diff --git a/.yamllint b/tests/.yamllint similarity index 53% rename from .yamllint rename to tests/.yamllint index 4f38fcc..99c5461 100644 --- a/.yamllint +++ b/tests/.yamllint @@ -1,6 +1,5 @@ extends: default - ignore: | vendor/ @@ -9,10 +8,10 @@ rules: document-start: present: false - line-length: - max: 120 -# allow-non-breakable-words: true -# allow-non-breakable-inline-mappings: false + line-length: false comments-indentation: false truthy: false + + indentation: + spaces: 2 diff --git a/tests/Helper/ActionCypherElementHelperTest.php b/tests/Helper/ActionCypherElementHelperTest.php index 0b691de..be6cbd1 100644 --- a/tests/Helper/ActionCypherElementHelperTest.php +++ b/tests/Helper/ActionCypherElementHelperTest.php @@ -4,6 +4,7 @@ namespace Syndesi\CypherEntityManager\Tests\Helper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Syndesi\CypherDataStructures\Type\Node; use Syndesi\CypherDataStructures\Type\NodeConstraint; @@ -20,7 +21,7 @@ class ActionCypherElementHelperTest extends TestCase { - public function provideActionCypherElementWithType() + public static function provideActionCypherElementWithType() { return [ [ @@ -58,9 +59,7 @@ public function provideActionCypherElementWithType() ]; } - /** - * @dataProvider provideActionCypherElementWithType - */ + #[DataProvider("provideActionCypherElementWithType")] public function testGetTypeFromActionCypherElement(ActionCypherElement $object, ActionCypherElementType $expectedType): void { $foundType = ActionCypherElementHelper::getTypeFromActionCypherElement($object); diff --git a/tests/Helper/LifecycleEventHandlerTest.php b/tests/Helper/LifecycleEventHandlerTest.php index 1b05a30..c4c2ce9 100644 --- a/tests/Helper/LifecycleEventHandlerTest.php +++ b/tests/Helper/LifecycleEventHandlerTest.php @@ -4,6 +4,7 @@ namespace Syndesi\CypherEntityManager\Tests\Helper; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Syndesi\CypherDataStructures\Type\Node; use Syndesi\CypherDataStructures\Type\NodeConstraint; @@ -45,7 +46,7 @@ class LifecycleEventHandlerTest extends TestCase { - public function provideTestCases() + public static function provideTestCases() { return [ [ @@ -247,9 +248,7 @@ public function provideTestCases() ]; } - /** - * @dataProvider provideTestCases - */ + #[DataProvider("provideTestCases")] public function testCases(ActionCypherElement $actionCypherElement, bool $isPre, array $expectedEvents): void { $actualEvents = LifecycleEventHelper::getLifecycleEventForCypherActionElement($actionCypherElement, $isPre); diff --git a/tests/Trait/StoppableEventTraitTest.php b/tests/Trait/StoppableEventTraitTest.php index ce33919..0463901 100644 --- a/tests/Trait/StoppableEventTraitTest.php +++ b/tests/Trait/StoppableEventTraitTest.php @@ -12,7 +12,7 @@ class StoppableEventTraitTest extends TestCase { private function getTrait(): EventInterface { - return new class() implements EventInterface { + return new class implements EventInterface { use StoppableEventTrait; }; }