Valinor/phpstan.neon.dist
Romain Canon 69ad3f4777 feat: allow injecting a cache implementation that is used by the mapper
The cache implementation that was previously injected in the mapper
builder must now be manually injected. This gives better control on when
the cache should be enabled, especially depending on which environment
the application is running.

The library provides a cache implementation out of the box, which saves
cache entries into the file system.

It is also possible to use any PSR-16 compliant implementation, as long
as it is capable of caching the entries handled by the library.

```php
$cache = new \CuyZ\Valinor\Cache\FileSystemCache('path/to/cache-dir');

(new \CuyZ\Valinor\MapperBuilder())
    ->withCache($cache)
    ->mapper()
    ->map(SomeClass::class, [/* … */]);
```
2022-05-23 20:28:02 +02:00

34 lines
1.4 KiB
Plaintext

includes:
- qa/PHPStan/valinor-phpstan-configuration.php
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
rules:
- CuyZ\Valinor\QA\PHPStan\Extension\ApiAndInternalAnnotationCheck
parameters:
level: max
paths:
- src
- tests
- qa/PHPStan
ignoreErrors:
# \PHPStan\Rules\BooleansInConditions
- '#Only booleans are allowed in .* given#'
# \PHPStan\Rules\DisallowedConstructs\DisallowedShortTernaryRule
- '#Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.#'
# \PHPStan\Rules\DisallowedConstructs\DisallowedEmptyRule
- '#Construct empty\(\) is not allowed\. Use more strict comparison\.#'
- '#Method [\w\\:]+_data_provider\(\) return type has no value type specified in iterable type#'
- message: '#Template type T of method CuyZ\\Valinor\\Mapper\\TreeMapper::map\(\) is not referenced in a parameter#'
path: src/Mapper/TreeMapper.php
- message: '#Method CuyZ\\Valinor\\MapperBuilder::withCache\(\) has parameter \$cache with generic interface Psr\\SimpleCache\\\CacheInterface but does not specify its types: EntryType#'
path: src/MapperBuilder.php
stubFiles:
- qa/PHPStan/Stubs/Psr/SimpleCache/CacheInterface.stub
tmpDir: var/cache/phpstan