yiisoft / arrays

Yii Array Helper
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
52 stars 28 forks source link

Psalm 5.23.1 #155

Closed hacan359 closed 7 months ago

hacan359 commented 7 months ago

Psalm version Psalm 5.23.1

ArrayableTrait.php - no copability with psalm version 5.23.1 and errorLevel=1

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:132:70 - Unable to determine the type that $definition is being assigned to (see https://psalm.dev/032)
        foreach ($this->resolveFields($fields, $expand) as $field => $definition) {

  The type of $definition is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:230:69
    protected function resolveFields(array $fields, array $expand): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:133:13 - Unable to determine the type that $attribute is being assigned to (see https://psalm.dev/032)
            $attribute = is_string($definition) ? $this->$definition : $definition($this, $field);

ERROR: MixedFunctionCall - vendor/yiisoft/arrays/src/ArrayableTrait.php:133:72 - Cannot call function on mixed (see https://psalm.dev/185)
            $attribute = is_string($definition) ? $this->$definition : $definition($this, $field);

ERROR: MixedArgumentTypeCoercion - vendor/yiisoft/arrays/src/ArrayableTrait.php:136:66 - Argument 2 of App\Dota\Match\Form\MatchDetailsLoadForm::extractFieldsFor expects string, but parent type array-key provided (see https://psalm.dev/194)
                $nestedFields = $this->extractFieldsFor($fields, $field);

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:230:69
    protected function resolveFields(array $fields, array $expand): array

ERROR: MixedArgumentTypeCoercion - vendor/yiisoft/arrays/src/ArrayableTrait.php:137:66 - Argument 2 of App\Dota\Match\Form\MatchDetailsLoadForm::extractFieldsFor expects string, but parent type array-key provided (see https://psalm.dev/194)
                $nestedExpand = $this->extractFieldsFor($expand, $field);

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:230:69
    protected function resolveFields(array $fields, array $expand): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:144:13 - Unable to determine the type of this assignment (see https://psalm.dev/032)
            $data[$field] = $attribute;

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:155:59 - Unable to determine the type that $field is being assigned to (see https://psalm.dev/032)
        foreach (array_merge($rootFields, $rootExpand) as $field) {

  The type of $field is sourced from here - vendor/vimeo/psalm/stubs/CoreGenericFunctions.phpstub:376:12
 * @return array<TKey, TValue>

ERROR: MixedArgument - vendor/yiisoft/arrays/src/ArrayableTrait.php:156:34 - Argument 1 of array_key_exists cannot be mixed, expecting array-key (see https://psalm.dev/030)
            if (array_key_exists($field, $array)) {

  The type of $field is sourced from here - vendor/vimeo/psalm/stubs/CoreGenericFunctions.phpstub:376:12
 * @return array<TKey, TValue>

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:157:17 - Unable to determine the type that $attribute is being assigned to (see https://psalm.dev/032)
                $attribute = $array[$field];

  The type of $attribute is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:150:44
    private function filterAndExpand(array $array, array $fields = [], array $expand = []): array

ERROR: MixedArgument - vendor/yiisoft/arrays/src/ArrayableTrait.php:158:66 - Argument 2 of App\Dota\Match\Form\MatchDetailsLoadForm::extractFieldsFor cannot be mixed, expecting string (see https://psalm.dev/030)
                $nestedFields = $this->extractFieldsFor($fields, $field);

  The type of $field is sourced from here - vendor/vimeo/psalm/stubs/CoreGenericFunctions.phpstub:376:12
 * @return array<TKey, TValue>

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:165:17 - Unable to determine the type of this assignment (see https://psalm.dev/032)
                $data[$field] = $attribute;

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:184:29 - Unable to determine the type that $field is being assigned to (see https://psalm.dev/032)
        foreach ($fields as $field) {

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:180:48
    protected function extractRootFields(array $fields): array

ERROR: MixedOperand - vendor/yiisoft/arrays/src/ArrayableTrait.php:185:32 - Left operand cannot be mixed (see https://psalm.dev/059)
            $result[] = strstr($field . '.', '.', true);

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:180:48
    protected function extractRootFields(array $fields): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:209:29 - Unable to determine the type that $field is being assigned to (see https://psalm.dev/032)
        foreach ($fields as $field) {

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:205:47
    protected function extractFieldsFor(array $fields, string $rootField): array

ERROR: MixedArgument - vendor/yiisoft/arrays/src/ArrayableTrait.php:210:33 - Argument 1 of str_starts_with cannot be mixed, expecting string (see https://psalm.dev/030)
            if (str_starts_with($field, "$rootField.")) {

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:205:47
    protected function extractFieldsFor(array $fields, string $rootField): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:236:47 - Unable to determine the type that $definition is being assigned to (see https://psalm.dev/032)
        foreach ($this->fields() as $field => $definition) {

  The type of $definition is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:76:31
    public function fields(): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:238:17 - Unable to determine the type that $field is being assigned to (see https://psalm.dev/032)
                $field = $definition;

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:76:31
    public function fields(): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:241:17 - Unable to determine the type of this assignment (see https://psalm.dev/032)
                $result[$field] = $definition;

  The type of $result[$field] is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:76:31
    public function fields(): array

ERROR: MixedArrayOffset - vendor/yiisoft/arrays/src/ArrayableTrait.php:241:17 - Cannot access value on variable $result[$field] using mixed offset (see https://psalm.dev/031)
                $result[$field] = $definition;

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:249:52 - Unable to determine the type that $definition is being assigned to (see https://psalm.dev/032)
        foreach ($this->extraFields() as $field => $definition) {

  The type of $definition is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:101:36
    public function extraFields(): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:251:17 - Unable to determine the type that $field is being assigned to (see https://psalm.dev/032)
                $field = $definition;

  The type of $field is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:101:36
    public function extraFields(): array

ERROR: MixedAssignment - vendor/yiisoft/arrays/src/ArrayableTrait.php:254:17 - Unable to determine the type of this assignment (see https://psalm.dev/032)
                $result[$field] = $definition;

  The type of $result[$field] is sourced from here - vendor/yiisoft/arrays/src/ArrayableTrait.php:101:36
    public function extraFields(): array

ERROR: MixedArrayOffset - vendor/yiisoft/arrays/src/ArrayableTrait.php:254:17 - Cannot access value on variable $result[$field] using mixed offset (see https://psalm.dev/031)
                $result[$field] = $definition;