diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dba790fd..6bb226db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,28 +8,7 @@ on: jobs: tests: - name: PHP ${{ matrix.php }}, SF ${{ matrix.symfony }} - ${{ matrix.deps }} - runs-on: ubuntu-latest - strategy: - matrix: - php: [8.1, 8.2, 8.3, 8.4] - deps: [highest] - symfony: [6.4.*, 7.2.*, 7.3.*] - include: - - php: 8.1 - deps: lowest - symfony: '*' - exclude: - - php: 8.1 - symfony: 7.2.* - - php: 8.1 - symfony: 7.3.* - steps: - - uses: zenstruck/.github/actions/php-test-symfony@main - with: - php: ${{ matrix.php }} - symfony: ${{ matrix.symfony }} - deps: ${{ matrix.deps }} + uses: zenstruck/.github/.github/workflows/php-test-symfony.yml@main code-coverage: uses: zenstruck/.github/.github/workflows/php-coverage-codecov.yml@main @@ -39,8 +18,6 @@ jobs: sca: uses: zenstruck/.github/.github/workflows/php-stan.yml@main - with: - php: 8.2 fixcs: name: Run php-cs-fixer @@ -48,7 +25,7 @@ jobs: if: (github.event_name == 'push' || github.event_name == 'schedule') && !startsWith(github.ref, 'refs/tags') && github.repository_owner == 'zenstruck' runs-on: ubuntu-latest steps: - - uses: zenstruck/.github@php-cs-fixer + - uses: zenstruck/.github/actions/php-cs-fixer@main with: php: 8.1 key: ${{ secrets.GPG_PRIVATE_KEY }} @@ -59,7 +36,7 @@ jobs: if: (github.event_name == 'push' || github.event_name == 'schedule') && !startsWith(github.ref, 'refs/tags') && github.repository_owner == 'zenstruck' runs-on: ubuntu-latest steps: - - uses: zenstruck/.github@sync-with-template + - uses: zenstruck/.github/actions/sync-with-template@main with: key: ${{ secrets.GPG_PRIVATE_KEY }} token: ${{ secrets.COMPOSER_TOKEN }} diff --git a/composer.json b/composer.json index f5786797..f6716867 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "zenstruck/temp-file": "^1.2.1" }, "require-dev": { - "doctrine/doctrine-bundle": "^2.8", + "doctrine/doctrine-bundle": "^2.8|^3.0", "doctrine/orm": "^2.14|^3.0", "league/flysystem-async-aws-s3": "^3.10", "league/flysystem-ftp": "^3.10", @@ -32,18 +32,19 @@ "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^9.6.18", "srwiez/thumbhash": "^1.2", - "symfony/browser-kit": "^6.4|^7.0", - "symfony/form": "^6.4|^7.0", - "symfony/framework-bundle": "^6.4|^7.0", - "symfony/mime": "^6.4|^7.0", - "symfony/phpunit-bridge": "^6.1|^7.0", - "symfony/serializer": "^6.4|^7.0", - "symfony/stopwatch": "^6.4|^7.0", - "symfony/string": "^6.4|^7.0", - "symfony/twig-bundle": "^6.4|^7.0", - "symfony/validator": "^6.4|^7.0", - "symfony/var-dumper": "^6.4|^7.0", - "symfony/yaml": "^6.4|^7.0", + "symfony/browser-kit": "^6.4|^7.0|^8.0", + "symfony/form": "^6.4|^7.0|^8.0", + "symfony/framework-bundle": "^6.4|^7.0|^8.0", + "symfony/mime": "^6.4|^7.0|^8.0", + "symfony/phpunit-bridge": "^6.4|^7.0|^8.0", + "symfony/serializer": "^6.4|^7.0|^8.0", + "symfony/stopwatch": "^6.4|^7.0|^8.0", + "symfony/string": "^6.4|^7.0|^8.0", + "symfony/twig-bundle": "^6.4|^7.0|^8.0", + "symfony/validator": "^6.4|^7.0|^8.0", + "symfony/var-dumper": "^6.4|^7.0|^8.0", + "symfony/var-exporter": "^6.4|^7.0|^8.0", + "symfony/yaml": "^6.4|^7.0|^8.0", "twig/twig": "^3.6", "zenstruck/assert": "^1.2", "zenstruck/console-test": "^1.4", diff --git a/src/Filesystem/Doctrine/MappingManager.php b/src/Filesystem/Doctrine/MappingManager.php index d7be052d..1b4af7f0 100644 --- a/src/Filesystem/Doctrine/MappingManager.php +++ b/src/Filesystem/Doctrine/MappingManager.php @@ -47,7 +47,7 @@ public function load(object|iterable $object): object|iterable } } - return $object; + return $object; // @phpstan-ignore return.type } if (isset($this->loaded[$object])) { diff --git a/src/Filesystem/Node/File/FlysystemFile.php b/src/Filesystem/Node/File/FlysystemFile.php index 2f92ae00..8ff6c5ef 100644 --- a/src/Filesystem/Node/File/FlysystemFile.php +++ b/src/Filesystem/Node/File/FlysystemFile.php @@ -58,7 +58,7 @@ public function stream(): Stream public function checksum(?string $algo = null): string { - return $this->cache['checksum'][$algo] ??= $this->operator->checksum($this->path(), $algo ? ['checksum_algo' => $algo] : []); + return $this->cache['checksum'][$algo ?? '_auto'] ??= $this->operator->checksum($this->path(), $algo ? ['checksum_algo' => $algo] : []); } public function publicUrl(array $config = []): string diff --git a/src/Filesystem/Symfony/DependencyInjection/Configuration.php b/src/Filesystem/Symfony/DependencyInjection/Configuration.php index 8f4aaca7..72f7e71a 100644 --- a/src/Filesystem/Symfony/DependencyInjection/Configuration.php +++ b/src/Filesystem/Symfony/DependencyInjection/Configuration.php @@ -33,7 +33,7 @@ public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('zenstruck_filesystem'); - $treeBuilder->getRootNode() // @phpstan-ignore method.notFound + $treeBuilder->getRootNode() ->validate() ->ifTrue(function(array $v) { if (null === $v['default_filesystem']) { diff --git a/src/Filesystem/Symfony/DependencyInjection/ZenstruckFilesystemExtension.php b/src/Filesystem/Symfony/DependencyInjection/ZenstruckFilesystemExtension.php index ce13ebb6..4b4e9401 100644 --- a/src/Filesystem/Symfony/DependencyInjection/ZenstruckFilesystemExtension.php +++ b/src/Filesystem/Symfony/DependencyInjection/ZenstruckFilesystemExtension.php @@ -406,10 +406,10 @@ private function registerFilesystem(string $name, array $config, ContainerBuilde ; if ($config['lazy']) { - $flysystemDef - ->setLazy(true) - ->addTag('proxy', ['interface' => Flysystem::class]) - ; +// $flysystemDef +// ->setLazy(true) +// ->addTag('proxy', ['interface' => Flysystem::class]) +// ; } $container->register($filesystemId = 'zenstruck_filesystem.filesystem.'.$name, FlysystemFilesystem::class) diff --git a/src/Filesystem/Symfony/Serializer/NodeNormalizer.php b/src/Filesystem/Symfony/Serializer/NodeNormalizer.php index 7c1d5ac1..5f221cba 100644 --- a/src/Filesystem/Symfony/Serializer/NodeNormalizer.php +++ b/src/Filesystem/Symfony/Serializer/NodeNormalizer.php @@ -46,12 +46,12 @@ public function __construct(private ContainerInterface $container) /** * @param Node $object */ - public function normalize(mixed $object, ?string $format = null, array $context = []): array|string // @phpstan-ignore missingType.iterableValue, missingType.iterableValue + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string // @phpstan-ignore missingType.iterableValue { return Mapping::fromArray($context)->serialize($object); } - public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool // @phpstan-ignore missingType.iterableValue + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof Node && !$data instanceof PendingFile; } @@ -59,7 +59,7 @@ public function supportsNormalization(mixed $data, ?string $format = null, array /** * @param string $data */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): Node // @phpstan-ignore missingType.iterableValue + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): Node { if (!\is_string($data) && !\is_array($data)) { throw new UnexpectedValueException('Data must be a string or array.'); @@ -94,7 +94,7 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a return $node; } - public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool // @phpstan-ignore missingType.iterableValue + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return isset(self::TYPE_MAP[$type]); } diff --git a/src/Filesystem/Test/Node/Mock.php b/src/Filesystem/Test/Node/Mock.php index 6eabfdfc..1755e4f4 100644 --- a/src/Filesystem/Test/Node/Mock.php +++ b/src/Filesystem/Test/Node/Mock.php @@ -35,6 +35,8 @@ public static function pendingFile(?string $filename = null, ?string $extension } /** + * @param int<1, max> $width + * @param int<1, max> $height * @param ?string $filename Optional filename to use (must not include directory separators) */ public static function pendingImage(int $width = 10, int $height = 10, string $type = 'png', ?string $filename = null): PendingImage diff --git a/tests/Fixtures/Controller/ArgumentResolverController.php b/tests/Fixtures/Controller/ArgumentResolverController.php index a226086c..855c9cf2 100644 --- a/tests/Fixtures/Controller/ArgumentResolverController.php +++ b/tests/Fixtures/Controller/ArgumentResolverController.php @@ -12,7 +12,7 @@ namespace Zenstruck\Tests\Fixtures\Controller; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Zenstruck\Filesystem\Attribute\PendingUploadedFile; use Zenstruck\Filesystem\Attribute\UploadedFile; use Zenstruck\Filesystem\Node\File; diff --git a/tests/Fixtures/Controller/ValidatedArgumentResolverController.php b/tests/Fixtures/Controller/ValidatedArgumentResolverController.php index 9b3e1f45..75377fa1 100644 --- a/tests/Fixtures/Controller/ValidatedArgumentResolverController.php +++ b/tests/Fixtures/Controller/ValidatedArgumentResolverController.php @@ -12,7 +12,7 @@ namespace Zenstruck\Tests\Fixtures\Controller; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Zenstruck\Filesystem\Attribute\PendingUploadedFile; use Zenstruck\Filesystem\Node\File; use Zenstruck\Filesystem\Symfony\Validator\PendingFileConstraint; diff --git a/tests/Fixtures/TestKernel.php b/tests/Fixtures/TestKernel.php index 924c74a9..3c6f9127 100644 --- a/tests/Fixtures/TestKernel.php +++ b/tests/Fixtures/TestKernel.php @@ -101,8 +101,6 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load $c->loadFromExtension('doctrine', [ 'dbal' => ['url' => 'sqlite:///%kernel.project_dir%/var/data.db'], 'orm' => [ - 'auto_generate_proxy_classes' => true, - 'auto_mapping' => true, 'mappings' => [ 'Test' => [ 'is_bundle' => false,