From 7e8602698b79af39a99f899c29e7078cfb5ccde7 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 08:50:25 +0100
Subject: [PATCH 01/22] moved release script to bin

---
 {data/bin => bin}/release.php | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename {data/bin => bin}/release.php (100%)

diff --git a/data/bin/release.php b/bin/release.php
similarity index 100%
rename from data/bin/release.php
rename to bin/release.php

From 1a97bfae165f5faf07f56fbb53bc65d59437090e Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 08:50:42 +0100
Subject: [PATCH 02/22] added bin folder to export ignore

---
 .gitattributes | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitattributes b/.gitattributes
index 9645b77e9..0af3f7329 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -8,4 +8,5 @@
 docker-compose.yml     export-ignore
 phpstan.neon           export-ignore
 phpunit.xml            export-ignore
+bin/                   export-ignore
 tests/                 export-ignore

From 5a832ac7a687a114b18e7b0fe06ad5e77100f506 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 09:05:12 +0100
Subject: [PATCH 03/22] updated header comment

---
 bin/release.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index ad652a3bf..3c2fecb05 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -1,8 +1,9 @@
 <?php
 
 /*
- * This file is part of the symfony package.
- * (c) 2004-2007 Fabien Potencier <fabien.potencier@symfony-project.com>
+ * This file is part of the Symfony1 package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.

From 0a0b0558a10c4b210217c2ed92700b5fe11b8b9d Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 09:05:55 +0100
Subject: [PATCH 04/22] we use autoload instead of separate includes

---
 bin/release.php | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index 3c2fecb05..6674d070d 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -9,22 +9,7 @@
  * file that was distributed with this source code.
  */
 
-/**
- * Release script.
- *
- * Usage: php data/bin/release.php 1.3.0 stable
- *
- * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * @version    SVN: $Id$
- */
-require_once __DIR__.'/../../lib/exception/sfException.class.php';
-
-require_once __DIR__.'/../../lib/task/sfFilesystem.class.php';
-
-require_once __DIR__.'/../../lib/util/sfFinder.class.php';
-
-require_once __DIR__.'/../../lib/vendor/lime/lime.php';
+require_once __DIR__.'/../vendor/autoload.php';
 
 if (!isset($argv[1])) {
     throw new Exception('You must provide version prefix.');

From df9cd855717cd8ae48c4bb82ea07d22a13ed6e44 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 09:07:16 +0100
Subject: [PATCH 05/22] we want an exact version (eg based on git tag) instead
 of prefix

---
 bin/release.php | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index 6674d070d..600f3aac7 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -12,7 +12,7 @@
 require_once __DIR__.'/../vendor/autoload.php';
 
 if (!isset($argv[1])) {
-    throw new Exception('You must provide version prefix.');
+    throw new \InvalidArgumentException('You must provide version.');
 }
 
 if (!isset($argv[2])) {
@@ -23,23 +23,7 @@
 
 $filesystem = new sfFilesystem();
 
-if (('beta' == $stability || 'alpha' == $stability) && count(explode('.', $argv[1])) < 2) {
-    $version_prefix = $argv[1];
-
-    list($result) = $filesystem->execute('svn status -u '.getcwd());
-    if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match)) {
-        $version = $match[1];
-    }
-
-    if (!isset($version)) {
-        throw new Exception('Unable to find last SVN revision.');
-    }
-
-    // make a PEAR compatible version
-    $version = $version_prefix.'.'.$version;
-} else {
-    $version = $argv[1];
-}
+$version = $argv[1];
 
 echo sprintf("Releasing symfony version \"%s\".\n", $version);
 

From b482e4c0a147126791c25f492c39fb1ae39f8008 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 09:08:57 +0100
Subject: [PATCH 06/22] release script is for do the release. the
 responsibility of the releaser to make sure the tests are green

---
 bin/release.php | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index 600f3aac7..08d4b2eaf 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -27,13 +27,6 @@
 
 echo sprintf("Releasing symfony version \"%s\".\n", $version);
 
-// tests
-list($result) = $filesystem->execute('php data/bin/symfony symfony:test');
-
-if (0 != $result) {
-    throw new Exception('Some tests failed. Release process aborted!');
-}
-
 if (is_file('package.xml')) {
     $filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
 }

From 2b11c6b2d124e0a8936bfa164de1ab66c09e07b2 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 09:11:41 +0100
Subject: [PATCH 07/22] dropped stability argument

---
 bin/release.php | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index 08d4b2eaf..dbb05b930 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -15,12 +15,6 @@
     throw new \InvalidArgumentException('You must provide version.');
 }
 
-if (!isset($argv[2])) {
-    throw new Exception('You must provide stability status (alpha/beta/stable).');
-}
-
-$stability = $argv[2];
-
 $filesystem = new sfFilesystem();
 
 $version = $argv[1];

From 4cf370593ee11f014c810a9e9b8dc9e9cbb520b3 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 09:12:51 +0100
Subject: [PATCH 08/22] dropped pear releasing process

---
 bin/release.php | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index dbb05b930..2724a405d 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -21,34 +21,4 @@
 
 echo sprintf("Releasing symfony version \"%s\".\n", $version);
 
-if (is_file('package.xml')) {
-    $filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
-}
-
-$filesystem->copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
-
-// add class files
-$finder = sfFinder::type('file')->relative();
-$xml_classes = '';
-$dirs = ['lib' => 'php', 'data' => 'data'];
-foreach ($dirs as $dir => $role) {
-    $class_files = $finder->in($dir);
-    foreach ($class_files as $file) {
-        $xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
-    }
-}
-
-// replace tokens
-$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', [
-    'SYMFONY_VERSION' => $version,
-    'CURRENT_DATE' => date('Y-m-d'),
-    'CLASS_FILES' => $xml_classes,
-    'STABILITY' => $stability,
-]);
-
-list($results) = $filesystem->execute('pear package');
-echo $results;
-
-$filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
-
 exit(0);

From ed770267e8404e075c7a3e35e82b7d0045274a05 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 09:33:48 +0100
Subject: [PATCH 09/22] cleanup filesystem instance

---
 bin/release.php | 2 --
 1 file changed, 2 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index 2724a405d..945e41c23 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -15,8 +15,6 @@
     throw new \InvalidArgumentException('You must provide version.');
 }
 
-$filesystem = new sfFilesystem();
-
 $version = $argv[1];
 
 echo sprintf("Releasing symfony version \"%s\".\n", $version);

From ab59082562858efdb2a116e57bc5d130895626b1 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 10:42:51 +0100
Subject: [PATCH 10/22] added several checks for common version number mistakes

---
 bin/release.php | 58 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 2 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index 945e41c23..50b6e27df 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -1,3 +1,4 @@
+#!/usr/bin/env php
 <?php
 
 /*
@@ -12,11 +13,64 @@
 require_once __DIR__.'/../vendor/autoload.php';
 
 if (!isset($argv[1])) {
-    throw new \InvalidArgumentException('You must provide version.');
+    throw new \InvalidArgumentException('You must specify the version: v1.x.x or next.');
 }
 
 $version = $argv[1];
 
-echo sprintf("Releasing symfony version \"%s\".\n", $version);
+exec('git tag -l', $tags, $resultCode);
+
+if ($resultCode > 0 || count($tags) === 0) {
+    throw new \RuntimeException('Reading tag failed.');
+}
+
+$latestVersionNumber = $tags[0];
+foreach ($tags as $tag) {
+    if (version_compare($latestVersionNumber, $tag) < 0) {
+        $latestVersionNumber = $tag;
+    }
+}
+
+if ($version !== 'next') {
+    if (!preg_match('/^v1\.([5-9]|\d{2,})\.\d+$/', $version)) {
+        throw new \InvalidArgumentException(sprintf('The format of the specified version number is incorrect: "%s"', $version));
+    }
+
+    if (in_array($version, $tags)) {
+        throw new \InvalidArgumentException(sprintf('The specified version number already exists: "%s"', $version));
+    }
+
+    [$latestMajorPart, $latestMinorPart, $latestPatchPart] = explode('.', $latestVersionNumber);
+    [$versionMajorPart, $versionMinorPart, $versionPatchPart] = explode('.', $version);
+
+    // This cannot be due to regexp. Just double check.
+    if ($latestMajorPart !== $versionMajorPart) {
+        throw new \InvalidArgumentException(sprintf('The specified version number can\'t change major: "%s"', $version));
+    }
+
+    // changed minor or patch
+    if ($latestMinorPart !== $versionMinorPart) {
+        if ($versionPatchPart !== '0') {
+            throw new \InvalidArgumentException(sprintf('The specified version number should be: "%s.%s.0"', $versionMajorPart, $versionMinorPart));
+        }
+    } elseif ($latestPatchPart !== $versionPatchPart) {
+        $latestPatchPartInt = (int) $latestPatchPart;
+        $versionPatchPartInt = (int) $versionPatchPart;
+
+        $nextPatchPartInt = $latestPatchPartInt+1;
+
+        if ($nextPatchPartInt !== $versionPatchPartInt) {
+            throw new \InvalidArgumentException(sprintf('Don\'t skip patch version. The specified version number should be: "%s.%s.%d"', $versionMajorPart, $versionMinorPart, $nextPatchPartInt));
+        }
+    }
+} else {
+    [$latestMajorPart, $latestMinorPart, $latestPatchPart] = explode('.', $latestVersionNumber);
+    $nextPatchPart = (int) $latestPatchPart + 1;
+    $version = sprintf('%s.%s.%d', $latestMajorPart, $latestMinorPart, $nextPatchPart);
+}
+
+$rawVersion = substr($version, 1);
+
+echo sprintf("Prepare symfony version \"%s\".\n", $rawVersion);
 
 exit(0);

From b79bc6f501bbcb6a930cdcb3a1a9acba513404bc Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 10:43:25 +0100
Subject: [PATCH 11/22] added release prepare

---
 bin/release.php | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/bin/release.php b/bin/release.php
index 50b6e27df..85e7191b4 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -73,4 +73,70 @@
 
 echo sprintf("Prepare symfony version \"%s\".\n", $rawVersion);
 
+/**
+ * prepare sfCoreAutoload class
+ */
+$file = __DIR__.'/../lib/autoload/sfCoreAutoload.class.php';
+$content = file_get_contents($file);
+
+$content = preg_replace('/^define\(.*SYMFONY_VERSION.*$/m', 'define(\'SYMFONY_VERSION\', \''.$rawVersion.'\');', $content, -1, $count);
+
+if ($count !== 1) {
+    throw new \RuntimeException('Preparing sfCoreAutoload failed, SYMFONY_VERSION constant not found.');
+}
+
+file_put_contents($file, $content);
+
+/**
+ * prepare CHANGELOG.md
+ */
+$file = __DIR__.'/../CHANGELOG.md';
+$content = file_get_contents($file);
+
+$nextVersionHeader = <<<EOL
+xx/xx/xxxx: Version 1.5.xx
+--------------------------
+
+
+
+
+EOL;
+
+$changelogHeader = sprintf('%s: Version %s', date('d/m/Y'), $rawVersion);
+$content = preg_replace('/^xx\/xx\/xxxx.*$/m', $nextVersionHeader.$changelogHeader, $content, -1, $count);
+
+if ($count !== 1) {
+    throw new \RuntimeException('Preparing CHANGELOG.md failed. Template line not found.');
+}
+
+file_put_contents($file, $content);
+
+/**
+ * content prepare end
+ */
+
+echo "Please check the changes before commit and tagging.\n";
+
+passthru('git diff');
+
+echo "Is everything ok? (y/N)\n";
+
+$answer = readline();
+
+if (strtolower($answer) !== 'y') {
+    echo "Revert changes.\n";
+    exec('git checkout lib/autoload/sfCoreAutoload.class.php');
+    exec('git checkout CHANGELOG.md');
+    echo "Stopped.\n";
+    exit(1);
+}
+
+chdir(__DIR__.'/..');
+exec('git add lib/autoload/sfCoreAutoload.class.php');
+exec('git add CHANGELOG.md');
+exec('git commit -m "Prepare release '.$rawVersion.'"');
+exec('git tag -a '.$version.' -m "Release '.$rawVersion.'"');
+exec('git push origin '.$version);
+
+
 exit(0);

From ca10bb71012e5aa95f2af18b8aeb237cc72a85bb Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 10:43:42 +0100
Subject: [PATCH 12/22] added readline ext because of bin/release.php script

---
 composer.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 90a612f1c..ce6222d12 100755
--- a/composer.json
+++ b/composer.json
@@ -8,7 +8,8 @@
         "friendsofsymfony1/swiftmailer": "^5.4.13 || ^6.2.5"
     },
     "require-dev": {
-        "psr/log": "*"
+        "psr/log": "*",
+        "ext-readline": "*"
     },
     "autoload": {
         "files": ["autoload.php"]

From 4b210f9b22a9ec634ffd12e94c61c61c8a16a783 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 11:18:33 +0100
Subject: [PATCH 13/22] added strict types

---
 bin/release.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/release.php b/bin/release.php
index 85e7191b4..dcfdd9255 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -1,5 +1,5 @@
 #!/usr/bin/env php
-<?php
+<?php declare(strict_types=1);
 
 /*
  * This file is part of the Symfony1 package.

From 5ed90b6f9800ae8d0067cf1f3961395c60cea3c3 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:20:05 +0100
Subject: [PATCH 14/22] added extract release note script

---
 bin/extract-release-notes.php | 50 +++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100755 bin/extract-release-notes.php

diff --git a/bin/extract-release-notes.php b/bin/extract-release-notes.php
new file mode 100755
index 000000000..6eb60512e
--- /dev/null
+++ b/bin/extract-release-notes.php
@@ -0,0 +1,50 @@
+#!/usr/bin/env php
+<?php declare(strict_types=1);
+
+if ($_SERVER['argc'] !== 2) {
+    echo sprintf('Usage: %s version', basename(__FILE__), ).PHP_EOL;
+    exit(1);
+}
+
+$version = $_SERVER['argv'][1];
+$rawVersion = str_starts_with($version, 'v') ? substr($version, 1) : $version;
+
+$changelogFilePath = __DIR__.'/../CHANGELOG.md';
+
+if (!is_file($changelogFilePath) || !is_readable($changelogFilePath)) {
+    echo 'Changelog file cannot read.'.PHP_EOL;
+    exit(1);
+}
+
+$buffer = '';
+$state = 'not_release_note';
+
+foreach (file($changelogFilePath) as $line) {
+    if (str_contains($line, 'Version '.$rawVersion)) {
+        $state = 'note_header';
+        continue;
+    }
+
+    if ($state === 'note_header') {
+        $state = 'note';
+        continue;
+    }
+
+    if ($state === 'note' && str_contains($line, 'Version ')) {
+        break;
+    }
+
+    if ($state === 'note') {
+        $buffer .= $line;
+    }
+}
+
+$buffer = trim($buffer);
+
+if ($buffer === '') {
+    echo 'Release note not found for the specified version.'.PHP_EOL;
+    exit(1);
+}
+
+echo $buffer.PHP_EOL;
+exit(0);

From 15808fec37fc914eb6f67fe77a9d05f2b3d3edc1 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:20:31 +0100
Subject: [PATCH 15/22] added release GHA job

---
 .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 .github/workflows/release.yml

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..df62275f6
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,41 @@
+on:
+  push:
+    tags:
+      - "**"
+
+name: Release
+
+jobs:
+  release:
+    name: Release
+
+    runs-on: ubuntu-latest
+
+    permissions:
+      contents: write
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Install PHP with extensions
+        uses: shivammathur/setup-php@v2
+        with:
+          php-version: 8.3
+          coverage: none
+          extensions: none
+          tools: none
+
+      - name: Determine tag
+        run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
+
+      - name: Parse ChangeLog
+        run: bin/extract-release-notes.php ${{ env.RELEASE_TAG }} > release-notes.md
+
+      - name: Create release
+        uses: ncipollo/release-action@v1
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          tag: ${{ env.RELEASE_TAG }}
+          name: Symfony1 ${{ env.RELEASE_TAG }}
+          bodyFile: release-notes.md

From 469a41cc2131f6552d616d5131ce9316c32a0b28 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:29:55 +0100
Subject: [PATCH 16/22] added bin to cs fix check

---
 .php-cs-fixer.dist.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index fccc2b3f9..000f91b81 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -3,6 +3,7 @@
 $finder = PhpCsFixer\Finder::create()
     ->ignoreVCSIgnored(true)
     ->in(__DIR__.'/lib')
+    ->in(__DIR__.'/bin')
     ->in(__DIR__.'/data/bin')
     ->in(__DIR__.'/test')
     ->append([__FILE__])

From d9c57f79f73427604e53ae053d80f90a523bfb98 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:33:36 +0100
Subject: [PATCH 17/22] applied cs fix

---
 bin/extract-release-notes.php | 25 +++++++++++++------
 bin/release.php               | 45 ++++++++++++++++++-----------------
 2 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/bin/extract-release-notes.php b/bin/extract-release-notes.php
index 6eb60512e..d68cbee49 100755
--- a/bin/extract-release-notes.php
+++ b/bin/extract-release-notes.php
@@ -1,8 +1,19 @@
 #!/usr/bin/env php
-<?php declare(strict_types=1);
+<?php
 
-if ($_SERVER['argc'] !== 2) {
-    echo sprintf('Usage: %s version', basename(__FILE__), ).PHP_EOL;
+declare(strict_types=1);
+
+/*
+ * This file is part of the Symfony1 package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+if (2 !== $_SERVER['argc']) {
+    echo sprintf('Usage: %s version', basename(__FILE__)).PHP_EOL;
     exit(1);
 }
 
@@ -25,23 +36,23 @@
         continue;
     }
 
-    if ($state === 'note_header') {
+    if ('note_header' === $state) {
         $state = 'note';
         continue;
     }
 
-    if ($state === 'note' && str_contains($line, 'Version ')) {
+    if ('note' === $state && str_contains($line, 'Version ')) {
         break;
     }
 
-    if ($state === 'note') {
+    if ('note' === $state) {
         $buffer .= $line;
     }
 }
 
 $buffer = trim($buffer);
 
-if ($buffer === '') {
+if ('' === $buffer) {
     echo 'Release note not found for the specified version.'.PHP_EOL;
     exit(1);
 }
diff --git a/bin/release.php b/bin/release.php
index dcfdd9255..74c7c1bdc 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -1,5 +1,7 @@
 #!/usr/bin/env php
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 /*
  * This file is part of the Symfony1 package.
@@ -13,15 +15,15 @@
 require_once __DIR__.'/../vendor/autoload.php';
 
 if (!isset($argv[1])) {
-    throw new \InvalidArgumentException('You must specify the version: v1.x.x or next.');
+    throw new InvalidArgumentException('You must specify the version: v1.x.x or next.');
 }
 
 $version = $argv[1];
 
 exec('git tag -l', $tags, $resultCode);
 
-if ($resultCode > 0 || count($tags) === 0) {
-    throw new \RuntimeException('Reading tag failed.');
+if ($resultCode > 0 || 0 === count($tags)) {
+    throw new RuntimeException('Reading tag failed.');
 }
 
 $latestVersionNumber = $tags[0];
@@ -31,13 +33,13 @@
     }
 }
 
-if ($version !== 'next') {
+if ('next' !== $version) {
     if (!preg_match('/^v1\.([5-9]|\d{2,})\.\d+$/', $version)) {
-        throw new \InvalidArgumentException(sprintf('The format of the specified version number is incorrect: "%s"', $version));
+        throw new InvalidArgumentException(sprintf('The format of the specified version number is incorrect: "%s"', $version));
     }
 
     if (in_array($version, $tags)) {
-        throw new \InvalidArgumentException(sprintf('The specified version number already exists: "%s"', $version));
+        throw new InvalidArgumentException(sprintf('The specified version number already exists: "%s"', $version));
     }
 
     [$latestMajorPart, $latestMinorPart, $latestPatchPart] = explode('.', $latestVersionNumber);
@@ -45,22 +47,22 @@
 
     // This cannot be due to regexp. Just double check.
     if ($latestMajorPart !== $versionMajorPart) {
-        throw new \InvalidArgumentException(sprintf('The specified version number can\'t change major: "%s"', $version));
+        throw new InvalidArgumentException(sprintf('The specified version number can\'t change major: "%s"', $version));
     }
 
     // changed minor or patch
     if ($latestMinorPart !== $versionMinorPart) {
-        if ($versionPatchPart !== '0') {
-            throw new \InvalidArgumentException(sprintf('The specified version number should be: "%s.%s.0"', $versionMajorPart, $versionMinorPart));
+        if ('0' !== $versionPatchPart) {
+            throw new InvalidArgumentException(sprintf('The specified version number should be: "%s.%s.0"', $versionMajorPart, $versionMinorPart));
         }
     } elseif ($latestPatchPart !== $versionPatchPart) {
         $latestPatchPartInt = (int) $latestPatchPart;
         $versionPatchPartInt = (int) $versionPatchPart;
 
-        $nextPatchPartInt = $latestPatchPartInt+1;
+        $nextPatchPartInt = $latestPatchPartInt + 1;
 
         if ($nextPatchPartInt !== $versionPatchPartInt) {
-            throw new \InvalidArgumentException(sprintf('Don\'t skip patch version. The specified version number should be: "%s.%s.%d"', $versionMajorPart, $versionMinorPart, $nextPatchPartInt));
+            throw new InvalidArgumentException(sprintf('Don\'t skip patch version. The specified version number should be: "%s.%s.%d"', $versionMajorPart, $versionMinorPart, $nextPatchPartInt));
         }
     }
 } else {
@@ -74,26 +76,26 @@
 echo sprintf("Prepare symfony version \"%s\".\n", $rawVersion);
 
 /**
- * prepare sfCoreAutoload class
+ * prepare sfCoreAutoload class.
  */
 $file = __DIR__.'/../lib/autoload/sfCoreAutoload.class.php';
 $content = file_get_contents($file);
 
 $content = preg_replace('/^define\(.*SYMFONY_VERSION.*$/m', 'define(\'SYMFONY_VERSION\', \''.$rawVersion.'\');', $content, -1, $count);
 
-if ($count !== 1) {
-    throw new \RuntimeException('Preparing sfCoreAutoload failed, SYMFONY_VERSION constant not found.');
+if (1 !== $count) {
+    throw new RuntimeException('Preparing sfCoreAutoload failed, SYMFONY_VERSION constant not found.');
 }
 
 file_put_contents($file, $content);
 
 /**
- * prepare CHANGELOG.md
+ * prepare CHANGELOG.md.
  */
 $file = __DIR__.'/../CHANGELOG.md';
 $content = file_get_contents($file);
 
-$nextVersionHeader = <<<EOL
+$nextVersionHeader = <<<'EOL'
 xx/xx/xxxx: Version 1.5.xx
 --------------------------
 
@@ -105,13 +107,13 @@
 $changelogHeader = sprintf('%s: Version %s', date('d/m/Y'), $rawVersion);
 $content = preg_replace('/^xx\/xx\/xxxx.*$/m', $nextVersionHeader.$changelogHeader, $content, -1, $count);
 
-if ($count !== 1) {
-    throw new \RuntimeException('Preparing CHANGELOG.md failed. Template line not found.');
+if (1 !== $count) {
+    throw new RuntimeException('Preparing CHANGELOG.md failed. Template line not found.');
 }
 
 file_put_contents($file, $content);
 
-/**
+/*
  * content prepare end
  */
 
@@ -123,7 +125,7 @@
 
 $answer = readline();
 
-if (strtolower($answer) !== 'y') {
+if ('y' !== strtolower($answer)) {
     echo "Revert changes.\n";
     exec('git checkout lib/autoload/sfCoreAutoload.class.php');
     exec('git checkout CHANGELOG.md');
@@ -138,5 +140,4 @@
 exec('git tag -a '.$version.' -m "Release '.$rawVersion.'"');
 exec('git push origin '.$version);
 
-
 exit(0);

From 32b80534617e9eb28470d775f56db400cac144bd Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:36:16 +0100
Subject: [PATCH 18/22] added bin dir to GHA when files did change

---
 .github/workflows/lint.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 99adc703b..3da56d980 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -4,6 +4,7 @@ on:
     paths:
       - .php-cs-fixer.dist.php
       - autoload.php
+      - bin/**
       - lib/**
       - data/**
       - tests/**
@@ -13,6 +14,7 @@ on:
     paths:
       - .php-cs-fixer.dist.php
       - autoload.php
+      - bin/**
       - lib/**
       - data/**
       - tests/**

From d41b708ad5d58b841369236f20f994e64baab985 Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:41:59 +0100
Subject: [PATCH 19/22] removed autoload. we dont use anything

---
 bin/release.php | 2 --
 1 file changed, 2 deletions(-)

diff --git a/bin/release.php b/bin/release.php
index 74c7c1bdc..6096b4cad 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -12,8 +12,6 @@
  * file that was distributed with this source code.
  */
 
-require_once __DIR__.'/../vendor/autoload.php';
-
 if (!isset($argv[1])) {
     throw new InvalidArgumentException('You must specify the version: v1.x.x or next.');
 }

From 9c21754d526e24256822d12e8d3c030558b852ff Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:42:35 +0100
Subject: [PATCH 20/22] cleanup old changelog script

---
 data/bin/changelog.php | 48 ------------------------------------------
 1 file changed, 48 deletions(-)
 delete mode 100644 data/bin/changelog.php

diff --git a/data/bin/changelog.php b/data/bin/changelog.php
deleted file mode 100644
index 6a3218a4b..000000000
--- a/data/bin/changelog.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
-/*
- * This file is part of the symfony package.
- * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Outputs formatted Subversion log entries.
- *
- * Usage: php data/bin/changelog.php -r12345:67890 /branches/1.3
- *
- * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * @version    SVN: $Id$
- */
-require_once __DIR__.'/../../lib/task/sfFilesystem.class.php';
-
-if (!isset($argv[1])) {
-    echo "You must provide a revision range (-r123:456)\n";
-
-    exit(1);
-}
-
-if (!isset($argv[2])) {
-    echo "You must provide a repository path (/branches/1.4)\n";
-
-    exit(1);
-}
-
-$filesystem = new sfFilesystem();
-
-list($out, $err) = $filesystem->execute('svn info --xml');
-$info = new SimpleXMLElement($out);
-
-list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', [
-    $argv[1],
-    (string) $info->entry->repository->root.$argv[2],
-])));
-$log = new SimpleXMLElement($out);
-
-foreach ($log->logentry as $logentry) {
-    echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\s*\[[\d\., ]+\]\s*/', '', (string) $logentry->msg)));
-    echo PHP_EOL;
-}

From b2332d739639d4dc47ca86419a0f87eda741101b Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:48:43 +0100
Subject: [PATCH 21/22] added version check

---
 bin/release.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bin/release.php b/bin/release.php
index 6096b4cad..e877f8442 100644
--- a/bin/release.php
+++ b/bin/release.php
@@ -12,6 +12,11 @@
  * file that was distributed with this source code.
  */
 
+if (PHP_VERSION_ID < 80300) {
+    echo 'PHP 8.3 required'.PHP_EOL;
+    exit(1);
+}
+
 if (!isset($argv[1])) {
     throw new InvalidArgumentException('You must specify the version: v1.x.x or next.');
 }

From 8a060d7fefbd74aa68cc231b32395087aec06c6a Mon Sep 17 00:00:00 2001
From: connor <connor@connor.hu>
Date: Wed, 27 Mar 2024 12:49:00 +0100
Subject: [PATCH 22/22] added exec flag

---
 bin/release.php | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 bin/release.php

diff --git a/bin/release.php b/bin/release.php
old mode 100644
new mode 100755