Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Request failed SyntaxError: Unexpected token '<', "<br /> <b>"... is not valid JSON #98

Open
kkmuffme opened this issue May 29, 2023 · 1 comment

Comments

@kkmuffme
Copy link
Contributor

https://psalm.dev/r/e4eb7a3e05

Issue is from line 15, key-of<TMapping> seems to break it.

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/e4eb7a3e05
<?php

class QueryDB {}

class Compatibility {}

class DI {
   const MAPPING = array(
		'query' => QueryDB::class,
       	'comp' => Compatibility::class,
   );
    
   /**
    * @template TMapping of DI::MAPPING
    * @template TKey of key-of<TMapping>
    *
    * @param TKey $arg
    * @return TMapping[TKey]
    */
   public function get( $arg ) {
       $v = self::MAPPING[ $arg ];
       /** @psalm-trace $v */;
       return $v;
   }
}

$d = new DI();
$r = $d->get( 'comp' );
$c = new $r();
/** @psalm-trace $c */;
Psalm encountered an internal error:

/vendor/vimeo/psalm/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php: count(): Argument #1 ($value) must be of type Countable|array, null given

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant