From 928e919b08edf8af9a88754ff605e9be6204ff84 Mon Sep 17 00:00:00 2001 From: Sarun Rattanasiri Date: Tue, 24 Feb 2026 20:31:47 +0700 Subject: [PATCH 1/2] chore: address Symfony deprecation warnings, switching to `addCommands` for console application command registrations. --- composer.json | 2 +- jigsaw | 8 +++++--- src/Jigsaw.php | 4 +--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 5b36069d..f9fa19c7 100644 --- a/composer.json +++ b/composer.json @@ -72,4 +72,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} +} \ No newline at end of file diff --git a/jigsaw b/jigsaw index 0655ea54..4d5734cf 100755 --- a/jigsaw +++ b/jigsaw @@ -23,9 +23,11 @@ $app->bootstrapWith([ ]); $application = new Symfony\Component\Console\Application('Jigsaw', '1.8.3'); -$application->add($app[TightenCo\Jigsaw\Console\InitCommand::class]); -$application->add(new TightenCo\Jigsaw\Console\BuildCommand($app)); -$application->add(new TightenCo\Jigsaw\Console\ServeCommand($app)); +$application->addCommands([ + $app[TightenCo\Jigsaw\Console\InitCommand::class], + new TightenCo\Jigsaw\Console\BuildCommand($app), + new TightenCo\Jigsaw\Console\ServeCommand($app), +]); $application->setCatchExceptions(false); TightenCo\Jigsaw\Jigsaw::addUserCommands($application, $app); diff --git a/src/Jigsaw.php b/src/Jigsaw.php index 4b337af8..209d75fe 100644 --- a/src/Jigsaw.php +++ b/src/Jigsaw.php @@ -61,9 +61,7 @@ public static function registerCommand($command) public static function addUserCommands($app, $container) { - foreach (self::$commands as $command) { - $app->add(new $command($container)); - } + $app->addCommands(array_map(fn ($command) => new $command($container), self::$commands)); } protected function buildCollections() From 961952d004837bb7a1c5accb6e05d4b1cc6a3f00 Mon Sep 17 00:00:00 2001 From: Sarun Rattanasiri Date: Tue, 24 Feb 2026 20:59:38 +0700 Subject: [PATCH 2/2] fix assertion inconsistencies --- tests/CollectionItemTest.php | 3 ++- tests/SiteBuilderTest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/CollectionItemTest.php b/tests/CollectionItemTest.php index 0b9e223d..19458b53 100644 --- a/tests/CollectionItemTest.php +++ b/tests/CollectionItemTest.php @@ -240,9 +240,10 @@ public function collection_item_page_metadata_contains_modified_time() $this->buildSite($files, $config, $pretty = true); - $this->assertEquals( + $this->assertEqualsWithDelta( $files->getChild('build/collection/page/index.html')->filemtime(), $this->clean($files->getChild('build/collection/page/index.html')->getContent()), + 1, // allow mtimes to be within 1 second difference ); } } diff --git a/tests/SiteBuilderTest.php b/tests/SiteBuilderTest.php index e28ae2b3..718c24a2 100644 --- a/tests/SiteBuilderTest.php +++ b/tests/SiteBuilderTest.php @@ -109,9 +109,10 @@ public function page_metadata_contains_source_file_modified_time() $files = $this->setupSource(['page.blade.php' => '{{ $page->getModifiedTime() }}']); $this->buildSite($files, [], $pretty = true); - $this->assertEquals( + $this->assertEqualsWithDelta( $files->getChild('build/page/index.html')->filemtime(), $this->clean($files->getChild('build/page/index.html')->getContent()), + 1, // allow mtimes to be within 1 second difference ); }