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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
with:
php-version: '8.2'
symfony-version: '6.2.*'
- name: "Run checkstyle with squizlabs/php_codesniffer"
run: vendor/bin/phpcs
- name: "Run checkstyle with symplify/easy-coding-standard"
run: vendor/bin/ecs

conventions:
name: "Conventions"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.idea/
/.phpcs-cache
/.phpunit.result.cache
/tests/.artifacts/
/tests/symfony/var/
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.6",
"symfony/filesystem": "^5.0|^6.0",
"symfony/finder": "^5.0|^6.0",
"symfony/process": "^5.0|^6.0"
"symfony/process": "^5.0|^6.0",
"symplify/easy-coding-standard": "^11.3"
},
"replace": {
"yokai/batch": "self.version",
Expand Down
44 changes: 44 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

declare(strict_types=1);

use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
use PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests/convention',
__DIR__ . '/tests/integration',
__DIR__ . '/tests/symfony/src',
__DIR__ . '/tests/symfony/tests',
]);

$ecsConfig->sets([
SetList::ARRAY,
SetList::DOCBLOCK,
SetList::NAMESPACES,
SetList::COMMENTS,
SetList::STRICT,
SetList::PSR_12,
]);

$ecsConfig->skip([
/* Do not force array on multiple lines : ['foo' => $foo, 'bar' => $bar] */
ArrayOpenerAndCloserNewlineFixer::class,
ArrayListItemNewlineFixer::class,
StandaloneLineInMultilineArrayFixer::class,
]);

$ecsConfig->ruleWithConfiguration(ForbiddenFunctionsSniff::class, [
'forbiddenFunctions' => ['dump' => null, 'dd' => null, 'var_dump' => null, 'die' => null],
]);
$ecsConfig->ruleWithConfiguration(FunctionDeclarationFixer::class, [
'closure_fn_spacing' => 'none',
]);
};
25 changes: 0 additions & 25 deletions phpcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/tests
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install () {
}

install "php82" "6.2.*"
led in -s php82 -- vendor/bin/phpcs
led in -s php82 -- vendor/bin/ecs
led in -s php82 -- vendor/bin/phpstan analyze
led in -s php82 -- vendor/bin/phpunit --testsuite=Convention

Expand Down
3 changes: 0 additions & 3 deletions src/batch-box-spout/src/Reader/FlatFileReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public function __construct(
$this->headerStrategy = $headerStrategy ?? HeaderStrategy::skip();
}

/**
* @inheritDoc
*/
public function read(): iterable
{
/** @var string $path */
Expand Down
6 changes: 0 additions & 6 deletions src/batch-box-spout/src/Reader/Options/CSVOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public function __construct(
) {
}

/**
* @inheritdoc
*/
public function configure(ReaderInterface $reader): void
{
if (!$reader instanceof CSVReader) {
Expand All @@ -38,9 +35,6 @@ public function configure(ReaderInterface $reader): void
$reader->setShouldPreserveEmptyRows($this->preserveEmptyRows);
}

/**
* @inheritdoc
*/
public function getSheets(ReaderInterface $reader): iterable
{
return $reader->getSheetIterator();
Expand Down
6 changes: 0 additions & 6 deletions src/batch-box-spout/src/Reader/Options/ODSOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public function __construct(
$this->sheetFilter = $sheetFilter ?? SheetFilter::all();
}

/**
* @inheritDoc
*/
public function configure(ReaderInterface $reader): void
{
if (!$reader instanceof ODSReader) {
Expand All @@ -36,9 +33,6 @@ public function configure(ReaderInterface $reader): void
$reader->setShouldPreserveEmptyRows($this->preserveEmptyRows);
}

/**
* @inheritDoc
*/
public function getSheets(ReaderInterface $reader): iterable
{
yield from $this->sheetFilter->getSheets($reader);
Expand Down
6 changes: 0 additions & 6 deletions src/batch-box-spout/src/Reader/Options/XLSXOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public function __construct(
$this->sheetFilter = $sheetFilter ?? SheetFilter::all();
}

/**
* @inheritDoc
*/
public function configure(ReaderInterface $reader): void
{
if (!$reader instanceof XLSXReader) {
Expand All @@ -36,9 +33,6 @@ public function configure(ReaderInterface $reader): void
$reader->setShouldPreserveEmptyRows($this->preserveEmptyRows);
}

/**
* @inheritDoc
*/
public function getSheets(ReaderInterface $reader): iterable
{
yield from $this->sheetFilter->getSheets($reader);
Expand Down
9 changes: 0 additions & 9 deletions src/batch-box-spout/src/Writer/FlatFileWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ public function __construct(
) {
}

/**
* @inheritDoc
*/
public function initialize(): void
{
/** @var string $path */
Expand All @@ -67,9 +64,6 @@ public function initialize(): void
}
}

/**
* @inheritDoc
*/
public function write(iterable $items): void
{
$writer = $this->writer;
Expand Down Expand Up @@ -102,9 +96,6 @@ public function write(iterable $items): void
}
}

/**
* @inheritDoc
*/
public function flush(): void
{
if ($this->writer === null) {
Expand Down
3 changes: 0 additions & 3 deletions src/batch-box-spout/src/Writer/Options/CSVOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public function __construct(
) {
}

/**
* @inheritdoc
*/
public function configure(WriterInterface $writer): void
{
if (!$writer instanceof CSVWriter) {
Expand Down
3 changes: 0 additions & 3 deletions src/batch-box-spout/src/Writer/Options/ODSOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public function __construct(
) {
}

/**
* @inheritDoc
*/
public function configure(WriterInterface $writer): void
{
if (!$writer instanceof ODSWriter) {
Expand Down
3 changes: 0 additions & 3 deletions src/batch-box-spout/src/Writer/Options/XLSXOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public function __construct(
) {
}

/**
* @inheritDoc
*/
public function configure(WriterInterface $writer): void
{
if (!$writer instanceof XLSXWriter) {
Expand Down
3 changes: 0 additions & 3 deletions src/batch-doctrine-dbal/src/DoctrineDBALInsertWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function __construct(
$this->connection = $connection;
}

/**
* @inheritdoc
*/
public function write(iterable $items): void
{
foreach ($items as $item) {
Expand Down
15 changes: 0 additions & 15 deletions src/batch-doctrine-dbal/src/DoctrineDBALJobExecutionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ public function createSchema(): void
$this->connection->getConfiguration()->setSchemaAssetsFilter($assetFilter);
}

/**
* @inheritDoc
*/
public function store(JobExecution $execution): void
{
try {
Expand All @@ -94,9 +91,6 @@ public function store(JobExecution $execution): void
}
}

/**
* @inheritDoc
*/
public function remove(JobExecution $execution): void
{
try {
Expand All @@ -106,9 +100,6 @@ public function remove(JobExecution $execution): void
}
}

/**
* @inheritDoc
*/
public function retrieve(string $jobName, string $executionId): JobExecution
{
try {
Expand All @@ -120,9 +111,6 @@ public function retrieve(string $jobName, string $executionId): JobExecution
return $this->fromRow($row);
}

/**
* @inheritDoc
*/
public function list(string $jobName): iterable
{
$qb = $this->connection->createQueryBuilder();
Expand All @@ -133,9 +121,6 @@ public function list(string $jobName): iterable
yield from $this->queryList($qb->getSQL(), ['jobName' => $jobName], ['jobName' => Types::STRING]);
}

/**
* @inheritDoc
*/
public function query(Query $query): iterable
{
$queryParameters = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function __construct(
}

/**
* @inheritdoc
* @phpstan-return Generator<array<string, string>>
*/
public function read(): Generator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function __construct(ConnectionRegistry $doctrine, string $sql, string $c
}

/**
* @inheritdoc
* @phpstan-return Generator<array<string, string>>
*/
public function read(): Generator
Expand Down
3 changes: 0 additions & 3 deletions src/batch-doctrine-dbal/src/DoctrineDBALUpsertWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public function __construct(ConnectionRegistry $doctrine, string $connection = n
$this->connection = $connection;
}

/**
* @inheritdoc
*/
public function write(iterable $items): void
{
foreach ($items as $item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Yokai\Batch\Tests\Bridge\Doctrine\DBAL;

use Doctrine\DBAL\Types\Types;
use Generator;
use Yokai\Batch\Bridge\Doctrine\DBAL\DoctrineDBALInsertWriter;
use Yokai\Batch\Exception\UnexpectedValueException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Yokai\Batch\Tests\Bridge\Doctrine\DBAL;

use DateTimeImmutable;
use Exception;
use Generator;
use RuntimeException;
use Throwable;
Expand Down Expand Up @@ -227,23 +226,23 @@ public function retrieveInvalid(): \Generator
{
yield '"parameters" column value is expected to be array' => [
['parameters' => '"string"'],
UnexpectedValueException::type('array', 'string')
UnexpectedValueException::type('array', 'string'),
];
yield '"summary" column value is expected to be array' => [
['summary' => '"string"'],
UnexpectedValueException::type('array', 'string')
UnexpectedValueException::type('array', 'string'),
];
yield '"failures" column value is expected to be array' => [
['failures' => '"string"'],
UnexpectedValueException::type('array', 'string')
UnexpectedValueException::type('array', 'string'),
];
yield '"warnings" column value is expected to be array' => [
['warnings' => '"string"'],
UnexpectedValueException::type('array', 'string')
UnexpectedValueException::type('array', 'string'),
];
yield '"child_executions" column value is expected to be array' => [
['child_executions' => '"string"'],
UnexpectedValueException::type('array', 'string')
UnexpectedValueException::type('array', 'string'),
];
}

Expand Down
3 changes: 0 additions & 3 deletions src/batch-doctrine-orm/src/EntityReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public function __construct(
) {
}

/**
* @inheritDoc
*/
public function read(): iterable
{
$manager = $this->doctrine->getManagerForClass($this->class);
Expand Down
3 changes: 0 additions & 3 deletions src/batch-doctrine-persistence/src/ObjectWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ public function __construct(
) {
}

/**
* @inheritDoc
*/
public function write(iterable $items): void
{
foreach ($items as $item) {
Expand Down
2 changes: 1 addition & 1 deletion src/batch-league-flysystem/src/Job/CopyFilesJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final public function execute(JobExecution $jobExecution): void
throw UnexpectedValueException::type('string|string[]', $config);
}

$transformLocation = $this->transformLocation ?? fn ($sourceLocation) => $sourceLocation;
$transformLocation = $this->transformLocation ?? fn($sourceLocation) => $sourceLocation;
foreach ($locations as $sourceLocation) {
$destinationLocation = $transformLocation($sourceLocation);
if (!\is_string($destinationLocation)) {
Expand Down
Loading