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
28 changes: 22 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

dependencies:
- "highest"
Expand All @@ -69,6 +70,11 @@ jobs:
exclude:
- php-version: "8.1"
symfony: "^7.0"
include:
- php-version: '8.4'
symfony: '^8.0'
- php-version: '8.5'
symfony: '^8.0'
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
Expand Down Expand Up @@ -103,6 +109,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

dependencies:
- "highest"
Expand All @@ -115,16 +122,21 @@ jobs:
exclude:
- php-version: "8.1"
symfony: "^7.0"
include:
- php-version: '8.4'
symfony: '^8.0'
- php-version: '8.5'
symfony: '^8.0'
steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"
tools: "flex"

- name: "Install composer dependencies"
Expand All @@ -135,7 +147,7 @@ jobs:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Static analysis"
run: "vendor/bin/psalm --php-version=${{ matrix.php-version }}"
run: "vendor/bin/phpstan --no-progress --memory-limit=1G analyse --error-format=github"

unit-tests:
name: "Unit tests"
Expand All @@ -149,6 +161,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

dependencies:
- "lowest"
Expand All @@ -162,6 +175,11 @@ jobs:
exclude:
- php-version: "8.1"
symfony: "^7.0"
include:
- php-version: '8.4'
symfony: '^8.0'
- php-version: '8.5'
symfony: '^8.0'

steps:
- name: "Checkout"
Expand All @@ -171,8 +189,6 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.PHP_EXTENSIONS }}"
coverage: "none"
tools: "flex"

- name: "Install composer dependencies"
Expand All @@ -193,7 +209,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.4"
- "8.5"

dependencies:
- "highest"
Expand Down
4 changes: 4 additions & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\PropertyInfo\Type as LegacyType;

$config = new Configuration();

Expand All @@ -16,6 +17,9 @@
} else {
$config->ignoreUnknownClasses([Type::class]);
}
if (!class_exists(LegacyType::class)) {
$config->ignoreUnknownClasses([LegacyType::class]);
}

// ignore polyfill
if (version_compare(PHP_VERSION, '8.3.0', '>=')) {
Expand Down
33 changes: 19 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,33 @@
"require": {
"php": ">=8.1",
"doctrine/dbal": "^3.4 || ^4.0",
"doctrine/doctrine-bundle": "^1.9 || ^2.0 || ^3.0",
"doctrine/doctrine-bundle": "^1.9 || ^2.0 || ^3.0 || ^4.0",
"dragonmantank/cron-expression": "^2.2 || ^3.0",
"symfony/config": "^5.4 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/form": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0",
"symfony/config": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
"symfony/dependency-injection": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
"symfony/form": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
"symfony/http-kernel": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
"symfony/options-resolver": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
"symfony/polyfill-php83": "^1.33",
"symfony/polyfill-php84": "^1.33",
"symfony/property-info": "^5.4 || ^6.0 || ^7.0",
"symfony/validator": "^5.4 || ^6.0 || ^7.0"
"symfony/property-info": "^5.4.22 || ^6.4 || ^7.0 || ^8.0",
"symfony/validator": "^5.4.22 || ^6.4 || ^7.0 || ^8.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.42",
"ergebnis/composer-normalize": "^2.45",
"matthiasnoback/symfony-dependency-injection-test": "^4.3 || ^5.0 || ^6.0",
"phpdocumentor/reflection-docblock": "^5.3",
"phpunit/phpunit": "^9.5 || ^12.0",
"psalm/plugin-phpunit": "^0.19",
"phpstan/extension-installer": "^1.0",
"phpstan/phpdoc-parser": "^1.0 || ^2.0",
"phpstan/phpstan": "^1.0 || ^2.0",
"phpstan/phpstan-phpunit": "^1.0 || ^2.0",
"phpstan/phpstan-strict-rules": "^1.0 || ^2.0",
"phpstan/phpstan-symfony": "^1.0 || ^2.0",
"phpunit/phpunit": "^10.5 || ^11.0.1 || ^12.0",
"roave/security-advisories": "dev-latest",
"shipmonk/composer-dependency-analyser": "^1.8",
"sylius-labs/coding-standard": "^4.1.1",
"symplify/easy-coding-standard": "^12.3.6",
"vimeo/psalm": "^6.0"
"symplify/easy-coding-standard": "^12.3.6 || ^13.0.0"
},
"prefer-stable": true,
"autoload": {
Expand All @@ -50,7 +54,8 @@
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"ergebnis/composer-normalize": true
"ergebnis/composer-normalize": true,
"phpstan/extension-installer": true
},
"sort-packages": true
},
Expand Down
2 changes: 2 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
parameters:
reportUnmatchedIgnoredErrors: false
23 changes: 23 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
includes:
- phpstan-baseline.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon

parameters:
level: 8
paths:
- src
- tests
scanFiles:
- vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php
treatPhpDocTypesAsCertain: false
checkInternalClassCaseSensitivity: true
checkMissingVarTagTypehint: true
checkMissingTypehints: true
checkUninitializedProperties: true
featureToggles:
skipCheckGenericClasses:
- Symfony\Component\Form\AbstractType
- Symfony\Component\Form\FormBuilderInterface
- Symfony\Component\Form\FormInterface
- Symfony\Component\Form\FormTypeExtensionInterface
- Symfony\Component\Form\FormTypeInterface
51 changes: 0 additions & 51 deletions psalm.xml

This file was deleted.

6 changes: 3 additions & 3 deletions src/DependencyInjection/SetonoCronExpressionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;

final class SetonoCronExpressionExtension extends Extension implements PrependExtensionInterface
{
#[\Override]
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.php');
}

#[\Override]
Expand Down
14 changes: 7 additions & 7 deletions src/Doctrine/DBAL/Types/CronExpressionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?CronExpr
}

if (!is_string($value)) {
/**
* @psalm-suppress UndefinedMethod
*/
/** @phpstan-ignore staticMethod.notFound */
throw class_exists(InvalidType::class) ? InvalidType::new($value, CronExpression::class, ['string']) : ConversionException::conversionFailedInvalidType($value, CronExpression::class, ['string']);
}

Expand All @@ -47,9 +45,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?CronExpr
try {
return CronExpression::factory($value);
} catch (\Throwable $e) {
/**
* @psalm-suppress UndefinedMethod
*/
/** @phpstan-ignore staticMethod.notFound */
throw class_exists(ValueNotConvertible::class) ? ValueNotConvertible::new($value, CronExpression::class, null, $e) : ConversionException::conversionFailed($value, CronExpression::class, $e);
}
}
Expand All @@ -72,7 +68,11 @@ public function getName(): string
return self::CRON_EXPRESSION_TYPE;
}

/** @noinspection PhpUnusedParameterInspection */
/**
* @noinspection PhpUnusedParameterInspection
*
* @phpstan-ignore return.tooWideBool
*/
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
{
return true;
Expand Down
6 changes: 3 additions & 3 deletions src/Form/DataTransformer/CronExpressionToPartsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

/**
* @template-implements DataTransformerInterface<CronExpression, array<string, array<string>>>
*
* @psalm-suppress TooManyTemplateParams
*/
final class CronExpressionToPartsTransformer implements DataTransformerInterface
{
Expand Down Expand Up @@ -88,7 +86,9 @@ public function reverseTransform($value): CronExpression
}

/**
* @psalm-assert array<string, array<scalar>> $value
* @phpstan-assert array<string, array<scalar>> $value
*
* @phpstan-ignore missingType.iterableValue
*/
private static function allArrayScalar(array $value): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

/**
* @template-implements DataTransformerInterface<CronExpression, array<string,string>>
*
* @psalm-suppress TooManyTemplateParams
*/
final class CronExpressionToStringPartsTransformer implements DataTransformerInterface
{
Expand Down Expand Up @@ -88,7 +86,9 @@ public function reverseTransform($value): CronExpression
}

/**
* @psalm-assert iterable<string> $value
* @phpstan-assert array<string> $value
*
* @phpstan-ignore missingType.iterableValue
*/
private static function allString(array $value): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

/**
* @template-implements DataTransformerInterface<CronExpression, string>
*
* @psalm-suppress TooManyTemplateParams
*/
final class CronExpressionToStringTransformer implements DataTransformerInterface
{
Expand Down
11 changes: 6 additions & 5 deletions src/Form/Type/CronExpressionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public function getBlockPrefix(): string
/**
* Will create an array where the first key is 1
* oneIndexedRange(3) will return [1 => 1, 2 => 2, 3 => 3].
*
* @return array<int, int>
*/
private function oneIndexedRange(int $end, int $start = 0): array
{
Expand All @@ -147,11 +149,10 @@ private function oneIndexedRange(int $end, int $start = 0): array

protected function buildCallback(int $payload): Callback
{
// helper function for Symfony 4.4
return new Callback([
'callback' => [$this, 'validateCronField'],
'payload' => $payload,
]);
return new Callback(
callback: $this->validateCronField(...),
payload: $payload,
);
}

public function validateCronField(?string $value, ExecutionContextInterface $context, int $payload): void
Expand Down
Loading