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
29 changes: 3 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -39,16 +18,14 @@ jobs:

sca:
uses: zenstruck/.github/.github/workflows/php-stan.yml@main
with:
php: 8.2

fixcs:
name: Run php-cs-fixer
needs: sync-with-template
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 }}
Expand All @@ -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 }}
27 changes: 14 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/Filesystem/Doctrine/MappingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Filesystem/Node/File/FlysystemFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/Filesystem/Symfony/Serializer/NodeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ 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;
}

/**
* @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.');
Expand Down Expand Up @@ -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]);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Filesystem/Test/Node/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Controller/ArgumentResolverController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions tests/Fixtures/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down