Skip to content
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

Don't call Pipeline::valid() recursively when a row is discarded #119

Merged
merged 4 commits into from
Jan 23, 2025
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
109 changes: 86 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ executors:
docker:
- image: php:8.2-alpine
working_directory: ~/repo
php8-3:
docker:
- image: php:8.3-alpine
working_directory: ~/repo
php8-4:
docker:
- image: php:8.4-alpine
working_directory: ~/repo


jobs:
# In the minimum PHP version supported, run all our quality checks.
Expand Down Expand Up @@ -37,38 +46,91 @@ jobs:
paths:
- vendor

phpcsfixer8-1:
phpstan8-1:
executor: php8-1
steps:
- checkout
- attach_workspace:
at: .
- run:
name: phpcs
command: vendor/bin/php-cs-fixer fix -v --dry-run --allow-risky=yes
name: phpstan
command: vendor/bin/phpstan analyse --memory-limit=256M

phpcs8-1:
phpunit8-1:
executor: php8-1
steps:
- checkout
- attach_workspace:
at: .
- run:
name: phpcs
command: vendor/bin/phpcs -n
name: phpunit
command: vendor/bin/phpunit --testdox

phpstan8-1:
executor: php8-1
# In higher versions of PHP, run only PHPUnit.
composer8-2:
executor: php8-2
steps:
- run:
name: Install alpine requirements for checkout
command: apk add git openssh-client curl
- checkout
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- ./vendor
- persist_to_workspace:
root: .
paths:
- vendor

phpunit8-2:
executor: php8-2
steps:
- checkout
- attach_workspace:
at: .
- run:
name: phpstan
command: vendor/bin/phpstan analyse --memory-limit=256M
name: phpunit
command: vendor/bin/phpunit --testdox

phpunit8-1:
executor: php8-1
composer8-3:
executor: php8-3
steps:
- run:
name: Install alpine requirements for checkout
command: apk add git openssh-client curl
- checkout
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- ./vendor
- persist_to_workspace:
root: .
paths:
- vendor

phpunit8-3:
executor: php8-3
steps:
- checkout
- attach_workspace:
Expand All @@ -77,9 +139,8 @@ jobs:
name: phpunit
command: vendor/bin/phpunit --testdox

# In higher versions of PHP, run only PHPUnit.
composer8-2:
executor: php8-2
composer8-4:
executor: php8-4
steps:
- run:
name: Install alpine requirements for checkout
Expand All @@ -104,8 +165,8 @@ jobs:
paths:
- vendor

phpunit8-2:
executor: php8-2
phpunit8-4:
executor: php8-4
steps:
- checkout
- attach_workspace:
Expand All @@ -120,12 +181,8 @@ workflows:
jobs:
- composer8-1
- composer8-2
- phpcs8-1:
requires:
- composer8-1
- phpcsfixer8-1:
requires:
- composer8-1
- composer8-3
- composer8-4
- phpstan8-1:
requires:
- composer8-1
Expand All @@ -135,3 +192,9 @@ workflows:
- phpunit8-2:
requires:
- composer8-2
- phpunit8-3:
requires:
- composer8-3
- phpunit8-4:
requires:
- composer8-4
41 changes: 0 additions & 41 deletions .php-cs-fixer.dist.php

This file was deleted.

12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
phpcs:
vendor/bin/phpcs -n

phpcbf:
vendor/bin/phpcbf

phpstan:
vendor/bin/phpstan clear-result-cache
vendor/bin/phpstan analyse

phpcsfixer:
vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes --diff

test:
vendor/bin/phpunit --testdox

infection:
vendor/bin/infection
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ _services.yaml_
shared: false
```

## How to contribute?

Below are some (not exhaustive) welcomed features for a 3.x version.
* Dropping support of older PHP versions.
* Type-hinting, rector...
* Putting PHPCS back on the project.
* Updating PHPUnit
* Improve code in order to remove some PHPStan exclusions.

## Documentation :notebook:

The documentation is available in a subfolder of the repo, [here](docs/README.md).
Expand Down
8 changes: 8 additions & 0 deletions changelog.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 2.4 (not released yet)

**Misc**
* Removed PHPCS and PHPCsFixer because too much code has become obsolete.
* Added a PHPStan exclusion.
* Updated CI to launch PHPUnit with PHP 8.3 and PHP 8.4.
* Updated the README to list which kind of work and improvements should be done to keep this library long-term.

## 2.3
* Add the PHPDoc _@mixin Pipeline_ to the Etl class.
* Add _mixed_ return type to _Wizaplace\Etl\Row\offsetGet_.
Expand Down
7 changes: 1 addition & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@
"ext-json": "*",
"ext-pdo_sqlite": "*",
"ext-xmlreader": "*",
"friendsofphp/php-cs-fixer": "^3.4",
"infection/infection": ">=0.15",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.100",
"phpstan/phpstan-deprecation-rules": "^0.12.6",
"phpstan/phpstan-strict-rules": "^0.12.11",
"phpunit/phpunit": ">=8",
"squizlabs/php_codesniffer": "^3.5"
"phpunit/phpunit": ">=8"
},
"autoload-dev": {
"psr-4": {
Expand All @@ -59,8 +56,6 @@
},
"scripts": {
"scan": [
"php-cs-fixer --dry-run -v --allow-risky=yes fix",
"phpcs -p",
"phpstan --memory-limit=256M analyze"
],
"test": "phpunit",
Expand Down
10 changes: 0 additions & 10 deletions phpcs.xml.dist

This file was deleted.

1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parameters:
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- '#Call to deprecated method#'
-
message: '~^Variable method call on ~'
path: src/Database/Query.php
Expand Down
80 changes: 0 additions & 80 deletions pre-commit.sample

This file was deleted.

5 changes: 1 addition & 4 deletions src/Pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ public function valid(): bool

foreach ($this->steps as $step) {
if ($this->current->discarded()) {
$this->key--;
$this->next();

return $this->valid();
break;
}

if ($step instanceof Transformer) {
Expand Down
Loading