Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Uncaught Psalm\Exception\TypeParseTreeException: Unexpected token #3430

Closed
gemal opened this issue May 23, 2020 · 4 comments
Closed

Uncaught Psalm\Exception\TypeParseTreeException: Unexpected token #3430

gemal opened this issue May 23, 2020 · 4 comments
Labels
bug easy problems Issues that can be fixed without background knowledge of Psalm

Comments

@gemal
Copy link

gemal commented May 23, 2020

I just installed psalm and did a psalm --init and crash:

Uncaught Psalm\Exception\TypeParseTreeException: Unexpected token . in x\app\Vendor\vimeo\psalm\src\Psalm\Type.php:1225
Stack trace:
#0 x\app\Vendor\vimeo\psalm\src\Psalm\Type.php(1268): Psalm\Type::tokenize('Facebook.Facebo...')
#1 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\PhpVisitor\ReflectorVisitor.php(1204): Psalm\Type::fixUpLocalType('Facebook.Facebo...', Object(Psalm\Aliases), NULL, Array)
#2 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\PhpVisitor\ReflectorVisitor.php(269): Psalm\Internal\PhpVisitor\ReflectorVisitor->registerClassLike(Object(PhpParser\Node\Stmt\Class_))
#3 x\app\Vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(200): Psalm\Internal\PhpVisitor\ReflectorVisitor->enterNode(Object(PhpParser\Node\Stmt\Class_))
#4 x\app\Vendor\nikic\php-parser\lib\PhpParser\NodeTraverser.php(91): PhpParser\NodeTraverser->traverseArray(Array)
#5 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\Scanner\FileScanner.php(94): PhpParser\NodeTraverser->traverse(Array)
#6 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(586): Psalm\Internal\Scanner\FileScanner->scan(Object(Psalm\Codebase), Object(Psalm\Storage\FileStorage), false, Object(Psalm\Progress\DefaultProgress))
#7 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(367): Psalm\Internal\Codebase\Scanner->scanFile('x\\...', Array, true)
#8 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(475): Psalm\Internal\Codebase\Scanner->Psalm\Internal\Codebase\{closure}(1240, 'x\\...')
#9 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\Codebase\Scanner.php(325): Psalm\Internal\Codebase\Scanner->scanFilePaths(1)
#10 x\app\Vendor\vimeo\psalm\src\Psalm\Codebase.php(477): Psalm\Internal\Codebase\Scanner->scanFiles(Object(Psalm\Internal\Codebase\ClassLikes), 1)
#11 x\app\Vendor\vimeo\psalm\src\Psalm\Internal\Analyzer\ProjectAnalyzer.php(533): Psalm\Codebase->scanFiles(1)
#12 x\app\Vendor\vimeo\psalm\src\psalm.php(588): Psalm\Internal\Analyzer\ProjectAnalyzer->check('x\\...', false)
#13 x\app\Vendor\vimeo\psalm\psalm(2): require_once('x\\...')
#14 {main}
(Psalm 3.11.4@58e1d8e68e5098bf4fbfdfb420c38d563f882549 crashed due to an uncaught Throwable)

@psalm-github-bot
Copy link

Hey @gemal, can you reproduce the issue on https://psalm.dev ?

@gemal
Copy link
Author

gemal commented May 23, 2020

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/7891af1e2b
<?php
use App\Lib\AwsS3;
use App\Lib\RoutesConnector;
use App\Lib\Utils;
use App\Model\DbString;
use App\Model\Entity\Country;
use App\Model\Entity\Language;
use App\Model\Entity\Partner;
use Cake\Utility\Security;
use Cake\Utility\Text;

/**
 * LinkHelper helper extends Html helper to add the handling of links and urls.
 *
 * @property \App\Lib\AwsS3 $AwsS3
 * @property HtmlHelper $Html
 * @property Facebook.Facebook $Facebook
 * @property PaginatorHelper $Paginator
 * @property StaticFilesHelper $StaticFiles
 * @package app.View.Helper
 */
class LinkHelper extends AppHelper {

	/**
	 * Flag to indicate full URL.
	 * @var boolean true
	 */
	const FULL_URL = true;

	/**
	 * Flag to indicate relative URL.
	 * @var boolean false
	 */
	const RELATIVE_URL = false;

	public $helpers = [
		'Facebook.Facebook',
		'Html' => [
			'className' => 'Shim.HtmlShim',
		],
		'Paginator',
		'Time',
		'StaticFiles',
	];


}
Psalm encountered an internal error:

/vendor/vimeo/psalm/src/Psalm/Internal/Type/TypeTokenizer.php: Unexpected token .

@muglug muglug added the bug label May 23, 2020
@muglug
Copy link
Collaborator

muglug commented May 23, 2020

Ah thanks, it’s the . Facebook.Facebook

@muglug muglug added the easy problems Issues that can be fixed without background knowledge of Psalm label May 23, 2020
@muglug muglug closed this as completed in b4855b3 May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug easy problems Issues that can be fixed without background knowledge of Psalm
Projects
None yet
Development

No branches or pull requests

2 participants