ernie-research/MEnvBench huggingface dataset:
Repository: googleapis/google-cloud-ruby (Ruby)

Issue:
Add Bigtable Client Conformance Tests
The Bigtable team maintains a suite of language-independent "conformance tests", which verify some common edge-cases behave correctly across all of the Bigtable clients.

We would like to add conformance tests for the Ruby client. This is accomplished by authoring a thin proxy, which implements the [`CloudBigtableV2TestProxy` service](https://github.com/googleapis/cndb-client-testing-protos/blob/6014db09e12e135abfcf5088c1b50947f8075411/google/bigtable/testproxy/test_proxy.proto#L236C9-L236C33).  The goal of the proxy is to _idiomatically_ use the client library to handle the requests it receives, _not_ to jump through hoops to make the tests pass; in this way, we can verify the idiomatic library use produces correct results.

The tests themselves are implemented in Go in https://github.com/googleapis/cloud-bigtable-clients-test. These tests spawn a mock Bigtable instance, so that the test runner can verify correctness both in the proxy's responses, but also in the client's outbound calls to Bigtable itself.



Fix (patch):
diff --git a/google-cloud-bigtable/lib/google/cloud/bigtable.rb b/google-cloud-bigtable/lib/google/cloud/bigtable.rb
index 613095c8c0bc..89707641d8a2 100644
--- a/google-cloud-bigtable/lib/google/cloud/bigtable.rb
+++ b/google-cloud-bigtable/lib/google/cloud/bigtable.rb
@@ -163,6 +163,7 @@ def self.new_with_emulator project_id, emulator_host, timeout
       def self.resolve_credentials given_credentials, scope
         credentials = given_credentials || default_credentials(scope: scope)
         return credentials if credentials.is_a? Google::Auth::Credentials
+        return credentials if credentials.is_a? GRPC::Core::Channel
         Bigtable::Credentials.new credentials, scope: scope
       end
 
diff --git a/google-cloud-bigtable/lib/google/cloud/bigtable/mutation_operations.rb b/google-cloud-bigtable/lib/google/cloud/bigtable/mutation_operations.rb
index bb4a362fc4e5..a14b62513c6b 100644
--- a/google-cloud-bigtable/lib/google/cloud/bigtable/mutation_operations.rb
+++ b/google-cloud-bigtable/lib/google/cloud/bigtable/mutation_operations.rb
@@ -245,7 +245,7 @@ def check_and_mutate_row key, predicate, on_match: nil, otherwise: nil
           response = service.check_and_mutate_row(
             path,
             key,
-            predicate_filter: predicate.to_grpc,
+            predicate_filter: predicate&.to_grpc,
             true_mutations:   true_mutations,
             false_mutations:  false_mutations,
             app_profile_id:   @app_profile_id
Repository: ruby-git/ruby-git (Ruby)

Issue:
failure using git built from source
If git was built from source, the version appears as:

git version 2.39.**GIT**

This regex fails, producing a nil version:
https://github.com/ruby-git/ruby-git/blob/ca8ff350a63172630b8e9e919e02a0ce8e7a7a6d/lib/git/lib.rb#L1032

Fix:
      version = output[/\d+\.\d+(\.(?:GIT|\d+))+/]

This at least prevents it from failing with this error:

../.local/share/gem/ruby/3.0.0/gems/git-1.13.0/lib/git/lib.rb:1034:in `current_command_version': undefined method `split' for nil:NilClass (NoMethodError)



Discussion: @kcburge can you take a looks at #605 to see if it fixes this problem for you? If it does, I will merge it and make a new version of the git gem.



Fix (patch):
diff --git a/lib/git/lib.rb b/lib/git/lib.rb
index 293f2878..b4d16152 100644
--- a/lib/git/lib.rb
+++ b/lib/git/lib.rb
@@ -63,8 +63,6 @@ def initialize(base = nil, logger = nil)
         @git_work_dir = base[:working_directory]
       end
       @logger = logger
-
-      Git::Lib.warn_if_old_command(self)
     end
 
     # creates or reinitializes the repository
@@ -1029,8 +1027,9 @@ def archive(sha, file = nil, opts = {})
     # returns the current version of git, as an Array of Fixnums.
     def current_command_version
       output = command('version')
-      version = output[/\d+\.\d+(\.\d+)+/]
-      version.split('.').collect {|i| i.to_i}
+      version = output[/\d+(\.\d+)+/]
+      version_parts = version.split('.').collect { |i| i.to_i }
+      version_parts.fill(0, version_parts.length...3)
     end
 
     def required_command_version
@@ -1043,10 +1042,11 @@ def meets_required_version?
 
     def self.warn_if_old_command(lib)
       return true if @version_checked
+      @version_checked = true
       unless lib.meets_required_version?
         $stderr.puts "[WARNING] The git gem requires git #{lib.required_command_version.join('.')} or later, but only found #{lib.current_command_version.join('.')}. You should probably upgrade."
       end
-      @version_checked = true
+      true
     end
 
     private
@@ -1104,6 +1104,8 @@ def with_custom_env_variables(&block)
     end
 
     def command(cmd, *opts, &block)
+      Git::Lib.warn_if_old_command(self)
+
       command_opts = { chomp: true, redirect: '' }
       if opts.last.is_a?(Hash)
         command_opts.merge!(opts.pop)
Repository: ruby/debug (Ruby)

Issue:
Object inspection doesn't work inside Mocks that doesn't expect the `singleton_class` method called
**Your environment**

* `ruby -v`:  ruby 3.3.7 (2025-01-15 revision be31f993d7) [x86_64-linux]
* `rdbg -v`: rdbg 1.11.0

**Describe the bug**
Object inspection doesn't work inside Mocks that doesn't expect the `singleton_class` method called
`unmocked method :singleton_class`

**To Reproduce**
You can try to reproduce it using a minitest Mock
```ruby
mock = Minitest::Mock.new

mock.expect :call, true do |*passed_args, **passed_kwargs|
  debugger
end

mock.call(123)
```

Or make your own mock class from scratch (of course is not the same as minitest but mimics it)
```ruby
class Mock
  def initialize
    @expected = {}
  end

  def expect(name, return_value = nil, expected_args = nil, &block)
    @expected[name.to_sym] = [return_value, expected_args, block]
    self
  end

  def method_missing(name, *args, **kwargs, &blk)
    entry = @expected[name.to_sym]
    raise NoMethodError, "unmocked method #{name.inspect}, expected one of #{@expected.keys.inspect}" unless entry

    return_value , expected_args, stored_block = entry
    return stored_block.call(*args, **kwargs) if stored_block
    return_value 
  end

  def respond_to_missing?(name, include_private = false)
    @expected.key?(name.to_sym) || super
  end

  def singleton_class
    method_missing(:singleton_class)
  end
end

mock = Mock.new

mock.expect :call, true do |*passed_args, **passed_kwargs|
  debugger
end

mock.call(123)
```

**Expected behavior**
It should stop at the debugger, instead we get an error ``full_message': unmocked method :singleton_class, expected one of [:call] (NoMethodError)`

**Additional context**
I don't really know if this is a problem of MiniTest or from this gem, but `binding.pry` does not seem to fall into this error. Additionally i have identified that the code dies at `lib/debug/frame_info.rb:172` where `NoMethodError` is not captured, although after inside `safe_ispect` it is captured, i don't really understand the flow of the gem but maybe we can skip the `NoMethodError` before safe inspecting. Lastly, i was eager to do a PR but i can't test because i'm on wsl2 and have no fast way of switching to linux at the moment.




Fix (patch):
diff --git a/lib/debug/frame_info.rb b/lib/debug/frame_info.rb
index 8fab332de..558f5466b 100644
--- a/lib/debug/frame_info.rb
+++ b/lib/debug/frame_info.rb
@@ -171,7 +171,7 @@ def parameters_info
 
     private def get_singleton_class obj
       obj.singleton_class # TODO: don't use it
-    rescue TypeError
+    rescue Exception
       nil
     end
Repository: statamic/cms (PHP)

Issue:
[Forms] Impossible to use globals in form settings
## Bug Description
It seems impossible to use global values in forms. I have globals set named "Company information" that contain an "email" handle which serves as the company's main email. If I want to use that value as the form recipient, it throws an error (I validated the syntax by outputting the value on the frontend and it output correctly).

## How to Reproduce
1. Create a globals set containing an email field
1. Input a valid email in the email field and submit
1. Create a form
1. In the created form settings, try to output the global email value in the "Recipient (To)" form (ex.: `{{ globals:company_information:email }}`)
1. Output the form on the frontend, fill it and submit it
1. The following error is encountered: `Trying to get property 'email' of non-object`

## Environment

<!-- You can copy/paste the output of `php please support:details` here -->

Statamic 3.0.14 Pro (multi-site)
Laravel 7.28.1
PHP 7.4.3
doublethreedigital/duplicator 1.1.1

**Install method (choose one):** Fresh install from `statamic/statamic`



Discussion: Pretty sure this is a duplicate. Or maybe a FR. However I can’t seem to find it now.
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
🦙



Fix (patch):
diff --git a/src/Forms/Email.php b/src/Forms/Email.php
index 1c6f429d8c7..ec4d3b2eda6 100644
--- a/src/Forms/Email.php
+++ b/src/Forms/Email.php
@@ -22,6 +22,7 @@ class Email extends Mailable
     protected $submissionData;
     protected $config;
     protected $site;
+    private $globalData;
 
     public function __construct(Submission $submission, array $config, Site $site)
     {
@@ -160,6 +161,10 @@ protected function getRenderableFieldData($values)
 
     private function getGlobalsData()
     {
+        if (! is_null($this->globalData)) {
+            return $this->globalData;
+        }
+
         $data = [];
 
         foreach (GlobalSet::all() as $global) {
@@ -172,7 +177,7 @@ private function getGlobalsData()
             $data[$global->handle()] = $global->toAugmentedArray();
         }
 
-        return array_merge($data, $data['global'] ?? []);
+        return $this->globalData = array_merge($data, $data['global'] ?? []);
     }
 
     protected function addresses($addresses)
@@ -203,7 +208,7 @@ protected function parseConfig(array $config)
         return collect($config)->map(function ($value) {
             $value = Parse::env($value); // deprecated
 
-            return (string) Antlers::parse($value, $this->submissionData);
+            return (string) Antlers::parse($value, array_merge($this->submissionData, $this->getGlobalsData()));
         });
     }
 }
Repository: statamic/cms (PHP)

Issue:
Video dimensions of rotated videos
### Bug description

The dimensions fields `width` and `height` are swapped for videos with rotated video streams.

PR is up: #11479 

### How to reproduce

Upload a video with a rotated video stream.

### Logs

```shell

```

### Environment

```yaml
Environment
Application Name: Statamic
Laravel Version: 11.38.2
PHP Version: 8.3.17
Composer Version: 2.8.4
Environment: production
Debug Mode: ENABLED
URL: freelingwaters-cms-new.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Statamic
Sites: 1
Stache Watcher: Disabled (auto)
Static Caching: Disabled
Version: 5.x-dev PRO
```

### Installation

Fresh statamic/statamic site via CLI

### Additional details

_No response_



Fix (patch):
diff --git a/src/Assets/Attributes.php b/src/Assets/Attributes.php
index 010de336ccd..fba9435e2f5 100644
--- a/src/Assets/Attributes.php
+++ b/src/Assets/Attributes.php
@@ -88,9 +88,18 @@ private function getVideoAttributes()
     {
         $id3 = ExtractInfo::fromAsset($this->asset);
 
+        $width = Arr::get($id3, 'video.resolution_x');
+        $height = Arr::get($id3, 'video.resolution_y');
+        $rotate = Arr::get($id3, 'video.rotate', 0);
+
+        // Adjust width and height if the video is rotated
+        if (in_array($rotate, [90, 270, -90, -270])) {
+            [$width, $height] = [$height, $width];
+        }
+
         return [
-            'width' => Arr::get($id3, 'video.resolution_x'),
-            'height' => Arr::get($id3, 'video.resolution_y'),
+            'width' => $width,
+            'height' => $height,
             'duration' => Arr::get($id3, 'playtime_seconds'),
         ];
     }
Repository: vimeo/psalm (PHP)

Issue:
``@psalm-import-type`` fails importing from ``enum``
Psalm fails importing a type with ``@psalm-import-type`` when importing from ``enum`` instead from a class:

https://psalm.dev/r/4fc46bc2a6


Discussion: I found these snippets:
<details>
<summary>https://psalm.dev/r/4fc46bc2a6</summary>

```php
<?php

/** @psalm-type FooClassType = array{value: string} */
class FooClass {}

/** @psalm-type FooEnumType = array{value: string} */
enum FooEnum {}

/**
 * @psalm-import-type FooClassType from FooClass
 * @psalm-import-type FooEnumType from FooEnum
 */
class User {
    /** @param FooClassType $bar */
    public function test1(array $bar): void {
        echo $bar['value'];
    }
    
    /** @param FooEnumType $bar */
    public function test2(array $bar): void {
        echo $bar['value'];
    }
}
```

```
Psalm output (using commit a3024ad):

ERROR: MismatchingDocblockParamType - 19:16 - Parameter $bar has wrong type 'type-alias(FooEnum::FooEnumType)', should be 'array<array-key, mixed>'

ERROR: InvalidArrayAccess - 21:14 - Cannot access array value on non-array variable $bar of type type-alias(FooEnum::FooEnumType)

INFO: MixedArgument - 21:14 - Argument 1 of echo cannot be mixed, expecting string
```
</details>




Fix (patch):
diff --git a/src/Psalm/Internal/Type/TypeExpander.php b/src/Psalm/Internal/Type/TypeExpander.php
index 795b5ad9a8a..61af641066f 100644
--- a/src/Psalm/Internal/Type/TypeExpander.php
+++ b/src/Psalm/Internal/Type/TypeExpander.php
@@ -283,7 +283,7 @@ public static function expandAtomic(
                 $declaring_fq_classlike_name = $self_class;
             }
 
-            if (!($evaluate_class_constants && $codebase->classOrInterfaceExists($declaring_fq_classlike_name))) {
+            if (!($evaluate_class_constants && $codebase->classOrInterfaceOrEnumExists($declaring_fq_classlike_name))) {
                 return [$return_type];
             }
Repository: vimeo/psalm (PHP)

Issue:
DateTimeImutable::modify() should return `static`
DateTime type issues strike back...

https://psalm.dev/r/09e238bf00

I expect `$foo2` to be of type `Subclass` and indeed, according to PHP it is:

https://3v4l.org/j9ZSo

I agree that the PHP manual [disagrees](https://www.php.net/manual/en/datetimeimmutable.modify.php), so that should probably be raised on the php internals list too, but seeing how big a BC break it would be for PHP to change this behavior, I assume that this is a doc bug, not a language issue.


Discussion: I found these snippets:
<details>
<summary>https://psalm.dev/r/09e238bf00</summary>

```php
<?php

class Subclass extends DateTimeImmutable
{
}

$foo = new Subclass('2023-01-01 12:12:13');
$foo2 = $foo->modify('+7 days');
/** @psalm-trace $foo2 */
echo $foo2->format('Y-m-d');
```

```
Psalm output (using commit c6cfa86):

INFO: Trace - 10:1 - $foo2: DateTimeImmutable
```
</details>

if you agree that Psalm should probably represent what PHP currently does, I'll try to submit a PR to fix the return type, though I'm a bit reluctant to start working on this right now as there were so many DateTime related issues and PRs raised in the recent past which kind of scares me to work on those parts at this point 😛 
Actual behaviour is the ground truth, so PR is welcome.



Fix (patch):
diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php
index 1b71f1a27db..83d32a7ca01 100644
--- a/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php
+++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/DateTimeModifyReturnTypeProvider.php
@@ -8,6 +8,7 @@
 use Psalm\Plugin\EventHandler\MethodReturnTypeProviderInterface;
 use Psalm\Type;
 use Psalm\Type\Atomic\TLiteralString;
+use Psalm\Type\Atomic\TNamedObject;
 use Psalm\Type\Union;
 
 /**
@@ -56,7 +57,11 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event)
             return Type::getFalse();
         }
         if ($has_date_time && !$has_false) {
-            return Type::parseString($event->getFqClasslikeName());
+            return Type::intersectUnionTypes(
+                Type::parseString($event->getCalledFqClasslikeName() ?? $event->getFqClasslikeName()),
+                new Union([new TNamedObject('static')]),
+                $statements_source->getCodebase(),
+            );
         }
 
         return null;
Repository: mongodb/laravel-mongodb (PHP)

Issue:
Rename column in migration has no effect
- Laravel-mongodb Version: 3.8
- PHP Version: 8.1.16
- Database Driver & Version: MongoDB 4.4.14, mongodb php driver 1.13.0

### Description:

When I try to rename a field of a collection within a migration using ```$table->renameColumn()``` the migration runs without errors but the fields in the collection have the same name as before running the migration 


### Steps to reproduce

Collection users:
```
{
    _id: 62859365a1767a00c9589712,
    name: "admin",
    role: "member"
}
```
Migration file:

```
class RenameUser extends Migration
{
    public function up()
    {
		Schema::table ('users', function (Blueprint $table) {
			$table->renameColumn ('role', 'global_role');
		});
    }
}
```

```> php artisan migrate```


### Expected behaviour

I expected the same behavior as running the following monogdb command
```db.users.updateMany ({},{ $rename: { 'role': 'global_role'}} )```
The name of the field ```role``` should be ```global_role``` after running the migration.

### Actual behaviour
Nothing, no error but also no effect.




Discussion: I'm also facing the same issue, No error but renaming has not happened. 
@flappix did you get any solution for this?
No, I think the schema builder is not capable of doing this. You could use a raw query instead of the schema builder like

```
public function up()
    {
		 DB::collection('users')->update([
            '$rename'=>['role'=> "global_role"],
        ]);
    }
```



Fix (patch):
diff --git a/src/Schema/Blueprint.php b/src/Schema/Blueprint.php
index 2580c407f..6dd28d3b2 100644
--- a/src/Schema/Blueprint.php
+++ b/src/Schema/Blueprint.php
@@ -5,6 +5,7 @@
 namespace MongoDB\Laravel\Schema;
 
 use Illuminate\Database\Connection;
+use Illuminate\Database\Schema\Blueprint as SchemaBlueprint;
 use MongoDB\Laravel\Collection;
 
 use function array_flip;
@@ -15,7 +16,7 @@
 use function is_string;
 use function key;
 
-class Blueprint extends \Illuminate\Database\Schema\Blueprint
+class Blueprint extends SchemaBlueprint
 {
     /**
      * The MongoConnection object for this blueprint.
@@ -276,6 +277,14 @@ public function drop()
         $this->collection->drop();
     }
 
+    /** @inheritdoc */
+    public function renameColumn($from, $to)
+    {
+        $this->collection->updateMany([$from => ['$exists' => true]], ['$rename' => [$from => $to]]);
+
+        return $this;
+    }
+
     /** @inheritdoc */
     public function addColumn($type, $name, array $parameters = [])
     {
Repository: prism-php/prism (PHP)

Issue:
[OpenAi] The `strict` flag when using Structured Mode can only currently be `true`
When using OpenAi with a Structured Schema Output, the `strict` flag should be set to `true` or `false`.

Currently inside this package, the only accepted value is `true` since setting it to `false` will change it to `null`, which is then omitted using `Arr:whereNotNull()`. 

This can be seen here: https://github.com/prism-php/prism/blob/main/src/Providers/OpenAI/Handlers/Structured.php#L122-L139

Ideally, this needs to allow both `true` and `false` instead of changing all non-true values to null.


Discussion: Does it default to false if not set?
> Does it default to false if not set?

After some testing, it seems to be `true` by default when using their API



Fix (patch):
diff --git a/src/Providers/OpenAI/Handlers/Structured.php b/src/Providers/OpenAI/Handlers/Structured.php
index 7d6af105f..6ba1ae55a 100644
--- a/src/Providers/OpenAI/Handlers/Structured.php
+++ b/src/Providers/OpenAI/Handlers/Structured.php
@@ -132,7 +132,9 @@ protected function handleStructuredMode(Request $request): ClientResponse
             'type' => 'json_schema',
             'name' => $request->schema()->name(),
             'schema' => $request->schema()->toArray(),
-            'strict' => $request->providerOptions('schema.strict') ? true : null,
+            'strict' => is_null($request->providerOptions('schema.strict'))
+                ? null
+                : $request->providerOptions('schema.strict'),
         ]);
 
         return $this->sendRequest($request, $responseFormat);
Repository: PHP-CS-Fixer/PHP-CS-Fixer (PHP)

Issue:
Incorrectly added a public declaration to the formal parameter.
### Problem description

    public function process(public object $event): void
    {
    }

v3.78.0 Incorrectly added a public declaration to the formal parameter. Promoted properties can be in constructor only.  

### Minimal reproducer CLI command

php vendor/bin/php-cs-fixer fix $1

### Minimal reproducer code snippet

    public function process(object $event): void
    {
    }

### Fixer version

v3.78.0

### PHP version

8.3

### How do you run Fixer?

Composer package

### Contribution Checks

- [x] I have verified if this problem was already reported
- [x] I am familiar with ["Feature or bug?"](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/feature-or-bug.rst)


Discussion: @liangchenwsl please, share your config, without it is hard to understand what is happening.



Fix (patch):
diff --git a/src/Tokenizer/TokensAnalyzer.php b/src/Tokenizer/TokensAnalyzer.php
index 7645270542d..af68d84993d 100644
--- a/src/Tokenizer/TokensAnalyzer.php
+++ b/src/Tokenizer/TokensAnalyzer.php
@@ -868,7 +868,9 @@ private function findClassyElements(int $classIndex, int $index): array
                 ];
                 $functionNameIndex = $this->tokens->getNextMeaningfulToken($index);
                 if ('__construct' === $this->tokens[$functionNameIndex]->getContent()) {
-                    foreach ($this->tokens->findGivenKind([CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PUBLIC, CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PROTECTED, CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PRIVATE, FCT::T_READONLY]) as $kindElements) {
+                    $openParenthesis = $this->tokens->getNextMeaningfulToken($functionNameIndex);
+                    $closeParenthesis = $this->tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $openParenthesis);
+                    foreach ($this->tokens->findGivenKind([CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PUBLIC, CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PROTECTED, CT::T_CONSTRUCTOR_PROPERTY_PROMOTION_PRIVATE, FCT::T_READONLY], $openParenthesis, $closeParenthesis) as $kindElements) {
                         foreach (array_keys($kindElements) as $promotedPropertyModifierIndex) {
                             /** @var int $promotedPropertyVariableIndex */
                             $promotedPropertyVariableIndex = $this->tokens->getNextTokenOfKind($promotedPropertyModifierIndex, [[T_VARIABLE]]);