From aefdeaf896670a784551bffcc752ad36ec827715 Mon Sep 17 00:00:00 2001
From: Daniel Speicher <daniel.speicher@lakedrops.com>
Date: Tue, 4 Jun 2024 16:27:53 +0200
Subject: [PATCH] Remove patch from color_field module, since it is fixed in
 new version 3.0.1

---
 patches/d10-3.json       |   3 -
 patches/d10.json         |   3 -
 patches/d10/3344907.diff | 173 ---------------------------------------
 patches/d9.json          |   3 -
 4 files changed, 182 deletions(-)
 delete mode 100644 patches/d10/3344907.diff

diff --git a/patches/d10-3.json b/patches/d10-3.json
index 24b412c..80bb269 100644
--- a/patches/d10-3.json
+++ b/patches/d10-3.json
@@ -23,9 +23,6 @@
     "drupal/codesnippet": {
       "#3021431 Add Yaml as code format": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3021431.diff"
     },
-    "drupal/color_field": {
-      "#3344907 PHP 8.1": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3344907.diff?v=3"
-    },
     "drupal/colorbox": {
       "#2808883 Responsive image styles": "https://www.drupal.org/files/issues/2024-03-17/colorbox-responsive-image-2808883-69.patch"
     },
diff --git a/patches/d10.json b/patches/d10.json
index e68cd19..2ef25da 100644
--- a/patches/d10.json
+++ b/patches/d10.json
@@ -20,9 +20,6 @@
     "drupal/codesnippet": {
       "#3021431 Add Yaml as code format": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3021431.diff"
     },
-    "drupal/color_field": {
-      "#3344907 PHP 8.1": "https://gitlab.lakedrops.com/composer/plugin/drupal-environment/-/raw/main/patches/d10/3344907.diff?v=3"
-    },
     "drupal/colorbox": {
       "#2808883 Responsive image styles": "https://www.drupal.org/files/issues/2024-03-17/colorbox-responsive-image-2808883-69.patch"
     },
diff --git a/patches/d10/3344907.diff b/patches/d10/3344907.diff
deleted file mode 100644
index 7582cb1..0000000
--- a/patches/d10/3344907.diff
+++ /dev/null
@@ -1,173 +0,0 @@
-diff --git a/color_field.module b/color_field.module
-index 89772e653bb58616f538b067b29a4b6220584b15..51f73cbd4b089fcb457e4c9ae85a874629711d22 100644
---- a/color_field.module
-+++ b/color_field.module
-@@ -153,7 +153,7 @@ function color_field_tokens(string $type, array $tokens, array $data, array $opt
-   if ($type === 'color_field' && !empty($data['color_field'])) {
-     /** @var \Drupal\color_field\Plugin\Field\FieldType\ColorFieldType $color_field */
-     $color_field = $data['color_field'];
--    $color_hex = new ColorHex($color_field->color, $color_field->opacity);
-+    $color_hex = new ColorHex($color_field->color, is_null($color_field->opacity) ? NULL : (float) $color_field->opacity);
- 
-     foreach ($tokens as $name => $original) {
-       switch ($name) {
-diff --git a/src/ColorCMY.php b/src/ColorCMY.php
-index 51a1d69908c9746f50a001894318e879aad94f7b..133faf181bc5c3168ecb6493c0b6c449fc2d4b43 100644
---- a/src/ColorCMY.php
-+++ b/src/ColorCMY.php
-@@ -39,10 +39,10 @@ class ColorCMY extends ColorBase {
-    *   The magenta.
-    * @param int $yellow
-    *   The yellow.
--   * @param float $opacity
-+   * @param float|null $opacity
-    *   The opacity.
-    */
--  public function __construct(int $cyan, int $magenta, int $yellow, float $opacity) {
-+  public function __construct(int $cyan, int $magenta, int $yellow, ?float $opacity) {
-     $this->cyan = $cyan;
-     $this->magenta = $magenta;
-     $this->yellow = $yellow;
-diff --git a/src/ColorCMYK.php b/src/ColorCMYK.php
-index 1f3f00a8ba79ed3694940ff5ee48e23c7e5cc63d..c9163e03d0f400170daf5c683df836dce71c5fd1 100644
---- a/src/ColorCMYK.php
-+++ b/src/ColorCMYK.php
-@@ -27,10 +27,10 @@ class ColorCMYK extends ColorCMY {
-    *   The yellow.
-    * @param int $key
-    *   The key (black).
--   * @param float $opacity
-+   * @param float|null $opacity
-    *   The opacity.
-    */
--  public function __construct(int $cyan, int $magenta, int $yellow, int $key, float $opacity) {
-+  public function __construct(int $cyan, int $magenta, int $yellow, int $key, ?float $opacity) {
-     parent::__construct($cyan, $magenta, $yellow, $opacity);
-     $this->key = $key;
-   }
-diff --git a/src/ColorHSL.php b/src/ColorHSL.php
-index 941581ea94d72c5d438266df1ac136274143b7e4..bc5cb32168c435241b7560d394f9513b976d0a1e 100644
---- a/src/ColorHSL.php
-+++ b/src/ColorHSL.php
-@@ -39,12 +39,12 @@ class ColorHSL extends ColorBase {
-    *   The sat (0-100)
-    * @param int $lum
-    *   The lum (0-100)
--   * @param float $opacity
-+   * @param float|null $opacity
-    *   The opacity.
-    *
-    * @throws \Exception
-    */
--  public function __construct(int $hue, int $sat, int $lum, float $opacity) {
-+  public function __construct(int $hue, int $sat, int $lum, ?float $opacity) {
-     if ($hue < 0 || $hue > 360) {
-       throw new \Exception("Invalid hue: $hue");
-     }
-diff --git a/src/ColorHex.php b/src/ColorHex.php
-index ebfc3460b6a8c01170f43713f893a861095813ba..8e5a5fd3498c7ba96fd1c86c5195e092d3ee786a 100644
---- a/src/ColorHex.php
-+++ b/src/ColorHex.php
-@@ -21,13 +21,13 @@ class ColorHex extends ColorBase {
-    *
-    * @param string $color
-    *   The string hex value (i.e. "FFFFFF").
--   * @param string $opacity
-+   * @param float|null $opacity
-    *   The opacity value.
-    *
-    * @throws \Exception
-    *   If the color doesn't appear to be a valid hex value.
-    */
--  public function __construct(string $color, ?string $opacity) {
-+  public function __construct(string $color, ?float $opacity) {
-     $color = trim(strtolower($color));
- 
-     if (str_starts_with($color, '#')) {
-@@ -45,8 +45,6 @@ class ColorHex extends ColorBase {
-     $this->color = hexdec($color);
-     $opacity = $opacity ?? '1';
-     $this->setOpacity((float) $opacity);
--
--    return $this;
-   }
- 
-   /**
-diff --git a/src/ColorRGB.php b/src/ColorRGB.php
-index 737a81123eb337890b6616834440a61b9af7a878..248db8eddeae337d8663630eeb86eed4dac2e850 100644
---- a/src/ColorRGB.php
-+++ b/src/ColorRGB.php
-@@ -39,10 +39,10 @@ class ColorRGB extends ColorBase {
-    *   The green (0-255)
-    * @param int $blue
-    *   The blue (0-255)
--   * @param float $opacity
-+   * @param float|null $opacity
-    *   The opacity.
-    */
--  public function __construct(int $red, int $green, int $blue, float $opacity) {
-+  public function __construct(int $red, int $green, int $blue, ?float $opacity) {
-     $this->red = max(0, min(255, $red));
-     $this->green = max(0, min(255, $green));
-     $this->blue = max(0, min(255, $blue));
-diff --git a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php
-index 8abadb45c37efd0a8d2e9c491be04dcc1758b7ae..bcd26d5905a78a05e5b27e09b36a98b467cefd5a 100644
---- a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php
-+++ b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php
-@@ -309,7 +309,7 @@ class ColorFieldFormatterCss extends FormatterBase implements ContainerFactoryPl
-     $opacity = $this->getFieldSetting('opacity');
-     $settings = $this->getSettings();
- 
--    $color_hex = new ColorHex($item->color, $item->opacity);
-+    $color_hex = new ColorHex($item->color, is_null($item->opacity) ? NULL : (float) $item->opacity);
- 
-     return $opacity && $settings['opacity']
-         ? $color_hex->toRgb()->toString(TRUE)
-diff --git a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatch.php b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatch.php
-index f1bae9a9557b498dbd255122064a2ee87d3306b3..8392e1ef30cecbfe28e6f87e5dda1f110676b3e9 100644
---- a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatch.php
-+++ b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatch.php
-@@ -132,7 +132,7 @@ class ColorFieldFormatterSwatch extends FormatterBase {
-         continue;
-       }
- 
--      $color = new ColorHex($item->color, $item->opacity);
-+      $color = new ColorHex($item->color, is_null($item->opacity) ? NULL : (float) $item->opacity);
-       $elements[$delta]['#attributes']['data-color'] = $color->toString(FALSE);
-     }
- 
-@@ -188,7 +188,7 @@ class ColorFieldFormatterSwatch extends FormatterBase {
-     $opacity = $this->getFieldSetting('opacity');
-     $settings = $this->getSettings();
- 
--    $color_hex = new ColorHex($item->color, $item->opacity);
-+    $color_hex = new ColorHex($item->color, is_null($item->opacity) ? NULL : (float) $item->opacity);
- 
-     return $opacity && $settings['opacity']
-         ? $color_hex->toRgb()->toString(TRUE)
-diff --git a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatchOptions.php b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatchOptions.php
-index b9af5fcd22a357c3e4f4a3a2681f73b70558d890..a1ff7d670f955c51c112c5bbd0fd7c52a7e2f2c8 100644
---- a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatchOptions.php
-+++ b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterSwatchOptions.php
-@@ -74,7 +74,7 @@ class ColorFieldFormatterSwatchOptions extends ColorFieldFormatterSwatch {
-    *   The color hex value.
-    */
-   protected function viewRawValue(ColorFieldType $item): string {
--    return (new ColorHex($item->color, $item->opacity))->toString(FALSE);
-+    return (new ColorHex($item->color, is_null($item->opacity) ? NULL : (float) $item->opacity))->toString(FALSE);
-   }
- 
- }
-diff --git a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php
-index d9573f328ee9d08d7f6dba821c03c021e5c1497b..5fee14e91cfe3e845478cff456f12d782f8c8507 100644
---- a/src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php
-+++ b/src/Plugin/Field/FieldFormatter/ColorFieldFormatterText.php
-@@ -128,7 +128,7 @@ class ColorFieldFormatterText extends FormatterBase {
-     $opacity = $this->getFieldSetting('opacity');
-     $settings = $this->getSettings();
- 
--    $color_hex = new ColorHex($item->color, $item->opacity);
-+    $color_hex = new ColorHex($item->color, is_null($item->opacity) ? NULL : (float) $item->opacity);
- 
-     switch ($settings['format']) {
-       case 'hex':
diff --git a/patches/d9.json b/patches/d9.json
index 0d32163..d4d05e3 100644
--- a/patches/d9.json
+++ b/patches/d9.json
@@ -25,9 +25,6 @@
     "drupal/codesnippet": {
       "#3021431 Add Yaml as code format": "https://git.drupalcode.org/project/codesnippet/-/merge_requests/4.diff"
     },
-    "drupal/color_field": {
-      "#3344907 PHP 8.1": "https://git.drupalcode.org/project/color_field/-/merge_requests/12.diff?v=3"
-    },
     "drupal/colorbox": {
       "#2808883 Responsive image styles": "https://www.drupal.org/files/issues/2024-03-17/colorbox-responsive-image-2808883-69.patch"
     },
-- 
GitLab