Skip to content

⬆️ Bump the composer group with 2 updates#331

Merged
homersimpsons merged 2 commits intomainfrom
dependabot/composer/composer-2e6eb6d312
Apr 2, 2026
Merged

⬆️ Bump the composer group with 2 updates#331
homersimpsons merged 2 commits intomainfrom
dependabot/composer/composer-2e6eb6d312

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot Bot commented on behalf of github Apr 1, 2026

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore <dependency name> major version will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
  • @dependabot ignore <dependency name> minor version will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
  • @dependabot ignore <dependency name> will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
  • @dependabot unignore <dependency name> will remove all of the ignore conditions of the specified dependency
  • @dependabot unignore <dependency name> <ignore condition> will remove the ignore condition of the specified dependency and ignore conditions

---
updated-dependencies:
- dependency-name: league/flysystem
  dependency-version: 3.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: composer
- dependency-name: phpstan/phpstan
  dependency-version: 2.1.46
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: composer
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added the x:size/tiny Tiny amount of work label Apr 1, 2026
@dependabot dependabot Bot requested a review from a team as a code owner April 1, 2026 10:50
@dependabot dependabot Bot added the x:size/tiny Tiny amount of work label Apr 1, 2026
Copy link
Copy Markdown
Collaborator

@homersimpsons homersimpsons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flysystem and phpstan changes. I will check phpstan failure.

Declaring a `non-empty-list` (with `__construct(private string $stableName, string $value)` proved to be impracticable regarding usage changes.
@homersimpsons homersimpsons force-pushed the dependabot/composer/composer-2e6eb6d312 branch from f3178c7 to daeb41f Compare April 2, 2026 18:50
@homersimpsons
Copy link
Copy Markdown
Collaborator

homersimpsons commented Apr 2, 2026

For the record, the diff to avoid the assert would look like the following.

While it is about even in terms of lines (-22, +26), I find the logic harder to follow.

diff --git a/src/Mapping.php b/src/Mapping.php
index cc1a63e..8c73916 100644
--- a/src/Mapping.php
+++ b/src/Mapping.php
@@ -96,8 +96,10 @@ class Mapping
     {
         // TRANSFORM: Function names are case-insensitive in PHP
         $lcName = strtolower($name);
-        $entry = $this->invertedFunctionMapping[$lcName] ?? null;
-        if ($entry === null) {
+        if (array_key_exists($lcName, $this->invertedFunctionMapping)) {
+            $entry = $this->invertedFunctionMapping[$lcName];
+            $entry->addValue($name);
+        } else {
             // Do not rename built-in functions except aliased ones, functions_exists() includes user-defined functions
             if (array_key_exists($lcName, $this->internalFunctions)) {
                 $unaliasedName = $this->functionAlias($lcName);
@@ -110,22 +112,17 @@ class Mapping
                 $stableName = self::PREFIX_FUNCTION . count($this->invertedFunctionMapping);
             }
 
-            $this->invertedFunctionMapping[$lcName] = $entry = new MappingEntry($stableName);
+            $entry = new MappingEntry($stableName, $name);
+            $this->invertedFunctionMapping[$lcName] = $entry;
         }
 
-        $entry->addValue($name);
-
         return $entry->getStableName();
     }
 
     public function addVariable(string $name): string
     {
-        $entry = $this->invertedVariableMapping[$name] ?? null;
-        if ($entry === null) {
-            $stableName = self::PREFIX_VARIABLE . count($this->invertedVariableMapping);
-            $this->invertedVariableMapping[$name] = $entry = new MappingEntry($stableName);
-            $entry->addValue($name);
-        }
+        $entry = $this->invertedVariableMapping[$name]
+            ??= new MappingEntry(self::PREFIX_VARIABLE . count($this->invertedVariableMapping), $name);
 
         return $entry->getStableName();
     }
@@ -134,9 +131,13 @@ class Mapping
     {
         // TRANSFORM: Class names are case-insensitive in PHP
         $lcName = strtolower($name);
-        $entry = $this->invertedClassMapping[$lcName]
-            ??= new MappingEntry(self::PREFIX_CLASS . count($this->invertedClassMapping));
-        $entry->addValue($name);
+        if (array_key_exists($lcName, $this->invertedClassMapping)) {
+            $entry = $this->invertedClassMapping[$lcName];
+            $entry->addValue($name);
+        } else {
+            $entry = new MappingEntry(self::PREFIX_CLASS . count($this->invertedClassMapping), $name);
+            $this->invertedClassMapping[$lcName] = $entry;
+        }
 
         return $entry->getStableName();
     }
@@ -145,9 +146,13 @@ class Mapping
     {
         // TRANSFORM: Method names are case-insensitive in PHP
         $lcName = strtolower($name);
-        $entry = $this->invertedMethodMapping[$lcName]
-            ??= new MappingEntry(self::PREFIX_METHOD . count($this->invertedMethodMapping));
-        $entry->addValue($name);
+        if (array_key_exists($lcName, $this->invertedMethodMapping)) {
+            $entry = $this->invertedMethodMapping[$lcName];
+            $entry->addValue($name);
+        } else {
+            $entry = new MappingEntry(self::PREFIX_METHOD . count($this->invertedMethodMapping), $name);
+            $this->invertedMethodMapping[$lcName] = $entry;
+        }
 
         return $entry->getStableName();
     }
diff --git a/src/MappingEntry.php b/src/MappingEntry.php
index 5ae585f..4893744 100644
--- a/src/MappingEntry.php
+++ b/src/MappingEntry.php
@@ -7,15 +7,15 @@ namespace App;
 use function array_count_values;
 use function array_key_first;
 use function arsort;
-use function assert;
 
 class MappingEntry
 {
-    /** @var list<string> */
-    private array $names = [];
+    /** @var non-empty-list<string> */
+    private array $names;
 
-    public function __construct(private string $stableName)
+    public function __construct(private string $stableName, string $value)
     {
+        $this->names = [$value];
     }
 
     public function addValue(string $value): void
@@ -30,7 +30,6 @@ class MappingEntry
 
     public function getMostCommonName(): string
     {
-        assert(! empty($this->names));
         $values = array_count_values($this->names);
         arsort($values);

@homersimpsons homersimpsons merged commit 3349f0b into main Apr 2, 2026
2 checks passed
@homersimpsons homersimpsons deleted the dependabot/composer/composer-2e6eb6d312 branch April 2, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:size/tiny Tiny amount of work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants