-
Notifications
You must be signed in to change notification settings - Fork 668
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
Cryptic error message when using psalm-type ... it is not transparent what is actually wrong #8034
Labels
Comments
yes, reproduceable here: https://psalm.dev/r/d733c3320d |
I found these snippets: https://psalm.dev/r/d733c3320d<?php
class Test{
/**
* @psalm-type APIResponse = array<array{
* _id: string,
* jobUrl: string,
* isFullRemote: bool,
* companyId: string,
* longitude: float,
* latitude: float,
* cityCategory: string,
* logoImg: string,
* activeFrom: string,
* expiresOn: ?string,
* candidateContactWay: string,
* company: string,
* address: string,
* actualCity: string,
* postalCode: string,
* companyType: string,
* companySize: string,
* hasVisaSponsorship: string,
* language: string,
* offerStockOrBonus: bool,
* name: string,
* jobType: string,
* expLevel: string,
* annualSalaryFrom: int,
* annualSalaryTo: int,
* techCategory: string,
* technologies: array<int, string>,
* country: "de"|"ch",
* }>
* @psalm-return APIResponse
*/
public function getApiJobs(): array
{
return [
[
'_id' => '6259381a37d1f57503ca646f',
'jobUrl' => 'bippokippo-solutions-Architekten-mwd-fr-Elektromobilitt',
'isFullRemote' => false,
'companyId' => '623b3be0c421b2d41d3778db',
'longitude' => 6.08364339,
'latitude' => 50.76881525,
'cityCategory' => 'Aachen',
'logoImg' => 'bkip-ebus-solutions-gmbh-logo.jpg',
'activeFrom' => '2022-04-16T00:00:00.000+02:00',
'expiresOn' => NULL,
'candidateContactWay' => 'Email',
'company' => 'bkip ebus solutions GmbH',
'address' => 'elefantenstrasse 12',
'actualCity' => 'Aachen',
'postalCode' => '52064',
'companyType' => 'Startup',
'companySize' => '<50',
'hasVisaSponsorship' => 'No',
'language' => 'English',
'offerStockOrBonus' => false,
'name' => 'Software-Architekten (m/w/d) für Elektromobilität',
'jobType' => 'Full-Time',
'expLevel' => 'Senior',
'annualSalaryFrom' => 55000,
'annualSalaryTo' => 70000,
'techCategory' => 'Architect',
'technologies' => array (0 => 'Angular', 1 => 'CI/CD', 2 => 'DevOps', 3 => 'Docker', 4 => 'ElasticSearch', 5 => 'Git', 6 => 'JBoss', 7 => 'Java', 8 => 'Jenkins', 9 => 'Quarkus',),
]
];
//'perkKeys' => array (0 => 'flexiblework', 1 => 'hardware', 2 => 'hybridwork', 3 => 'startupculture', 4 => 'parttime', 5 => 'coworkshops', 6 => 'teamevents', 7 => 'tablefoot', 8 => 'standingdesk', 9 => 'sweets', 10 => 'coffee', 11 => 'intteam', 12 => 'coparking', 13 => 'beer', 14 => 'cooloffice',),
//'filterTags' => array (0 => 'Atlassian', 1 => 'BitBucket', 2 => 'Confluence', 3 => 'DevOps', 4 => 'Docker', 5 => 'ElasticSearch', 6 => 'JBoss', 7 => 'JIRA', 8 => 'Java', 9 => 'Jenkins', 10 => 'Python', 11 => 'REST', 12 => 'Angular', 13 => 'CI/CD', 14 => 'Git', 15 => 'Quarkus',),
}
}
|
You have no You can figure this out by removing keys from the definition one by one. There is some ongoing effort to improve this in #7445 and #7890. |
I found these snippets: https://psalm.dev/r/342ae3fb2b<?php
class Test{
/**
* @psalm-type APIResponse = array<array{
* _id: string,
* jobUrl: string,
* isFullRemote: bool,
* companyId: string,
* longitude: float,
* latitude: float,
* cityCategory: string,
* logoImg: string,
* activeFrom: string,
* expiresOn: ?string,
* candidateContactWay: string,
* company: string,
* address: string,
* actualCity: string,
* postalCode: string,
* companyType: string,
* companySize: string,
* hasVisaSponsorship: string,
* language: string,
* offerStockOrBonus: bool,
* name: string,
* jobType: string,
* expLevel: string,
* annualSalaryFrom: int,
* annualSalaryTo: int,
* techCategory: string,
* technologies: array<int, string>,
* }>
* @psalm-return APIResponse
*/
public function getApiJobs(): array
{
return [
[
'_id' => '6259381a37d1f57503ca646f',
'jobUrl' => 'bippokippo-solutions-Architekten-mwd-fr-Elektromobilitt',
'isFullRemote' => false,
'companyId' => '623b3be0c421b2d41d3778db',
'longitude' => 6.08364339,
'latitude' => 50.76881525,
'cityCategory' => 'Aachen',
'logoImg' => 'bkip-ebus-solutions-gmbh-logo.jpg',
'activeFrom' => '2022-04-16T00:00:00.000+02:00',
'expiresOn' => NULL,
'candidateContactWay' => 'Email',
'company' => 'bkip ebus solutions GmbH',
'address' => 'elefantenstrasse 12',
'actualCity' => 'Aachen',
'postalCode' => '52064',
'companyType' => 'Startup',
'companySize' => '<50',
'hasVisaSponsorship' => 'No',
'language' => 'English',
'offerStockOrBonus' => false,
'name' => 'Software-Architekten (m/w/d) für Elektromobilität',
'jobType' => 'Full-Time',
'expLevel' => 'Senior',
'annualSalaryFrom' => 55000,
'annualSalaryTo' => 70000,
'techCategory' => 'Architect',
'technologies' => array (0 => 'Angular', 1 => 'CI/CD', 2 => 'DevOps', 3 => 'Docker', 4 => 'ElasticSearch', 5 => 'Git', 6 => 'JBoss', 7 => 'Java', 8 => 'Jenkins', 9 => 'Quarkus',),
]
];
//'perkKeys' => array (0 => 'flexiblework', 1 => 'hardware', 2 => 'hybridwork', 3 => 'startupculture', 4 => 'parttime', 5 => 'coworkshops', 6 => 'teamevents', 7 => 'tablefoot', 8 => 'standingdesk', 9 => 'sweets', 10 => 'coffee', 11 => 'intteam', 12 => 'coparking', 13 => 'beer', 14 => 'cooloffice',),
//'filterTags' => array (0 => 'Atlassian', 1 => 'BitBucket', 2 => 'Confluence', 3 => 'DevOps', 4 => 'Docker', 5 => 'ElasticSearch', 6 => 'JBoss', 7 => 'JIRA', 8 => 'Java', 9 => 'Jenkins', 10 => 'Python', 11 => 'REST', 12 => 'Angular', 13 => 'CI/CD', 14 => 'Git', 15 => 'Quarkus',),
}
}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you quickly point out what is wrong in the array I return?
I cannot. This is saddening tbh.... it should be fairly easy to point the first place where an inconsistency happens, no? instead of just spitting the monster of the entire definition plus the data and go "well lmao, figure out yourself what is wrong"
The text was updated successfully, but these errors were encountered: