diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cad1bb..5ee683f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +2.1.1 +===== + +* (improvement) Replace `.` with `:` in `TaskMetaData::getKey`. +* (improvement) Change column of `TaskRun::$taskLog` to be not nullable. +* (internal) Update `21torr/janus` and use `phpunit` instead of `simple-phpunit`. + + 2.1.0 ===== diff --git a/composer.json b/composer.json index ca0966c..c45ce3b 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,10 @@ "symfony/uid": "^7.2" }, "require-dev": { - "21torr/janus": "^1.4.0", - "bamarni/composer-bin-plugin": "^1.8", + "21torr/janus": "^2.0.0", + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^12.2.5", "roave/security-advisories": "dev-latest", - "symfony/phpunit-bridge": "^7.2", "symfony/translation-contracts": "^3.6" }, "autoload": { @@ -48,6 +48,7 @@ }, "config": { "allow-plugins": { + "21torr/janus": true, "bamarni/composer-bin-plugin": true }, "sort-packages": true @@ -72,7 +73,7 @@ "PHP_CS_FIXER_IGNORE_ENV=1 vendor-bin/cs-fixer/vendor/bin/php-cs-fixer check --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php --no-interaction --ansi" ], "test": [ - "simple-phpunit", + "phpunit", "vendor-bin/phpstan/vendor/bin/phpstan analyze -c phpstan.neon . --ansi -v" ] } diff --git a/phpstan.neon b/phpstan.neon index c97c69f..b567413 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,8 +1,14 @@ includes: - vendor/21torr/janus/phpstan/lib.neon -# If you use simple-phpunit, you need to uncomment the following line. -# Always make sure to first run simple-phpunit and then PHPStan. parameters: - bootstrapFiles: - - vendor/bin/.phpunit/phpunit/vendor/autoload.php + +# These are temporarily copied here, as normally they should be in the lib.neon of janus. +# However, due to a bug in PHPStan, this currently doesn't work (https://github.com/phpstan/phpstan/issues/12844) + excludePaths: + analyse: + - vendor + analyseAndScan: + - node_modules (?) + - var (?) + - vendor-bin diff --git a/src/Entity/TaskRun.php b/src/Entity/TaskRun.php index 8e78e97..3e96751 100644 --- a/src/Entity/TaskRun.php +++ b/src/Entity/TaskRun.php @@ -26,6 +26,7 @@ class TaskRun /** */ #[ORM\ManyToOne(targetEntity: TaskLog::class, inversedBy: "runs")] + #[ORM\JoinColumn(name: "task_log_id", referencedColumnName: "id", nullable: false)] private TaskLog $taskLog; /** diff --git a/src/Task/TaskMetaData.php b/src/Task/TaskMetaData.php index c606717..f730fe5 100644 --- a/src/Task/TaskMetaData.php +++ b/src/Task/TaskMetaData.php @@ -38,7 +38,7 @@ public function getKey () : string // these are validated to be safe, so we can keep using these if (null !== $this->uniqueTaskId) { - return $this->uniqueTaskId; + return strtr($this->uniqueTaskId, ".", ":"); } $slugger = new AsciiSlugger("en"); diff --git a/src/TaskManagerBundle.php b/src/TaskManagerBundle.php index 05508f5..49f2972 100644 --- a/src/TaskManagerBundle.php +++ b/src/TaskManagerBundle.php @@ -16,7 +16,7 @@ final class TaskManagerBundle extends Bundle /** * @inheritDoc */ - public function getContainerExtension () : ?ExtensionInterface + public function getContainerExtension () : ExtensionInterface { return new ConfigurableBundleExtension( $this, diff --git a/tests/Task/TaskMetaDataTest.php b/tests/Task/TaskMetaDataTest.php index b0d52cf..b3c95f9 100644 --- a/tests/Task/TaskMetaDataTest.php +++ b/tests/Task/TaskMetaDataTest.php @@ -2,6 +2,7 @@ namespace Tests\Torr\TaskManager\Task; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Torr\TaskManager\Exception\Task\InvalidTaskDefinitionException; use Torr\TaskManager\Task\TaskMetaData; @@ -13,21 +14,21 @@ final class TaskMetaDataTest extends TestCase { public static function provideValidUniqueTaskIds () : iterable { - yield "plain" => ["test"]; - yield "with dash" => ["a-b"]; - yield "with underscore" => ["a-b_c"]; - yield "all characters" => ["a-b_c.d"]; - yield "numbers" => ["5"]; - yield "numbers longer" => ["1-2-3-4"]; + yield "plain" => ["test", "test"]; + yield "with dash" => ["a-b", "a-b"]; + yield "with underscore" => ["a-b_c", "a-b_c"]; + yield "all characters" => ["a-b_c.d", "a-b_c:d"]; + yield "numbers" => ["5", "5"]; + yield "numbers longer" => ["1-2-3-4", "1-2-3-4"]; } /** - * @dataProvider provideValidUniqueTaskIds */ - public function testValidUniqueTaskIds (string $uniqueTaskId) : void + #[DataProvider("provideValidUniqueTaskIds")] + public function testValidUniqueTaskIds (string $uniqueTaskId, string $expected) : void { $metadata = new TaskMetaData("Test", uniqueTaskId: $uniqueTaskId); - self::assertSame($uniqueTaskId, $metadata->getKey()); + self::assertSame($expected, $metadata->getKey()); } public static function provideInvalidUniqueTaskIds () : iterable @@ -45,8 +46,8 @@ public static function provideInvalidUniqueTaskIds () : iterable } /** - * @dataProvider provideInvalidUniqueTaskIds */ + #[DataProvider("provideInvalidUniqueTaskIds")] public function testInvalidUniqueTaskIds (string $uniqueTaskId) : void { $this->expectException(InvalidTaskDefinitionException::class); diff --git a/vendor-bin/c-norm/composer.json b/vendor-bin/c-norm/composer.json index 29d96fe..43031c1 100644 --- a/vendor-bin/c-norm/composer.json +++ b/vendor-bin/c-norm/composer.json @@ -1,6 +1,6 @@ { "require-dev": { - "ergebnis/composer-normalize": "^2.42", + "ergebnis/composer-normalize": "^2.47", "roave/security-advisories": "dev-latest" }, "config": { diff --git a/vendor-bin/cs-fixer/composer.json b/vendor-bin/cs-fixer/composer.json index ceadfce..42e20ab 100644 --- a/vendor-bin/cs-fixer/composer.json +++ b/vendor-bin/cs-fixer/composer.json @@ -1,6 +1,6 @@ { "require-dev": { - "21torr/php-cs-fixer": "^1.1.1", + "21torr/php-cs-fixer": "^1.1.5", "roave/security-advisories": "dev-latest" } } diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json index cf165ff..4eb9387 100644 --- a/vendor-bin/phpstan/composer.json +++ b/vendor-bin/phpstan/composer.json @@ -3,14 +3,14 @@ "php": "^8.3" }, "require-dev": { - "phpstan/extension-installer": "^1.3.1", - "phpstan/phpstan": "^1.11", - "phpstan/phpstan-deprecation-rules": "^1.2", - "phpstan/phpstan-doctrine": "^1.4", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-symfony": "^1.4", + "phpstan/extension-installer": "^1.4.2", + "phpstan/phpstan": "^2.1.11", + "phpstan/phpstan-deprecation-rules": "^2.0.1", + "phpstan/phpstan-doctrine": "^2.0.2", + "phpstan/phpstan-phpunit": "^2.0.6", + "phpstan/phpstan-symfony": "^2.0.4", "roave/security-advisories": "dev-latest", - "staabm/phpstan-todo-by": "^0.1.25" + "staabm/phpstan-todo-by": "^0.2" }, "config": { "sort-packages": true,