ernie-research/MEnvBench huggingface dataset:
Repository: briannesbitt/Carbon (PHP)

Issue:
Short and long time translation mismatchs
|English|Azerbaijani|comments|
|--|--|--|
|2h|2 saat|This should rather be '2 s' because in Azerbaijani, abbreviating 'saat' to 's' is a common practice for time expressions, especially for shorthand notation, similar to other languages using single-letter time units.|
|2 minutes|2 d.|This should rather be '2 dəqiqə' because in Azerbaijani, the full word 'dəqiqə' is the proper translation for 'minutes' in standard contexts, and abbreviating it to 'd' should only apply in shorthand or particular usages like for time intervals.|
|2m|2 dəqiqə|This should rather be '2 d' because in Azerbaijani, abbreviating 'dəqiqə' to 'd' is a common practice for time expressions, especially for shorthand notation, similar to other languages using single-letter time units.|
|2 seconds|2 san.|2 seconds" should be '2 saniyə': "This should rather be '2 saniyə' because in Azerbaijani, the full word 'saniyə' is the proper translation for 'seconds' in standard contexts. The abbreviation 'san.' is used only when shortening time units in specific cases.|
|2s|2 saniyə|2s" should be '2 san.': "This should rather be '2 san.' because in Azerbaijani, the abbreviation for 'seconds' is 'san.', and it is appropriate to use it when representing time in shorthand notation.|
|1 second|1 san.|This should rather be '1 saniyə' because in Azerbaijani, the full word 'saniyə' is used for 'second' in standard contexts. The abbreviation 'san.' is typically used in shorthand or time expressions, but not for singular units.|


----
These changes are important because they fix a mismatch in the translation that makes some formats wrong. For example, short texts like "2 minutes" should be shown as "2 dəqiqə" instead of "2 d." and "1 second" should be "1 saniyə" instead of "1 san." This ensures consistency, where long-time expressions aren't shortened incorrectly and short ones aren't overly extended. Correcting this keeps the translations accurate and makes the format more natural for Azerbaijani speakers.



Fix (patch):
diff --git a/src/Carbon/Lang/az.php b/src/Carbon/Lang/az.php
index c53865e6df..1b5ded05b9 100644
--- a/src/Carbon/Lang/az.php
+++ b/src/Carbon/Lang/az.php
@@ -18,6 +18,7 @@
  * - Orxan
  * - Şəhriyar İmanov
  * - Baran Şengül
+ * - Novruz Rahimov
  */
 return [
     'year' => ':count il',
@@ -34,13 +35,13 @@
     'd' => ':count g.',
     'hour' => ':count saat',
     'a_hour' => '{1}bir saat|]1,Inf[:count saat',
-    'h' => ':count saat',
-    'minute' => ':count d.',
+    'h' => ':count s.',
+    'minute' => ':count dəqiqə',
     'a_minute' => '{1}bir dəqiqə|]1,Inf[:count dəqiqə',
-    'min' => ':count dəqiqə',
-    'second' => ':count san.',
+    'min' => ':count d.',
+    'second' => ':count saniyə',
     'a_second' => '{1}birneçə saniyə|]1,Inf[:count saniyə',
-    's' => ':count saniyə',
+    's' => ':count san.',
     'ago' => ':time əvvəl',
     'from_now' => ':time sonra',
     'after' => ':time sonra',
Repository: cakephp/cakephp (PHP)

Issue:
TypeError when using Form::time() with Cake\I18n\Time
### Description

I would expect `Form::time()` to accept `Cake\I18n\Time` but instead I get a TypeError:
`Cake\View\Widget\DateTimeWidget::formatDateTime(): Argument #1 ($value) must be of type Cake\Chronos\ChronosDate|DateTimeInterface|string|int|null, Cake\I18n\Time given, called in .../vendor/cakephp/cakephp/src/View/Widget/DateTimeWidget.php on line 124`

Works fine on CakePHP 4 but now getting this error when updating a large-ish application to CakePHP 5.

### CakePHP Version

5.0.1

### PHP Version

8.2


Discussion: What version of Chronos are you using Are you using [3.0.2](https://github.com/cakephp/chronos/releases/tag/3.0.2)+?
> What version of Chronos are you using Are you using [3.0.2](https://github.com/cakephp/chronos/releases/tag/3.0.2)+?

Yes, 3.0.4 at the moment.



Fix (patch):
diff --git a/src/View/Widget/DateTimeWidget.php b/src/View/Widget/DateTimeWidget.php
index be173f651c2..49f31364050 100644
--- a/src/View/Widget/DateTimeWidget.php
+++ b/src/View/Widget/DateTimeWidget.php
@@ -17,6 +17,7 @@
 namespace Cake\View\Widget;
 
 use Cake\Chronos\ChronosDate;
+use Cake\Chronos\ChronosTime;
 use Cake\Database\Schema\TableSchemaInterface;
 use Cake\View\Form\ContextInterface;
 use Cake\View\StringTemplate;
@@ -176,13 +177,13 @@ protected function setStep(array $data, ContextInterface $context, string $field
     /**
      * Formats the passed date/time value into required string format.
      *
-     * @param \Cake\Chronos\ChronosDate|\DateTimeInterface|string|int|null $value Value to deconstruct.
+     * @param \Cake\Chronos\ChronosDate|\Cake\Chronos\ChronosTime|\DateTimeInterface|string|int|null $value Value to deconstruct.
      * @param array<string, mixed> $options Options for conversion.
      * @return string
      * @throws \InvalidArgumentException If invalid input type is passed.
      */
     protected function formatDateTime(
-        ChronosDate|DateTimeInterface|string|int|null $value,
+        ChronosDate|ChronosTime|DateTimeInterface|string|int|null $value,
         array $options
     ): string {
         if ($value === '' || $value === null) {
@@ -190,7 +191,7 @@ protected function formatDateTime(
         }
 
         try {
-            if ($value instanceof ChronosDate || $value instanceof DateTimeInterface) {
+            if ($value instanceof DateTimeInterface || $value instanceof ChronosDate || $value instanceof ChronosTime) {
                 /** @var \Cake\Chronos\ChronosDate|\DateTime|\DateTimeImmutable $dateTime Expand type for phpstan */
                 $dateTime = clone $value;
             } elseif (is_string($value) && !is_numeric($value)) {
Repository: cakephp/cakephp (PHP)

Issue:
Problem formatting milliseconds using i18nFormat
### Description

I am facing similar problem to https://github.com/cakephp/cakephp/issues/10439 when formatting using the function `i18nFormat`

This line https://github.com/cakephp/cakephp/blob/1daf3c0854c139bac85d3535505cef6154f9d164/src/I18n/DateFormatTrait.php#L104 could be changed to `return (string)static::$formatters[$key]->format($date->format('U.u'));` to allow microseconds when formatting. This should not be a breaking change, since the date us already formatted again within the same line, but I am not sure if this could cause any new problem. 

This is a quick test:

```
$time = new FrozenTime('2014-07-06T13:09:01.523000+00:00');
$this->assertEquals('2014-07-06 13:09:01.523000', $time->format('Y-m-d H:i:s.u'));
$i18nFormat = $time->i18nFormat("yyyy-MM-dd'T'HH':'mm':'ss.SSSxxx", null, 'en-US');
$this->assertEquals('2014-07-06T13:09:01.523+00:00', $i18nFormat); // this will fail returning 2014-07-06T13:09:01.000+00:00
```

This is hapening in many different cakephp versions including 4.x and 5.x and it is independent from php version used


### CakePHP Version

4.4.0

### PHP Version

7.4


Discussion: The ticket you have referenced relates to saving value to datetime columns with milliseconds. Have you mapped your column to the `datetimefractional` type in table schema?  (This type didn't exist in CakePHP 3.x). 
NVM, I see now that the issue is limited to just formatting. The change looks fine to me.



Fix (patch):
diff --git a/src/I18n/DateFormatTrait.php b/src/I18n/DateFormatTrait.php
index fc11ce3ce9a..945534e8245 100644
--- a/src/I18n/DateFormatTrait.php
+++ b/src/I18n/DateFormatTrait.php
@@ -101,7 +101,7 @@ protected function _formatObject(
             static::$formatters[$key] = $formatter;
         }
 
-        return (string)static::$formatters[$key]->format($date->format('U'));
+        return (string)static::$formatters[$key]->format($date);
     }
 
     /**
Repository: cakephp/cakephp (PHP)

Issue:
Datetime validation rises an exception when a boolean is passed as value
### Description

Hello!

When I use the datetime validation, if a boolean is passed as value, an error is rised [here](https://github.com/cakephp/cakephp/blob/4fd9c162529f355e576e72e0cb00be18c82a46fc/src/Validation/Validation.php#L572) as the `preg_split` function expects a string as second argurment.

A solution would be to assert that `$check` is a string prior to calling the `preg_split` and result false if not string.

I can propose a PR for that if you are interested.



### CakePHP Version

5.2.5

### PHP Version

_No response_



Fix (patch):
diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php
index cf22446e04d..c4bdba6bbac 100644
--- a/src/Validation/Validation.php
+++ b/src/Validation/Validation.php
@@ -569,6 +569,9 @@ public static function datetime(mixed $check, array|string $dateFormat = 'ymd',
             $check = static::_getDateString($check);
             $dateFormat = 'ymd';
         }
+        if (!is_string($check)) {
+            return false;
+        }
         $parts = preg_split('/[\sT]+/', $check);
         if ($parts && count($parts) > 1) {
             $date = rtrim(array_shift($parts), ',');
Repository: shlinkio/shlink (PHP)

Issue:
Error when calling API to get non-orphan visits
### Shlink version

4.4.3

### PHP version

8

### How do you serve Shlink

Docker image

### Database engine

PostgreSQL

### Database version

16.4

### Current behavior

When attempting to call the REST API via `/rest/v3/visits/non-orphan` using an API key with the role `Author only`, 
the server responds with a 500 error code. 
The error message states: 
`[Semantical Error] line 0, col 92 near 's.author Api Key': Error: 's' is not defined. in /etc/shlink/vendor/doctrine/orm/src/Query/QueryException.php:28`

### Expected behavior

Return non-orphan visit data corresponding to the API key

### Minimum steps to reproduce

Generate an API key with `Author only` Role.
Call the API.


Discussion: I have just released Shlink v4.4.4 including a fix for this.



Fix (patch):
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e6746343..81cb8ba0a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
 
-## [Unreleased]
+## [4.4.4] - 2025-02-19
 ### Added
 * *Nothing*
 
@@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
 
 ### Fixed
 * [#2366](https://github.com/shlinkio/shlink/issues/2366) Fix error "Cannot use 'SCRIPT' with redis-cluster" thrown when creating a lock while using a redis cluster.
+* [#2368](https://github.com/shlinkio/shlink/issues/2368) Fix error when listing non-orphan visits using API key with `AUTHORED_SHORT_URLS` role.
+
 
 ## [4.4.3] - 2025-02-15
 ### Added
diff --git a/module/Core/src/Visit/Repository/VisitRepository.php b/module/Core/src/Visit/Repository/VisitRepository.php
index 9c4668c1a..bfba51784 100644
--- a/module/Core/src/Visit/Repository/VisitRepository.php
+++ b/module/Core/src/Visit/Repository/VisitRepository.php
@@ -21,6 +21,7 @@
 use Shlinkio\Shlink\Core\Visit\Spec\CountOfNonOrphanVisits;
 use Shlinkio\Shlink\Core\Visit\Spec\CountOfOrphanVisits;
 use Shlinkio\Shlink\Rest\ApiKey\Role;
+use Shlinkio\Shlink\Rest\Entity\ApiKey;
 
 use const PHP_INT_MAX;
 
@@ -177,7 +178,12 @@ public function findNonOrphanVisits(VisitsListFiltering $filtering): array
         $qb = $this->createAllVisitsQueryBuilder($filtering);
         $qb->andWhere($qb->expr()->isNotNull('v.shortUrl'));
 
-        $this->applySpecification($qb, $filtering->apiKey?->inlinedSpec());
+        $apiKey = $filtering->apiKey;
+        if (ApiKey::isShortUrlRestricted($apiKey)) {
+            $qb->join('v.shortUrl', 's');
+        }
+
+        $this->applySpecification($qb, $apiKey?->inlinedSpec(), 'v');
 
         return $this->resolveVisitsWithNativeQuery($qb, $filtering->limit, $filtering->offset);
     }
Repository: glpi-project/glpi (PHP)

Issue:
Legacy api search/AllAssets not working
### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Version

11.0.1

### Bug description

I have an app that still uses legacy api. (migrating to new api is still in progress)
When i call the api "search/AllAssets" I get an 500 error. (Computer or other assets work)


### Relevant log output

```shell
glpi.CRITICAL:   *** Uncaught PHP Exception TypeError: "DbUtils::getExpectedTableNameForClass(): Argument #1 ($classname) must be of type string, null given, called in ./src/DbUtils.php on line 207" at DbUtils.php line 228
  Backtrace :
  ./src/DbUtils.php:228                              
  ./src/DbUtils.php:207                              DbUtils->getExpectedTableNameForClass()
  ./src/autoload/dbutils-aliases.php:149             DbUtils->getTableForItemType()
  ./src/autoload/dbutils-aliases.php:75              getTableForItemType()
  ./src/Glpi/Api/API.php:1509                        getForeignKeyFieldForItemType()
  ./src/Glpi/Api/API.php:1465                        Glpi\Api\API->getSearchOptionUniqID()
  ./src/Glpi/Api/API.php:1604                        Glpi\Api\API->listSearchOptions()
  ./src/Glpi/Api/APIRest.php:224                     Glpi\Api\API->searchItems()
  ./src/Glpi/Controller/ApiController.php:77         Glpi\Api\APIRest->call()
  ./vendor/symfony/http-kernel/HttpKernel.php:101    Glpi\Controller\ApiController->Glpi\Controller\{closure}()
  ...ymfony/http-foundation/StreamedResponse.php:106 Symfony\Component\HttpKernel\HttpKernel::Symfony\Component\HttpKernel\{closure}()
  ./vendor/symfony/http-foundation/Response.php:423  Symfony\Component\HttpFoundation\StreamedResponse->sendContent()
  ./src/Glpi/Kernel/Kernel.php:295                   Symfony\Component\HttpFoundation\Response->send()
  ./public/index.php:72                              Glpi\Kernel\Kernel->sendResponse()
```

### Page URL

_No response_

### Steps To reproduce

_No response_

### Your GLPI setup information

_No response_

### Anything else?

_No response_



Fix (patch):
diff --git a/src/Glpi/Api/API.php b/src/Glpi/Api/API.php
index 6d551c7dd57..d9e570537b8 100644
--- a/src/Glpi/Api/API.php
+++ b/src/Glpi/Api/API.php
@@ -1503,10 +1503,9 @@ private function getSearchOptionUniqID($itemtype, $option = [])
 
         $sub_itemtype = getItemTypeForTable($option['table']);
 
-        if (
-            (isset($option['joinparams']['beforejoin']['table'])
+        if ((isset($option['joinparams']['beforejoin']['table'])
             || empty($option['joinparams']))
-            && $option['linkfield'] != getForeignKeyFieldForItemType($sub_itemtype)
+            && ($sub_itemtype === null || $option['linkfield'] != getForeignKeyFieldForItemType($sub_itemtype))
             && $option['linkfield'] != $option['field']
         ) {
             $uid_parts[] = $option['linkfield'];
Repository: flow-php/flow (PHP)

Issue:
[Bug]: HTMLEntry/HTMLType cannot read not-strict HTML
### What happened?

If parsed HTML is not strictly valid, right now `HTMLEntry` and/or `HTMLType` can produce a PHP warning:
```shell
In HTMLEntry.php line 35:
                                                                                                                          
  [ErrorException]                                                                                                        
  Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-closed-token in Entity, line: 2117, column: 15-19
```

### How to reproduce?

```php
        $html = <<<'HTML'
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
    <div>foo</div>
    <div><p><span>bar</span></span></p></div>
</body>
</html>
HTML;
        $entry = html_entry('html', $html);
```

### Data required to reproduce bug locally

As above, try to read HTML that is not strictly valid, like having duplicated close tags.


### Version

0.27

### Relevant error output

```shell
In HTMLEntry.php line 35:
                                                                                                                          
  [ErrorException]                                                                                                        
  Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-closed-token in Entity, line: 2117, column: 15-19
```



Fix (patch):
diff --git a/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php b/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
index 9777bf089..d9f977dc1 100644
--- a/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
+++ b/src/core/etl/src/Flow/ETL/Row/Entry/HTMLEntry.php
@@ -32,7 +32,7 @@ public function __construct(
         ?Metadata $metadata = null,
     ) {
         if (\is_string($value)) {
-            $this->value = HTMLDocument::createFromString($value);
+            $this->value = HTMLDocument::createFromString($value, \LIBXML_NOERROR);
         } else {
             $this->value = $value;
         }
diff --git a/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php b/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
index 1205eb1af..1be4c8797 100644
--- a/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
+++ b/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php
@@ -40,7 +40,7 @@ public function cast(mixed $value) : HTMLDocument
 
         /* @phpstan-ignore-next-line */
         if (\is_string($value)) {
-            return HTMLDocument::createFromString($value);
+            return HTMLDocument::createFromString($value, \LIBXML_NOERROR);
         }
 
         return $value;
Repository: flow-php/flow (PHP)

Issue:
Doctrine - empty input invokes runtime exception "Bulk data cannot be empty"
Either when the input is empty or you filter out all the input data you leverage "to_dbal_table_insert" function it should probably just do nothing, but I received an Runtime exception "Bulk data cannot be empty" instead.

```php
 df()
  ->withEntry('price', ref('node')->xpath('price')->domElementValue())
  ->filter(ref('price')->notEquals(lit(''))->isTrue())
  ->write(to_dbal_table_insert(...))
  ->run();
```



Fix (patch):
diff --git a/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php b/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php
index 0fcf5cf4b..d4534ab13 100644
--- a/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php
+++ b/src/core/etl/src/Flow/ETL/Pipeline/SynchronousPipeline.php
@@ -57,7 +57,13 @@ public function process(FlowContext $context) : \Generator
                             $generator->send(Signal::STOP);
                         }
                     } elseif ($pipe instanceof Loader) {
-                        $pipe->load($rows, $context);
+                        if ($rows->count()) {
+                            /**
+                             * When there are no rows to load, we should not call the loader. This way we can avoid
+                             * checking rows count inside the loader implementation.
+                             */
+                            $pipe->load($rows, $context);
+                        }
                     }
                 } catch (\Throwable $exception) {
                     if ($context->errorHandler()->throw($exception, $rows)) {
Repository: barryvdh/laravel-ide-helper (PHP)

Issue:
PHPStan annotations for models are dropped
PHPStan annotations (or any other description) for models are dropped, for example:

```php
/**
 * Some class.
 *
 * @implements \App\Contracts\Models\SomeContract<...>
 *
 * @property int $id
 * [...]
```

after:

```php
/**
 * Some class.
 *
 * @property int $id
 * [...]
```

Is there any way to preserve these entries? These are critical from a static analysis point of view.


Discussion: Are you adding the reset flag?
Hi, yes.

I understand that reset resets everything :) but, the class name itself is preserved, so I would expect that the additional description (also phpstan annotations) should also be preserved.

Maybe it would be a good idea to add some tag to which ide helper does not change the description? For example:

```php
/**
 * Some class.
 *
 * More class description.
 *
 * @implements \App\Contracts\Models\SomeContract<...>
 *
 * @idehelper-ignore-before
 *
 * @property int $id
 * [...]
```
I think https://github.com/barryvdh/laravel-ide-helper/pull/1603 would be better perhaps. Just remove the property and methods tags, skip the other tags?
Yes, sounds good :)



Fix (patch):
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f473a14fc..0d323e113 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,8 @@ All notable changes to this project will be documented in this file.
 --------------
 
 ### Changed
-Add support for multiple pivot types when using the same accessor.
+- Add support for multiple pivot types when using the same accessor.
+- Smarter reset, keep tags that IDE helper doesn't use
 
 2024-10-18, 3.2.0
 --------------
diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php
index b915e03cc..ddf1dea98 100644
--- a/src/Console/ModelsCommand.php
+++ b/src/Console/ModelsCommand.php
@@ -945,13 +945,19 @@ protected function createPhpDocs($class)
             $reflection->getParentClass()->getInterfaceNames()
         );
 
+        $phpdoc = new DocBlock($reflection, new Context($namespace));
         if ($this->reset) {
-            $phpdoc = new DocBlock('', new Context($namespace));
             $phpdoc->setText(
                 (new DocBlock($reflection, new Context($namespace)))->getText()
             );
-        } else {
-            $phpdoc = new DocBlock($reflection, new Context($namespace));
+            foreach ($phpdoc->getTags() as $tag) {
+                if (
+                    in_array($tag->getName(), ['property', 'property-read', 'property-write', 'method', 'mixin'])
+                    || ($tag->getName() === 'noinspection' && in_array($tag->getContent(), ['PhpUnnecessaryFullyQualifiedNameInspection', 'PhpFullyQualifiedNameUsageInspection']))
+                ) {
+                    $phpdoc->deleteTag($tag);
+                }
+            }
         }
 
         $properties = [];
Repository: barryvdh/laravel-ide-helper (PHP)

Issue:
AsCollection::of cast not handled
### Versions:
- ide-helper Version: 3.5.5
- Laravel Version: 12.13
- PHP Version: 8.4

### Description:
Laravel 12.10 [added](https://github.com/laravel/framework/pull/55383) a `AsCollection::of(CustomObject::class)` cast.

It is not handled by the IDE Helper, which produce no type for the variable in the docblock.

### Steps To Reproduce:

```php
protected function casts(): array
    {
        return [
            'foos' => AsCollection::of(Foo::class),
        ];
    }
```

I can't take a look for a PR right now, I'll try later.

Thanks.



Fix (patch):
diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php
index 1c82e9340..1cd7544c1 100644
--- a/src/Console/ModelsCommand.php
+++ b/src/Console/ModelsCommand.php
@@ -475,7 +475,11 @@ public function castPropertiesType($model)
             }
 
             if (Str::startsWith($type, AsCollection::class)) {
-                $realType = $this->getTypeInModel($model, $params[0] ?? null) ?? '\Illuminate\Support\Collection';
+                $realType = $this->getTypeInModel($model, $params[0] ?? null) ?: '\Illuminate\Support\Collection';
+                $relatedModel = $this->getTypeInModel($model, $params[1] ?? null);
+                if ($relatedModel) {
+                    $realType = $this->getCollectionTypeHint($realType, $relatedModel);
+                }
             }
 
             if (Str::startsWith($type, AsEnumCollection::class)) {